Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -1,54 +1,13 @@
import { type LoaderFunctionArgs, useLoaderData } from "react-router";
import { useTranslation } from "react-i18next";
import { loadLeadContext, notFoundResponse, requireLeadPermission } from "~/utils/integrations/leads/leadAccess.server";
import { leadsPath, LEADS_MODULE_KEY } from "~/utils/integrations/leads/leadRoutePaths";
import { getLeadStatistics } from "~/utils/integrations/leads/leadService.server";
import ServerError from "~/components/ui/errors/ServerError";
// R-P7 (P7 Lead-Inbox) — legacy redirect. The statistics screen moved out of the
// inbox route family to `/leads-statistics` (reached via the leads sub-sidenav).
// Without this file the old path would fall through to `leads.$id` and be read as
// a lead id, so bookmarks and old links are redirected instead.
type LoaderData = Awaited<ReturnType<typeof getLeadStatistics>> & { listHref: string };
import { redirect, type LoaderFunctionArgs } from "react-router";
import { leadStatisticsPath, LEADS_MODULE_KEY } from "~/utils/integrations/leads/leadRoutePaths";
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
const ctx = await loadLeadContext({ request, params, requireModule: true });
try {
requireLeadPermission(ctx, "leads.read_own");
} catch {
throw notFoundResponse();
}
const stats = await getLeadStatistics({ tenantId: ctx.tenantId, ctx });
return Response.json({ ...stats, listHref: leadsPath(params.tenant ?? "") } satisfies LoaderData);
export const loader = ({ params }: LoaderFunctionArgs) => {
throw redirect(leadStatisticsPath(params.tenant ?? ""), 301);
};
export default function LeadStatisticsRoute() {
const { t } = useTranslation();
const data = useLoaderData<LoaderData>();
const cards = [
["total", data.total],
["open", data.open],
["converted", data.converted],
["spam", data.spam],
] as const;
return (
<main className="mx-auto max-w-5xl px-4 py-10" data-ui-id="ui.leads.statistics">
<a href={data.listHref} className="text-theme-600 text-sm font-medium">{t("leads.actions.backToList")}</a>
<h1 className="text-foreground mt-4 text-xl font-semibold">{t("leads.statistics.title")}</h1>
<div className="mt-6 grid gap-4 sm:grid-cols-4">
{cards.map(([key, value]) => (
<section key={key} className="rounded-md border p-4">
<p className="text-muted-foreground text-sm">{t(`leads.statistics.card.${key}`)}</p>
<p className="mt-2 text-2xl font-semibold">{value}</p>
</section>
))}
</div>
<section className="mt-6 rounded-md border p-4">
<h2 className="font-medium">{t("leads.statistics.bySource")}</h2>
<ul className="mt-3 grid gap-2 text-sm">{data.byQuelle.map((row) => <li key={row.quelle}>{t(`leads.quelle.${row.quelle}`)}: {row.count}</li>)}</ul>
</section>
</main>
);
}
export function ErrorBoundary() {
return <ServerError />;
}
export const handle = { moduleKey: LEADS_MODULE_KEY };