Files
supabase/apps/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx
Ivan Vasilov 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

107 lines
3.9 KiB
TypeScript

import { JwtSecretUpdateStatus } from '@supabase/shared-types/out/events'
import { useParams } from 'common'
import { AlertCircle, Loader } from 'lucide-react'
import { PropsWithChildren } from 'react'
import { Input } from 'ui'
import Panel from '@/components/ui/Panel'
import { useJwtSecretUpdatingStatusQuery } from '@/data/config/jwt-secret-updating-status-query'
import { useProjectPostgrestConfigQuery } from '@/data/config/project-postgrest-config-query'
import { useProjectSettingsV2Query } from '@/data/config/project-settings-v2-query'
export const DisplayConfigSettings = () => {
const { ref: projectRef } = useParams()
const {
data: settings,
isPending: isProjectSettingsLoading,
isError: isProjectSettingsError,
} = useProjectSettingsV2Query({
projectRef,
})
const { data: config, isError: isPostgrestError } = useProjectPostgrestConfigQuery({ projectRef })
const {
data,
isError: isJwtSecretUpdateStatusError,
isPending: isJwtSecretUpdateStatusLoading,
} = useJwtSecretUpdatingStatusQuery({ projectRef })
const jwtSecretUpdateStatus = data?.jwtSecretUpdateStatus
const isNotUpdatingJwtSecret =
jwtSecretUpdateStatus === undefined || jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updated
const jwtSecret = config?.jwt_secret ?? ''
const protocol = settings?.app_config?.protocol ?? 'https'
const endpoint = settings?.app_config?.endpoint
const apiUrl = endpoint ? `${protocol}://${endpoint}` : '-'
return (
<ConfigContentWrapper>
{isProjectSettingsError || isPostgrestError || isJwtSecretUpdateStatusError ? (
<div className="flex items-center justify-center py-8 space-x-2">
<AlertCircle size={16} strokeWidth={1.5} />
<p className="text-sm text-foreground-light">
{isProjectSettingsError || isPostgrestError
? 'Failed to retrieve configuration'
: 'Failed to update JWT secret'}
</p>
</div>
) : isProjectSettingsLoading || isPostgrestError || isJwtSecretUpdateStatusLoading ? (
<div className="flex items-center justify-center py-8 space-x-2">
<Loader className="animate-spin" size={16} strokeWidth={1.5} />
<p className="text-sm text-foreground-light">
{isProjectSettingsLoading ? 'Retrieving API keys' : 'JWT secret is being updated'}
</p>
</div>
) : (
<>
<Panel.Content>
<Input
label="URL"
readOnly
copy
disabled
className="input-mono"
value={apiUrl}
descriptionText="A RESTful endpoint for querying and managing your database."
layout="horizontal"
/>
</Panel.Content>
<Panel.Content className="border-t border-panel-border-interior-light in-data-[theme*=dark]:border-panel-border-interior-dark">
<Input
label="JWT Secret"
readOnly
copy={isNotUpdatingJwtSecret}
reveal={isNotUpdatingJwtSecret}
disabled
value={
jwtSecretUpdateStatus === JwtSecretUpdateStatus.Failed
? 'JWT secret update failed'
: jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updating
? 'Updating JWT secret...'
: jwtSecret
}
className="input-mono"
descriptionText="Used to decode your JWTs. You can also use this to mint your own JWTs."
layout="horizontal"
/>
</Panel.Content>
</>
)}
</ConfigContentWrapper>
)
}
const ConfigContentWrapper = ({ children }: PropsWithChildren<{}>) => {
return (
<Panel
title={
<div className="space-y-3">
<h5 className="text-base">Project Configuration</h5>
</div>
}
>
{children}
</Panel>
)
}