Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: add conditional rendering of sparkline

TzeYiingfa3368516aee
diff --git a/studio/components/interfaces/Reports/Statistic.tsx b/studio/components/interfaces/Reports/Statistic.tsx
index 61c26979c05..e8f534ae003 100644
--- a/studio/components/interfaces/Reports/Statistic.tsx
+++ b/studio/components/interfaces/Reports/Statistic.tsx
@@ -7,7 +7,7 @@ interface Props {
prefix?: string
suffix?: string
valueFormatter?: (value: Props['value']) => string
- sparklineData?: Record<string, number>[]
+ sparklineData?: any
sparklineXAxis?: string
sparklineYAxis?: string
}
@@ -43,7 +43,7 @@ const Statistic: React.FC<Props> = ({
</div>
)}
{showSparkline && (
- <Sparkline data={sparklineData} xAxisKey={sparklineXAxis} yAxisKey={sparklineYAxis} />
+ <Sparkline data={sparklineData} xAxisKey={sparklineXAxis} yAxisKey={sparklineYAxis} size="small" />
)}
</div>
)
diff --git a/studio/components/interfaces/Reports/renderers/AuthRenderers.tsx b/studio/components/interfaces/Reports/renderers/AuthRenderers.tsx
index fbd38fb6c5f..f61c26a5674 100644
--- a/studio/components/interfaces/Reports/renderers/AuthRenderers.tsx
+++ b/studio/components/interfaces/Reports/renderers/AuthRenderers.tsx
@@ -19,7 +19,15 @@ export const renderUnverifiedUsers = (
}>
) => {
const count = props.data.length === 0 ? 0 : props?.data?.[0]?.count
- return <Statistic value={count} />
+
+ return (
+ <Statistic
+ value={count}
+ sparklineData={props.data.length >= 3 ? props.data : null}
+ sparklineXAxis="timestamp"
+ sparklineYAxis="count"
+ />
+ )
}
export const renderSignUpProviders = (
props: ReportWidgetProps<{