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

Add system dark mode detection for Vue apps #11624 #11667

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

jacobtylerwalls
Copy link
Member

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Description of Change

A vue app no longer has to query for the system dark mode itself, and can depend on a user's persisted dark mode preference being hydrated (although a vue app's toggle will need to persist the choice, see example in archesproject/arches-lingo#91).

Issues Solved

Closes #11624

Checklist

  • I targeted one of these branches:
    • dev/8.0.x (under development): features, bugfixes not covered below
    • dev/7.6.x (main support): regressions, crashing bugs, security issues, major bugs in new features
    • dev/6.2.x (extended support): major security issues, data loss issues
  • I added a changelog in arches/releases
  • I submitted a PR to arches-docs (if appropriate)
  • Unit tests pass locally with my changes
  • I added tests that prove my fix is effective or that my feature works
  • My test fails on the target branch

Ticket Background

  • Sponsored by: Getty Conservation Institute

@@ -35,6 +35,16 @@
gtag('config', '{{app_settings.GOOGLE_ANALYTICS_TRACKING_ID}}');
</script>
{% endif %}
<script>
const darkModeToggleState = localStorage.getItem("arches-dark");
Copy link
Member Author

Choose a reason for hiding this comment

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

This class name is hard coded, because I don't see a way to read it dynamically from the DEFAULT_THEME js file. If project developers have a different use case, as a last resort, this template could be overridden.

Copy link
Contributor

@chrabyrd chrabyrd left a comment

Choose a reason for hiding this comment

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

looks good! Once the toggle lives outside of lingo we'll probably need to revisit this. I can imagine keying value in localStorage on the username as well -- unless we go with adding a row to the userprofile table -- so that there isn't odd behavior on shared computers.

@jacobtylerwalls jacobtylerwalls merged commit 3050821 into dev/8.0.x Dec 3, 2024
7 checks passed
@jacobtylerwalls
Copy link
Member Author

Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query browser setting for dark mode and provide it with base-root.htm
2 participants