Skip to content

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

UI fixes

Joshen Lim86e51ddb2f81
diff --git a/studio/components/interfaces/Integrations/ProjectLinker.tsx b/studio/components/interfaces/Integrations/ProjectLinker.tsx
index a619b126559..b537e6a6602 100644
--- a/studio/components/interfaces/Integrations/ProjectLinker.tsx
+++ b/studio/components/interfaces/Integrations/ProjectLinker.tsx
@@ -1,7 +1,9 @@
import { ReactNode, useRef, useState } from 'react'
-import { IntegrationProjectConnection } from 'data/integrations/integrations.types'
-import { IntegrationConnectionsCreateVariables } from 'data/integrations/integrations.types'
+import {
+ IntegrationConnectionsCreateVariables,
+ IntegrationProjectConnection,
+} from 'data/integrations/integrations.types'
import { useSelectedOrganization } from 'hooks'
import { BASE_PATH } from 'lib/constants'
import { toast } from 'react-hot-toast'
@@ -19,8 +21,6 @@ import {
Popover_Shadcn_,
cn,
} from 'ui'
-import { useProjectsQuery } from 'data/projects/projects-query'
-import { useVercelProjectsQuery } from 'data/integrations/integrations-vercel-projects-query'
export interface Project {
id: string
diff --git a/studio/components/interfaces/Organization/AuditLogs/AuditLogs.tsx b/studio/components/interfaces/Organization/AuditLogs/AuditLogs.tsx
index aa36a0286b7..56dda8f2de7 100644
--- a/studio/components/interfaces/Organization/AuditLogs/AuditLogs.tsx
+++ b/studio/components/interfaces/Organization/AuditLogs/AuditLogs.tsx
@@ -1,7 +1,7 @@
import * as Tooltip from '@radix-ui/react-tooltip'
import dayjs from 'dayjs'
import Image from 'next/image'
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
import { Alert, Button, IconArrowDown, IconArrowUp, IconRefreshCw, IconUser } from 'ui'
import { useParams } from 'common'
@@ -51,6 +51,23 @@ const AuditLogs = () => {
iso_timestamp_end: dateRange.to,
})
+ // This feature depends on the subscription tier of the user. Free user can view logs up to 1 day
+ // in the past. The API limits the logs to maximum of 1 day and 5 minutes so when the page is
+ // viewed for more than 5 minutes, the call parameters needs to be updated. This also works with
+ // higher tiers (7 days of logs).The user will see a loading shimmer.
+ useEffect(() => {
+ const duration = dayjs(dateRange.from).diff(dayjs(dateRange.to))
+ const interval = setInterval(() => {
+ const currentTime = dayjs().utc().set('millisecond', 0)
+ setDateRange({
+ from: currentTime.add(duration).toISOString(),
+ to: currentTime.toISOString(),
+ })
+ }, 5 * 60000)
+
+ return () => clearInterval(interval)
+ }, [dateRange.from, dateRange.to])
+
const members = detailData?.members ?? []
const roles = rolesData?.roles ?? []
diff --git a/studio/components/ui/AlertError.tsx b/studio/components/ui/AlertError.tsx
index dfd6b976a9a..aed01b2fc59 100644
--- a/studio/components/ui/AlertError.tsx
+++ b/studio/components/ui/AlertError.tsx
@@ -31,8 +31,13 @@ const AlertError = ({ ref, subject, error, className }: AlertErrorProps) => {
<IconAlertCircle className="h-4 w-4" />
<AlertTitle_Shadcn_>{subject}</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_ className="flex flex-col gap-3">
- {error?.message && <p>Error: {error?.message}</p>}
- Try refreshing your browser, but if the issue persists, please reach out to us via support.
+ <div>
+ {error?.message && <p>Error: {error?.message}</p>}
+ <p>
+ Try refreshing your browser, but if the issue persists, please reach out to us via
+ support.
+ </p>
+ </div>
<div>
<Link key="contact-support" href={href} passHref>
<Button type="warning" asChild>
diff --git a/studio/components/ui/DatePicker/DatePicker.tsx b/studio/components/ui/DatePicker/DatePicker.tsx
index 9d1deb498f1..e34910be428 100644
--- a/studio/components/ui/DatePicker/DatePicker.tsx
+++ b/studio/components/ui/DatePicker/DatePicker.tsx
@@ -1,19 +1,22 @@
-import React, { useState, useEffect } from 'react'
+import React, { useEffect, useState } from 'react'
import DatePicker from 'react-datepicker'
import {
Button,
- Popover,
- IconChevronLeft,
- IconChevronRight,
IconArrowRight,
IconCalendar,
+ IconChevronLeft,
+ IconChevronRight,
+ Popover,
+ PopoverContent_Shadcn_,
+ PopoverTrigger_Shadcn_,
+ Popover_Shadcn_,
} from 'ui'
+import { DatePickerToFrom } from 'components/interfaces/Settings/Logs'
import { format } from 'date-fns'
-import TimeSplitInput from './TimeSplitInput'
import dayjs from 'dayjs'
import { ButtonProps } from 'ui/src/components/Button/Button'
-import { DatePickerToFrom } from 'components/interfaces/Settings/Logs'
+import TimeSplitInput from './TimeSplitInput'
export interface DatePickerProps {
onChange?: (args: DatePickerToFrom) => void
@@ -139,64 +142,87 @@ function _DatePicker({
if (onChange) onChange({ from: null, to: null })
}
+
return (
- <Popover
- open={open}
- onOpenChange={(e) => setOpen(e)}
- size="small"
- align="center"
- side="bottom"
- header={
- hideTime ? null : (
- <>
- <div className="flex items-stretch justify-between py-2">
- {!selectsRange ? null : (
+ <Popover_Shadcn_ open={open} onOpenChange={setOpen}>
+ <PopoverTrigger_Shadcn_ asChild>
+ <Button
+ title={triggerButtonTitle}
+ type={triggerButtonType}
+ icon={<IconCalendar />}
+ className={triggerButtonClassName}
+ >
+ {children !== undefined ? (
+ children
+ ) : (
+ <>
+ {/* Custom */}
+ {selectsRange &&
+ appliedStartDate &&
+ appliedEndDate &&
+ appliedStartDate !== appliedEndDate ? (
<>
- <div className="flex grow flex-col gap-1">
- <TimeSplitInput
- type="start"
- startTime={startTime}
- endTime={endTime}
- time={startTime}
- setTime={setStartTime}
- setStartTime={setStartTime}
- setEndTime={setEndTime}
- startDate={startDate}
- endDate={endDate}
- />
- </div>
- <div
- className={`
+ {format(new Date(appliedStartDate), 'dd MMM')} -{' '}
+ {format(new Date(appliedEndDate), 'dd MMM')}
+ </>
+ ) : appliedStartDate || appliedEndDate ? (
+ format(new Date((appliedStartDate || appliedEndDate)!), 'dd MMM')
+ ) : (
+ 'Custom'
+ )}
+ </>
+ )}
+ </Button>
+ </PopoverTrigger_Shadcn_>
+ <PopoverContent_Shadcn_ align="center" side="bottom" className="p-0">
+ <>
+ {hideTime ? null : (
+ <>
+ <div className="flex items-stretch justify-between py-2">
+ {!selectsRange ? null : (
+ <>
+ <div className="flex grow flex-col gap-1">
+ <TimeSplitInput
+ type="start"
+ startTime={startTime}
+ endTime={endTime}
+ time={startTime}
+ setTime={setStartTime}
+ setStartTime={setStartTime}
+ setEndTime={setEndTime}
+ startDate={startDate}
+ endDate={endDate}
+ />
+ </div>
+ <div
+ className={`
flex
w-12
items-center
justify-center
text-scale-900
`}
- >
- <IconArrowRight strokeWidth={1.5} size={14} />
- </div>
- </>
- )}
- <div className="flex grow flex-col gap-1">
- <TimeSplitInput
- type="end"
- startTime={startTime}
- endTime={endTime}
- time={endTime}
- setTime={setEndTime}
- setStartTime={setStartTime}
- setEndTime={setEndTime}
- startDate={startDate}
- endDate={endDate}
- />
+ >
+ <IconArrowRight strokeWidth={1.5} size={14} />
+ </div>
+ </>
+ )}
+ <div className="flex grow flex-col gap-1">
+ <TimeSplitInput
+ type="end"
+ startTime={startTime}
+ endTime={endTime}
+ time={endTime}
+ setTime={setEndTime}
+ setStartTime={setStartTime}
+ setEndTime={setEndTime}
+ startDate={startDate}
+ endDate={endDate}
+ />
+ </div>
</div>
- </div>
- </>
- )
- }
- overlay={
- <>
+ </>
+ )}
<div className="px-3 py-4">
<DatePicker
inline
@@ -262,37 +288,8 @@ function _DatePicker({
<Button onClick={() => handleSubmit()}>Apply</Button>
</div>
</>
- }
- >
- <Button
- asChild
- title={triggerButtonTitle}
- type={triggerButtonType}
- icon={<IconCalendar />}
- className={triggerButtonClassName}
- >
- {children !== undefined ? (
- children
- ) : (
- <>
- {/* Custom */}
- {selectsRange &&
- appliedStartDate &&
- appliedEndDate &&
- appliedStartDate !== appliedEndDate ? (
- <>
- {format(new Date(appliedStartDate), 'dd MMM')} -{' '}
- {format(new Date(appliedEndDate), 'dd MMM')}
- </>
- ) : appliedStartDate || appliedEndDate ? (
- format(new Date((appliedStartDate || appliedEndDate)!), 'dd MMM')
- ) : (
- 'Custom'
- )}
- </>
- )}
- </Button>
- </Popover>
+ </PopoverContent_Shadcn_>
+ </Popover_Shadcn_>
)
}
diff --git a/studio/package.json b/studio/package.json
index 9bad8f60b1d..a8c3639f106 100644
--- a/studio/package.json
+++ b/studio/package.json
@@ -82,7 +82,7 @@
"react-beautiful-dnd": "^13.1.0",
"react-contexify": "^5.0.0",
"react-csv": "^2.0.3",
- "react-datepicker": "^4.8.0",
+ "react-datepicker": "^4.16.0",
"react-dnd": "^14.0.3",
"react-dnd-html5-backend": "^14.0.1",
"react-dom": "^17.0.2",