Skip to content

Commit 536ba20

Browse files
committed
Merge origin/leader with conflicts
2 parents de024be + 9d213f8 commit 536ba20

14 files changed

Lines changed: 66 additions & 94 deletions

File tree

.github/prompts/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Security and Performance: Ensure the refactored code is performant, especially f
2929

3030
**Code Quality and Maintainability:**
3131

32-
- **No Magic Numbers**: Hardcoded values should be defined as constants in a dedicated constants file (`lib/constants.ts` or similar). This improves readability and maintainability.
32+
- **No Magic Numbers**: Hardcoded values should be defined as constants. While shared constants should be placed in the `constants/` directory, highly module-specific constants (e.g., timing intervals or internal parameters used only within a single hook or component) should be defined at the top of the relevant file. This maintains locality and reduces global namespace clutter.
3333
- **Modularity and Single Responsibility**: Avoid creating overly long scripts or components. Break down large files like `gemini-client.ts` and `page.tsx` into smaller, reusable functions or components with a single responsibility.
3434
- **Shared Helper Functions**: Encourage the creation and use of shared helper functions for common tasks. Place these in the `utils` or `lib` directory.
3535
- **Testing**:

app/client/connect/page.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,18 @@ import {
2222
import throttle from 'lodash.throttle'
2323
import { HrmInputMessage } from '@/types/websocket'
2424
import logger from '@/utils/logger'
25-
import { useTestPageReady } from '@/hooks/useTestPageReady'
2625

2726
export default function ConnectPage() {
27+
const [isReady, setIsReady] = useState(false)
28+
useEffect(() => {
29+
const timer = setTimeout(() => setIsReady(true), 0)
30+
return () => clearTimeout(timer)
31+
}, [])
32+
2833
const [userSettings, setUserSettings] = useUserSettings()
2934
const { userName, userAge, userWeight, gender, unitSystem } = userSettings
3035

3136
const [currentHR, setCurrentHR] = useState(0)
32-
const isReady = useTestPageReady()
3337

3438
const [localDisplayWeight, setLocalDisplayWeight] = useState<string | null>(
3539
null

app/client/control/ControlPanel.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import Head from 'next/head'
1313
import { useEffect } from 'react'
1414
import { useWebSocket } from '@/context/WebSocketContext'
1515
import dynamic from 'next/dynamic'
16-
import { useTestPageReady } from '@/hooks/useTestPageReady'
1716

1817
const SpotifyControls = dynamic(() => import('./components/SpotifyControls'), {
1918
loading: () => (
@@ -28,7 +27,6 @@ import TimerControls from './components/TimerControls'
2827

2928
const ControlPanel = () => {
3029
const { connectionStatus, connect, sendData } = useWebSocket()
31-
const isReady = useTestPageReady()
3230

3331
// Register this client as a controller
3432
useEffect(() => {
@@ -68,7 +66,6 @@ const ControlPanel = () => {
6866
</Head>
6967
<Container
7068
data-testid="control-panel"
71-
data-ready={isReady ? 'true' : 'false'}
7269
maxWidth="xs"
7370
sx={{
7471
py: 1,

app/client/experimental/components/ExperimentalAnalyticsPage.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
} from '@/lib/workout-session-storage'
1414
import { HeartRateZone } from '@/lib/shared/hr-zones'
1515
import { calculateMaxHr } from '@/utils/hrCalculations'
16-
import { useTestPageReady } from '@/hooks/useTestPageReady'
1716

1817
// Components
1918
import WorkoutSummary from './WorkoutSummary'
@@ -41,7 +40,6 @@ type View = 'active' | 'list' | 'detail'
4140
const ExperimentalAnalyticsPage = () => {
4241
const { hrmData, sendData, connectionStatus } = useWebSocket()
4342
const [userSettings] = useUserSettings()
44-
const isReady = useTestPageReady()
4543

4644
// Use #5110's hooks
4745
const {
@@ -201,12 +199,7 @@ const ExperimentalAnalyticsPage = () => {
201199
const defaultDate = useMemo(() => new Date(), [])
202200

203201
return (
204-
<Container
205-
maxWidth="lg"
206-
sx={{ mt: 4, mb: 4 }}
207-
data-testid="dashboard"
208-
data-ready={isReady ? 'true' : 'false'}
209-
>
202+
<Container maxWidth="lg" sx={{ mt: 4, mb: 4 }} data-testid="dashboard">
210203
{view === 'active' && (
211204
<>
212205
<Box sx={{ mb: 3, display: 'flex', gap: 2 }}>

app/client/mock/page.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import Typography from '@mui/material/Typography'
1212
import { useCallback, useEffect, useState } from 'react'
1313
import BottomNavBar from '../../../components/BottomNavBar'
1414
import { useWebSocket } from '@/context/WebSocketContext'
15-
import { useTestPageReady } from '@/hooks/useTestPageReady'
1615
import {
1716
HrmInputMessage,
1817
HrmMetadataUpdateMessage,
@@ -28,7 +27,6 @@ export default function MockPage() {
2827
const [weight, setWeight] = useState(70) // Add weight state
2928
const [height, setHeight] = useState(175) // Add height state
3029
const [gender, setGender] = useState('female') // Add gender state
31-
const isReady = useTestPageReady()
3230
const [intervalId, setIntervalId] = useState<number | null>(null)
3331

3432
const isStreaming = intervalId !== null
@@ -127,11 +125,7 @@ export default function MockPage() {
127125

128126
return (
129127
<>
130-
<Container
131-
maxWidth="sm"
132-
sx={{ py: 3, pb: 10 }}
133-
data-ready={isReady ? 'true' : 'false'}
134-
>
128+
<Container maxWidth="sm" sx={{ py: 3, pb: 10 }}>
135129
<Card sx={{ p: 3, textAlign: 'center' }}>
136130
<Science color="primary" sx={{ fontSize: 60, mb: 2 }} />
137131
<Typography

app/client/spotify-selection/page.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import dynamic from 'next/dynamic'
1111
import { useState } from 'react'
1212
import { useWebSocket } from '@/context/WebSocketContext'
1313
import { useSpotifyCommand } from '@/hooks/useSpotifyCommand'
14-
import { useTestPageReady } from '@/hooks/useTestPageReady'
1514

1615
const PlaylistSelector = dynamic(
1716
() => import('../../../components/Spotify/PlaylistSelector'),
@@ -37,7 +36,6 @@ const SpotifySelectionPage = () => {
3736
const [selectedPlaylistId, setSelectedPlaylistId] = useState<string | null>(
3837
null
3938
)
40-
const isReady = useTestPageReady()
4139

4240
const handlePlaylistSelected = (uri: string) => {
4341
const playlistId = uri.split(':').pop()
@@ -49,11 +47,7 @@ const SpotifySelectionPage = () => {
4947
}
5048

5149
return (
52-
<Container
53-
maxWidth="sm"
54-
sx={{ py: 3 }}
55-
data-ready={isReady ? 'true' : 'false'}
56-
>
50+
<Container maxWidth="sm" sx={{ py: 3 }}>
5751
<Typography variant="h4" component="h1" gutterBottom align="center">
5852
Spotify Playlist Selector
5953
</Typography>

app/debug/spotify/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { Session } from 'next-auth'
88
import { signIn, signOut, useSession } from 'next-auth/react'
99
import { useEffect, useState } from 'react'
1010
import { API_DEBUG_SPOTIFY_TOKEN } from '@/constants/apiEndpoints'
11-
import { useTestPageReady } from '@/hooks/useTestPageReady'
1211

1312
interface ServerTokenStatus {
1413
status: string
@@ -25,7 +24,6 @@ interface ServerTokenStatus {
2524
export default function SpotifyDebugPage() {
2625
const { data: session } = useSession() as { data: Session | null }
2726
const [serverToken, setServerToken] = useState<ServerTokenStatus | null>(null)
28-
const isReady = useTestPageReady()
2927

3028
const fetchServerToken = async () => {
3129
const res = await fetch(API_DEBUG_SPOTIFY_TOKEN)
@@ -41,7 +39,7 @@ export default function SpotifyDebugPage() {
4139
}, [])
4240

4341
return (
44-
<Box sx={{ p: 2 }} data-ready={isReady ? 'true' : 'false'}>
42+
<Box sx={{ p: 2 }}>
4543
<Typography variant="h4" gutterBottom>
4644
Spotify Debug
4745
</Typography>

app/main.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ export default function Main({ children }: { children: React.ReactNode }) {
2626
<UserSettingsProvider>
2727
<TimerSoundProvider>
2828
<AnimatePresence mode="wait">
29-
<motion.div
29+
<motion.main
3030
key={pathname}
3131
variants={pageVariants}
3232
initial="initial"
3333
animate="in"
3434
exit="out"
3535
data-testid="main-content-layout"
36+
role="main"
3637
>
3738
{children}
38-
</motion.div>
39+
</motion.main>
3940
</AnimatePresence>
4041
</TimerSoundProvider>
4142
</UserSettingsProvider>

app/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { useState, useCallback } from 'react'
1313
import HrmConnectionPanel from '@/components/HrmConnectionPanel'
1414
import TimerDisplay from '@/components/TimerDisplay'
1515
import { useAudio } from '@/hooks/useAudio'
16-
import { useTestPageReady } from '@/hooks/useTestPageReady'
1716

1817
// Dynamically import SpotifyDisplay with SSR disabled.
1918
// This prevents the heavy Spotify SDK logic from blocking the initial server HTML or hydration.
@@ -63,6 +62,7 @@ const Dashboard = () => {
6362

6463
const [docIsManuallyShrunk, setDocIsManuallyShrunk] = useState(false)
6564
const [audioInitialized, setAudioInitialized] = useState(false)
65+
<<<<<<< HEAD
6666

6767
// Track the readiness of dynamic components to ensure accurate VRT snapshots.
6868
// data-ready will only be set to true once all critical sections are hydrated.
@@ -99,6 +99,8 @@ const Dashboard = () => {
9999
: componentLoadStatus.googleDoc)
100100

101101
const isReady = useTestPageReady(allComponentsReady)
102+
=======
103+
>>>>>>> origin/leader
102104
const [refreshKey, setRefreshKey] = useState(0)
103105
const { initializeAudio } = useAudio()
104106

@@ -116,7 +118,6 @@ const Dashboard = () => {
116118
return (
117119
<Container
118120
data-testid="dashboard"
119-
data-ready={isReady ? 'true' : 'false'}
120121
maxWidth="xl"
121122
onClick={handleInteraction}
122123
sx={{

constants/bluetooth-config.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)