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:
Fredrik Johansson
2026-06-29 13:43:29 +02:00
parent cef9374416
commit fcbd84f873
6 changed files with 31 additions and 7 deletions

View File

@@ -29,6 +29,7 @@ interface WasteState {
// peers
connectedPeers: PeerInfo[]
knownPeers: Record<string, string> // id → alias for historical peers
// chat — keyed by room
messages: Record<string, ChatMessage[]>
@@ -87,6 +88,7 @@ export const useWaste = create<WasteState>((set, get) => ({
networks: [],
activeNetworkId: null,
connectedPeers: [],
knownPeers: {},
messages: {},
historyCutoff: {},
activeRoom: 'general',
@@ -215,6 +217,8 @@ export const useWaste = create<WasteState>((set, get) => ({
switch (msg.type) {
case 'state_snapshot': {
const networks = msg.networks ?? []
const knownPeers: Record<string, string> = {}
for (const p of msg.known_peers ?? []) knownPeers[p.id] = p.alias
set({
masterAlias: msg.master_alias ?? null,
masterId: msg.master_id ?? null,
@@ -222,6 +226,7 @@ export const useWaste = create<WasteState>((set, get) => ({
networks,
connectedPeers: msg.connected_peers ?? [],
activeNetworkId: networks[0]?.network_id ?? null,
knownPeers,
})
break
}