mirror of
https://github.com/supabase/supabase.git
synced 2026-09-07 10:29:14 +08:00
Follow-up to #48344: collapses the two resolution paths for the Admonition module into one. `src/admonition.tsx` was a back-compat shim re-exporting `src/Admonition/`. Two ways to resolve one module is exactly what produced the macOS self-import bug fixed in #48344, and the local typecheck errors that #48374 worked around. This removes the shim and standardizes on the PascalCase subpath, matching every other export in the package. **Changed:** - Codemodded all 246 `ui-patterns/admonition` imports to `ui-patterns/Admonition` (240 `.tsx`, 5 `.mdx`, 1 `.ts` across studio, docs, www, design-system, and lite-studio) - Pointed the 5 internal `'../admonition'` imports back at the `'../Admonition'` directory **Removed:** - `packages/ui-patterns/src/admonition.tsx`, and its `./admonition` entry in the exports map (regenerated with `pnpm gen:exports`) ## To test - `grep -r "ui-patterns/admonition" --include='*.ts*'` → no hits - `pnpm test:case-hazards` → passes - `pnpm typecheck` → all 15 tasks green - `pnpm --filter studio run lint:ratchet` → passes - `pnpm --filter ui-patterns vitest run src/Admonition` → 11 tests pass <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Standardized Admonition component imports across the application and documentation. * Improved compatibility with case-sensitive environments by using the canonical component path. * Removed the legacy Admonition import entry point. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
120 lines
4.7 KiB
TypeScript
120 lines
4.7 KiB
TypeScript
import { useFlag } from 'common'
|
|
import { UseFormReturn } from 'react-hook-form'
|
|
import {
|
|
Badge,
|
|
cn,
|
|
FormControl,
|
|
FormField,
|
|
FormItem,
|
|
RadioGroupStacked,
|
|
RadioGroupStackedItem,
|
|
Tooltip,
|
|
TooltipContent,
|
|
TooltipTrigger,
|
|
} from 'ui'
|
|
import { Admonition } from 'ui-patterns/Admonition'
|
|
import { CollapsibleCardSection } from 'ui-patterns/CollapsibleCardSection'
|
|
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
|
|
|
import { CreateProjectForm } from './ProjectCreation.schema'
|
|
import { DocsButton } from '@/components/ui/DocsButton'
|
|
import Panel from '@/components/ui/Panel'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
|
|
interface AdvancedConfigurationProps {
|
|
form: UseFormReturn<CreateProjectForm>
|
|
}
|
|
|
|
export const AdvancedConfiguration = ({ form }: AdvancedConfigurationProps) => {
|
|
const disableOrioleProjectCreation = useFlag('disableOrioleProjectCreation')
|
|
|
|
return (
|
|
<Panel.Content>
|
|
<CollapsibleCardSection
|
|
title="Advanced Configuration"
|
|
description="These settings cannot be changed after the project is created"
|
|
>
|
|
<FormField
|
|
name="useOrioleDb"
|
|
control={form.control}
|
|
render={({ field }) => (
|
|
<>
|
|
<FormItemLayout
|
|
layout="horizontal"
|
|
label="Postgres Type"
|
|
className="[&>div>label]:break-normal!"
|
|
>
|
|
<FormControl>
|
|
<RadioGroupStacked
|
|
// Due to radio group not supporting boolean values
|
|
// value is converted to boolean
|
|
onValueChange={(value) => field.onChange(value === 'true')}
|
|
defaultValue={field.value.toString()}
|
|
>
|
|
<FormItem asChild>
|
|
<FormControl>
|
|
<RadioGroupStackedItem
|
|
value="false"
|
|
// @ts-ignore
|
|
label={
|
|
<>
|
|
Postgres
|
|
<Badge>Default</Badge>
|
|
</>
|
|
}
|
|
description="Recommended for production workloads"
|
|
className="[&>div>div>p]:text-left [&>div>div>p]:text-xs [&>div>div>label]:flex [&>div>div>label]:items-center [&>div>div>label]:gap-x-2"
|
|
/>
|
|
</FormControl>
|
|
</FormItem>
|
|
<FormItem asChild>
|
|
<FormControl>
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<RadioGroupStackedItem
|
|
value="true"
|
|
// @ts-ignore
|
|
label={
|
|
<>
|
|
Postgres with OrioleDB
|
|
<Badge variant="warning">Alpha</Badge>
|
|
</>
|
|
}
|
|
description="Not recommended for production workloads"
|
|
className={cn(
|
|
'[&>div>div>p]:text-left [&>div>div>p]:text-xs [&>div>div>label]:flex [&>div>div>label]:items-center [&>div>div>label]:gap-x-2',
|
|
form.getValues('useOrioleDb') ? 'rounded-b-none!' : ''
|
|
)}
|
|
disabled={disableOrioleProjectCreation}
|
|
/>
|
|
</TooltipTrigger>
|
|
{disableOrioleProjectCreation && (
|
|
<TooltipContent side="right" className="w-60 text-center">
|
|
OrioleDB is temporarily disabled for new projects. Please try again
|
|
later.
|
|
</TooltipContent>
|
|
)}
|
|
</Tooltip>
|
|
</FormControl>
|
|
</FormItem>
|
|
</RadioGroupStacked>
|
|
</FormControl>
|
|
{form.getValues('useOrioleDb') && (
|
|
<Admonition
|
|
type="warning"
|
|
className="rounded-t-none [&>div]:text-xs"
|
|
title="OrioleDB is not production ready"
|
|
description="Postgres with OrioleDB extension is currently in Public Alpha and not recommended for production usage yet."
|
|
>
|
|
<DocsButton className="mt-2" href={`${DOCS_URL}/guides/database/orioledb`} />
|
|
</Admonition>
|
|
)}
|
|
</FormItemLayout>
|
|
</>
|
|
)}
|
|
/>
|
|
</CollapsibleCardSection>
|
|
</Panel.Content>
|
|
)
|
|
}
|