feat: 1-to-1 message render + web data-lake backend

This commit is contained in:
hh committed 2026-05-31 01:45:05 +02:00
1 parent f0afb7ec5b
commit 75425d1bee
110 files changed
+10199 -54

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
import type { Account, PeerView } from "$lib/api/types";
const PEER_COLOR_COUNT = 7;
export function peerColorIndex(id: number): number {
return Math.abs(id) % PEER_COLOR_COUNT;
}
export function peerName(peer: PeerView | null): string {
if (!peer) {
return "";
}
if (peer.is_deleted_account) {
return "Deleted Account";
}
const parts = [peer.first_name, peer.last_name].filter(Boolean);
if (parts.length > 0) {
return parts.join(" ");
}
if (peer.username) {
return `@${peer.username}`;
}
return String(peer.peer_id);
}
export function accountName(account: Account): string {
return (
account.label ??
account.phone ??
String(account.tg_user_id ?? account.account_id)
);
}
const WHITESPACE = /\s+/;
export function initials(name: string): string {
const words = name.trim().split(WHITESPACE).filter(Boolean);
if (words.length === 0) {
return "?";
}
const first = words[0][0];
if (words.length === 1) {
return first.toUpperCase();
}
const lastWord = words.at(-1);
const last = lastWord ? lastWord[0] : "";
return (first + last).toUpperCase();
}