Add prayertimes.dev landing page with CYD screen preview and PR preview build workflow#34
Conversation
…or numeric sensors
…eck, smart threshold step Co-authored-by: element-software <81567707+element-software@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…redundant if-check; 15 tests pass Co-authored-by: element-software <81567707+element-software@users.noreply.github.com>
…-thresholds Add threshold-based icon switching and dynamic threshold management for numeric sensors
Co-authored-by: element-software <81567707+element-software@users.noreply.github.com>
…preview Co-authored-by: element-software <81567707+element-software@users.noreply.github.com>
|
@copilot why did this not have a preview vercel deployment? |
The repository doesn't have Vercel set up — it deploys to GitHub Pages via the To get PR preview deployments you'd need to either:
Let me know which approach you'd prefer and I can set it up. |
There was a problem hiding this comment.
Pull request overview
Adds a new /prayertimes landing page to the config-generator site, showcasing a prayer-times themed CYD screen preview (clock/date/countdown ring/next prayer) and linking users between prayertimes.dev and the existing config generator.
Changes:
- Added new
/prayertimespage with metadata, hero, explainer sections, and CTA back to the config generator. - Introduced
CydPrayerTimesScreen+CydPrayerTimesDevicePreviewto render the mockup-style screen inside the CYD frame. - Linked the new page from both
SiteHeaderandSiteFooternavigation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| config-generator/components/SiteHeader.tsx | Adds “Prayer Times” to the main nav. |
| config-generator/components/SiteFooter.tsx | Adds “Prayer Times” to footer links. |
| config-generator/components/CydPrayerTimesScreen.tsx | New client component rendering the prayer-times screen UI (clock/date/ring/next prayer). |
| config-generator/components/CydPrayerTimesDevicePreview.tsx | Wraps the prayer-times screen inside the existing CYD device-frame layout. |
| config-generator/app/prayertimes/page.tsx | New landing page with copy + live device preview and CTAs. |
| countdown: scale(30), | ||
| countdownSub: scale(11), |
There was a problem hiding this comment.
FONT.countdown and FONT.countdownSub are defined but never used. Either remove these constants to avoid dead code, or wire them into the SVG text styling so the scaling stays consistent with the rest of the screen.
| countdown: scale(30), | |
| countdownSub: scale(11), |
| bottom: '27%', | ||
| left: '24%', | ||
| }} | ||
| aria-label="Prayer times display preview" |
There was a problem hiding this comment.
The screen-preview container is exposed to assistive tech via aria-label, which means screen readers may traverse a live-updating, purely decorative preview (time updates every second). In CydDevicePreview the equivalent container is aria-hidden; consider matching that here (or alternatively give the preview a clear semantic role and ensure its dynamic content doesn’t create noise for AT users).
| aria-label="Prayer times display preview" | |
| aria-hidden="true" |
| function formatTime(date: Date): { time: string; ampm: string } { | ||
| const h = date.getHours(); | ||
| const m = date.getMinutes().toString().padStart(2, '0'); | ||
| const ampm = h >= 12 ? 'PM' : 'AM'; | ||
| const hour = h % 12 || 12; | ||
| return { time: `${hour}:${m}`, ampm }; | ||
| } |
There was a problem hiding this comment.
formatTime produces hours without a leading zero (e.g., 1:05), but the PR description calls for an hh:mm AM/PM display. Consider formatting with a 2-digit hour (e.g., padStart on the hour or use toLocaleTimeString with { hour: '2-digit', minute: '2-digit', hour12: true }).
| const cy = 38; | ||
| const viewSize = 76; | ||
| const circumference = 2 * Math.PI * r; | ||
| const progress = Math.min(1, Math.max(0, minutes / total)); |
There was a problem hiding this comment.
progress is calculated as minutes / total without guarding total. If total is 0 (or negative), this will produce Infinity/NaN and break the SVG ring rendering. Add a defensive check (e.g., treat non-positive totals as 0 progress) before computing dashoffset.
| const progress = Math.min(1, Math.max(0, minutes / total)); | |
| const progress = | |
| total > 0 ? Math.min(1, Math.max(0, minutes / total)) : 0; |
|
add a second workflow that builds the static export on PRs and deploys to a separate Pages environment or uploads the out/ folder as a workflow artifact (accessible via the Actions tab). @copilot |
Co-authored-by: element-software <81567707+element-software@users.noreply.github.com>
Done in commit
On subsequent pushes to the same PR the comment is updated in-place rather than creating duplicates. |
|
Nice work @copilot, how cna I trigger that work flow on this pr? |
…_number input Co-authored-by: element-software <81567707+element-software@users.noreply.github.com>
Since the workflow file was introduced in this PR (not yet on
Once this PR is merged to |
🔍 PR Preview BuildThe static export has been built and uploaded as a workflow artifact. Download preview artifact — expand Artifacts at the bottom of the run page to download
|
|
that's great, but i need a preview URL, not the build output. @copilot |
…artifact fallback, teardown on PR close Co-authored-by: element-software <81567707+element-software@users.noreply.github.com>
Updated in commit One-time setup to enable live preview URLs:
Once that's done, every push to a PR will:
Without |
|
@copilot does Github not support preview deployments? I don't want to use a third party. |
GitHub doesn't natively support per-PR preview hosting. GitHub Pages only serves a single site from one configured branch/folder — each deploy replaces the previous one, so there's no built-in "isolated URL per PR" feature. The closest GitHub-only option is deploying each PR preview to a subdirectory of the existing Pages site (e.g. Platforms that do offer this natively with GitHub integration (no manual setup):
If you'd like the GitHub Pages subdirectory approach, let me know and I'll update the workflow. Otherwise, connecting one of the platforms above to the repo would give you automatic previews with no workflow changes needed. |
|
@copilot Remove the surge.sh implementation and the work flow update. |
No
/prayertimespage existed in the config-generator site. Adds a dedicated landing page matching the mockup screen layout — live clock, Gregorian date, gold SVG countdown ring, and next prayer name/time — rendered inside the standard CYD device frame.New components
CydPrayerTimesScreen— dark-background screen matching the mockup: livehh:mm AM/PMclock,dd/mm/yyyyGregorian date, SVG arc ring (gold stroke, 30-min preview, "Next prayer" label), andAsr 3:15 PMprayer footer. Uses the samecqminscaling asCydClock/CydScreenGrid.CydPrayerTimesDevicePreview— thin wrapper placing the screen into the existing CYD device frame (mirrorsCydDevicePreviewlayout).New page —
/prayertimesNavigation
SiteHeadernav links andSiteFooterlink list.PR preview build workflow —
.github/workflows/pr-preview.ymlmainworkflow_dispatchwith an optionalpr_numberinput — useful for running the workflow on the PR that first introduced the file (before it exists onmain)SURGE_TOKENrepository secret is configured, deploys tohttps://cyd-esphome-pr-{n}.surge.shvia Surge.sh and posts the clickable URL as a PR comment (updated on every push; preview is torn down automatically when the PR is closed/merged)SURGE_TOKENis not set, uploadsconfig-generator/out/as a downloadable workflow artifact namedpr-preview-{PR number}(7-day retention) and posts a comment with a download linkTo enable live preview URLs: create a free Surge.sh account, run
npx surge token, and add the token as a repository secret namedSURGE_TOKEN.Screen preview
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.