Skip to content

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

chore: migrate Logs settings `Modal` to `Dialog` (#46229)

Gildas Garcia90dd19b41b2a
diff --git a/apps/studio/components/interfaces/Settings/Logs/Logs.UpdateSavedQueryModal.tsx b/apps/studio/components/interfaces/Settings/Logs/Logs.UpdateSavedQueryModal.tsx
index fecd04e41a2..42f067006a7 100644
--- a/apps/studio/components/interfaces/Settings/Logs/Logs.UpdateSavedQueryModal.tsx
+++ b/apps/studio/components/interfaces/Settings/Logs/Logs.UpdateSavedQueryModal.tsx
@@ -1,7 +1,21 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useEffect } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
-import { Button, Form, FormControl, FormField, Input, Modal, Textarea } from 'ui'
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogSection,
+ DialogSectionSeparator,
+ DialogTitle,
+ Form,
+ FormControl,
+ FormField,
+ Input,
+ Textarea,
+} from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import * as z from 'zod'
@@ -45,46 +59,56 @@ export const UpdateSavedQueryModal = ({
}
return (
- <Modal visible={visible} onCancel={handleCancel} hideFooter header={header} size="medium">
- <Form {...form}>
- <form onSubmit={form.handleSubmit(onSubmit)} noValidate>
- <Modal.Content>
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItemLayout layout="vertical" label="Name">
- <FormControl>
- <Input {...field} placeholder="Enter text" />
- </FormControl>
- </FormItemLayout>
- )}
- />
- </Modal.Content>
- <Modal.Content>
- <FormField
- control={form.control}
- name="description"
- render={({ field }) => (
- <FormItemLayout layout="vertical" label="Description">
- <FormControl>
- <Textarea {...field} placeholder="Describe query" className="resize-none" />
- </FormControl>
- </FormItemLayout>
- )}
- />
- </Modal.Content>
- <Modal.Separator />
- <Modal.Content className="flex items-center justify-end gap-2">
- <Button htmlType="reset" type="default" onClick={handleCancel} disabled={isSubmitting}>
- Cancel
- </Button>
- <Button htmlType="submit" loading={isSubmitting} disabled={isSubmitting || !isDirty}>
- Save query
- </Button>
- </Modal.Content>
- </form>
- </Form>
- </Modal>
+ <Dialog open={visible} onOpenChange={handleCancel}>
+ <DialogContent size="medium">
+ <DialogHeader>
+ <DialogTitle>{header}</DialogTitle>
+ </DialogHeader>
+ <DialogSectionSeparator />
+ <Form {...form}>
+ <form onSubmit={form.handleSubmit(onSubmit)} noValidate>
+ <DialogSection>
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItemLayout layout="vertical" label="Name">
+ <FormControl>
+ <Input {...field} placeholder="Enter text" />
+ </FormControl>
+ </FormItemLayout>
+ )}
+ />
+ </DialogSection>
+ <DialogSection>
+ <FormField
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <FormItemLayout layout="vertical" label="Description">
+ <FormControl>
+ <Textarea {...field} placeholder="Describe query" className="resize-none" />
+ </FormControl>
+ </FormItemLayout>
+ )}
+ />
+ </DialogSection>
+ <DialogFooter>
+ <Button
+ htmlType="reset"
+ type="default"
+ onClick={handleCancel}
+ disabled={isSubmitting}
+ >
+ Cancel
+ </Button>
+ <Button htmlType="submit" loading={isSubmitting} disabled={isSubmitting || !isDirty}>
+ Save query
+ </Button>
+ </DialogFooter>
+ </form>
+ </Form>
+ </DialogContent>
+ </Dialog>
)
}
diff --git a/apps/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx b/apps/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx
index ee45244719e..b0e94e24f57 100644
--- a/apps/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx
+++ b/apps/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx
@@ -1,5 +1,14 @@
import Link from 'next/link'
-import { Button, Modal } from 'ui'
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogSection,
+ DialogSectionSeparator,
+ DialogTitle,
+} from 'ui'
import { TIER_QUERY_LIMITS } from './Logs.constants'
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
@@ -29,54 +38,55 @@ const UpgradePrompt: React.FC<Props> = ({
const { data: organization } = useSelectedOrganizationQuery()
return (
- <Modal
- hideFooter
- visible={show}
- size="medium"
- header={title}
- onCancel={() => setShowUpgradePrompt(false)}
- >
- <Modal.Content>
- <div className="space-y-4">
- <p className="text-sm">{description}</p>
- <div className="border-control bg-surface-300 rounded-sm border">
- <div className="flex items-center px-4 pt-2 pb-1">
- <p className="text-foreground-light w-[40%] text-sm">Plan</p>
- <p className="text-foreground-light w-[60%] text-sm">Retention duration</p>
- </div>
- <div className="py-1">
- <div className="flex items-center px-4 py-1">
- <p className="w-[40%] text-sm">Free</p>
- <p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.FREE.text}</p>
- </div>
- <div className="flex items-center px-4 py-1">
- <p className="w-[40%] text-sm">Pro</p>
- <p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.PRO.text}</p>
- </div>
- <div className="flex items-center px-4 py-1">
- <p className="w-[40%] text-sm">Team</p>
- <p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.TEAM.text}</p>
+ <Dialog open={show} onOpenChange={() => setShowUpgradePrompt(false)}>
+ <DialogContent size="medium">
+ <DialogHeader>
+ <DialogTitle>{title}</DialogTitle>
+ </DialogHeader>
+ <DialogSectionSeparator />
+ <DialogSection>
+ <div className="space-y-4">
+ <p className="text-sm">{description}</p>
+ <div className="border-control bg-surface-300 rounded-sm border">
+ <div className="flex items-center px-4 pt-2 pb-1">
+ <p className="text-foreground-light w-[40%] text-sm">Plan</p>
+ <p className="text-foreground-light w-[60%] text-sm">Retention duration</p>
</div>
- <div className="flex items-center px-4 py-1">
- <p className="w-[40%] text-sm">Enterprise</p>
- <p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.ENTERPRISE.text}</p>
+ <div className="py-1">
+ <div className="flex items-center px-4 py-1">
+ <p className="w-[40%] text-sm">Free</p>
+ <p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.FREE.text}</p>
+ </div>
+ <div className="flex items-center px-4 py-1">
+ <p className="w-[40%] text-sm">Pro</p>
+ <p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.PRO.text}</p>
+ </div>
+ <div className="flex items-center px-4 py-1">
+ <p className="w-[40%] text-sm">Team</p>
+ <p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.TEAM.text}</p>
+ </div>
+ <div className="flex items-center px-4 py-1">
+ <p className="w-[40%] text-sm">Enterprise</p>
+ <p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.ENTERPRISE.text}</p>
+ </div>
</div>
</div>
</div>
- </div>
- </Modal.Content>
- <Modal.Separator />
- <Modal.Content className="flex justify-end gap-3">
- <Button type="default" onClick={() => setShowUpgradePrompt(false)}>
- Close
- </Button>
- <Button asChild size="tiny">
- <Link href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=${source}`}>
- Upgrade
- </Link>
- </Button>
- </Modal.Content>
- </Modal>
+ </DialogSection>
+ <DialogFooter className="flex justify-end gap-3">
+ <Button type="default" onClick={() => setShowUpgradePrompt(false)}>
+ Close
+ </Button>
+ <Button asChild size="tiny">
+ <Link
+ href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=${source}`}
+ >
+ Upgrade
+ </Link>
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
)
}