import { ArrowUpRight, Box, Globe2 } from "lucide-react"; import type { DockApp, Favorite } from "../../shared/contracts"; import { effectiveAppUrl, favoriteIconUrl } from "../../shared/domain"; import { ServiceIcon } from "./ServiceIcon"; const serviceDescriptions: Array<[RegExp, string]> = [ [/plex/i, "Media server & streaming"], [/jellyfin/i, "De vrije software mediaserver"], [/sonarr/i, "PVR voor tv-series"], [/radarr/i, "PVR voor films"], [/home.?assistant|ha-core/i, "Centrale automatisering"], [/adguard|pihole|pi-hole/i, "Netwerkbeveiliging & filter"], [/nextcloud/i, "Bestandshosting"], [/gitea|github|gitlab/i, "Code en samenwerking"], [/immich/i, "Foto's en herinneringen"], [/paperless/i, "Documenten en archief"], ]; function describeService(app: DockApp, categoryName: string) { const haystack = `${app.displayName} ${app.technicalName}`; return ( serviceDescriptions.find(([pattern]) => pattern.test(haystack))?.[1] ?? `${categoryName} service` ); } function statusLabel(status: DockApp["status"]) { return status === "online" ? "Online" : status === "offline" ? "Offline" : "Status onbekend"; } export function AppTile({ app, externalAccess, showStatus, index, categoryName, variant = "standard", }: { app: DockApp; externalAccess: boolean; showStatus: boolean; index: number; categoryName: string; variant?: "standard" | "feature"; }) { const url = effectiveAppUrl(app, externalAccess); const content = ( <> {app.displayName} {describeService(app, categoryName)} {showStatus && ( {statusLabel(app.status)} )}