import Link from "next/link"; import { apiGet } from "@/lib/server-api"; import { fmtDateTime, fmtDay, notificationStatusLabel } from "@/lib/format"; import { isRestricted } from "@/lib/access"; import type { Dashboard, Me } from "@/lib/types"; export default async function DashboardPage() { const [d, me] = await Promise.all([apiGet("/dashboard"), apiGet("/auth/me")]); const users = d.users_by_status; const restricted = isRestricted(me.account); return ( <>

Início

{d.outage_since && (
A PontoMais está fora do ar desde {fmtDateTime(d.outage_since)}. Ninguém foi pausado; os admins foram avisados pelo Telegram.
)} {d.holiday_fallback_day && (
Não foi possível obter os feriados deste ano: segunda a sexta estão valendo como dias úteis.{" "} Ver feriados
)} {!restricted && (
)}

Lembretes de hoje ({fmtDay(d.today)})

{Object.keys(d.today_by_status).length === 0 ? (

Nenhum lembrete gerado hoje.

) : (
    {Object.entries(d.today_by_status).map(([status, count]) => (
  • {restricted ? ( {notificationStatusLabel[status] ?? status}: {count} ) : ( {notificationStatusLabel[status] ?? status}: {count} )}
  • ))}
)}
); } function Stat({ label, value, href, tone }: { label: string; value: number; href?: string; tone?: "error" }) { const content = ( <> {value} {label} ); return (
{href ? {content} : content}
); }