import Link from "@/components/Link"; import { KeyRound } from "lucide-react"; import { DEFAULT_GRANT_TERM, GRANT_TERM_TEXT, GRANT_TERMS, type AccessRequestView } from "@peppa/core"; import type { Translator } from "@peppa/shared/i18n"; import { denyAccessRequestAction, grantAccessButtonAction } from "@/app/(app)/actions"; import { Hidden } from "@/components/cards"; import { ago } from "@/components/common"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; const SELECT = "h-9 rounded-md border border-input bg-background px-2 text-sm"; /** «читать» / «читать и менять». */ export function accessModeText(mode: AccessRequestView["mode"], t: Translator): string { return mode === "write" ? t("читать и менять") : t("только читать"); } export function AccessStatus({ r, t }: { r: AccessRequestView; t: Translator }) { if (r.status === "open") return {t("ждёт вашего решения")}; if (r.status === "granted") return {t("доступ выдан")}; if (r.status === "denied") return {t("отказано")}; return {t("агент отменил запрос")}; } /** PEP-261: the term of a grant — 1 day by default. */ export function GrantTermSelect({ t }: { t: Translator }) { return ( ); } /** PEP-261: «чтение» / «полные права» — by default what the agent asked for. */ export function GrantRightsSelect({ r, t }: { r: AccessRequestView; t: Translator }) { return ( ); } /** PEP-250/261: «Агенты просят доступ» on «Подключения» — the owner's open requests with «Дать» buttons. `grantable` — requests with a fitting connection. */ export function AccessRequestList({ list, grantable, t }: { list: AccessRequestView[]; grantable: Set; t: Translator }) { return ( ); }