diff --git a/src/components/ChatInterface.tsx b/src/components/ChatInterface.tsx index 461535d..ae7c01b 100644 --- a/src/components/ChatInterface.tsx +++ b/src/components/ChatInterface.tsx @@ -147,6 +147,9 @@ export default function ChatInterface() {

{activeThread?.title}

+
+ +
diff --git a/src/components/Clock.tsx b/src/components/Clock.tsx new file mode 100644 index 0000000..8b96ee0 --- /dev/null +++ b/src/components/Clock.tsx @@ -0,0 +1,43 @@ +import { useState, useEffect, useRef } from 'react'; + +interface ClockProps {} + +function Clock({}: ClockProps) { + const [time, setTime] = useState(''); + const intervalRef = useRef(null); + + const formatTime = (date: Date): string => { + return [ + date.getHours().toString().padStart(2, '0'), + date.getMinutes().toString().padStart(2, '0'), + date.getSeconds().toString().padStart(2, '0') + ].join(':'); + }; + + useEffect(() => { + const updateTime = () => { + setTime(formatTime(new Date())); + }; + + updateTime(); + + intervalRef.current = setInterval(updateTime, 1000); + + return () => { + if (intervalRef.current) { + clearInterval(intervalRef.current); + } + }; + }, []); + + return ( +
+ {time} +
+ ); +} + +export default Clock;