Mobile responsiveness: several flex rows had a `truncate` child without `min-w-0`, so a long value (member/door name, channel name, published form URL) would not shrink and pushed the row past the viewport on a phone. Added `min-w-0` (with `flex-1`/`shrink-0` where needed) on the dashboard presence + door-self-entry rows, the comms channel list, and the form-builder URL. Door inbound poll: `/api/cron/door-ingest` now polls connections with Promise.allSettled instead of a sequential loop, so one tick is bounded to the slowest single poll rather than the sum of all per-call timeouts; each connection stays isolated and the run is idempotent. Docs: refreshed ARCHITECTURE (door epic marked complete P1-P5), the README access-control feature bullet + project-status pointer, a historical banner on the older AUDIT.md, a door-epic CHANGELOG entry, and the rolling HANDOFF audit log (passes 65-68). No migration; no behavior change for existing users.
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import { toast } from 'sonner'
|
|
import { Button } from '@/components/ui/button'
|
|
import { useConfirm } from '@/components/ui/confirm'
|
|
import { selfEntry } from '@/lib/actions'
|
|
|
|
type Door = { id: string; name: string }
|
|
|
|
export function DoorSelfEntry({ doors }: { doors: Door[] }) {
|
|
const confirm = useConfirm()
|
|
const [busy, setBusy] = useState<string | null>(null)
|
|
|
|
async function open(d: Door) {
|
|
const ok = await confirm({
|
|
title: `Open ${d.name}?`,
|
|
description:
|
|
'This sends a live command that physically opens the door. Only do this if you are at the door and authorized to enter.',
|
|
confirmText: 'Open the door',
|
|
})
|
|
if (!ok) return
|
|
setBusy(d.id)
|
|
const res = await selfEntry({ connectionId: d.id })
|
|
setBusy(null)
|
|
if ('error' in res && res.error) return toast.error(res.error)
|
|
toast.success(`${d.name} opened`)
|
|
}
|
|
|
|
return (
|
|
<div className="bg-card rounded border border-border divide-y divide-border">
|
|
{doors.map(d => (
|
|
<div key={d.id} className="flex items-center justify-between gap-3 px-4 py-3">
|
|
<span className="flex-1 min-w-0 font-sans text-sm text-foreground truncate">{d.name}</span>
|
|
<Button size="sm" className="shrink-0" disabled={busy === d.id} onClick={() => open(d)}>
|
|
{busy === d.id ? 'Opening…' : 'Open'}
|
|
</Button>
|
|
</div>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|