Skip to content

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

chore: remove unused renderer code

TzeYiing5acd15417d0d
diff --git a/studio/components/interfaces/Reports/renderers/AuthRenderers.tsx b/studio/components/interfaces/Reports/renderers/AuthRenderers.tsx
deleted file mode 100644
index f61c26a5674..00000000000
--- a/studio/components/interfaces/Reports/renderers/AuthRenderers.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-import { BarChart } from 'components/to-be-cleaned/Charts/ChartRenderer'
-import StackedBarChart from 'components/ui/Charts/StackedBarChart'
-import { DATETIME_FORMAT } from '../Reports.constants'
-import { ReportWidgetProps } from '../ReportWidget'
-import Statistic from '../Statistic'
-
-export const renderBannedUsers = (
- props: ReportWidgetProps<{
- count: number
- }>
-) => {
- const count = props.data.length === 0 ? 0 : props?.data?.[0]?.count
- return <Statistic value={count} />
-}
-export const renderUnverifiedUsers = (
- props: ReportWidgetProps<{
- timestamp: string
- count: number
- }>
-) => {
- const count = props.data.length === 0 ? 0 : props?.data?.[0]?.count
-
- return (
- <Statistic
- value={count}
- sparklineData={props.data.length >= 3 ? props.data : null}
- sparklineXAxis="timestamp"
- sparklineYAxis="count"
- />
- )
-}
-export const renderSignUpProviders = (
- props: ReportWidgetProps<{
- timestamp: string
- provider: string
- count: number
- }>
-) => {
- return (
- <StackedBarChart
- hideHeader
- variant="percentages"
- data={props.data}
- xAxisKey="timestamp"
- yAxisKey="count"
- stackKey="provider"
- />
- )
-}
-export const renderFailedMigrations = (
- props: ReportWidgetProps<{
- timestamp: string
- count: number
- }>
-) => {
- const count = props.data.length === 0 ? 0 : props?.data?.[0]?.count
- return <Statistic value={count} />
-}
-export const renderCumulativeUsers = (
- props: ReportWidgetProps<{
- count: number
- timestamp: string
- }>
-) => {
- const total = props.data?.[0]?.count
- return (
- <div className="flex w-full flex-col">
- <BarChart
- data={props.data}
- attribute="count"
- label=""
- minimalHeader
- highlightedValue={total}
- customDateFormat={DATETIME_FORMAT}
- noDataMessage={'No confirmed users yet'}
- />
- </div>
- )
-}
-
-export const renderNewUsers = (
- props: ReportWidgetProps<{
- count: number
- timestamp: string
- }>
-) => {
- const sum = (props.data || []).reduce((acc, datum) => datum.count + acc, 0)
- return (
- <div className="flex w-full flex-col">
- <BarChart
- data={props.data}
- attribute="count"
- label=""
- minimalHeader
- highlightedValue={sum}
- customDateFormat={DATETIME_FORMAT}
- noDataMessage={'No new user signups during this time period'}
- />
- </div>
- )
-}
-
-export const renderDailyActiveUsers = (
- props: ReportWidgetProps<{
- count: number
- timestamp: string
- }>
-) => {
- const last = props.data?.[props.data.length - 1]?.count
-
- return (
- <div className="flex w-full flex-col">
- <BarChart
- data={props.data}
- attribute="count"
- label=""
- minimalHeader
- highlightedValue={last}
- customDateFormat={DATETIME_FORMAT}
- noDataMessage={'No authenticated users during this time period'}
- />
- </div>
- )
-}
diff --git a/studio/components/interfaces/Reports/renderers/StorageRenderers.tsx b/studio/components/interfaces/Reports/renderers/StorageRenderers.tsx
deleted file mode 100644
index 22f21527fd8..00000000000
--- a/studio/components/interfaces/Reports/renderers/StorageRenderers.tsx
+++ /dev/null
@@ -1,189 +0,0 @@
-import Table from 'components/to-be-cleaned/Table'
-import StackedBarChart from 'components/ui/Charts/StackedBarChart'
-import { ReportWidgetProps } from '../ReportWidget'
-import Statistic from '../Statistic'
-
-export const renderLargestObjectsPerBucket = (
- props: ReportWidgetProps<{
- name: string
- mimetype: string
- bucket_id: string
- size: number
- row: number
- }>
-) => {
- return (
- <Table
- containerClassName="max-h-72 w-full overflow-y-auto"
- className="relative rounded border border-scale-600"
- head={
- <>
- <Table.th className="sticky top-0 z-10">Name</Table.th>
- <Table.th className="sticky top-0 z-10">Mimetype</Table.th>
- <Table.th className="sticky top-0 z-10">Size</Table.th>
- </>
- }
- body={
- <>
- {props.data.map((row, index) => (
- <Table.tr key={index}>
- <Table.td>{row.name}</Table.td>
- <Table.td>{row.bucket_id}</Table.td>
- <Table.td>{row.size}</Table.td>
- <Table.td>{row.row}</Table.td>
- </Table.tr>
- ))}
- </>
- }
- />
- )
-}
-
-export const renderTopDownloaded = (
- props: ReportWidgetProps<{
- count: number
- path: string
- }>
-) => {
- return (
- <Table
- containerClassName="max-h-72 w-full overflow-y-auto"
- className="relative rounded border border-scale-600"
- head={
- <>
- <Table.th className="sticky top-0 z-10">Path</Table.th>
- <Table.th className="sticky top-0 z-10">Download Count</Table.th>
- </>
- }
- body={
- <>
- {props.data.map((row, index) => (
- <Table.tr key={index}>
- <Table.td>{row.path}</Table.td>
- <Table.td>{row.count}</Table.td>
- </Table.tr>
- ))}
- </>
- }
- />
- )
-}
-
-export const renderMostFiles = (
- props: ReportWidgetProps<{
- owner: string
- file_count: number
- total_size: number
- }>
-) => {
- return (
- <Table
- containerClassName="max-h-72 w-full overflow-y-auto"
- className="relative rounded border border-scale-600"
- head={
- <>
- <Table.th className="sticky top-0 z-10">User</Table.th>
- <Table.th className="sticky top-0 z-10">Count</Table.th>
- <Table.th className="sticky top-0 z-10">Total Size</Table.th>
- </>
- }
- body={
- <>
- {props.data.map((row, index) => (
- <Table.tr key={index}>
- <Table.td>{row.owner}</Table.td>
- <Table.td>{row.file_count}</Table.td>
- <Table.td>{row.total_size}</Table.td>
- </Table.tr>
- ))}
- </>
- }
- />
- )
-}
-export const renderStaleFiles = (
- props: ReportWidgetProps<{
- one_month: number
- three_month: number
- six_month: number
- twelve_month: number
- }>
-) => {
- if (!props.data[0]) return null
- return (
- <div className="flex flex-row w-full px-4 justify-between gap-4">
- {[
- { key: 'one_month', label: '1 Month' },
- { key: 'three_month', label: '3 Month' },
- { key: 'six_month', label: '6 Month' },
- { key: 'twelve_month', label: '12 Month' },
- ].map(({ key, label }) => (
- <div className="flex flex-col items-center">
- <Statistic value={props.data[0][key as keyof typeof props.data[0]]} />
- <span className="text-lg text-scale-1000">{label}</span>
- </div>
- ))}
- </div>
- )
-}
-
-export const renderTopSizes = (
- props: ReportWidgetProps<{
- count: number
- search: string
- }>
-) => {
- return (
- <Table
- containerClassName="max-h-72 w-full overflow-y-auto"
- className="relative rounded border border-scale-600"
- head={
- <>
- <Table.th className="sticky top-0 z-10">Search</Table.th>
- <Table.th className="sticky top-0 z-10">Count</Table.th>
- </>
- }
- body={
- <>
- {props.data.map((row, index) => (
- <Table.tr key={index}>
- <Table.td>{row.count}</Table.td>
- <Table.td>{row.search}</Table.td>
- </Table.tr>
- ))}
- </>
- }
- />
- )
-}
-export const renderCacheHitRate = (
- props: ReportWidgetProps<{
- timestamp: string
- hit_count: number
- miss_count: number
- }>
-) => {
- const stackedData = props.data.flatMap((datum) => [
- {
- timestamp: datum.timestamp,
- count: datum.hit_count,
- type: 'hit',
- },
- {
- timestamp: datum.timestamp,
- count: datum.miss_count,
- type: 'miss',
- },
- ])
-
- return (
- <StackedBarChart
- hideHeader
- variant="percentages"
- data={stackedData}
- xAxisKey="timestamp"
- yAxisKey="count"
- stackKey="type"
- />
- )
-}