import { useEffect, useState } from "react"; import { Link } from "react-router-dom"; import { api, type ImmichInfo } from "../api/client"; import EmptyState from "../components/EmptyState"; import TimeAgo from "../components/TimeAgo"; import { BlockSkeleton } from "../components/Skeleton"; import { ErrorNotice } from "../components/Notice"; import { formatBytes } from "./settings/StorageSettings"; import { readableError } from "../utils/errors"; import PageIntro from "../components/PageIntro"; import FigureHistory from "../components/FigureHistory"; import { t } from "../i18n"; function Badge({ i }: { i: ImmichInfo }) { if (!i.enabled) return Off; if (!i.state) return {t("Not read yet")}; if (!i.fresh) return Can’t be read; if (i.problems.some((x) => x.severity === "critical")) return {t("Needs a look")}; if (i.problems.length > 0) return {t("Needs a look")}; return {t("In order")}; } const n = (v: number | null) => (v === null ? "—" : v.toLocaleString()); function Card({ i }: { i: ImmichInfo }) { const s = i.state; const failed = s?.queues?.reduce((total, q) => total + q.failed, 0) ?? 0; const percent = s?.disk?.percent ?? null; return (

{i.name}

{i.status ? <>read : "not read yet"}
{i.status && !i.status.ok &&
The last attempt to read it failed: {i.status.error ?? "no answer"}.
} {i.problems.length > 0 && ( )} {s && ( <>
{[s.version ? `version ${s.version}` : null, s.updateAvailable && s.latestVersion ? `${s.latestVersion} is out` : null].filter(Boolean).join(" · ")}
Photos
{n(s.photos)}
Videos
{n(s.videos)}
Library
{s.usageBytes === null ? "—" : formatBytes(s.usageBytes)}
Disk under it
{percent === null ? "—" : `${Math.round(percent)} %`}
{s.disk && ( <>

Background jobs{failed > 0 && {failed} failed}

{!s.queues ? (
Immich did not answer about its jobs (the API key needs to be allowed to read them).
) : (
{s.queues.map((q) => ( ))}
Queue {t("Active")} Waiting Failed
{q.name} {q.active.toLocaleString()} {q.waiting.toLocaleString()} 0 ? "text-red fw-bold" : "text-secondary"}`}>{q.failed.toLocaleString()} {q.paused && paused}
)} )}
); } /** Immich: whether the photo library is healthy — the disk under it, how many it holds, and whether its background jobs are failing quietly. */ export default function Immich() { const [data, setData] = useState(null); const [error, setError] = useState(null); useEffect(() => { const load = () => api.immich .list() .then((r) => { setData(r.immiches); setError(null); }) .catch((err) => setError(readableError(err))); void load(); const t = setInterval(load, 60_000); return () => clearInterval(t); }, []); return ( <>

Immich

Photos are what cannot be made again, and Immich fails quietly. It is read every few minutes with an API key (see {t("Integrations")}). A disk under the library that is filling up and background jobs that have failed (thumbnails and metadata that were never made) are alerts — see {t("Alerts")}. {!data && !error && } {data && data.length === 0 && (
)} {data?.map((i) => )} ); }