mirror of
https://github.com/MeshCore-Beacon/beacon-web.git
synced 2026-09-13 08:55:35 +00:00
Add Observation Count to channel messages and some more git ignore
This commit is contained in:
@@ -6,6 +6,10 @@ dist/
|
||||
build/
|
||||
.next/
|
||||
.nuxt/
|
||||
scripts/
|
||||
|
||||
# Dev server helper runtime files
|
||||
.scripts/
|
||||
|
||||
# Environment
|
||||
.env
|
||||
|
||||
+6
-1
@@ -7,7 +7,12 @@
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"start": "./scripts/devserver.sh start",
|
||||
"stop": "./scripts/devserver.sh stop",
|
||||
"restart": "./scripts/devserver.sh restart",
|
||||
"dev:status": "./scripts/devserver.sh status",
|
||||
"dev:stop-all": "./scripts/devserver.sh stop-all"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/react-query": "^5.100.11",
|
||||
|
||||
@@ -30,6 +30,8 @@ function formatMessageTime(iso: string): string {
|
||||
}
|
||||
|
||||
function MessageRow({ msg, heardCount, onAnalyze }: { msg: ChannelMessage; heardCount?: number; onAnalyze?: (hash: string) => void }) {
|
||||
// REST carries the server-side total; the live WS counter augments it during the session
|
||||
const reach = Math.max(msg.observationCount ?? 0, heardCount ?? 0);
|
||||
return (
|
||||
<div
|
||||
className={`px-3 py-2${onAnalyze ? " cursor-pointer hover:bg-bg-surface transition-colors" : ""}`}
|
||||
@@ -40,13 +42,9 @@ function MessageRow({ msg, heardCount, onAnalyze }: { msg: ChannelMessage; heard
|
||||
{msg.senderName}
|
||||
</span>
|
||||
<span className="text-[11px] text-text-dim">{formatMessageTime(msg.sentAt)}</span>
|
||||
{reach > 0 && <Badge variant="text">×{reach}</Badge>}
|
||||
</div>
|
||||
<div className="text-text-normal text-xs mt-0.5">{msg.content}</div>
|
||||
{heardCount != null && heardCount > 1 && (
|
||||
<div className="text-[11px] text-text-dim mt-0.5 font-mono">
|
||||
heard {heardCount}×
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -26,4 +26,5 @@ export interface ChannelMessage {
|
||||
senderName: string;
|
||||
content: string;
|
||||
sentAt: string;
|
||||
observationCount?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user