chore: commit unrelated local changes

This commit is contained in:
William Valentin
2026-02-15 21:51:22 -08:00
parent 7f563b4bb1
commit 50dcff5ea6
7 changed files with 60 additions and 21 deletions
+9 -12
View File
@@ -13,18 +13,15 @@ export interface MessageListProps {
// Helper to format timestamp in human-readable way
function formatTimestamp(timestamp: number): string {
const now = Date.now();
const diff = now - timestamp;
const seconds = Math.floor(diff / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
const date = new Date(timestamp);
const now = new Date();
const isSameDay = date.toDateString() === now.toDateString();
if (seconds < 60) {return 'just now';}
if (minutes < 60) {return `${minutes}m ago`;}
if (hours < 24) {return `${hours}h ago`;}
if (days < 7) {return `${days}d ago`;}
return new Date(timestamp).toLocaleDateString([], { month: 'short', day: 'numeric' });
if (isSameDay) {
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
}
return date.toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
}
// Individual message component
@@ -37,7 +34,7 @@ const MessageItem = memo(function MessageItem({
}): React.ReactElement {
const isUser = message.role === 'user';
const accentColor = isUser ? 'blue' : '#ff8c00';
const timestampText = message.timestamp ? formatTimestamp(message.timestamp) : '';
const timestampText = message.timestamp ? formatTimestamp(message.timestamp) : 'unknown time';
return (
<Box