The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add types for DateRangePicker
Joshen Lim7f967e82d62b
diff --git a/studio/components/interfaces/BillingV2/Usage/Usage.tsx b/studio/components/interfaces/BillingV2/Usage/Usage.tsxindex f53f4e1c2ce..cd61a2d5889 100644--- a/studio/components/interfaces/BillingV2/Usage/Usage.tsx+++ b/studio/components/interfaces/BillingV2/Usage/Usage.tsx@@ -146,14 +146,11 @@ const Usage = () => {<div className="flex items-center space-x-4">{!isLoadingSubscription && (<DateRangePicker- id="billingCycle"- name="billingCycle"onChange={setDateRange}value={TIME_PERIODS_BILLING[0].key}options={[...TIME_PERIODS_BILLING, ...TIME_PERIODS_REPORTS]}loading={isLoadingSubscription}currentBillingPeriodStart={subscription?.current_period_start}- className="!w-[200px]"/>)}diff --git a/studio/components/interfaces/Organization/Usage/Usage.tsx b/studio/components/interfaces/Organization/Usage/Usage.tsxindex aeb0ab2933e..8ab2028de66 100644--- a/studio/components/interfaces/Organization/Usage/Usage.tsx+++ b/studio/components/interfaces/Organization/Usage/Usage.tsx@@ -99,14 +99,11 @@ const Usage = () => {{isSuccessSubscription && (<><DateRangePicker- id="billingCycle"- name="billingCycle"onChange={setDateRange}value={TIME_PERIODS_BILLING[0].key}options={[...TIME_PERIODS_BILLING, ...TIME_PERIODS_REPORTS]}loading={isLoadingSubscription}currentBillingPeriodStart={subscription?.current_period_start}- className="!w-[200px]"/><Listboxdiff --git a/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx b/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsxindex c47e5cfae33..caacdeee269 100644--- a/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx+++ b/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx@@ -155,14 +155,11 @@ const InfrastructureActivity = () => {{!isLoadingSubscription && (<><DateRangePicker- id="billingCycle"- name="billingCycle"onChange={setDateRange}value={TIME_PERIODS_REPORTS[0].key}options={[...TIME_PERIODS_BILLING, ...TIME_PERIODS_REPORTS]}loading={isLoadingSubscription}currentBillingPeriodStart={subscription?.current_period_start}- className="!w-[200px]"/><p className="text-sm text-scale-1000">{dayjs(startDate).format('DD MMM YYYY')} - {dayjs(endDate).format('DD MMM YYYY')}diff --git a/studio/components/to-be-cleaned/DateRangePicker.tsx b/studio/components/to-be-cleaned/DateRangePicker.tsxindex 220a0ce8ad9..d4061159430 100644--- a/studio/components/to-be-cleaned/DateRangePicker.tsx+++ b/studio/components/to-be-cleaned/DateRangePicker.tsx@@ -12,7 +12,29 @@ import { DATE_FORMAT } from 'lib/constants'* Otherwise there won't be any data shown on the graphs*/-const DateRangePicker = ({ onChange, value, options, loading, currentBillingPeriodStart }: any) => {+interface DateRangePickerProps {+ value: string+ loading: boolean+ onChange: ({+ period_start,+ period_end,+ interval,+ }: {+ period_start: { date: string; time_period: string }+ period_end: { date: string; time_period: string }+ interval?: string+ }) => void+ options: { key: string; label: string; interval?: string }[]+ currentBillingPeriodStart?: number+}++const DateRangePicker = ({+ onChange,+ value,+ options,+ loading,+ currentBillingPeriodStart,+}: DateRangePickerProps) => {const [timePeriod, setTimePeriod] = useState(value)useEffect(() => {@@ -34,11 +56,14 @@ const DateRangePicker = ({ onChange, value, options, loading, currentBillingPericase 'currentBillingCycle':onChange({period_start: {- date: dayjs.unix(currentBillingPeriodStart).format(DATE_FORMAT),+ date: dayjs.unix(currentBillingPeriodStart ?? 0).format(DATE_FORMAT),time_period: '1d',},period_end: {- date: dayjs.unix(currentBillingPeriodStart).add(1, 'month').format(DATE_FORMAT),+ date: dayjs+ .unix(currentBillingPeriodStart ?? 0)+ .add(1, 'month')+ .format(DATE_FORMAT),time_period: 'today',},interval: '1d',@@ -47,11 +72,14 @@ const DateRangePicker = ({ onChange, value, options, loading, currentBillingPericase 'previousBillingCycle':onChange({period_start: {- date: dayjs.unix(currentBillingPeriodStart).subtract(1, 'month').format(DATE_FORMAT),+ date: dayjs+ .unix(currentBillingPeriodStart ?? 0)+ .subtract(1, 'month')+ .format(DATE_FORMAT),time_period: '1d',},period_end: {- date: dayjs.unix(currentBillingPeriodStart).format(DATE_FORMAT),+ date: dayjs.unix(currentBillingPeriodStart ?? 0).format(DATE_FORMAT),time_period: 'today',},interval: '1d',@@ -177,7 +205,7 @@ const DateRangePicker = ({ onChange, value, options, loading, currentBillingPeri}><Button asChild type="default" iconRight={<IconChevronDown />}>- <span>{timePeriod && options.find((x: any) => x.key == timePeriod).label}</span>+ <span>{timePeriod && options.find((x: any) => x.key == timePeriod)?.label}</span></Button></Dropdown></>