This pull request adds a feature to redact grades for privacy reasons, and fixes a bug in finding the correct SPO data for each course. It also improves the layout and appearance of the grades and personal pages, and updates the translation files and the SPO parser script accordingly. The main changes are in the grades-utils.js, grades.jsx, and personal.jsx files, as well as the Grades.module.css and Personal.module.css files. The Spoiler component is a new element that hides the average grade until the user clicks on it. The combine_jsons.py script is modified to simplify and preserve the course names. The grades.json and personal.json files are updated to add or remove the relevant translation keys.
Sing, O Muse, of the skillful coder who changed the appWith many a line of CSS and JSX, and t function callsWho added the Spoiler component, hiding the grades from viewLike Zeus concealed his lightning bolts, or Athena her wisdom
Use an environment variable NEXT_PUBLIC_REDACT_GRADES to enable or disable the feature in grades-utils.js (link)
Replace all numeric grades with 1.0 if the feature is enabled in grades-utils.js (link)
Create a Spoiler component that hides its children until clicked in grades.jsx (link)
Use the Spoiler component to wrap the summary section of the grades page in grades.jsx (link)
Add CSS classes and transitions to create the visual effect of the spoiler component in Grades.module.css (link)
Add localized text for the spoiler component in grades.json for German and English (link, link)
Fix a bug that could cause incorrect calculations of the average or missing weightings due to multiple courses with the same name (link)
Use a filter to find all the courses with the same name and select the one with a defined weight or the first one as a fallback in grades-utils.js (link)
Improve the visual appearance and readability of the grades and pending lists (link, link, link, link, link, link)
Separate the grade from the details and make it more prominent in grades.jsx (link)
Simplify the heading of the pending list and make the text smaller in grades.jsx (link, link)
Use a CSS variable --gray for the text color of the details and the disclaimer in Grades.module.css (link, link)
Add some padding to the container and the bottom of the average in Grades.module.css (link, link)
Simplify the interface and remove redundant information from the personal page (link, link, link, link, link, link)
Remove the unused import, state variable, function call, and JSX elements related to the grade average in personal.jsx (link, link, link, link)
Remove the unused translation for the grade average in personal.json for German and English (link, link)
Improve the visual appearance and alignment of the links to external services on the personal page (link, link, link, link)
Add a className attribute with a value of styles.interaction_row to each ListGroup.Item component in personal.jsx (link, link, link)
Define a flex layout with a row-reverse direction, a space-between justification, and a center alignment for the interaction_row class in Personal.module.css (link)
Create a helper function to simplify the names of the courses by removing irrelevant characters and words in combine_jsons.py (link, link)
Import the re module and define a regular expression simplifyName that matches non-alphanumeric characters and some words in combine_jsons.py (link)
Define a function simplify that uses the regular expression to remove those characters and words from a given name and convert it to lowercase in combine_jsons.py (link)
Call the simplify function on each entry in the JSON content and modify the name attribute accordingly in combine_jsons.py (link)
Ensure that the output file of the combine_jsons.py script preserves the non-ASCII characters in the JSON content (link)
Specify the encoding as utf-8 and the ensure_ascii option as False for the open and json.dump functions in combine_jsons.py (link)
Full
spo-grade-weights.json
for testing: spo-grade-weights.zip🤖 Generated by Copilot at e3c8dc2
Summary
🌐🎓🐛
This pull request adds a feature to redact grades for privacy reasons, and fixes a bug in finding the correct SPO data for each course. It also improves the layout and appearance of the grades and personal pages, and updates the translation files and the SPO parser script accordingly. The main changes are in the
grades-utils.js
,grades.jsx
, andpersonal.jsx
files, as well as theGrades.module.css
andPersonal.module.css
files. TheSpoiler
component is a new element that hides the average grade until the user clicks on it. Thecombine_jsons.py
script is modified to simplify and preserve the course names. Thegrades.json
andpersonal.json
files are updated to add or remove the relevant translation keys.Walkthrough
NEXT_PUBLIC_REDACT_GRADES
to enable or disable the feature ingrades-utils.js
(link)1.0
if the feature is enabled ingrades-utils.js
(link)Spoiler
component that hides its children until clicked ingrades.jsx
(link)Spoiler
component to wrap the summary section of the grades page ingrades.jsx
(link)Grades.module.css
(link)grades.json
for German and English (link, link)grades-utils.js
(link)grades.jsx
(link)grades.jsx
(link, link)--gray
for the text color of the details and the disclaimer inGrades.module.css
(link, link)Grades.module.css
(link, link)personal.jsx
(link, link, link, link)personal.json
for German and English (link, link)className
attribute with a value ofstyles.interaction_row
to eachListGroup.Item
component inpersonal.jsx
(link, link, link)flex
layout with a row-reverse direction, a space-between justification, and a center alignment for theinteraction_row
class inPersonal.module.css
(link)combine_jsons.py
(link, link)re
module and define a regular expressionsimplifyName
that matches non-alphanumeric characters and some words incombine_jsons.py
(link)simplify
that uses the regular expression to remove those characters and words from a given name and convert it to lowercase incombine_jsons.py
(link)simplify
function on each entry in the JSON content and modify thename
attribute accordingly incombine_jsons.py
(link)combine_jsons.py
script preserves the non-ASCII characters in the JSON content (link)utf-8
and theensure_ascii
option asFalse
for theopen
andjson.dump
functions incombine_jsons.py
(link)