Skip to content

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

fix: ui fixes for datepicker

TzeYiingf674a35d3df5
diff --git a/studio/components/interfaces/Reports/Reports.constants.ts b/studio/components/interfaces/Reports/Reports.constants.ts
index 90010822e2e..fedef4cdd7e 100644
--- a/studio/components/interfaces/Reports/Reports.constants.ts
+++ b/studio/components/interfaces/Reports/Reports.constants.ts
@@ -6,13 +6,12 @@ export const LAYOUT_COLUMN_COUNT = 24
export const REPORTS_DATEPICKER_HELPERS: DatetimeHelper[] = [
{
- text: 'Last 7 days',
- calcFrom: () => dayjs().subtract(7, 'day').startOf('day').toISOString(),
+ text: 'Last day',
calcTo: () => '',
- default: true,
+ calcFrom: () => dayjs().subtract(1, 'day').startOf('day').toISOString(),
},
{
- text: 'Last 14 days',
+ text: 'Last 7 days',
calcFrom: () => dayjs().subtract(7, 'day').startOf('day').toISOString(),
calcTo: () => '',
},
diff --git a/studio/components/interfaces/Reports/Reports.utils.tsx b/studio/components/interfaces/Reports/Reports.utils.tsx
index 4d07a2686ee..41e0ee4d975 100644
--- a/studio/components/interfaces/Reports/Reports.utils.tsx
+++ b/studio/components/interfaces/Reports/Reports.utils.tsx
@@ -63,6 +63,12 @@ export const usePresetReport = (hooks: PresetHookResult[]) => {
})
}
const isLoading = data.map((datum) => datum.isLoading).some((v) => v)
+ const helpers = REPORTS_DATEPICKER_HELPERS.map((helper, index) => {
+ if (tier?.key === 'FREE' && index === 0) return { ...helper, default: true }
+ if (tier?.key === 'PRO' && index === 1) return { ...helper, default: true }
+ return { ...helper, default: false }
+ })
+
const Layout: React.FC<{ title: string }> = ({ title, children }) => (
<div className="1xl:px-28 mx-auto flex flex-col gap-4 px-5 py-6 lg:px-16 xl:px-24 2xl:px-32">
<h1 className="text-2xl text-scale-1200">{title}</h1>
@@ -70,8 +76,8 @@ export const usePresetReport = (hooks: PresetHookResult[]) => {
<DatePickers
onChange={handleDatepickerChange}
to={data[0]?.params?.iso_timestamp_end || ''}
- from={data[0]?.params?.iso_timestamp_end || ''}
- helpers={REPORTS_DATEPICKER_HELPERS}
+ from={data[0]?.params?.iso_timestamp_start || ''}
+ helpers={helpers}
/>
<Button
type="default"