Skip to content

Commit

Permalink
Merge pull request #64 from relaxxpls/develop
Browse files Browse the repository at this point in the history
[v1.8.0] Timetable sharing and admin approvals for reviews and resources
  • Loading branch information
relaxxpls authored Feb 19, 2022
2 parents bb6e291 + 3e89895 commit 8497f46
Show file tree
Hide file tree
Showing 63 changed files with 2,385 additions and 1,679 deletions.
39 changes: 21 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "resobin",
"version": "1.6.1",
"version": "1.8.0",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/wncc/resobin.git"
},
"author": "Laxman Desai <[email protected]>",
"license": "MIT",
"scripts": {
"start": "react-scripts start",
Expand All @@ -18,25 +19,27 @@
"prepare": "husky install"
},
"dependencies": {
"@reduxjs/toolkit": "^1.7.1",
"@sentry/react": "^6.16.1",
"@sentry/tracing": "^6.16.1",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@reduxjs/toolkit": "^1.7.2",
"@sentry/react": "^6.17.9",
"@sentry/tracing": "^6.17.9",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^13.5.0",
"antd": "^4.18.4",
"axios": "^0.25.0",
"antd": "^4.18.7",
"axios": "^0.26.0",
"date-fns": "^2.28.0",
"dompurify": "^2.3.4",
"dompurify": "^2.3.6",
"js-cookie": "^3.0.1",
"lodash": "^4.17.21",
"nanoid": "^3.2.0",
"polished": "^4.1.3",
"nanoid": "^3.3.1",
"polished": "^4.1.4",
"qrcode.react": "^1.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-dropzone": "^11.5.1",
"react-helmet-async": "^1.2.2",
"react-pdf": "^5.6.0",
"react-dropzone": "^12.0.4",
"react-ga": "^3.3.0",
"react-helmet-async": "^1.2.3",
"react-pdf": "^5.7.1",
"react-quill": "2.0.0-beta.4",
"react-redux": "^7.2.6",
"react-router-dom": "^6.2.1",
Expand All @@ -45,7 +48,7 @@
"redux-persist": "^6.0.0",
"styled-components": "^5.3.3",
"styled-icons": "^10.45.0",
"web-vitals": "^2.1.3"
"web-vitals": "^2.1.4"
},
"devDependencies": {
"@stylelint/postcss-css-in-js": "^0.37.2",
Expand All @@ -58,10 +61,10 @@
"postcss-syntax": "^0.36.2",
"prettier": "^2.5.1",
"redux-logger": "^3.0.6",
"stylelint": "^14.2.0",
"stylelint": "^14.5.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-standard": "^24.0.0",
"stylelint-config-standard": "^25.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-order": "^5.0.0"
},
Expand All @@ -77,4 +80,4 @@
"last 1 safari version"
]
}
}
}
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

<div id="root"></div>

<div class="spinner">
<img src="%PUBLIC_URL%/images/devcom/DC_logo_black.png" alt="logo" />
</div>
Expand Down
11 changes: 5 additions & 6 deletions public/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
// import worker from 'pdfjs-dist/build/pdf.worker.entry'
import { Suspense } from 'react'
import { Helmet } from 'react-helmet-async'
// import { pdfjs } from 'react-pdf'
import { useSelector } from 'react-redux'
import { ThemeProvider } from 'styled-components/macro'

import { LoaderAnimation } from 'components/shared'
import { usePageTracking } from 'hooks'
import { AppRoutes } from 'routes'
import { selectAuthLoading } from 'store/authSlice'
import { selectTheme } from 'store/settingsSlice'
import { themes, GlobalStyles } from 'styles'

// ? for viewing course resource pdfs
// import worker from 'pdfjs-dist/build/pdf.worker.entry'
// import { pdfjs } from 'react-pdf'
// pdfjs.GlobalWorkerOptions.workerSrc = worker

const App = () => {
const selectedTheme = useSelector(selectTheme)
const theme = useSelector(selectTheme)
const authLoading = useSelector(selectAuthLoading)
usePageTracking()

return (
<ThemeProvider theme={themes[selectedTheme]}>
<ThemeProvider theme={themes[theme] ?? themes.dark}>
<Helmet>
<title>ResoBin</title>
<meta
Expand Down
11 changes: 8 additions & 3 deletions src/components/Contact/ContactContainer.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Input } from 'antd'
import { Input, Empty } from 'antd'
import { useState } from 'react'
import styled from 'styled-components/macro'

import { DeveloperList } from 'components/Contact'
// import { DeveloperList } from 'components/Contact'
import {
Aside,
PageSubtitle,
ButtonSquare,
Form,
PageHeading,
Expand Down Expand Up @@ -71,7 +73,10 @@ const ContactContainer = () => {
</div>
</StyledForm>

<DeveloperList />
{/* <DeveloperList /> */}
<Aside title="Contributors">
<Empty description={<PageSubtitle>Coming soon!</PageSubtitle>} />
</Aside>
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,16 @@ const ContributeContainer = ({ visible, setVisible }) => {
const addUploadedFile = (file) =>
setUploadedFiles((prevItems) => [file, ...prevItems])

const onDrop = useCallback((acceptedFiles) => {
const onDrop = useCallback((acceptedFiles, fileRejections) => {
fileRejections.forEach((file) => {
file.errors.forEach((err) => {
toast({
status: 'error',
content: err.message,
})
})
})

acceptedFiles.forEach((file) => {
const fileItem = {
id: nanoid(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,22 @@ const ContributeForm = ({ fileItem, handleUpload, handleDelete }) => {
<Input placeholder="Title" />
</Form.Item>

<Form.Item name="author" rules={[{ required: false }]}>
<Form.Item
name="author"
rules={[{ max: 255, message: 'Author must be atmost 255 characters.' }]}
>
<Input placeholder="Author" />
</Form.Item>

<Form.Item name="description">
<Form.Item
name="description"
rules={[
{ max: 500, message: 'Description must be atmost 500 characters.' },
]}
>
<Input.TextArea
autoSize={{ minRows: 1, maxRows: 10 }}
placeholder="Description"
rules={[
{ max: 500, message: 'Title must be atmost 500 characters.' },
]}
/>
</Form.Item>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ const ContributeItem = ({
addUploadedFile,
}) => {
// ? If no file is valid, reset the file list item
const onDrop = (acceptedFiles) => {
const onDrop = (acceptedFiles, fileRejections) => {
fileRejections.forEach((file) => {
file.errors.forEach((err) => {
toast({
status: 'error',
content: err.message,
})
})
})

if (acceptedFiles.length !== 0)
updateFileItem({
file: acceptedFiles[0],
Expand Down Expand Up @@ -53,16 +62,18 @@ const ContributeItem = ({
fd.append('tags', JSON.stringify(tags))

try {
const response = await API.resources.create({
payload: fd,
onUploadProgress,
})
// const response = await API.resources.create({
// payload: fd,
// onUploadProgress,
// })
// addUploadedFile(response)
await API.resources.create({ payload: fd, onUploadProgress })

addUploadedFile(response)
deleteFileItem()
toast({
status: 'success',
content: 'Resource uploaded successfully!',
content:
'Resource uploaded successfully! Pending moderator approval (1-2 days).',
})
} catch (error) {
toast({ status: 'error', content: error })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ import { device, fontSize } from 'styles/responsive'

import { fileTypes } from './fileDetails'

const dropzoneProps = {
accept: fileTypes.map((file) => file.type),
maxSize: 30 * 1024 * 1024, // ? 30MB
minSize: 3 * 1024, // ? 3KB
}

export const DragNDropSub = ({ onDrop, children }) => {
const { getRootProps, getInputProps, isDragActive, isDragReject } =
useDropzone({
accept: fileTypes.map((file) => file.type),
maxFiles: 1,
onDrop,
})
useDropzone({ maxFiles: 1, onDrop, ...dropzoneProps })

let message = children
if (isDragActive) {
if (isDragReject) message = <h2>Invalid upload format</h2>
if (isDragReject) message = <h2>File too large or invalid upload format</h2>
else message = <h2>Drop files here</h2>
}

Expand All @@ -32,10 +34,7 @@ export const DragNDropSub = ({ onDrop, children }) => {

const DragNDrop = ({ onDrop, children }) => {
const { getRootProps, getInputProps, isDragActive, isDragReject } =
useDropzone({
accept: fileTypes.map((file) => file.type),
onDrop,
})
useDropzone({ onDrop, ...dropzoneProps })

let message = null
if (!isDragActive)
Expand All @@ -52,15 +51,12 @@ const DragNDrop = ({ onDrop, children }) => {
return (
<UploadBox {...getRootProps()} error={isDragReject}>
<input {...getInputProps()} />

<CloudUpload size="60" />

{message}

<span>
Accepted formats: .pdf, .doc, .ppt
<br />
Maximum upload file size: 20MB
Maximum upload file size: 30MB
</span>
</UploadBox>
)
Expand Down
File renamed without changes.
File renamed without changes.
20 changes: 9 additions & 11 deletions src/components/CourseFinder/CourseContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { useQueryString } from 'hooks'

import CourseList from './CourseList'
import CourseSearch from './CourseSearch'
import { ClearAll, filterKeys } from './Filter/CourseFinderFilterContainer'
import CourseFinderFilterForm from './Filter/CourseFinderFilterForm'
import { ClearAll } from './Filter/CourseFinderFilterContainer'
import CourseFinderFilterForm, {
filterKeys,
} from './Filter/CourseFinderFilterForm'

let ajaxRequest = null
const CourseFinderContainer = () => {
Expand Down Expand Up @@ -40,16 +42,12 @@ const CourseFinderContainer = () => {
useEffect(() => {
const filter = getQueryString()
const params = {
q: filter.q,
search_fields: 'code,title,description',
page: filter.p,
department: filter.department,
is_half_semester: filter.halfsem,
is_running: filter.running,
credits_min: filter.credits_min,
credits_max: filter.credits_max,
semester: filter.semester,
tags: filter.tags,
q: filter.q,
...filterKeys.reduce(
(accumulator, value) => ({ ...accumulator, [value]: filter[value] }),
{}
),
}

fetchCourses(params)
Expand Down
Loading

0 comments on commit 8497f46

Please sign in to comment.