mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 12:55:06 +03:00
* Add lucide-react to docs (to make the autocomplete work). * Migrate the docs app icons. * Migrate the ui-patterns. * Remove the old icons from ui package. * Migrate the www app from react-feather icons. * Migrate all of studio icons. * Migrate the only component in design-system. * Fix an old import in ui package. Revert an import in docs app. * Fix some pages in www. * Remove unneeded files used in generation of icons. * Fix a prettier error. * Fix more issues in www. * Fix an issue in Log Date picker. * Replace all string sizes with number sizes because the icons grew in some cases. * Fix more imports in security page. * Fix an extra import. * Remove the size prop from all icons if they're in a button and they match the button size. * Minor fixes for docs and www. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
97 lines
3.1 KiB
TypeScript
97 lines
3.1 KiB
TypeScript
import { noop } from 'lodash'
|
|
import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button, Modal } from 'ui'
|
|
|
|
import CardButton from 'components/ui/CardButton'
|
|
import { Edit, ExternalLink, FlaskConical, Grid } from 'lucide-react'
|
|
import { useAppStateSnapshot } from 'state/app-state'
|
|
|
|
interface PolicySelectionProps {
|
|
description: string
|
|
showAssistantPreview: boolean
|
|
onViewTemplates: () => void
|
|
onViewEditor: () => void
|
|
onToggleFeaturePreviewModal?: () => void
|
|
}
|
|
|
|
const PolicySelection = ({
|
|
description = '',
|
|
showAssistantPreview,
|
|
onViewTemplates = noop,
|
|
onViewEditor = noop,
|
|
onToggleFeaturePreviewModal,
|
|
}: PolicySelectionProps) => {
|
|
const snap = useAppStateSnapshot()
|
|
|
|
return (
|
|
<Modal.Content className="space-y-4 py-4">
|
|
<div className="flex flex-col gap-y-2">
|
|
<p className="text-sm text-foreground-light">{description}</p>
|
|
<div className="grid grid-cols-1 gap-2 lg:grid-cols-1">
|
|
<CardButton
|
|
title="Get started quickly"
|
|
description="Create a policy from a template"
|
|
icon={
|
|
<div className="flex">
|
|
<div
|
|
className="
|
|
flex h-8 w-8 items-center
|
|
justify-center
|
|
rounded bg-foreground text-background
|
|
"
|
|
>
|
|
<Grid size={14} strokeWidth={2} />
|
|
</div>
|
|
</div>
|
|
}
|
|
onClick={onViewTemplates}
|
|
/>
|
|
<CardButton
|
|
title="For full customization"
|
|
description="Create a policy from scratch"
|
|
icon={
|
|
<div className="flex">
|
|
<div
|
|
className="
|
|
flex h-8 w-8 items-center
|
|
justify-center
|
|
rounded bg-foreground text-background
|
|
"
|
|
>
|
|
<Edit size={14} strokeWidth={2} />
|
|
</div>
|
|
</div>
|
|
}
|
|
onClick={onViewEditor}
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
{showAssistantPreview && onToggleFeaturePreviewModal !== undefined && (
|
|
<Alert_Shadcn_>
|
|
<FlaskConical />
|
|
<AlertTitle_Shadcn_>Try the new Supabase Assistant for RLS policies</AlertTitle_Shadcn_>
|
|
<AlertDescription_Shadcn_>
|
|
Create RLS policies for your tables with the help of AI
|
|
</AlertDescription_Shadcn_>
|
|
<div className="flex items-center gap-x-2 mt-3">
|
|
<Button type="default" onClick={onToggleFeaturePreviewModal}>
|
|
Toggle feature preview
|
|
</Button>
|
|
<Button asChild type="default" icon={<ExternalLink strokeWidth={1.5} />}>
|
|
<a
|
|
href="https://supabase.com/blog/studio-introducing-assistant#introducing-the-supabase-assistant"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
>
|
|
Learn more
|
|
</a>
|
|
</Button>
|
|
</div>
|
|
</Alert_Shadcn_>
|
|
)}
|
|
</Modal.Content>
|
|
)
|
|
}
|
|
|
|
export default PolicySelection
|