Skip to content

Commit 8497f46

Browse files
authored
Merge pull request #64 from relaxxpls/develop
[v1.8.0] Timetable sharing and admin approvals for reviews and resources
2 parents bb6e291 + 3e89895 commit 8497f46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2385
-1679
lines changed

package.json

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "resobin",
3-
"version": "1.6.1",
3+
"version": "1.8.0",
44
"private": true,
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/wncc/resobin.git"
88
},
9+
"author": "Laxman Desai <[email protected]>",
910
"license": "MIT",
1011
"scripts": {
1112
"start": "react-scripts start",
@@ -18,25 +19,27 @@
1819
"prepare": "husky install"
1920
},
2021
"dependencies": {
21-
"@reduxjs/toolkit": "^1.7.1",
22-
"@sentry/react": "^6.16.1",
23-
"@sentry/tracing": "^6.16.1",
24-
"@testing-library/jest-dom": "^5.16.1",
25-
"@testing-library/react": "^12.1.2",
22+
"@reduxjs/toolkit": "^1.7.2",
23+
"@sentry/react": "^6.17.9",
24+
"@sentry/tracing": "^6.17.9",
25+
"@testing-library/jest-dom": "^5.16.2",
26+
"@testing-library/react": "^12.1.3",
2627
"@testing-library/user-event": "^13.5.0",
27-
"antd": "^4.18.4",
28-
"axios": "^0.25.0",
28+
"antd": "^4.18.7",
29+
"axios": "^0.26.0",
2930
"date-fns": "^2.28.0",
30-
"dompurify": "^2.3.4",
31+
"dompurify": "^2.3.6",
3132
"js-cookie": "^3.0.1",
3233
"lodash": "^4.17.21",
33-
"nanoid": "^3.2.0",
34-
"polished": "^4.1.3",
34+
"nanoid": "^3.3.1",
35+
"polished": "^4.1.4",
36+
"qrcode.react": "^1.0.1",
3537
"react": "^17.0.2",
3638
"react-dom": "^17.0.2",
37-
"react-dropzone": "^11.5.1",
38-
"react-helmet-async": "^1.2.2",
39-
"react-pdf": "^5.6.0",
39+
"react-dropzone": "^12.0.4",
40+
"react-ga": "^3.3.0",
41+
"react-helmet-async": "^1.2.3",
42+
"react-pdf": "^5.7.1",
4043
"react-quill": "2.0.0-beta.4",
4144
"react-redux": "^7.2.6",
4245
"react-router-dom": "^6.2.1",
@@ -45,7 +48,7 @@
4548
"redux-persist": "^6.0.0",
4649
"styled-components": "^5.3.3",
4750
"styled-icons": "^10.45.0",
48-
"web-vitals": "^2.1.3"
51+
"web-vitals": "^2.1.4"
4952
},
5053
"devDependencies": {
5154
"@stylelint/postcss-css-in-js": "^0.37.2",
@@ -58,10 +61,10 @@
5861
"postcss-syntax": "^0.36.2",
5962
"prettier": "^2.5.1",
6063
"redux-logger": "^3.0.6",
61-
"stylelint": "^14.2.0",
64+
"stylelint": "^14.5.1",
6265
"stylelint-config-prettier": "^9.0.3",
6366
"stylelint-config-rational-order": "^0.1.2",
64-
"stylelint-config-standard": "^24.0.0",
67+
"stylelint-config-standard": "^25.0.0",
6568
"stylelint-config-styled-components": "^0.1.1",
6669
"stylelint-order": "^5.0.0"
6770
},
@@ -77,4 +80,4 @@
7780
"last 1 safari version"
7881
]
7982
}
80-
}
83+
}

public/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525
<body>
2626
<noscript>You need to enable JavaScript to run this app.</noscript>
27+
2728
<div id="root"></div>
29+
2830
<div class="spinner">
2931
<img src="%PUBLIC_URL%/images/devcom/DC_logo_black.png" alt="logo" />
3032
</div>

public/safari-pinned-tab.svg

Lines changed: 5 additions & 6 deletions
Loading

src/App.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
// import worker from 'pdfjs-dist/build/pdf.worker.entry'
21
import { Suspense } from 'react'
32
import { Helmet } from 'react-helmet-async'
4-
// import { pdfjs } from 'react-pdf'
53
import { useSelector } from 'react-redux'
64
import { ThemeProvider } from 'styled-components/macro'
75

86
import { LoaderAnimation } from 'components/shared'
7+
import { usePageTracking } from 'hooks'
98
import { AppRoutes } from 'routes'
109
import { selectAuthLoading } from 'store/authSlice'
1110
import { selectTheme } from 'store/settingsSlice'
1211
import { themes, GlobalStyles } from 'styles'
1312

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

1718
const App = () => {
18-
const selectedTheme = useSelector(selectTheme)
19+
const theme = useSelector(selectTheme)
1920
const authLoading = useSelector(selectAuthLoading)
21+
usePageTracking()
2022

2123
return (
22-
<ThemeProvider theme={themes[selectedTheme]}>
24+
<ThemeProvider theme={themes[theme] ?? themes.dark}>
2325
<Helmet>
2426
<title>ResoBin</title>
2527
<meta

src/components/Contact/ContactContainer.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { Input } from 'antd'
1+
import { Input, Empty } from 'antd'
22
import { useState } from 'react'
33
import styled from 'styled-components/macro'
44

5-
import { DeveloperList } from 'components/Contact'
5+
// import { DeveloperList } from 'components/Contact'
66
import {
7+
Aside,
8+
PageSubtitle,
79
ButtonSquare,
810
Form,
911
PageHeading,
@@ -71,7 +73,10 @@ const ContactContainer = () => {
7173
</div>
7274
</StyledForm>
7375

74-
<DeveloperList />
76+
{/* <DeveloperList /> */}
77+
<Aside title="Contributors">
78+
<Empty description={<PageSubtitle>Coming soon!</PageSubtitle>} />
79+
</Aside>
7580
</>
7681
)
7782
}

src/components/contribute/ContributeContainer.jsx renamed to src/components/Contribute/ContributeContainer.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ const ContributeContainer = ({ visible, setVisible }) => {
5151
const addUploadedFile = (file) =>
5252
setUploadedFiles((prevItems) => [file, ...prevItems])
5353

54-
const onDrop = useCallback((acceptedFiles) => {
54+
const onDrop = useCallback((acceptedFiles, fileRejections) => {
55+
fileRejections.forEach((file) => {
56+
file.errors.forEach((err) => {
57+
toast({
58+
status: 'error',
59+
content: err.message,
60+
})
61+
})
62+
})
63+
5564
acceptedFiles.forEach((file) => {
5665
const fileItem = {
5766
id: nanoid(),

src/components/contribute/ContributeForm.jsx renamed to src/components/Contribute/ContributeForm.jsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,22 @@ const ContributeForm = ({ fileItem, handleUpload, handleDelete }) => {
4444
<Input placeholder="Title" />
4545
</Form.Item>
4646

47-
<Form.Item name="author" rules={[{ required: false }]}>
47+
<Form.Item
48+
name="author"
49+
rules={[{ max: 255, message: 'Author must be atmost 255 characters.' }]}
50+
>
4851
<Input placeholder="Author" />
4952
</Form.Item>
5053

51-
<Form.Item name="description">
54+
<Form.Item
55+
name="description"
56+
rules={[
57+
{ max: 500, message: 'Description must be atmost 500 characters.' },
58+
]}
59+
>
5260
<Input.TextArea
5361
autoSize={{ minRows: 1, maxRows: 10 }}
5462
placeholder="Description"
55-
rules={[
56-
{ max: 500, message: 'Title must be atmost 500 characters.' },
57-
]}
5863
/>
5964
</Form.Item>
6065

src/components/contribute/ContributeItem.jsx renamed to src/components/Contribute/ContributeItem.jsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ const ContributeItem = ({
1818
addUploadedFile,
1919
}) => {
2020
// ? If no file is valid, reset the file list item
21-
const onDrop = (acceptedFiles) => {
21+
const onDrop = (acceptedFiles, fileRejections) => {
22+
fileRejections.forEach((file) => {
23+
file.errors.forEach((err) => {
24+
toast({
25+
status: 'error',
26+
content: err.message,
27+
})
28+
})
29+
})
30+
2231
if (acceptedFiles.length !== 0)
2332
updateFileItem({
2433
file: acceptedFiles[0],
@@ -53,16 +62,18 @@ const ContributeItem = ({
5362
fd.append('tags', JSON.stringify(tags))
5463

5564
try {
56-
const response = await API.resources.create({
57-
payload: fd,
58-
onUploadProgress,
59-
})
65+
// const response = await API.resources.create({
66+
// payload: fd,
67+
// onUploadProgress,
68+
// })
69+
// addUploadedFile(response)
70+
await API.resources.create({ payload: fd, onUploadProgress })
6071

61-
addUploadedFile(response)
6272
deleteFileItem()
6373
toast({
6474
status: 'success',
65-
content: 'Resource uploaded successfully!',
75+
content:
76+
'Resource uploaded successfully! Pending moderator approval (1-2 days).',
6677
})
6778
} catch (error) {
6879
toast({ status: 'error', content: error })

src/components/contribute/DragNDrop.jsx renamed to src/components/Contribute/DragNDrop.jsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ import { device, fontSize } from 'styles/responsive'
77

88
import { fileTypes } from './fileDetails'
99

10+
const dropzoneProps = {
11+
accept: fileTypes.map((file) => file.type),
12+
maxSize: 30 * 1024 * 1024, // ? 30MB
13+
minSize: 3 * 1024, // ? 3KB
14+
}
15+
1016
export const DragNDropSub = ({ onDrop, children }) => {
1117
const { getRootProps, getInputProps, isDragActive, isDragReject } =
12-
useDropzone({
13-
accept: fileTypes.map((file) => file.type),
14-
maxFiles: 1,
15-
onDrop,
16-
})
18+
useDropzone({ maxFiles: 1, onDrop, ...dropzoneProps })
1719

1820
let message = children
1921
if (isDragActive) {
20-
if (isDragReject) message = <h2>Invalid upload format</h2>
22+
if (isDragReject) message = <h2>File too large or invalid upload format</h2>
2123
else message = <h2>Drop files here</h2>
2224
}
2325

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

3335
const DragNDrop = ({ onDrop, children }) => {
3436
const { getRootProps, getInputProps, isDragActive, isDragReject } =
35-
useDropzone({
36-
accept: fileTypes.map((file) => file.type),
37-
onDrop,
38-
})
37+
useDropzone({ onDrop, ...dropzoneProps })
3938

4039
let message = null
4140
if (!isDragActive)
@@ -52,15 +51,12 @@ const DragNDrop = ({ onDrop, children }) => {
5251
return (
5352
<UploadBox {...getRootProps()} error={isDragReject}>
5453
<input {...getInputProps()} />
55-
5654
<CloudUpload size="60" />
57-
5855
{message}
59-
6056
<span>
6157
Accepted formats: .pdf, .doc, .ppt
6258
<br />
63-
Maximum upload file size: 20MB
59+
Maximum upload file size: 30MB
6460
</span>
6561
</UploadBox>
6662
)

0 commit comments

Comments
 (0)