-
Notifications
You must be signed in to change notification settings - Fork 0
DATASHARE-134: FE: Mobile/Tablet Homepage: Latest Updates #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.2.0
Are you sure you want to change the base?
Changes from all commits
4f3a90d
e131a6e
83e16aa
e803361
681365c
ee19bc9
3efebc2
b2539d4
6f51af2
e48bc5e
6de44fc
124dcf1
9b7e734
80dfff8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,11 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| "use client"; | ||||||||||||||||||||||||||||||||||||||||||||||
| import React from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||
| import React, { useRef, useState, useCallback, useEffect } from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||
| import Image from "next/image"; | ||||||||||||||||||||||||||||||||||||||||||||||
| import UpdateCard from "./UpdateCard"; | ||||||||||||||||||||||||||||||||||||||||||||||
| import startIcon from '../../../../assets/icons/Start_Icon.svg' | ||||||||||||||||||||||||||||||||||||||||||||||
| import pauseIcon from '../../../../assets/icons/Pause_Icon.svg' | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| const AUTO_ROTATE_INTERVAL_MS = 5000; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| export interface GalleryUpdate { | ||||||||||||||||||||||||||||||||||||||||||||||
| image: string; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -19,27 +24,183 @@ export interface GalleryConfig { | |||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| interface GalleryProps { | ||||||||||||||||||||||||||||||||||||||||||||||
| data: { gallery: GalleryConfig}; | ||||||||||||||||||||||||||||||||||||||||||||||
| data: { gallery: GalleryConfig }; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| const CARD_WIDTH_MOBILE = 214; | ||||||||||||||||||||||||||||||||||||||||||||||
| const CARD_GAP_MOBILE = 28; | ||||||||||||||||||||||||||||||||||||||||||||||
| const SLIDE_STEP = CARD_WIDTH_MOBILE + CARD_GAP_MOBILE; // 242 | ||||||||||||||||||||||||||||||||||||||||||||||
| const MOBILE_VIEWPORT_OFFSET = -SLIDE_STEP; // -242: show indices 1,2,3 | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| /** Build initial mobile list [c, a, b, c, a, b] from updates [a, b, c] so visible indices 1,2,3 show a,b,c */ | ||||||||||||||||||||||||||||||||||||||||||||||
| function buildMobileRotatingList(updates: GalleryUpdate[] | undefined): GalleryUpdate[] { | ||||||||||||||||||||||||||||||||||||||||||||||
| if (!updates || updates.length < 3) return []; | ||||||||||||||||||||||||||||||||||||||||||||||
| const [a, b, c] = updates; | ||||||||||||||||||||||||||||||||||||||||||||||
| return [c, a, b, c, a, b]; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+35
to
+39
|
||||||||||||||||||||||||||||||||||||||||||||||
| /** Build initial mobile list [c, a, b, c, a, b] from updates [a, b, c] so visible indices 1,2,3 show a,b,c */ | |
| function buildMobileRotatingList(updates: GalleryUpdate[] | undefined): GalleryUpdate[] { | |
| if (!updates || updates.length < 3) return []; | |
| const [a, b, c] = updates; | |
| return [c, a, b, c, a, b]; | |
| /** Build initial mobile list for the mobile carousel. | |
| * - For exactly 3 updates [a, b, c], return [c, a, b, c, a, b] so visible indices 1,2,3 show a,b,c. | |
| * - For fewer than 3 updates, return [] (not enough items to slide). | |
| * - For more than 3 updates, return the full list unchanged. | |
| */ | |
| function buildMobileRotatingList(updates: GalleryUpdate[] | undefined): GalleryUpdate[] { | |
| if (!updates || updates.length < 3) { | |
| return []; | |
| } | |
| if (updates.length === 3) { | |
| const [a, b, c] = updates; | |
| return [c, a, b, c, a, b]; | |
| } | |
| // For more than 3 updates, use the entire list without truncation. | |
| return updates; |
Copilot
AI
Mar 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slideTrackRef is declared but never read. With Next/TypeScript ESLint rules this is typically flagged as an unused variable and can fail CI; remove it (and the ref={...}) or use it (e.g., for imperative scrolling/measurement).
| const slideTrackRef = useRef<HTMLDivElement>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hover overlay is hidden via
opacity-0but still contains a focusable<a>; keyboard users can tab to an invisible link (andaria-hiddendoes not prevent focus). This is an accessibility issue. Consider disabling pointer events while hidden (e.g.,pointer-events-none+ enabling ongroup-hover/group-focus-within), and ensure the overlay can also be revealed on keyboard focus (not hover-only).