feat(presence): dashboard Who's-here panel + /attendance + /me history + nav
Dashboard right column gets a 'Who's here' panel: present members with Host badges + your own Check in / Check in as host / Check out with an optional note (router.refresh after). New /attendance page (all members) lists recent visits with status + duration + notes. /me gains a 'My recent visits' section. Sidebar 'Attendance' link under People.
This commit is contained in:
@@ -4,8 +4,9 @@ import { redirect } from 'next/navigation'
|
||||
import type { Tables } from '@/types/database'
|
||||
import { PageTitle } from '@/components/ui/page-title'
|
||||
import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription } from '@/components/ui/empty'
|
||||
import { listSelfEntryDoors } from '@/lib/actions'
|
||||
import { listSelfEntryDoors, listPresentNow } from '@/lib/actions'
|
||||
import { DoorSelfEntry } from './door-self-entry'
|
||||
import { PresencePanel } from './presence-panel'
|
||||
|
||||
function IcoUsers({ className }: { className?: string }) {
|
||||
return <svg className={className} fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" /></svg>
|
||||
@@ -158,8 +159,11 @@ export default async function DashboardPage() {
|
||||
)
|
||||
}
|
||||
|
||||
const selfEntryRes = await listSelfEntryDoors()
|
||||
const [selfEntryRes, presentRes] = await Promise.all([listSelfEntryDoors(), listPresentNow()])
|
||||
const selfEntryDoors = ('data' in selfEntryRes ? selfEntryRes.data : []) as { id: string; name: string }[]
|
||||
const present = ('data' in presentRes ? presentRes.data : []) as {
|
||||
id: string; name: string; isHost: boolean; isMe: boolean; checkedInAt: string; note: string | null
|
||||
}[]
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
@@ -329,6 +333,8 @@ export default async function DashboardPage() {
|
||||
</div>
|
||||
|
||||
<div className="space-y-6">
|
||||
<PresencePanel present={present} />
|
||||
|
||||
{selfEntryDoors.length > 0 && (
|
||||
<div>
|
||||
<p className="font-mono text-[10px] tracking-widest text-muted-foreground uppercase mb-3 flex items-center gap-1.5">
|
||||
|
||||
Reference in New Issue
Block a user