import {
BoxIcon,
ChevronRightIcon,
FileKeyIcon,
TriangleAlertIcon,
UserRoundXIcon,
WorkProfileIcon,
} from "@repo/rdx-ui/lib/icons";
import { useQuery } from "@tanstack/react-query";
import { useTranslation } from "react-i18next";
import type { DashboardIssue } from "../../../../common/dashboard";
import { BlockState, DashboardPanel } from "../../shared";
import { dashboardApi, dashboardKeys } from "../../shared/api";
const ISSUE_ICONS = {
certificate: FileKeyIcon,
license: FileKeyIcon,
profile: WorkProfileIcon,
missing_site: BoxIcon,
inactive_person: UserRoundXIcon,
};
export function DashboardAttentionPanel({
companyId,
onDetails,
}: {
companyId: string | undefined;
onDetails: (issue: DashboardIssue) => void;
}) {
const { t } = useTranslation("companies");
const attention = useQuery({
queryKey: dashboardKeys.block("attention", companyId),
queryFn: ({ signal }) => dashboardApi.attention(signal, companyId),
staleTime: 0,
});
return (
}
title={t("dashboard.attention")}
>
{attention.data?.items.map((item) => {
const Icon = ISSUE_ICONS[item.kind];
return (
-
);
})}
);
}