Frontend: Enhance Admin Dashboard: Add AnalyticsChart for generated contacts and update layout spacing
This commit is contained in:
parent
1c3e682515
commit
7018533f3f
4 changed files with 18 additions and 9 deletions
|
|
@ -11,6 +11,7 @@ import {
|
||||||
CardAction,
|
CardAction,
|
||||||
CardContent,
|
CardContent,
|
||||||
CardDescription,
|
CardDescription,
|
||||||
|
CardFooter,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "~/components/ui/card";
|
} from "~/components/ui/card";
|
||||||
|
|
@ -72,7 +73,7 @@ export default function AnalyticsChart({
|
||||||
const DatePickerLocale = locale === "it" ? it : enUS;
|
const DatePickerLocale = locale === "it" ? it : enUS;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="@container/card w-full">
|
<Card className="@container/card w-full pb-4">
|
||||||
<CardHeader className="flex flex-col border-b @md/card:grid">
|
<CardHeader className="flex flex-col border-b @md/card:grid">
|
||||||
<CardTitle>{title}</CardTitle>
|
<CardTitle>{title}</CardTitle>
|
||||||
<CardDescription className={cn(!description && "sr-only")}>
|
<CardDescription className={cn(!description && "sr-only")}>
|
||||||
|
|
@ -150,6 +151,14 @@ export default function AnalyticsChart({
|
||||||
)}
|
)}
|
||||||
</ChartContainer>
|
</ChartContainer>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
<CardFooter className="flex justify-end border-t !pt-4">
|
||||||
|
<span className="text-muted-foreground text-sm">
|
||||||
|
Totale:{" "}
|
||||||
|
<strong>
|
||||||
|
{filteredData.reduce((acc, item) => acc + item.value, 0)}
|
||||||
|
</strong>
|
||||||
|
</span>
|
||||||
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,12 +108,7 @@ const ServizioInteraction = ({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <InteressatoButton annuncioId={annuncioId} />;
|
||||||
//todo join table annuncioId e userId richieste di sblocco,per mostrare testo se già inviate, stessa funzionalità in pag ricerca con annunci compatibili con questo bottone
|
|
||||||
//todo email di richiesta di sblocco deve avere un bottone che rimanda alla pagina di richiesta per poterla accettare o rifiutare
|
|
||||||
//todo paginina di sunto per richiesta con info minime e link a annuncio e utente
|
|
||||||
<InteressatoButton annuncioId={annuncioId} />
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const InteressatoButton = ({
|
export const InteressatoButton = ({
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export const AdminDashboard = () => {
|
||||||
if (isLoading) return <LoadingPage />;
|
if (isLoading) return <LoadingPage />;
|
||||||
return (
|
return (
|
||||||
<div className="mx-1 flex-1 overflow-auto">
|
<div className="mx-1 flex-1 overflow-auto">
|
||||||
<div className="mx-auto pt-4">
|
<div className="mx-auto pt-4 pb-8">
|
||||||
<div className="mx-3 items-start justify-between pb-3 md:flex">
|
<div className="mx-3 items-start justify-between pb-3 md:flex">
|
||||||
<div className="flex max-w-lg items-center gap-3">
|
<div className="flex max-w-lg items-center gap-3">
|
||||||
<h3 className="text-2xl font-bold">Admin Dashboard</h3>
|
<h3 className="text-2xl font-bold">Admin Dashboard</h3>
|
||||||
|
|
@ -34,6 +34,12 @@ export const AdminDashboard = () => {
|
||||||
timeserie={stats.orderTimeserie}
|
timeserie={stats.orderTimeserie}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex w-full justify-center">
|
||||||
|
<AnalyticsChart
|
||||||
|
title="Contatti generati"
|
||||||
|
timeserie={stats.contattiTimeserie}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ export const statsRouter = createTRPCRouter({
|
||||||
value: parseInt(String(item.value)),
|
value: parseInt(String(item.value)),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
//todo finire
|
|
||||||
const contattiTimeserie = (
|
const contattiTimeserie = (
|
||||||
await db
|
await db
|
||||||
.selectFrom("servizio_annunci")
|
.selectFrom("servizio_annunci")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue