Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zhige Yu
scientia
Commits
f29d7631
Commit
f29d7631
authored
Jun 15, 2021
by
Ivan Procaccini
💻
Browse files
Merge branch 'dev' into 'merge_request_1'
# Conflicts: # src/components/modals/UploadModal/index.tsx
parents
711b02e7
06112943
Changes
5
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
f29d7631
...
...
@@ -6,24 +6,36 @@ _🚧 This platform is currently under development! 🚧_
This project was bootstrapped with
[
Create React App
](
https://github.com/facebook/create-react-app
)
.
## Requirements
-
[
Node
](
https://nodejs.org/en/
)
14.X
-
[
Yarn
](
https://yarnpkg.com/
)
If you already have a different version of Node, install
[
NVM
](
https://github.com/nvm-sh/nvm#installing-and-updating
)
and proceed as follows:
```
shell script
nvm install 14
nvm use 14
```
## Setup
First, run
`yarn install`
to install the node modules used for the frontend.
In order for the API links to work, the following repository branches need to be cloned and run separately:
### 1. materials@scientia-integration
### 1. materials@api
Clone
*Materials*
.
```
shell
# Clone the repository and checkout to the relevant branch
git clone https://gitlab.doc.ic.ac.uk/edtech/materials.git
git checkout scientia-integration
# Setup and run the development server on port 5000
python3
-m
venv venv
./scripts/start_scientia_dev.sh
git checkout api
```
Follow the instructions in the
[
README
](
https://gitlab.doc.ic.ac.uk/edtech/materials/-/blob/api/README.md
)
to
run the app on port 5000. Check that you meet the system requirements (near the top of the README) before attempting this.
### 2. scientia-calendar
```
shell
...
...
src/components/cards/ModuleCard/index.tsx
View file @
f29d7631
...
...
@@ -49,7 +49,6 @@ const ModuleCard: React.FC<ModuleCardProps> = ({ module }: ModuleCardProps) => {
paddingRight
:
"
0.625rem
"
,
}
}
>
<
Card
border
=
{
!
module
.
hasMaterials
?
"
danger
"
:
""
}
className
=
{
classNames
(
styles
.
moduleCard
)
}
as
=
{
Link
}
to
=
{
`modules/
${
module
.
code
}
`
}
>
...
...
src/components/modals/UploadModal/index.tsx
View file @
f29d7631
...
...
@@ -84,7 +84,7 @@ const UploadModal: React.FC<UploadModalProps> = ({
}
=
useDropzone
({
onDrop
,
minSize
:
0
,
maxSize
,
maxSize
:
MAX_SIZE
,
multiple
:
true
,
})
...
...
src/components/pages/modulePages/ModuleDashboard/index.tsx
View file @
f29d7631
import
React
,
{
useEffect
,
useState
}
from
"
react
"
import
React
from
"
react
"
import
Dandruff
from
"
components/headings/Dandruff
"
import
styles
from
"
./style.module.scss
"
import
classNames
from
"
classnames
"
import
{
faGlobe
,
faUserFriends
}
from
"
@fortawesome/free-solid-svg-icons
"
import
PageButtonGroup
from
"
components/groups/PageButtonGroup
"
import
{
request
}
from
"
utils/api
"
import
{
api
,
methods
}
from
"
constants/routes
"
import
{
modulesList
}
from
"
../../ModuleList/list
"
import
{
teachingAims
}
from
"
../../ModuleList/aims
"
...
...
@@ -49,36 +47,18 @@ const MODULE_AIMS_PLACEHOLDER = (
const
ModuleDashboard
:
React
.
FC
<
Props
>
=
({
year
,
moduleID
})
=>
{
const
moduleCode
=
moduleID
.
startsWith
(
"
CO
"
)
?
moduleID
.
slice
(
2
)
:
moduleID
let
[
buttons
,
setButtons
]
=
useState
<
any
>
([])
useEffect
(()
=>
{
const
onSuccess
=
(
data
:
{
[
k
:
string
]:
any
})
=>
{
const
newButtons
:
any
[]
=
[
{
title
:
"
Syllabus
"
,
icon
:
faGlobe
,
url
:
`https://www.imperial.ac.uk/computing/current-students/courses/
${
moduleCode
}
/`
,
},
{
title
:
"
Piazza
"
,
icon
:
faUserFriends
,
url
:
`https://piazza.com/imperial.ac.uk/fall2021/comp
${
moduleID
}
`
,
},
]
setButtons
(
newButtons
)
}
request
({
url
:
api
.
MATERIALS_RESOURCES
,
method
:
methods
.
GET
,
onSuccess
,
onError
:
()
=>
{
console
.
log
(
"
fail
"
)
},
body
:
{
year
:
year
,
course
:
moduleCode
,
},
})
},
[
moduleID
,
year
])
let
buttons
:
any
[]
=
[
{
title
:
"
Syllabus
"
,
icon
:
faGlobe
,
url
:
`https://www.imperial.ac.uk/computing/current-students/courses/
${
moduleCode
}
/`
,
},
{
title
:
"
Piazza
"
,
icon
:
faUserFriends
,
url
:
`https://piazza.com/imperial.ac.uk/fall2021/comp
${
moduleID
}
`
,
},
]
return
(
<>
...
...
@@ -106,18 +86,4 @@ const ModuleDashboard: React.FC<Props> = ({ year, moduleID }) => {
)
}
export
default
ModuleDashboard
const
piazzaClasses
:
{
[
index
:
string
]:
string
}
=
{
CO140
:
"
k0r3c04qwhj3e
"
,
CO142
:
"
k0r3c156mj35b
"
,
CO112
:
"
k0r3by316kp6
"
,
CO145
:
"
k0r3c1h4zik5y
"
,
"
CO120.2
"
:
"
k0r3bzfpcno23
"
,
CO150
:
"
k0r3c1t4x8k6l
"
,
CO113
:
"
k0r3byq0f68t
"
,
CO141
:
"
k0r3c0t7dak4o
"
,
CO130
:
"
k0r3bzsith2r
"
,
}
export
default
ModuleDashboard
\ No newline at end of file
src/components/pages/modulePages/ModuleResources/utils.ts
View file @
f29d7631
...
...
@@ -26,7 +26,9 @@ export function tags(resources: Resource[]) {
export
function
folders
(
resources
:
Resource
[]):
Folder
[]
{
return
Array
.
from
(
new
Set
<
string
>
(
resources
.
map
((
res
:
Resource
)
=>
res
.
folder
))
).
map
((
title
,
id
)
=>
({
title
:
title
,
id
:
id
}))
)
.
sort
()
.
map
((
title
,
id
)
=>
({
title
:
title
,
id
:
id
}))
}
export
function
categories
(
folders
:
Folder
[]):
string
[]
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment