nusmods icon indicating copy to clipboard operation
nusmods copied to clipboard

Include colors and theme when sharing timetable

Open leslieyip02 opened this issue 2 years ago • 5 comments

Context

Resolves #3423 by allowing module colors and theme to be shared via URL.

Implementation

Module colorMapping and themeId are passed into the query parameters.

e.g.

modules = {
   CS2104: { Lecture: '1', Tutorial: '2' },
   CS2107: { Lecture: '1', Tutorial: '8' },
}

colors = {
   CS2104: 3,
   CS2107: 4,
}

themeId = 'monokai'

=> CS2104=LEC:1,TUT:2,COL:3&CS2107=LEC:1,TUT:8,COL:4&THEME=monokai

https://github.com/nusmodifications/nusmods/assets/90888680/5ef8e2a5-0cae-48dd-b695-87ddd258e3d5

leslieyip02 avatar Jul 27 '23 13:07 leslieyip02

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nusmods-export ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2023 3:48pm
nusmods-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2023 3:48pm

vercel[bot] avatar Jul 27 '23 13:07 vercel[bot]

@leslieyip02 is attempting to deploy a commit to a Personal Account owned by @nusmodifications on Vercel.

@nusmodifications first needs to authorize it.

vercel[bot] avatar Jul 27 '23 13:07 vercel[bot]

Codecov Report

Patch coverage: 63.15% and project coverage change: +0.04% :tada:

Comparison is base (b7c679e) 53.29% compared to head (484b1bc) 53.34%. Report is 37 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3467      +/-   ##
==========================================
+ Coverage   53.29%   53.34%   +0.04%     
==========================================
  Files         271      271              
  Lines        5850     5892      +42     
  Branches     1395     1406      +11     
==========================================
+ Hits         3118     3143      +25     
- Misses       2732     2749      +17     
Files Changed Coverage Δ
website/src/actions/export.ts 11.11% <0.00%> (ø)
website/src/bootstrapping/matomo.ts 24.24% <0.00%> (ø)
website/src/entry/export/TimetableOnly.tsx 0.00% <0.00%> (ø)
website/src/reducers/timetables.ts 85.39% <ø> (ø)
website/src/serverless/handler.ts 0.00% <0.00%> (ø)
website/src/types/views.ts 100.00% <ø> (ø)
website/src/utils/error.ts 15.38% <0.00%> (ø)
website/src/utils/ical.ts 98.55% <ø> (ø)
...ebsite/src/views/components/SearchkitSearchBox.tsx 0.00% <0.00%> (ø)
...c/views/components/filters/DropdownListFilters.tsx 41.37% <0.00%> (ø)
... and 45 more

... and 1 file with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jul 27 '23 14:07 codecov[bot]

I wanted to implement undoing colors and theme imports, but it seems that the "UNDO" button in the notifications isn't working. I have opened a new issue for that: #3475.

leslieyip02 avatar Jul 31 '23 11:07 leslieyip02

I wanted to implement undoing colors and theme imports, but it seems that the "UNDO" button in the notifications isn't working. I have opened a new issue for that: #3475.

The issue has been resolved. Imported colors can be undone, but the theme does not become undone. I'm not sure why the theme is not stored in the history. I'm guessing it has something to do with this:

https://github.com/nusmodifications/nusmods/blob/8ebbf2fd7d3751a04069ddfd9b357cc6c4e1e180/website/src/views/timetable/TimetableContainer.tsx#L50

leslieyip02 avatar Aug 08 '23 15:08 leslieyip02