Skip to content

Theme API, logo & layout fixes, compatibility fixes - #2

Open
Hazeyuh wants to merge 4 commits into
Zyzzyva0381:mainfrom
Hazeyuh:main
Open

Hazeyuh wants to merge 4 commits into
Zyzzyva0381:mainfrom
Hazeyuh:main

Conversation

@Hazeyuh

@Hazeyuh Hazeyuh commented Mar 20, 2026

Copy link
Copy Markdown

显示调整

  • 文本不会超出边框
  • 下方按键自动排列,可适应窄一些的屏幕

按键调整

  • 中间计时模块有暂停和继续按钮;右模块减少为三按钮,并减少歧义
图片

分辨率测试

在常见分辨率条件下均能正常显示;
在非16:9分辨率时,计时圆盘可能不与文字对齐,有一点点不美观
图片
图片
图片
图片
图片

颜色设置在index.html的开头root部分

d49ea3c59a0609cd3a10b5bbd8cc9625

目前颜色是因为还没有好的配色想法所以先用黑白了

p.s. 刚才写的pull request被刷新掉了所以重写:(

Copilot AI review requested due to automatic review settings March 20, 2026 13:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the timer page UI/theme system and refactors the timing logic to improve layout responsiveness, reduce button ambiguity, and introduce a more explicit pause/resume flow.

Changes:

  • Added a “Theme Embed API” via expanded :root CSS variables and refreshed layout/styling for title/timer/manual panels.
  • Refactored the timer implementation to a timestamp-based state machine (IDLE/RUNNING/PAUSED), removed eval, and added a unified loadStage() helper.
  • Updated UI structure: added corner logo placement, title edit button, and reorganized controls (including a central pause/resume button and simplified right panel buttons).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
title.js Updates the default title text exposed via window.APP_TITLE_TEXT.
index.html Major UI/CSS overhaul + timer engine refactor (state machine, pause/resume, stage loader, ResizeObserver-based text fitting).

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

Comment thread index.html
Comment on lines +1008 to +1018
function togglePauseState() {
if (state === 'RUNNING') {
var now = Date.now();
pausedTimeLeft = Math.ceil((endTime - now) / 1000);
if (pausedTimeLeft < 0) pausedTimeLeft = 0;
state = 'PAUSED';
clearInterval(intervalId);
} else if (state === 'PAUSED' || state === 'IDLE') {
if (state === 'IDLE' && pausedTimeLeft <= 0) return; // 无剩余时间不可继续
endTime = Date.now() + pausedTimeLeft * 1000;
state = 'RUNNING';

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

#time-pause-btn is labeled “开始” when state === 'IDLE', but togglePauseState() returns early in that state when pausedTimeLeft <= 0, so the button does nothing on initial load and typically does nothing after a timer finishes. Also, because pausedTimeLeft isn’t reset on startTimer()/finish, clicking “开始” in IDLE can resume a stale leftover from a previous pause. Consider making IDLE-click restart the current stage (e.g., startTimer(currentStageDuration)), and reset pausedTimeLeft on new starts and when reaching 0.

Copilot uses AI. Check for mistakes.
Comment thread index.html
Comment on lines +961 to +970
function getDialStyle() {
return {
element: '',
textResponsive: 2,
seconds: {
gauge: {
thickness: 1,
bgColor: getCssVariable('--dial-gauge-bg') || "rgba(118,88,60,0.18)",
fgColor: getCssVariable('--dial-gauge-fg') || "#1e66d0"
},

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

The “theme API” defines --theme-dial-danger, but the countdown dial color will still switch to hard-coded #FF0000 under 10 seconds due to js/jquery.classycountdown.js logic. Since getDialStyle() always returns the normal --dial-gauge-fg, the final 10-second color is effectively not themeable. To keep theming consistent, override the knob fgColor after each update based on timeLeft (normal vs --theme-dial-danger), or adjust the plugin to use a configurable value instead of a literal.

Copilot uses AI. Check for mistakes.
Comment thread index.html
radial-gradient(circle at 85% 8%, var(--bg-grad-circle-5), var(--bg-grad-circle-0) 42%),
linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 46%, var(--bg-grad-3) 100%);
overflow-x: hidden;
overflow-y: hidden;

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

body { overflow-y: hidden; } combined with a fixed .app { height: calc(100vh - 20px); grid-template-rows: 20vh 60vh 20vh; } can make content inaccessible on short-height but wide screens (no scrolling possible, and the grid can clip). Consider allowing vertical scrolling by default (e.g., overflow-y: auto) and only hiding overflow for specific containers that must not scroll.

Suggested change
overflow-y: hidden;
overflow-y: auto;

Copilot uses AI. Check for mistakes.
Comment thread index.html
Comment on lines +783 to +785
<button id="recover">重置</button>
<button id="next" style="grid-column: span 2;">下一环节</button>
</div>

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

The style="grid-column: span 2;" inline style on the “下一环节” button makes layout harder to maintain alongside the rest of the CSS-driven grid rules. Consider moving this into a dedicated CSS selector/class (e.g., for #next) so layout stays centralized in the stylesheet.

Copilot uses AI. Check for mistakes.
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