mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Refactoring charts in statistics in organization.
This commit is contained in:
@@ -28,9 +28,9 @@ export type EvolutionLineChartProps = {
|
|||||||
export function EvolutionLineChart(props: EvolutionLineChartProps) {
|
export function EvolutionLineChart(props: EvolutionLineChartProps) {
|
||||||
const {data} = props;
|
const {data} = props;
|
||||||
|
|
||||||
const fakeData = generateFakeEvolutionData(14, 2, 10)
|
// const fakeData = generateFakeEvolutionData(14, 2, 10)
|
||||||
|
|
||||||
const dailyData = fakeData
|
const dailyData = data
|
||||||
.reduce((acc, backup) => {
|
.reduce((acc, backup) => {
|
||||||
const date = backup.createdAt.toISOString().split("T")[0];
|
const date = backup.createdAt.toISOString().split("T")[0];
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,6 @@ export const LineChartCustom = <T extends { date: string }>({
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<>
|
|
||||||
{data.length > 0 ? (
|
|
||||||
<Card className="w-full">
|
<Card className="w-full">
|
||||||
<CardHeader className="flex items-center gap-4 space-y-0 border-b py-0 sm:flex-row">
|
<CardHeader className="flex items-center gap-4 space-y-0 border-b py-0 sm:flex-row">
|
||||||
<CardTitle className="text-sm md:text-lg">{title}</CardTitle>
|
<CardTitle className="text-sm md:text-lg">{title}</CardTitle>
|
||||||
@@ -69,7 +66,9 @@ export const LineChartCustom = <T extends { date: string }>({
|
|||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="px-2 pt-4 sm:px-6 sm:pt-6 md:pt-0 md:px-6 ">
|
<CardContent className="px-2 pt-4 sm:px-6 sm:pt-6 md:pt-0 md:px-6 h-full w-full">
|
||||||
|
|
||||||
|
{data.length > 0 ? (
|
||||||
<ChartContainer config={config}>
|
<ChartContainer config={config}>
|
||||||
<LineChart
|
<LineChart
|
||||||
accessibilityLayer
|
accessibilityLayer
|
||||||
@@ -90,17 +89,11 @@ export const LineChartCustom = <T extends { date: string }>({
|
|||||||
/>
|
/>
|
||||||
</LineChart>
|
</LineChart>
|
||||||
</ChartContainer>
|
</ChartContainer>
|
||||||
|
) : (
|
||||||
|
<PlaceholderChart text="No data available"/>
|
||||||
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
) : (
|
|
||||||
<PlaceholderChart text="No backup data available"/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
|
|
||||||
</>
|
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
export const PlaceholderChart = ({text}: { text: string }) => (
|
export const PlaceholderChart = ({text}: { text: string }) => (
|
||||||
<div className="flex h-48 items-center justify-center text-sm text-muted-foreground">{text}</div>
|
<div className="flex h-100 w-full items-center justify-center text-sm text-muted-foreground">{text}</div>
|
||||||
);
|
);
|
||||||
Reference in New Issue
Block a user