Skip to content

Header/share UI refactor: add header status badge, tweak header styles and responsiveness - #102

Merged
alvin000009238 merged 2 commits into
devfrom
codex/reduce-header-height-for-better-ux
Mar 31, 2026
Merged

Header/share UI refactor: add header status badge, tweak header styles and responsiveness#102
alvin000009238 merged 2 commits into
devfrom
codex/reduce-header-height-for-better-ux

Conversation

@alvin000009238

Copy link
Copy Markdown
Owner

Motivation

  • Provide a consistent, accessible indicator for read-only shared views and simplify how the badge is rendered.
  • Improve header spacing, sizing and responsive behavior to avoid overflow and cramped layouts.

Description

  • Replace dynamic DOM insertion of a .share-indicator in checkSharedLink() with a dedicated static element span#headerStatusBadge that is set to textContent = '僅供檢視' when a share link is loaded.
  • Add .header-status-badge CSS and show it in read-only mode via body.read-only-mode .header-status-badge, remove the old .readonly-badge usage, and hide interactive buttons in read-only mode.
  • Multiple header/style tweaks across header.css, responsive.css, utilities.css, and compatibility.css to adjust paddings, icon/logo sizes, gaps, flex rules, theme button sizing, and small-screen behaviors to prevent overflow and improve truncation.
  • Update public/index.html to include the new header-status-badge element, add aria-label attributes to some header buttons for accessibility, and update the built asset filenames referenced for CSS/JS.

Testing

  • Ran a production frontend build with npm run build and the build completed successfully.
  • Executed the frontend unit tests with npm test and they passed.
  • Ran linter checks with npm run lint and no issues were reported.

Codex Task

Copilot AI review requested due to automatic review settings March 31, 2026 14:11
@alvin000009238
alvin000009238 merged commit 47a5035 into dev Mar 31, 2026
1 check passed
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

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

Refactors the “shared/read-only view” header indicator to use a static badge element and adjusts header styling/responsiveness to reduce overflow and improve small-screen layout.

Changes:

  • Replaced dynamic .share-indicator DOM insertion with a static #headerStatusBadge that gets populated in shared-link mode.
  • Added new .header-status-badge styling and removed the legacy .readonly-badge utility style.
  • Tweaked header sizing/layout and responsive rules (gaps, flex behavior, button sizing, small-screen truncation).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
public/index.html Adds the static header status badge element and improves button accessibility labels; updates built asset filenames.
frontend/styles/utilities.css Adjusts theme toggle sizing and removes the old .readonly-badge utility style.
frontend/styles/responsive.css Updates header/data-time-box behavior on smaller screens to reduce overflow and improve wrapping.
frontend/styles/header.css Adds styling for the new header status badge and adjusts header spacing/typography/truncation.
frontend/styles/compatibility.css Adjusts read-only-mode visibility rules (no longer hides .time-info).
frontend/share.js Populates the new #headerStatusBadge in shared-link (read-only) mode instead of injecting DOM.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/share.js
Comment on lines +167 to +168
const headerStatusBadge = document.getElementById('headerStatusBadge');
if (headerStatusBadge) headerStatusBadge.textContent = '僅供檢視';

Copilot AI Mar 31, 2026

Copy link

Choose a reason for hiding this comment

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

body.read-only-mode makes .header-status-badge visible immediately, but checkSharedLink() only sets headerStatusBadge.textContent after a successful fetch. During loading (and on 404/error before redirect) this can render a blank pill in the header. Set the badge text as soon as you enter read-only mode (before the fetch), or update the CSS to keep the badge hidden when it’s empty (e.g., :empty).

Copilot uses AI. Check for mistakes.
@alvin000009238
alvin000009238 deleted the codex/reduce-header-height-for-better-ux branch April 1, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants