Skip to content

Commit 193d0a8

Browse files
Copilotdnafication
andauthored
Add simple white progress bar at top of screen (#11)
* Initial plan * Add progress bar indicator around screen edges Co-authored-by: dnafication <6381587+dnafication@users.noreply.github.com> * Refactor progress bar code based on review feedback Co-authored-by: dnafication <6381587+dnafication@users.noreply.github.com> * Add YouTube-style progress bar around screen edges Co-authored-by: dnafication <6381587+dnafication@users.noreply.github.com> * Simplify progress bar to single white bar at top Co-authored-by: dnafication <6381587+dnafication@users.noreply.github.com> * Show progress bar when timer is paused Co-authored-by: dnafication <6381587+dnafication@users.noreply.github.com> * Use named export for ProgressBar component Co-authored-by: dnafication <6381587+dnafication@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dnafication <6381587+dnafication@users.noreply.github.com>
1 parent 53478d3 commit 193d0a8

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

components/progress-bar.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
interface ProgressBarProps {
2+
elapsedTime: number
3+
totalTime: number
4+
}
5+
6+
export const ProgressBar = ({ elapsedTime, totalTime }: ProgressBarProps) => {
7+
const progress = totalTime > 0 ? (elapsedTime / totalTime) * 100 : 0
8+
const clampedProgress = Math.min(progress, 100)
9+
10+
return (
11+
<div className="fixed top-0 left-0 right-0 pointer-events-none z-50">
12+
<div className="h-[5px] bg-white bg-opacity-20 w-full">
13+
<div
14+
className="h-full bg-white transition-all duration-300"
15+
style={{ width: `${clampedProgress}%` }}
16+
/>
17+
</div>
18+
</div>
19+
)
20+
}

components/talk-timer.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { useCallback, useEffect, useState } from 'react'
44

55
import Footer from './footer'
6+
import { ProgressBar } from './progress-bar'
67
import TimerDisplay from './timer-display'
78

89
export function TalkTimer() {
@@ -122,6 +123,9 @@ export function TalkTimer() {
122123
active={active}
123124
bgColor={getBackgroundColor()}
124125
/>
126+
{elapsedTime > 0 && (
127+
<ProgressBar elapsedTime={elapsedTime} totalTime={redThreshold} />
128+
)}
125129
<Footer
126130
active={active}
127131
isRunning={isRunning}

0 commit comments

Comments
 (0)