import m from '@garage44/mithril' import {Button} from '@garage44/mithril/components' import {adminOpenRow, adminRequestRow} from '@/components/admin' import {openDecision} from '@/components/decisions' import {icon} from '@/components/icons' import {age, now, span} from '@/lib/format' import {needs} from '@/lib/needs' import type {Need} from '@/lib/needs' import {$s} from '@/lib/store' import {go} from '@/lib/route' import {hosted} from '@/lib/stream' /** Everything that waits for the person now: the tab's title and the nav count this. */ export const waitingForYou = (): Need[] => needs($s.decisions, hosted(), now(), $s.admin?.requests ?? []) const open = (id: string) => go(`sessions/${id}`) function row(n: Need): m.Children { if (n.kind === 'admin') return adminRequestRow(n.request) if (n.kind === 'decision') return openDecision(n.decision) const s = n.session if (n.kind === 'awaits') return (