Show read-only header badge for shared links and refine header/layout styles - #106
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements several UI refinements to the header and read-only mode, improving responsiveness and accessibility. Key changes include transitioning from manual DOM manipulation for the share indicator to a structured status badge, optimizing header spacing, and adding ARIA labels to interactive elements. A review comment suggests adding a CSS fallback for the color-mix() function to support older browser versions.
I am having trouble creating individual review comments. Click here to see my feedback.
frontend/styles/header.css (204)
The color-mix() CSS function has limited support in older browsers (e.g., Safari < 16.2, Firefox < 113). To ensure graceful degradation for users on these browsers, it's good practice to provide a fallback. A simple solid color from your theme can serve as a good fallback, ensuring the badge remains readable even if the appearance is slightly different.
background: var(--color-warning-muted); /* Fallback for older browsers */
background: color-mix(in srgb, var(--color-warning-muted) 40%, transparent);
There was a problem hiding this comment.
Pull request overview
Updates header/read-only styling to better support shared-link (read-only) views and consolidate related layout rules.
Changes:
- Adjusts
.time-infolayout in the header to a horizontal/centered presentation. - Hides
.time-labelviaheader.cssand removes now-redundant read-only overrides fromcompatibility.css.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| frontend/styles/header.css | Updates header time block layout and hides the time label. |
| frontend/styles/compatibility.css | Removes read-only-mode overrides for time label/info from legacy compatibility styles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
|
|
||
|
|
||
| .time-label { |
There was a problem hiding this comment.
.time-label is now permanently hidden (display: none) for all modes. Previously this label was only hidden in read-only mode / small screens, so this change likely removes the “資料更新時間” context for normal usage and leaves a hidden DOM node in the header. If the intent is to hide it only for shared links, scope the rule under body.read-only-mode; otherwise consider removing the label element (and any redundant responsive rule) to avoid dead markup/styles.
| .time-label { | |
| body.read-only-mode .time-label { |
| body.read-only-mode .data-time-box { | ||
| width: 100%; | ||
| justify-content: space-between; | ||
| } |
There was a problem hiding this comment.
compatibility.css still contains a .share-indicator rule, but the shared-link flow no longer creates/uses that element (no matches outside this file). Since this PR explicitly moves the read-only indicator into the header badge, removing the leftover .share-indicator styles would prevent unused/dead CSS from accumulating.
Motivation
share.jsand instead use an existing header badge element for simpler state updates.Description
frontend/share.jsto set the text of#headerStatusBadgeto僅供檢視when a shared link is loaded and keep the app in read-only mode instead of creating a new.share-indicatorelement..header-status-badgeelement topublic/index.htmlinside the title/subtitle area and wire it withid="headerStatusBadge"for accessible live updates.frontend/styles/header.css,frontend/styles/responsive.css,frontend/styles/compatibility.cssandfrontend/styles/utilities.cssto: tighten header paddings, update logo/icon sizes, enable truncation/ellipsis for title/subtitle, show/hide the status badge inbody.read-only-mode, and improve mobile wrapping and spacing..readonly-badgerule fromutilities.cssand consolidate the visual read-only indicator to the new.header-status-badgestyling.public/index.htmlto point to the new built filenames for CSS and the main JS module.Testing
npm run buildand the build completed successfully.npm run lintand it completed without errors.Codex Task