Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesigned courses modal to include ability to filter courses by difficulty and category. #355

Closed
wants to merge 265 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
265 commits
Select commit Hold shift + click to select a range
c642480
updated subtractive geometry to work with groups
samuel-zuk Jun 7, 2019
e532437
disabled save, play, stop, and recover when reference is open in new tab
samuel-zuk Jun 11, 2019
c4cdcd5
disabled buttons in sidebar via button styles rather than hiding them…
samuel-zuk Jun 11, 2019
6fc4cbf
added tests for subtractive functions
samuel-zuk Jun 11, 2019
7dd0f1f
Merge branch 'dev' of https://github.com/engaging-computing/MYR into dev
samuel-zuk Jun 11, 2019
d48ea79
Fixed makeUnPushable/unDroppable bug, fixed animation bugs on render,…
jSwanson99 Jun 13, 2019
1ac632d
Merge branch 'dev' of https://github.com/engaging-computing/MYR into dev
samuel-zuk Jun 13, 2019
feade46
Merge branch 'dev' of github.com:samuel-zuk/MYR
samuel-zuk Jun 13, 2019
1e564c2
re-removed makeUnDroppable/makeUnPushable from the autocomplete
samuel-zuk Jun 13, 2019
be6cd4f
Fixed formatting, moved render bug fix to state, removed loading scre…
jSwanson99 Jun 13, 2019
e61bdd5
Render changes reversed
jSwanson99 Jun 14, 2019
7e71e98
Resolved merge conflicts
jSwanson99 Jun 14, 2019
99247d0
Should have resolved merge conflicts
jSwanson99 Jun 14, 2019
ef4a452
Merge branch 'dev' into master
jasondkiesling Jun 14, 2019
032dc4c
Revert "re-removed makeUnDroppable/makeUnPushable from the autocomplete"
samuel-zuk Jun 14, 2019
078b90b
Revert "Merge branch 'dev' of github.com:samuel-zuk/MYR"
samuel-zuk Jun 14, 2019
0cd4b34
create new commit in different branch to hope that it didn't highligh…
Jun 14, 2019
2598706
Revert "Merge branch 'dev' of https://github.com/engaging-computing/M…
samuel-zuk Jun 14, 2019
b92c96b
Merge branch 'master' of github.com:samuel-zuk/MYR
samuel-zuk Jun 14, 2019
0435000
Merge pull request #233 from Jlu18/issue71-2
jasondkiesling Jun 14, 2019
7a4bbf9
Merge branch 'master' of https://github.com/jswanson99/myr into test-229
jasondkiesling Jun 16, 2019
636a1c4
Merge branch 'dev' into master
jasondkiesling Jun 16, 2019
42d5999
Merge pull request #229 from jSwanson99/master
jasondkiesling Jun 16, 2019
5ea0ccf
Added makeUnDroppable/Pushable back to reference
jasondkiesling Jun 16, 2019
5598a63
Added makeUnDroppable/Pushable back to autocomplete
jasondkiesling Jun 16, 2019
0829692
Merge branch 'dev' into master
jasondkiesling Jun 16, 2019
845e1c9
Merge pull request #235 from jasondkiesling/master
jasondkiesling Jun 16, 2019
8b13466
1.2.3 change log
jasondkiesling Jun 16, 2019
cc595a1
1.2.3 change log
jasondkiesling Jun 16, 2019
9b10828
changed appearance of render/stop buttons when on reference page
samuel-zuk Jun 17, 2019
7dd2e66
Merge branch 'master' of https://github.com/engaging-computing/MYR
samuel-zuk Jun 17, 2019
143b32e
reverted merge conflicts
samuel-zuk Jun 17, 2019
603b168
increased stop/start button thickness on reference page
samuel-zuk Jun 17, 2019
bf21ec6
let -> const
samuel-zuk Jun 17, 2019
0f703ed
Merge branch 'dev' into master
jasondkiesling Jun 17, 2019
f7ade8b
Disabled save, recover, play, and stop buttons in header and sidebar …
samuel-zuk Jun 17, 2019
3799ba6
Render button should behave properly/the same as crtl enter (#237)
jSwanson99 Jun 17, 2019
553c855
Fixed bug where view only toggle doesn't work in courses (#238)
jSwanson99 Jun 18, 2019
6dd53f9
Merge branch 'master' into dev
jasondkiesling Jun 18, 2019
dbb5fde
Update README.md
jasondkiesling Jun 18, 2019
3767737
View only on RefEx, ctrl+shift+s rename, eslint, and formatting galor…
jasondkiesling Jun 19, 2019
a55cb66
Merge branch 'master' into dev
jasondkiesling Jun 19, 2019
cd0c8aa
package.json version number
jasondkiesling Jun 19, 2019
45ae1db
Change log for 1.2.5
jasondkiesling Jun 19, 2019
de40464
Update README.md
jasondkiesling Jun 19, 2019
fc169cb
Error handling for reference examples and add to eslint rules (#247)
jasondkiesling Jun 19, 2019
6e78649
Update change log 1.2.5
jasondkiesling Jun 19, 2019
687ec13
Prefer const is too strict for react
jasondkiesling Jun 19, 2019
34650b2
add name and description for reference example when saving (#250)
Jlu18 Jun 20, 2019
10297c6
1.2.6 change log
jasondkiesling Jun 20, 2019
15615a9
Update version #
jasondkiesling Jun 20, 2019
0a23239
Merge branch 'master' into dev
jasondkiesling Jun 20, 2019
a4a028e
editor with change will now show the confirmation window before exit …
Jlu18 Jun 20, 2019
446db60
Update README.md
jasondkiesling Jun 20, 2019
1293c32
Implement relative cursor modification functions (#258)
Jlu18 Jun 21, 2019
f9cac9a
Update package.json
jasondkiesling Jun 21, 2019
2ad30ae
1.2.7 change log
jasondkiesling Jun 21, 2019
fd93694
Add CircleCI status to readme
jasondkiesling Jun 21, 2019
ebf37be
Project view moved from drawer to tabbed modal (#260)
elenaizotova Jun 22, 2019
cede8c8
Loading overlay implemented (#261)
jSwanson99 Jun 22, 2019
92b997f
1.3.0 change log
jasondkiesling Jun 22, 2019
3802511
Projects with same name are sorted by timestamp (#254)
Jlu18 Jun 22, 2019
5fb98ef
1.3.0 change log
jasondkiesling Jun 22, 2019
8dbd259
Version is now 1.3.0
jasondkiesling Jun 22, 2019
71a8eb7
Implemented welcome screen (#265)
jasondkiesling Jun 23, 2019
d7e00d5
Reference close and open in new tab buttons moved out of tabs. (#264)
elenaizotova Jun 23, 2019
ef9b2c4
Merge branch 'master' into dev
jasondkiesling Jun 23, 2019
c5268e6
1.3.0 change log
jasondkiesling Jun 23, 2019
c206881
No tour on welcome screen on mobile (#266)
jasondkiesling Jun 23, 2019
b244fdc
Welcome screen padding fix (#267)
jasondkiesling Jun 23, 2019
9327e34
Welcome screen never again button closes modal (#269)
jasondkiesling Jun 23, 2019
9159a7f
Update manifest.json
jasondkiesling Jun 23, 2019
c45b860
Reverted loading overlay (#273)
jSwanson99 Jun 24, 2019
a8afa32
1.3.0 change log
jasondkiesling Jun 24, 2019
07e4752
Merge branch 'dev' of https://github.com/engaging-computing/MYR
samuel-zuk Jun 24, 2019
26949a1
Reference tab labels auto hidden on extra-small viewports
samuel-zuk Jun 24, 2019
d7137b0
GDPR compliant welcome screen with sidebar button (#286)
jasondkiesling Jun 25, 2019
5889b7d
Merge branch 'dev' into master
jasondkiesling Jun 25, 2019
5632f71
Fixed welcome scene typos
jasondkiesling Jun 25, 2019
0ca0a8f
1.3.0 change log updates
jasondkiesling Jun 25, 2019
137293f
Reference drawer title (#271)
elenaizotova Jun 25, 2019
d53e5ea
Merge branch 'dev' into master
jasondkiesling Jun 25, 2019
b6bb5c5
header logo (MYR) will now redirect to the new scene (#287)
Jlu18 Jun 25, 2019
3be5679
1.3.0 change log - Add brand link
jasondkiesling Jun 25, 2019
7fc2954
Merge branch 'dev' of https://github.com/engaging-computing/MYR
samuel-zuk Jun 25, 2019
80c5a2a
Merge branch 'master' of github.com:samuel-zuk/MYR
samuel-zuk Jun 25, 2019
6df6fdb
Reference tab labels are now automatically hidden on extra-small scre…
samuel-zuk Jun 25, 2019
8bc3568
1.3.0 change log - Reference labels and view
jasondkiesling Jun 25, 2019
8649578
Added loading screen implementation (#274)
jSwanson99 Jun 25, 2019
3c98c4d
Merge branch 'dev' of https://github.com/engaging-computing/MYR
samuel-zuk Jun 25, 2019
e6d7f40
added ability to pass arrays to getRandomColor()
samuel-zuk Jun 25, 2019
b6ff4df
cleaned up getRandomColor code
samuel-zuk Jun 25, 2019
90ccf44
cleaned up getRandomColor code
samuel-zuk Jun 25, 2019
fcdcb1f
getRandomColor() now checks for empty arrays and for no arguments. ad…
samuel-zuk Jun 25, 2019
cb4f8c0
added new array functionality within getRandomColor to the reference
samuel-zuk Jun 25, 2019
7f9b7d5
Revert "Added loading screen implementation (#274)" (#297)
jasondkiesling Jun 26, 2019
9d3d205
Remove view loading screen from change log
jasondkiesling Jun 26, 2019
1d94dcb
Merge branch 'dev' into master
jasondkiesling Jun 26, 2019
06fccd5
Adds ability to pass array to getRandomColor() (#295)
samuel-zuk Jun 26, 2019
4890144
Too many errors won't show for long code blocks (#293)
Jlu18 Jun 26, 2019
5e314d8
1.3.0 change log - too many errors, getRandomColor
jasondkiesling Jun 26, 2019
ed2ab76
Revert "Adds ability to pass array to getRandomColor() (#295)" (#298)
jasondkiesling Jun 26, 2019
da9ea02
1.3.0 change log
jasondkiesling Jun 26, 2019
c2c49d4
Settings modal now has tabs (#300)
elenaizotova Jun 27, 2019
50f1f61
1.3.0 - Tabbed settings
jasondkiesling Jun 27, 2019
a9c49ae
Merge branch 'dev' of https://github.com/engaging-computing/MYR
samuel-zuk Jun 27, 2019
f408672
Merge branch 'master' of github.com:samuel-zuk/MYR
samuel-zuk Jun 27, 2019
0bad5b6
fixed functionality of getRandomColor();
samuel-zuk Jun 27, 2019
7754b52
colors array initialized to null
samuel-zuk Jun 27, 2019
ac05ab5
delete duplicate function (#304)
Jlu18 Jun 27, 2019
11856a8
No view on welcome screen (#307)
jasondkiesling Jun 28, 2019
f2a14f5
Cookie notice at top of small screens (#308)
jasondkiesling Jun 28, 2019
92ff521
Fix typo in scene config
jasondkiesling Jun 28, 2019
d888c4e
A-Frame camera refactored to fix errors in console. (#305)
samuel-zuk Jun 28, 2019
20e674e
Add camera to change log
jasondkiesling Jun 28, 2019
84ec8e8
Merge branch 'dev' into master
jasondkiesling Jun 28, 2019
65b6887
Fixed issue where editor overlays view for iPhones (#315)
jSwanson99 Jul 3, 2019
2321bb1
1.4.1 version number
jasondkiesling Jul 3, 2019
f55d932
1.4.1 change log
jasondkiesling Jul 3, 2019
ebcb6d9
Merge branch 'dev' of https://github.com/engaging-computing/MYR
samuel-zuk Jul 3, 2019
31c0485
Merge branch 'master' of github.com:samuel-zuk/MYR
samuel-zuk Jul 3, 2019
f3336e1
Text function will now only take string as an argument (#314)
Jlu18 Jul 6, 2019
42788c1
1.4.2 change log - text()
jasondkiesling Jul 6, 2019
76d0a3f
Merge branch 'dev' of https://github.com/engaging-computing/MYR
samuel-zuk Jul 8, 2019
0ab0bfe
refactored components that used componentWillRecieveProps() lifecycle…
samuel-zuk Jul 8, 2019
e71a793
scene description now should send properly to firebase
samuel-zuk Jul 8, 2019
1074b60
renamed variables
samuel-zuk Jul 8, 2019
c6b8580
added makeSubtractive() function to enable subtractive geometry for M…
samuel-zuk May 23, 2019
21ce9f7
cleaned up makeSubtractive() function
samuel-zuk May 23, 2019
beec221
last commit broke subtractive geometry. this one fixes it.
samuel-zuk May 24, 2019
6af4028
updated Reference.js and Myr.js
samuel-zuk Jun 4, 2019
0209071
added documentation for makeSubtractive/makeUnSubtractive in referenc…
samuel-zuk Jun 4, 2019
91fa345
changed wording in reference section
samuel-zuk Jun 4, 2019
68f4dd7
slight change to addtive/subtractive mixins
samuel-zuk Jun 5, 2019
8d90357
minor change to mixins, and also readded make(Un)Droppable() to the c…
samuel-zuk Jun 5, 2019
e49076e
updated dependencies
samuel-zuk Jun 6, 2019
8344cf5
updated dependencies to use new fork of aframe-csg-meshs
samuel-zuk Jun 6, 2019
583861a
updated subtractive geometry to work with groups
samuel-zuk Jun 7, 2019
7308bd8
Fixed makeUnPushable/unDroppable bug, fixed animation bugs on render,…
jSwanson99 Jun 13, 2019
c13e075
Fixed formatting, moved render bug fix to state, removed loading scre…
jSwanson99 Jun 13, 2019
2034a2c
Resolved merge conflicts
jSwanson99 Jun 14, 2019
4876754
Revert "Merge branch 'dev' of github.com:samuel-zuk/MYR"
samuel-zuk Jun 14, 2019
476ad94
Revert "Merge branch 'dev' of https://github.com/engaging-computing/M…
samuel-zuk Jun 14, 2019
3459175
Added makeUnDroppable/Pushable back to reference
jasondkiesling Jun 16, 2019
e13c0e1
1.2.3 change log
jasondkiesling Jun 16, 2019
7a8017c
reverted merge conflicts
samuel-zuk Jun 17, 2019
0766cc7
Render button should behave properly/the same as crtl enter (#237)
jSwanson99 Jun 17, 2019
a0856f2
Fixed bug where view only toggle doesn't work in courses (#238)
jSwanson99 Jun 18, 2019
f5874f6
View only on RefEx, ctrl+shift+s rename, eslint, and formatting galor…
jasondkiesling Jun 19, 2019
a11cc86
Error handling for reference examples and add to eslint rules (#247)
jasondkiesling Jun 19, 2019
e71732c
Update change log 1.2.5
jasondkiesling Jun 19, 2019
13c91f0
Update version #
jasondkiesling Jun 20, 2019
76a43af
Project view moved from drawer to tabbed modal (#260)
elenaizotova Jun 22, 2019
f995487
Implemented welcome screen (#265)
jasondkiesling Jun 23, 2019
5ee5002
Welcome screen never again button closes modal (#269)
jasondkiesling Jun 23, 2019
23eec8d
1.3.0 change log
jasondkiesling Jun 24, 2019
fb642d5
added ability to pass arrays to getRandomColor()
samuel-zuk Jun 25, 2019
a821068
delete duplicate function (#304)
Jlu18 Jun 27, 2019
8c320af
fixed bad merges from rebase
samuel-zuk Jul 11, 2019
41ac703
merge conflict fix
samuel-zuk Jul 11, 2019
492c456
Update README.md
elenaizotova Jul 11, 2019
d6240a7
Update package.json
elenaizotova Jul 11, 2019
ac8c542
Update README.md
jasondkiesling Jul 11, 2019
f0459c5
added makeSubtractive() function to enable subtractive geometry for M…
samuel-zuk May 23, 2019
7b5c1f7
cleaned up makeSubtractive() function
samuel-zuk May 23, 2019
54b33b8
last commit broke subtractive geometry. this one fixes it.
samuel-zuk May 24, 2019
fbb6428
updated Reference.js and Myr.js
samuel-zuk Jun 4, 2019
580f027
added documentation for makeSubtractive/makeUnSubtractive in referenc…
samuel-zuk Jun 4, 2019
e976e9b
changed wording in reference section
samuel-zuk Jun 4, 2019
6aad32d
slight change to addtive/subtractive mixins
samuel-zuk Jun 5, 2019
87b7f13
minor change to mixins, and also readded make(Un)Droppable() to the c…
samuel-zuk Jun 5, 2019
f96de72
updated dependencies
samuel-zuk Jun 6, 2019
fd4cf04
updated dependencies to use new fork of aframe-csg-meshs
samuel-zuk Jun 6, 2019
e48dd61
updated subtractive geometry to work with groups
samuel-zuk Jun 7, 2019
8cd5951
Fixed makeUnPushable/unDroppable bug, fixed animation bugs on render,…
jSwanson99 Jun 13, 2019
fb908cf
Fixed formatting, moved render bug fix to state, removed loading scre…
jSwanson99 Jun 13, 2019
45253ba
Resolved merge conflicts
jSwanson99 Jun 14, 2019
5bfea77
Revert "Merge branch 'dev' of github.com:samuel-zuk/MYR"
samuel-zuk Jun 14, 2019
dd00337
Revert "Merge branch 'dev' of https://github.com/engaging-computing/M…
samuel-zuk Jun 14, 2019
4bbae31
Added makeUnDroppable/Pushable back to reference
jasondkiesling Jun 16, 2019
b909e9f
1.2.3 change log
jasondkiesling Jun 16, 2019
dc7ac35
reverted merge conflicts
samuel-zuk Jun 17, 2019
d8f20b7
Render button should behave properly/the same as crtl enter (#237)
jSwanson99 Jun 17, 2019
dad8e99
Fixed bug where view only toggle doesn't work in courses (#238)
jSwanson99 Jun 18, 2019
bd20959
View only on RefEx, ctrl+shift+s rename, eslint, and formatting galor…
jasondkiesling Jun 19, 2019
21a13ba
Error handling for reference examples and add to eslint rules (#247)
jasondkiesling Jun 19, 2019
e6643c9
Update version #
jasondkiesling Jun 20, 2019
fb29c75
Project view moved from drawer to tabbed modal (#260)
elenaizotova Jun 22, 2019
2194b26
Implemented welcome screen (#265)
jasondkiesling Jun 23, 2019
703fad7
Welcome screen never again button closes modal (#269)
jasondkiesling Jun 23, 2019
897296a
1.3.0 change log
jasondkiesling Jun 24, 2019
040cd53
added ability to pass arrays to getRandomColor()
samuel-zuk Jun 25, 2019
5822151
delete duplicate function (#304)
Jlu18 Jun 27, 2019
57a4cc8
refactored components that used componentWillRecieveProps() lifecycle…
samuel-zuk Jul 8, 2019
aeb2103
scene description now should send properly to firebase
samuel-zuk Jul 8, 2019
051776b
fixed bad merges from rebase
samuel-zuk Jul 11, 2019
1ae0adc
merge conflict fix
samuel-zuk Jul 11, 2019
eff4ad4
Fixed makeUnPushable/unDroppable bug, fixed animation bugs on render,…
jSwanson99 Jun 13, 2019
854fba0
Fixed formatting, moved render bug fix to state, removed loading scre…
jSwanson99 Jun 13, 2019
62b1067
Resolved merge conflicts
jSwanson99 Jun 14, 2019
7a853da
Render button should behave properly/the same as crtl enter (#237)
jSwanson99 Jun 17, 2019
7ad5aa7
Fixed bug where view only toggle doesn't work in courses (#238)
jSwanson99 Jun 18, 2019
5b46d65
View only on RefEx, ctrl+shift+s rename, eslint, and formatting galor…
jasondkiesling Jun 19, 2019
e1741a4
Project view moved from drawer to tabbed modal (#260)
elenaizotova Jun 22, 2019
7cd9762
Implemented welcome screen (#265)
jasondkiesling Jun 23, 2019
8b71b34
Reverted loading overlay (#273)
jSwanson99 Jun 24, 2019
7a93fe4
delete duplicate function (#304)
Jlu18 Jun 27, 2019
7dd0e49
conflict
Jul 11, 2019
4c12b5a
rebase
Jul 11, 2019
7f97df0
rebase
Jul 11, 2019
a9817da
modify autocomplete to pull function from reference
Jul 11, 2019
6b4ca73
fix indentation
Jul 11, 2019
434af8a
Fixed makeUnPushable/unDroppable bug, fixed animation bugs on render,…
jSwanson99 Jun 13, 2019
d40c271
Fixed formatting, moved render bug fix to state, removed loading scre…
jSwanson99 Jun 13, 2019
ec5cf81
Resolved merge conflicts
jSwanson99 Jun 14, 2019
3542118
Render button should behave properly/the same as crtl enter (#237)
jSwanson99 Jun 17, 2019
d45c844
Fixed bug where view only toggle doesn't work in courses (#238)
jSwanson99 Jun 18, 2019
c0c7980
View only on RefEx, ctrl+shift+s rename, eslint, and formatting galor…
jasondkiesling Jun 19, 2019
1a9f2f4
Project view moved from drawer to tabbed modal (#260)
elenaizotova Jun 22, 2019
adc3bf3
Implemented welcome screen (#265)
jasondkiesling Jun 23, 2019
c3ae44c
Reverted loading overlay (#273)
jSwanson99 Jun 24, 2019
e4cc76e
delete duplicate function (#304)
Jlu18 Jun 27, 2019
ac10155
conflict
Jul 11, 2019
4930fbb
rebase
Jul 11, 2019
1ec908a
rebase
Jul 11, 2019
ebfd8f4
modify autocomplete to pull function from reference
Jul 11, 2019
fc1edd4
fix indentation
Jul 11, 2019
020f738
Infinite loop detector
jasondkiesling Jul 14, 2019
552c312
Error for !=
jasondkiesling Jul 14, 2019
784e4a2
Fix !=
jasondkiesling Jul 14, 2019
6ca74c0
Catch firebase image errors
jasondkiesling Jul 14, 2019
c7e0eaf
Remove name and ID from settings for existing scenes
jasondkiesling Jul 14, 2019
d22732c
v1.6.0
jasondkiesling Jul 15, 2019
cdaddc1
Merge branch 'dev' of https://github.com/engaging-computing/MYR into …
samuel-zuk Jul 16, 2019
8d88c31
Merge branch 'dev' of https://github.com/engaging-computing/MYR into …
samuel-zuk Aug 5, 2019
a4bc33f
working filter buttons
samuel-zuk Aug 9, 2019
44f1d7e
revised style of buttons
samuel-zuk Aug 12, 2019
33e5899
reset package.json, got rid of string concatenation warning
samuel-zuk Aug 12, 2019
2056cc0
v1.6.1
jasondkiesling Aug 16, 2019
79f232d
Fix classoom bug
jasondkiesling Aug 16, 2019
ca8ab5c
Fix lint issue
jasondkiesling Aug 16, 2019
28ceb79
course select modal filtering functionality added
samuel-zuk Aug 16, 2019
a9ddb49
Fixed button functionality, made modal not extend past viewport heigh…
samuel-zuk Aug 16, 2019
e1d49db
Reset package.json
samuel-zuk Aug 16, 2019
6cdaccd
Merge branch 'dev' of https://github.com/engaging-computing/MYR into …
samuel-zuk Aug 16, 2019
42ba5de
Merge branch 'courses-redesign' of github.com:samuel-zuk/MYR into cou…
samuel-zuk Aug 16, 2019
a466111
Should have fixed broken previews
jSwanson99 Aug 19, 2019
b4ea0e9
v1.6.1
jasondkiesling Aug 20, 2019
d925756
Merge branch 'dev' of https://github.com/engaging-computing/MYR into …
samuel-zuk Aug 20, 2019
d25deeb
Merge branch 'dev' of https://github.com/engaging-computing/MYR into …
samuel-zuk Aug 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 164 additions & 11 deletions src/components/courses/CourseSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import React, { Component } from "react";

import {
ButtonBase,
Button,
Card,
CardContent,
IconButton,
Icon,
Modal,
Tooltip
Tooltip,
Typography,
Grid,
} from "@material-ui/core";

import { withStyles } from "@material-ui/core/styles";
Expand Down Expand Up @@ -45,17 +48,47 @@ const modelStyles = theme => ({
class CourseSelectModal extends Component {
constructor(props) {
super(props);
this.difficulties = ["beginner", "intermediate", "advanced", "expert"];
this.categories = ["geometry", "transformations", "animations", "groups", "firstTimer", "teachers", "misc"];
this.state = {
// open: false
difficultyFilter : {},
categoryFilter : {},
};
for(let i in this.difficulties) {
this.state.difficultyFilter[this.difficulties[i]] = true;
}
for(let i in this.categories) {
this.state.categoryFilter[this.categories[i]] = true;
}
}

convertCamelCase = (text) => {
//converts camelCase difficulty/category filters keys into Mixed Case button labels
if (typeof(text) === "string") {
return text.charAt(0).toUpperCase() + text.replace(/([A-Z]){1}/g, " $1").slice(1);
}
else {
return text;
}
}

helper = (course) => {
if (course) {
let anyCategorySelected = (arr) => {
let hasBeenSelected = false;
for(let i = 0; i < arr.length; i++) {
if (this.state.categoryFilter[arr[i]]) {
hasBeenSelected = true;
}
}
return hasBeenSelected;
};
if (course && this.state.difficultyFilter[this.difficulties[course.difficulty]] && anyCategorySelected(course.categories)) {
let id = course._id;
let shortname = course.shortname;
let name = course.name;
let description = course.description;
let difficulty = this.convertCamelCase(this.difficulties[course.difficulty]);
let categories = course.categories.length > 0 ? course.categories.map(this.convertCamelCase).join(", ") : "None";
let link = "/course/" + shortname;
return (
<div key={id} id={id} title={name}
Expand All @@ -68,7 +101,15 @@ class CourseSelectModal extends Component {
<Card>
<CardContent>
<h4>{name}</h4>
<p>{description}</p>
<Typography variant="caption" display="block" gutterBottom>
Difficulty : {difficulty}
</Typography>
<Typography variant="caption" display="block" gutterBottom>
Categories : {categories}
</Typography>
<Typography variant="body1" gutterBottom>
{description}
</Typography>
</CardContent>
</Card>
</a>
Expand All @@ -80,7 +121,61 @@ class CourseSelectModal extends Component {
}
}

// Render all of the elements
setFilterValue = (val, key, type) => {
//console.log(val + key + type);
if (type === "difficulty") {
let newState = this.state;
newState.difficultyFilter[key] = val;
this.setState(newState);
}
else if (type === "category") {
let newState = this.state;
newState.categoryFilter[key] = val;
this.setState(newState);
}
}

setAllFilters = (value, type) => {
switch(type){
case "difficulty":
for(let i in this.difficulties) {
this.setFilterValue(value , this.difficulties[i], "difficulty");
}
break;
case "category":
for(let i in this.categories) {
this.setFilterValue(value , this.categories[i], "category");
}
break;
default:
}
}

filterHelper = (key, type) => {
if (key) {
//converts camelCase difficulty/category filters keys into Mixed Case button labels
let buttonText = this.convertCamelCase(key);
let filter;
if (type === "difficulty") {
filter = this.state.difficultyFilter;
}
else if (type === "category") {
filter = this.state.categoryFilter;
}
return(
<Button
variant={filter[key] ? "contained" : "outlined"}
onClick={() => { this.setFilterValue(!filter[key], key, type); }}
size="small">
{buttonText}
</Button>
);
}
else {
return null;
}
}

render() {
const { classes } = this.props;
const courses = [].concat(this.props.courses);
Expand Down Expand Up @@ -115,13 +210,71 @@ class CourseSelectModal extends Component {
<Icon className="material-icons">clear</Icon>
</ButtonBase >
<h3 className="col-12 p-0 mb-3 border-bottom">Available Courses</h3>
<div id="filters" className="border-bottom">
<h5>Difficulty: </h5>
<Grid container spacing={3}>
<Grid item xs={8}>
<div>
{
this.difficulties.map(i => { return this.filterHelper(i, "difficulty"); })
}
</div>
</Grid>
<Grid item xs={4}>
<Button
onClick={() => { this.setAllFilters(true, "difficulty"); }}
size="small">
Select All
</Button>
<Button
onClick={() => { this.setAllFilters(false, "difficulty"); }}

size="small">
Deselect All
</Button>
</Grid>
</Grid>
<br></br>
<Grid container spacing={3}>
<Grid item xs={8}>
<h5>Categories: </h5>
</Grid>
</Grid>
<Grid container spacing={3}>
<Grid item xs={8}>
<div>
{
this.categories.map(i => { return this.filterHelper(i, "category"); })
}
</div>
</Grid>
<Grid item xs={4}>
<Button
onClick={() => { this.setAllFilters(true, "category"); }}
size="small">
Select All
</Button>
<Button
onClick={() => { this.setAllFilters(false, "category"); }}
size="small">
Deselect All
</Button>
</Grid>
</Grid>
<br></br>
</div>
<br></br>
<div className="row" id="courses">
{ // Sort the users projects in alphabetical order
courses.sort(function (a, b) {
return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
}).map(course => {
return this.helper(course);
})
{ // Sort the users projects in alphabetical order
courses.length !== 0 ?
() => {
return courses.sort(function (a, b) {
return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
}).map(course => {
return this.helper(course);
});
} :
() => { return (<Typography variant="caption" display="block" gutterBottom>No Courses Found</Typography>); }
}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/css/CourseSelect.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}

div#courses {
max-height: 70vh;
max-height: 60vh;
overflow: auto;
}

Expand Down