Allow user to configure light/dark mode in setting; cache accepted terms - #87
Open
nllong wants to merge 1 commit into
Open
Allow user to configure light/dark mode in setting; cache accepted terms#87nllong wants to merge 1 commit into
nllong wants to merge 1 commit into
Conversation
…d terms for 90 days
nllong
commented
Aug 27, 2026
| import { TermsService } from './terms.service' | ||
|
|
||
| const ACCEPTED_AT_KEY = 'nlrTermsAcceptedAt' | ||
| const ACCEPTANCE_DAYS = 90 |
Member
Author
There was a problem hiding this comment.
keep accepted terms for 90 days
Contributor
There was a problem hiding this comment.
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 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.