The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: Minor papercut fixes in the studio (#21319)
Ivan Vasilov630eeefa933f
diff --git a/apps/studio/components/interfaces/Account/Preferences/ProfileInformation.tsx b/apps/studio/components/interfaces/Account/Preferences/ProfileInformation.tsxindex a1628b16058..edba22306aa 100644--- a/apps/studio/components/interfaces/Account/Preferences/ProfileInformation.tsx+++ b/apps/studio/components/interfaces/Account/Preferences/ProfileInformation.tsx@@ -30,7 +30,7 @@ export const ProfileInformation = ({ profile }: { profile: Profile }) => {const form = useForm({resolver: zodResolver(FormSchema),- defaultValues: { first_name: profile.first_name, last_name: profile.last_name },+ defaultValues: { first_name: profile.first_name ?? '', last_name: profile.last_name ?? '' },})const { mutateAsync: updateProfile, isLoading } = useProfileUpdateMutation({diff --git a/apps/studio/components/interfaces/Database/Backups/PITR/PITRNotice.tsx b/apps/studio/components/interfaces/Database/Backups/PITR/PITRNotice.tsxindex cc1279ae7ba..acd6d7836ba 100644--- a/apps/studio/components/interfaces/Database/Backups/PITR/PITRNotice.tsx+++ b/apps/studio/components/interfaces/Database/Backups/PITR/PITRNotice.tsx@@ -29,7 +29,7 @@ const PITRNotice = ({}) => {</span><Tooltip.Root delayDuration={0}><Tooltip.Trigger asChild>- <Button asChild disabled={canUpdateSubscription} type="default">+ <Button asChild disabled={!canUpdateSubscription} type="default"><Link href={`/project/${projectRef}/settings/addons?panel=pitr`}>Increase retention period</Link>diff --git a/apps/studio/components/interfaces/Database/Backups/PITR/PITRSelection.tsx b/apps/studio/components/interfaces/Database/Backups/PITR/PITRSelection.tsxindex 6b1b09c71a7..2a92aa8409e 100644--- a/apps/studio/components/interfaces/Database/Backups/PITR/PITRSelection.tsx+++ b/apps/studio/components/interfaces/Database/Backups/PITR/PITRSelection.tsx@@ -24,7 +24,9 @@ import InformationBox from 'components/ui/InformationBox'import { useBackupsQuery } from 'data/database/backups-query'import { usePitrRestoreMutation } from 'data/database/pitr-restore-mutation'import { setProjectStatus } from 'data/projects/projects-query'+import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'import { PROJECT_STATUS } from 'lib/constants'+import Link from 'next/link'import BackupsEmpty from '../BackupsEmpty'import { Timezone } from './PITR.types'import {@@ -35,9 +37,7 @@ import {} from './PITR.utils'import PITRStatus from './PITRStatus'import TimeInput from './TimeInput'-import TimezoneSelection from './TimezoneSelection'-import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'-import Link from 'next/link'+import { TimezoneSelection } from './TimezoneSelection'const PITRSelection = () => {const router = useRouter()@@ -294,8 +294,6 @@ const PITRSelection = () => {<p className="text-sm text-foreground-light">Time zone</p><div className="w-[350px]"><TimezoneSelection- hideLabel- dropdownWidth="w-[400px]"selectedTimezone={selectedTimezone}onSelectTimezone={setSelectedTimezone}/>diff --git a/apps/studio/components/interfaces/Database/Backups/PITR/PITRStatus.tsx b/apps/studio/components/interfaces/Database/Backups/PITR/PITRStatus.tsxindex 09bb66c3363..4b083ad80f0 100644--- a/apps/studio/components/interfaces/Database/Backups/PITR/PITRStatus.tsx+++ b/apps/studio/components/interfaces/Database/Backups/PITR/PITRStatus.tsx@@ -7,10 +7,10 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'import { useParams } from 'common'import { FormPanel } from 'components/ui/Forms'import { useBackupsQuery } from 'data/database/backups-query'+import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'import { useCheckPermissions } from 'hooks'import { Timezone } from './PITR.types'-import TimezoneSelection from './TimezoneSelection'-import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'+import { TimezoneSelection } from './TimezoneSelection'interface PITRStatusProps {selectedTimezone: Timezone@@ -92,7 +92,6 @@ const PITRStatus = ({<div className="p-6 space-y-6"><div className="w-[350px]"><TimezoneSelection- hideLabelselectedTimezone={selectedTimezone}onSelectTimezone={onUpdateTimezone}/>diff --git a/apps/studio/components/interfaces/Database/Backups/PITR/TimezoneSelection.tsx b/apps/studio/components/interfaces/Database/Backups/PITR/TimezoneSelection.tsxindex d34b20c339c..1b71f9414b6 100644--- a/apps/studio/components/interfaces/Database/Backups/PITR/TimezoneSelection.tsx+++ b/apps/studio/components/interfaces/Database/Backups/PITR/TimezoneSelection.tsx@@ -1,78 +1,87 @@-import { FormEvent, useState } from 'react'-import { IconGlobe, IconSearch, Listbox } from 'ui'+import { useState } from 'react'+import {+ Button,+ CommandEmpty_Shadcn_,+ CommandGroup_Shadcn_,+ CommandInput_Shadcn_,+ CommandItem_Shadcn_,+ Command_Shadcn_,+ IconGlobe,+ PopoverContent_Shadcn_,+ PopoverTrigger_Shadcn_,+ Popover_Shadcn_,+ ScrollArea,+ cn,+} from 'ui'+import { CheckIcon, ChevronsUpDown } from 'lucide-react'import { ALL_TIMEZONES } from './PITR.constants'+import { Timezone } from './PITR.types'interface TimezoneSelectionProps {- hideLabel?: boolean- dropdownWidth?: string- selectedTimezone: any- onSelectTimezone: (timezone: any) => void+ selectedTimezone: Timezone+ onSelectTimezone: (timezone: Timezone) => void}-const TimezoneSelection = ({- hideLabel,- dropdownWidth,+export const TimezoneSelection = ({selectedTimezone,onSelectTimezone,}: TimezoneSelectionProps) => {- const [searchString, setSearchString] = useState<string>('')+ const [open, setOpen] = useState(false)- const timezoneOptions =- searchString.length > 0- ? ALL_TIMEZONES.map((option) => option.text).filter((option) =>- option.toLowerCase().includes(searchString.toLowerCase())- )- : ALL_TIMEZONES.map((option) => option.text)+ const timezoneOptions = ALL_TIMEZONES.map((option) => option.text)return (- <div className="flex justify-between space-x-8">- {!hideLabel && <p className="w-2/5 text-sm">Select timezone</p>}- <div className={`${hideLabel ? 'w-full' : 'w-3/5'}`}>- <Listbox- value={selectedTimezone.text}- icon={<IconGlobe />}- onChange={(text) => {- const selectedTimezone = ALL_TIMEZONES.find((option) => option.text === text)- onSelectTimezone(selectedTimezone)- }}- onBlur={() => setSearchString('')}- >- <div- className={[- 'fixed top-0 flex w-full items-center',- 'rounded-t-md border-b border-overlay bg-surface-300',- 'mb-4 space-x-2 px-4 py-2',- ].join(' ')}- style={{ zIndex: 1 }}+ <div className="w-full">+ <Popover_Shadcn_ open={open} onOpenChange={setOpen}>+ <PopoverTrigger_Shadcn_ asChild>+ <Button+ role="combobox"+ aria-expanded={open}+ className="w-[350px] justify-between"+ size="small"+ icon={<IconGlobe />}+ iconRight={<ChevronsUpDown size={14} strokeWidth={1.5} />}>- <IconSearch size={14} />- <input- autoFocus- className="placeholder-foreground-lighter w-72 bg-transparent text-sm outline-none"- value={searchString}- placeholder={''}- onChange={(e: FormEvent<HTMLInputElement>) => setSearchString(e.currentTarget.value)}- />- </div>- {/* Whitespace to shift listbox options down for searchfield */}- <div className="h-8" />- {timezoneOptions.map((option) => {- return (- <Listbox.Option key={option} label={option} value={option} className={dropdownWidth}>- <div>{option}</div>- </Listbox.Option>- )- })}- {timezoneOptions.length === 0 && (- <Listbox.Option disabled key="no-results" label="" value="">- No timezones found- </Listbox.Option>- )}- </Listbox>- </div>+ {selectedTimezone+ ? timezoneOptions.find((option) => option === selectedTimezone.text)+ : 'Select timezone...'}+ </Button>+ </PopoverTrigger_Shadcn_>+ <PopoverContent_Shadcn_ className="w-[350px] p-0">+ <Command_Shadcn_>+ <CommandInput_Shadcn_ placeholder="Search timezone..." className="h-9" />+ <CommandEmpty_Shadcn_> No timezones found</CommandEmpty_Shadcn_>+ <CommandGroup_Shadcn_>+ <ScrollArea className="h-72">+ {timezoneOptions.map((option) => (+ <CommandItem_Shadcn_+ key={option}+ value={option}+ onSelect={(text) => {+ const selectedTimezone = ALL_TIMEZONES.find(+ (option) => option.text.toLocaleLowerCase() === text+ )+ if (selectedTimezone) {+ onSelectTimezone(selectedTimezone)+ setOpen(false)+ }+ }}+ >+ {option}+ <CheckIcon+ className={cn(+ 'ml-auto h-4 w-4',+ selectedTimezone.text === option ? 'opacity-100' : 'opacity-0'+ )}+ />+ </CommandItem_Shadcn_>+ ))}+ </ScrollArea>+ </CommandGroup_Shadcn_>+ </Command_Shadcn_>+ </PopoverContent_Shadcn_>+ </Popover_Shadcn_></div>)}--export default TimezoneSelectiondiff --git a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsxindex be5965ecd29..734c7d54ae4 100644--- a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx+++ b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx@@ -145,7 +145,7 @@ const FunctionsList = ({<Table.th key="return_type" className="hidden lg:table-cell">Return type</Table.th>- <Table.th key="return_type" className="hidden lg:table-cell w-[100px]">+ <Table.th key="security" className="hidden lg:table-cell w-[100px]">Security</Table.th><Table.th key="buttons" className="w-1/6"></Table.th>diff --git a/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx b/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsxindex f9a8ba3a77d..e1bd991b747 100644--- a/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx+++ b/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx@@ -67,7 +67,7 @@ const TriggerList = ({if (_triggers.length === 0 && filterString.length > 0) {return (<Table.tr key={schema}>- <Table.td colSpan={5}>+ <Table.td colSpan={6}><p className="text-sm text-foreground">No results found</p><p className="text-sm text-foreground-light">Your search for "{filterString}" did not return any resultsdiff --git a/apps/studio/pages/project/_/[[...routeSlug]].tsx b/apps/studio/pages/project/_/[[...routeSlug]].tsxindex b9f75ebce50..a6c7ec0ec4e 100644--- a/apps/studio/pages/project/_/[[...routeSlug]].tsx+++ b/apps/studio/pages/project/_/[[...routeSlug]].tsx@@ -38,13 +38,13 @@ const GenericProjectPage: NextPage = () => {const urlRewriterFactory = (slug: string | string[] | undefined) => {return (projectRef: string) => {- const hash = location.hash ? `#${location.hash}` : undefined+ const hash = location.hashif (!Array.isArray(slug)) {return [`/project/${projectRef}`, query, hash].filter(Boolean).join('')}- const slugPath = slug.reduce((a, b) => `${a}/${b}`, '').slice(1)+ const slugPath = slug.join('/')return [`/project/${projectRef}/${slugPath}`, query, hash].filter(Boolean).join('')}}diff --git a/packages/ui/src/components/NavMenu/index.tsx b/packages/ui/src/components/NavMenu/index.tsxindex b8f0be774c5..7dc6c2a9452 100644--- a/packages/ui/src/components/NavMenu/index.tsx+++ b/packages/ui/src/components/NavMenu/index.tsx@@ -21,14 +21,15 @@ export const NavMenu = forwardRef<HTMLDivElement, NavMenuProps>(export const NavMenuItem = ({children,className,+ active,...props}: PropsWithChildren<{className?: stringactive: boolean}>) => (<li- aria-selected={props.active ? 'true' : 'false'}- data-state={props.active ? 'active' : 'inactive'}+ aria-selected={active ? 'true' : 'false'}+ data-state={active ? 'active' : 'inactive'}className={cn('inline-flex items-center justify-center whitespace-nowrap text-sm ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground text-foreground-lighter hover:text-foreground data-[state=active]:border-foreground border-b-2 border-transparent *:px-3 *:py-1.5',className