Skip to content

Commit ed952e3

Browse files
committed
chore(cli): tidy timer and image components
1 parent d84caa6 commit ed952e3

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

cli/src/components/elapsed-timer.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { formatElapsedTime } from '../utils/format-elapsed-time'
77
interface ElapsedTimerProps {
88
startTime: number | null
99
suffix?: string
10-
attributes?: number
10+
attributes?: TextAttributes
1111
}
1212

1313
/**
@@ -20,14 +20,9 @@ export const ElapsedTimer = ({
2020
attributes,
2121
}: ElapsedTimerProps) => {
2222
const theme = useTheme()
23-
24-
// Calculate elapsed seconds synchronously for SSR/initial render
25-
const calculateElapsed = () => {
26-
if (!startTime) return 0
27-
return Math.floor((Date.now() - startTime) / 1000)
28-
}
29-
30-
const [elapsedSeconds, setElapsedSeconds] = useState<number>(calculateElapsed)
23+
const [elapsedSeconds, setElapsedSeconds] = useState<number>(() =>
24+
startTime ? Math.floor((Date.now() - startTime) / 1000) : 0,
25+
)
3126

3227
useEffect(() => {
3328
if (!startTime) {

cli/src/components/image-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const ImageCard = ({
108108
{/* Thumbnail or icon area */}
109109
<box
110110
style={{
111-
height: 3,
111+
height: THUMBNAIL_HEIGHT,
112112
justifyContent: 'center',
113113
alignItems: 'center',
114114
}}

cli/src/components/message-block.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ const MessageAttachments = ({
9898
marginTop: 1,
9999
}}
100100
>
101-
{attachments.map((attachment, index) => (
101+
{attachments.map((attachment) => (
102102
<ImageCard
103-
key={`${attachment.path}-${index}`}
103+
key={attachment.path}
104104
image={attachment}
105105
showRemoveButton={false}
106106
/>

0 commit comments

Comments
 (0)