Skip to content

Allow user to configure light/dark mode in setting; cache accepted terms - #87

Open
nllong wants to merge 1 commit into
mainfrom
light-mode-in-settings
Open

Allow user to configure light/dark mode in setting; cache accepted terms#87
nllong wants to merge 1 commit into
mainfrom
light-mode-in-settings

Conversation

@nllong

@nllong nllong commented Aug 27, 2026

Copy link
Copy Markdown
Member

No description provided.

import { TermsService } from './terms.service'

const ACCEPTED_AT_KEY = 'nlrTermsAcceptedAt'
const ACCEPTANCE_DAYS = 90

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

keep accepted terms for 90 days

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds user-facing controls for display preferences and reduces repeated Terms-of-Service prompts by caching acceptance on the client. This fits into the profile/auth experience by persisting a user’s preferred light/dark scheme and streamlining sign-in when terms were recently accepted.

Changes:

  • Added a new Profile “Display” page to choose light/dark mode and persist the selection to org-user settings.
  • Hydrated the app-wide theme scheme from the signed-in user’s persisted setting at layout startup.
  • Cached NLR Terms acceptance in localStorage (90-day window) and updated sign-in UX + added unit tests.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/app/modules/profile/settings/settings.component.ts New component to persist a selected scheme to org-user settings and update ConfigService.
src/app/modules/profile/settings/settings.component.html New UI for selecting light/dark via a button-toggle group.
src/app/modules/profile/settings/settings.component.spec.ts Unit tests for persisting scheme changes and rollback behavior.
src/app/modules/profile/profile.routes.ts Adds /profile/display route for the new settings page.
src/app/modules/profile/profile.component.ts Adds “Display” to profile tabs/navigation.
src/app/layout/layout.component.ts Sets initial scheme from currentUser.settings.colorScheme.
src/app/layout/common/user/user.component.ts Adds navigation handler to open display settings.
src/app/layout/common/user/user.component.html Wires the Settings menu item to navigate to /profile/display.
src/app/modules/auth/sign-in/sign-in.component.ts Initializes terms checkbox based on cached acceptance and records acceptance on successful sign-in.
src/app/modules/auth/sign-in/sign-in.component.html Shows an “already accepted” state and hides the checkbox when cached acceptance is valid.
src/@seed/services/terms/terms.service.ts Adds localStorage-backed acceptance caching with a 90-day expiry.
src/@seed/services/terms/terms.service.spec.ts Unit tests for acceptance recording and expiry logic.
src/@seed/api/organization/organization.types.ts Extends org-user settings type with optional colorScheme.
MIGRATION.md Updates migration snapshot/status narrative (appears unrelated to stated PR purpose).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +9 to +23
<mat-button-toggle-group
class="border-button-toggle-group flex w-full"
[disabled]="saving"
[value]="scheme"
aria-label="Color scheme"
>
<mat-button-toggle class="flex-1" (click)="setScheme('light')" value="light">
<mat-icon class="mr-2 icon-size-5" svgIcon="heroicons-solid:sun"></mat-icon>
Light
</mat-button-toggle>
<mat-button-toggle class="flex-1" (click)="setScheme('dark')" value="dark">
<mat-icon class="mr-2 icon-size-5" svgIcon="heroicons-solid:moon"></mat-icon>
Dark
</mat-button-toggle>
</mat-button-toggle-group>
Comment on lines +3 to +6
<h2 class="mb-6 flex items-center text-center text-2xl">
<mat-icon class="mr-2 text-primary-900 dark:text-primary-300" svgIcon="fa-solid:gear"></mat-icon>
Display
</h2>
Comment on lines +46 to +47
setScheme(scheme: ColorScheme): void {
if (this.saving || this.currentUser.settings.colorScheme === scheme) return
Comment on lines +4 to +6
const NLR_TERMS_ACCEPTED_AT_KEY = 'nlrTermsAcceptedAt'
const NLR_TERMS_ACCEPTANCE_DAYS = 90
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000
Comment thread MIGRATION.md
Comment on lines +180 to +183
Snapshot refreshed **2026-08-27 09:58 MDT** from the legacy route/template inventory, current GitHub
PR metadata, and refreshed branch refs. Local remote-tracking refs match the current core
`develop` and Angular `main` heads;
shared fragments and modal HTML remain counted under their owning page rather than as separate pages.
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.

2 participants