Files
buzz-sheet/components/public/visitor-presence.tsx
T
gunshiz 9a3672dab3
CI / Verify (push) Successful in 1m14s
CI / Build immutable images and deploy (push) Failing after 57s
perf : improve via lighthouse
2026-09-08 18:11:15 +07:00

32 lines
1008 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import { UsersIcon } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { useVisitorPresence } from "@/hooks/use-presence";
export function VisitorPresence({ guideId }: { guideId?: string }) {
const counts = useVisitorPresence(guideId ?? null);
return (
<div className="flex items-center gap-1" aria-live="polite">
<Badge
variant="secondary"
className="min-w-24 tabular-nums"
title="ผู้เข้าชมทั้งหมดที่กำลังออนไลน์"
>
<UsersIcon data-icon="inline-start" />
ทั้งหมด {counts?.global ?? "–"}
</Badge>
{guideId ? (
<Badge
variant="outline"
className="min-w-24 tabular-nums"
title="ผู้เข้าชม Guide นี้ที่กำลังออนไลน์"
>
Guide นี้ {counts?.guide ?? "–"}
</Badge>
) : null}
</div>
);
}