fix: compact timestamps, historical alias resolution, wider ts column
- Timestamps now show "Jun 28 10:58" for older messages (dropped "Yesterday" which overflowed the fixed-width column) - Timestamp column widened from 52px to 72px to fit date+time - state_snapshot now includes known_peers (historically seen, not currently connected) so the UI can resolve aliases in history - MessagePane aliasFor falls back to knownPeers map Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,17 +4,16 @@ import { useWaste } from '../store'
|
||||
const today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
const todayMs = today.getTime()
|
||||
const yesterdayMs = todayMs - 86400000
|
||||
|
||||
function formatTs(ts: number): string {
|
||||
const time = new Date(ts).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false })
|
||||
const d = new Date(ts)
|
||||
const time = d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false })
|
||||
if (ts >= todayMs) return time
|
||||
if (ts >= yesterdayMs) return `Yesterday ${time}`
|
||||
return new Date(ts).toLocaleDateString([], { month: 'short', day: 'numeric' }) + ' ' + time
|
||||
return d.toLocaleDateString([], { month: 'short', day: 'numeric' }) + ' ' + time
|
||||
}
|
||||
|
||||
export function MessagePane() {
|
||||
const { messages, historyCutoff, activeRoom, activeNetworkId, localPeer, connectedPeers, send } = useWaste()
|
||||
const { messages, historyCutoff, activeRoom, activeNetworkId, localPeer, connectedPeers, knownPeers, send } = useWaste()
|
||||
const [draft, setDraft] = useState('')
|
||||
const bottomRef = useRef<HTMLDivElement>(null)
|
||||
const roomMessages = messages[activeRoom] ?? []
|
||||
@@ -53,7 +52,9 @@ export function MessagePane() {
|
||||
|
||||
function aliasFor(fromId: string) {
|
||||
if (fromId === localPeer?.id) return localPeer.alias
|
||||
return connectedPeers.find(p => p.id === fromId)?.alias ?? fromId.slice(0, 8)
|
||||
return connectedPeers.find(p => p.id === fromId)?.alias
|
||||
?? knownPeers[fromId]
|
||||
?? fromId.slice(0, 8)
|
||||
}
|
||||
|
||||
const roomLabel = activeRoom.startsWith('dm:')
|
||||
|
||||
Reference in New Issue
Block a user