Skip to content

Commit 14872ac

Browse files
Responsive filtering (#78)
* applied filters into the search function using flags in the model, will have to refine more in the filters, but this is great for the demo * wrote departments filter option * added check to make sure to not recommend courses the client has taken before * initial state good * departments go to model * trying to add filtering out courses with NULL fields as an implementable filter option, merging with main start as per teams request * merging into brain? --------- Co-authored-by: kexana <deotsts@gmail.com>
1 parent c64c6ee commit 14872ac

File tree

12 files changed

+269
-131
lines changed

12 files changed

+269
-131
lines changed

my-app/src/model.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@ export const model = {
1818
applyTranscriptFilter: true,
1919
eligibility: "weak", //the possible values for the string are: "weak"/"moderate"/"strong"
2020
applyLevelFilter: true,
21-
level: [], //the possible values for the array are: "PREPARATORY", "BASIC", "ADVANCED", "RESEARCH"
21+
level: ["PREPARATORY", "BASIC", "ADVANCED", "RESEARCH"], //the possible values for the array are: "PREPARATORY", "BASIC", "ADVANCED", "RESEARCH"
2222
applyLanguageFilter: true,
2323
language: "none", //the possible values for the string are: "none"/"english"/"swedish"/"both"
2424
applyLocationFilter:true,
2525
location: [], //the possible values for the array are: 'KTH Campus', 'KTH Kista', 'AlbaNova', 'KTH Flemingsberg', 'KTH Solna', 'KTH Södertälje', 'Handelshögskolan', 'KI Solna', 'Stockholms universitet', 'KONSTFACK'
2626
applyCreditsFilter:true,
2727
creditMin: 0,
2828
creditMax: 45,
29-
applyDepartmentFilter:false,
30-
department: []
29+
applyDepartmentFilter: true,
30+
department: ["EECS/Computational Science and Technology", "EECS/Theoretical Computer Science", "EECS/Electric Power and Energy Systems", "EECS/Network and Systems Engineering",
31+
"ITM/Learning in Engineering Sciences", "ITM/Industrial Economics and Management", "ITM/Energy Systems", "ITM/Integrated Product Development and Design", "ITM/SKD GRU",
32+
"SCI/Mathematics", "SCI/Applied Physics", "SCI/Mechanics", "SCI/Aeronautical and Vehicle Engineering",
33+
"ABE/Sustainability and Environmental Engineering", "ABE/Concrete Structures", "ABE/Structural Design & Bridges", "ABE/History of Science, Technology and Environment", ],
34+
applyRemoveNullCourses: false
3135
},
3236

3337
setUser(user) {
@@ -144,6 +148,11 @@ export const model = {
144148
this.filterOptions.eligibility = eligibility;
145149
},
146150

151+
updateDepartmentFilter(department) {
152+
console.log(department);
153+
this.filterOptions.department = department;
154+
},
155+
147156
//setters for the filter options
148157
setApplyTranscriptFilter(transcriptFilterState) {
149158
this.filterOptions.applyTranscriptFilter = transcriptFilterState;
@@ -160,9 +169,9 @@ export const model = {
160169
setApplyCreditsFilter(creditsFilterState) {
161170
this.filterOptions.applyCreditsFilter = creditsFilterState;
162171
},
163-
// setApplyDepartmentFilter(departmentFilterState) {
164-
// this.filterOptions.applyDepartmentFilter = departmentFilterState;
165-
// },
172+
setApplyDepartmentFilter(departmentFilterState) {
173+
this.filterOptions.applyDepartmentFilter = departmentFilterState;
174+
},
166175

167176
async getAverageRating(courseCode) {
168177
const reviews = await getReviewsForCourse(courseCode);

my-app/src/pages/App.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { model } from '/src/model.js';
1010
function MainAppLayout({ model }) {
1111
return (
1212
<div className="flex h-screen w-screen overflow-hidden">
13-
<FilterPresenter model={model} />
1413
<div className="flex-auto w-40% h-full bg-gradient-to-t from-[#4f3646] to-[#6747c0]">
1514
<SidebarPresenter model={model} />
1615
</div>
@@ -21,6 +20,7 @@ function MainAppLayout({ model }) {
2120
<div className="flex-auto border bg-[#121212] relative">
2221
<ListViewPresenter model={model} />
2322
</div>
23+
<FilterPresenter model={model} />
2424
</div>
2525
</div>
2626
);

0 commit comments

Comments
 (0)