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

Unify css with bootstrap themes #4745

Merged
merged 53 commits into from
Jul 31, 2023
Merged

Unify css with bootstrap themes #4745

merged 53 commits into from
Jul 31, 2023

Conversation

jorg-vr
Copy link
Contributor

@jorg-vr jorg-vr commented Jun 8, 2023

This pull request removes the separate dark mode css file. It is replaced by the new bootstrap 5.3 css theming.

A new js theme picker is also added, supporting, darkmode, lightmode and system mode. This more general approach will allow more themes in the future.

There were a lot of css variable to overwrite, more so because every component has some own css variable.
I have thus not overwritten every possible variable, but started with the obvious ones and then did some visuals checks while walking through the application. I then updated those colors which stood out as odd.
This means I might have missed some variables that should be overwritten because the relevant bootstrap class is only used on one specific page. Please let me know if you find such an occurrence.

I was also disappointed that I had to write my own btn-danger and btn-success variant classes as the bootstrap instances did not support theming well.

Changes:

  • Rewrite js theme selection logic
  • Rename toggle_dark_mode to set_theme
  • Remove application_dark.scss
  • Use css variables instead of sass variables everywhere
  • Set correct variables for newly introduced bootstrap scss variables
  • d3 graphs now use theme colors instead of redefining them

New theme selector:
image
image

The preferred theme is now stored for the user

Other pages should be unchanged.

Closes #4711 as all changes are contained here

dependabot bot and others added 3 commits June 6, 2023 09:31
Bumps [bootstrap](https://github.com/twbs/bootstrap) and [@types/bootstrap](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/bootstrap). These dependencies needed to be updated together.

Updates `bootstrap` from 5.2.0 to 5.3.0
- [Release notes](https://github.com/twbs/bootstrap/releases)
- [Commits](twbs/bootstrap@v5.2.0...v5.3.0)

Updates `@types/bootstrap` from 5.2.4 to 5.2.6
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/bootstrap)

---
updated-dependencies:
- dependency-name: bootstrap
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: "@types/bootstrap"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
@jorg-vr jorg-vr self-assigned this Jun 8, 2023
@jorg-vr jorg-vr added the enhancement A change that isn't substantial enough to be called a feature label Jun 8, 2023
@jorg-vr jorg-vr requested a review from chvp July 7, 2023 11:30
@bmesuere bmesuere added the deploy naos Request a deployment on naos label Jul 12, 2023
@bmesuere bmesuere temporarily deployed to naos July 12, 2023 07:49 — with GitHub Actions Inactive
@github-actions github-actions bot removed the deploy naos Request a deployment on naos label Jul 12, 2023
Copy link
Member

@bmesuere bmesuere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 nice work. This removes a few scss hacks and unifies our variables to css.

Some remarks:

  • I would not add a theme menu in the main navigation bar and instead make it a sub menu in the current user menu.
  • The contrast of the selected option isn't great. The text should be white here (as is the case with the year selector on the signed in home page)
    image
  • I found it odd that the icon for auto displayed the current state. Maybe use https://pictogrammers.com/library/mdi/icon/theme-light-dark/ ?
  • Is there a reason why the icons are inlined?
  • The sign in page looks bad in dark mode due to the icons. Should we disable dark mode here?
  • Why do we store theme in the session? (I know you didn't change this, just asking the question) I would make it entirely client side (and thus use local storage) or store it in the database as a user setting. If we store it in the database, we could also add the option to the profile page.
  • The theme controller call should be excluded from being "stored". If you go to the sign in page, then switch themes and then sign in, you are redirected to /theme which doesn't exist.

app/assets/javascripts/components/theme_picker.ts Outdated Show resolved Hide resolved
app/assets/javascripts/state/Theme.ts Show resolved Hide resolved
app/assets/javascripts/components/theme_picker.ts Outdated Show resolved Hide resolved
app/assets/javascripts/components/theme_picker.ts Outdated Show resolved Hide resolved
app/assets/javascripts/heatmap.ts Outdated Show resolved Hide resolved
app/assets/stylesheets/components/themepicker.css.scss Outdated Show resolved Hide resolved
@jorg-vr jorg-vr requested a review from bmesuere July 13, 2023 14:09
Copy link
Member

@bmesuere bmesuere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • label for dark mode in menu
  • always light mode when not signed in

@jorg-vr jorg-vr merged commit d34955b into main Jul 31, 2023
11 of 13 checks passed
@jorg-vr jorg-vr deleted the enhance/update-color-modes branch July 31, 2023 08:49
@jorg-vr jorg-vr temporarily deployed to naos July 31, 2023 08:49 — with GitHub Actions Inactive
@jorg-vr jorg-vr temporarily deployed to production July 31, 2023 08:54 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A change that isn't substantial enough to be called a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants