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

Frontend refactor: typescript added, updated packages, directory structure and functional components #55

Merged
merged 15 commits into from
Jun 9, 2024
Merged
8 changes: 4 additions & 4 deletions first-year-scraper/generate_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def format_cell(original_value):
return [x for sub in original_value.split("\n") for j in sub.split(" ") for x in j.split(",") if x]

def generate_schedule(valid_sheets, workbook, subjects_dict):
with open("../frontend/src/schedule.json", "r") as json_data:
with open("../frontend/src/data/schedule.json", "r") as json_data:
schedule_dict = json.load(json_data)
with open("../frontend/src/empty_schedule.json", "r") as json_data:
with open("../frontend/src/data/empty_schedule.json", "r") as json_data:
empty_schedule_dict = json.load(json_data)

for sheet in valid_sheets:
Expand All @@ -42,10 +42,10 @@ def generate_schedule(valid_sheets, workbook, subjects_dict):
if(room in empty_schedule_dict[i][j]):
empty_schedule_dict[i][j].remove(room)

with open("../frontend/src/schedule.json", "w") as outfile:
with open("../frontend/src/data/schedule.json", "w") as outfile:
json.dump(schedule_dict, outfile, indent=2)

with open("../frontend/src/empty_schedule.json", "w") as outfile:
with open("../frontend/src/data/empty_schedule.json", "w") as outfile:
json.dump(empty_schedule_dict, outfile, indent=2)


Expand Down
4 changes: 2 additions & 2 deletions first-year-scraper/generate_subjectDetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def generate_subjectDetails():
get_cell_value(5, i+4).upper()+" TUTORIAL",
]

with open("../frontend/src/subjectDetails.json", "r") as json_data:
with open("../frontend/src/data/subjectDetails.json", "r") as json_data:
subject_details = json.load(json_data)

for key in subjects_dict.keys():
subject_details[subjects_dict[key][0]] = subjects_dict[key][1]

with open("../frontend/src/subjectDetails.json", "w") as outfile:
with open("../frontend/src/data/subjectDetails.json", "w") as outfile:
json.dump(subject_details, outfile, indent=2)

return subjects_dict
Expand Down
32 changes: 25 additions & 7 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
"dependencies": {
"lodash.chunk": "^4.2.0",
"lodash.intersection": "^4.4.0",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-bootstrap": "^0.32.4",
"react-dom": "^16.13.1",
"react-scripts": "^1.1.1",
"react-table": "^6.7.6",
"react": "^18.2.0",
"react-bootstrap": "^2.9.1",
"react-dom": "^18.2.0",
"react-scripts": "^5.0.1",
"react-table": "^7.8.0",
"save-dev": "0.0.1-security"
},
"scripts": {
Expand All @@ -24,6 +23,25 @@
"heroku-prebuild": "npm install -g serve"
},
"devDependencies": {
"gh-pages": "^3.1.0"
"@types/lodash.chunk": "^4.2.9",
"@types/lodash.intersection": "^4.4.9",
"@types/jest": "^29.5.10",
"@types/node": "^20.10.0",
"@types/react": "^18.2.38",
"@types/react-dom": "^18.2.17",
"gh-pages": "^3.1.0",
"typescript": "^5.3.2"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Loading