From 8111d8665d62ae61df999e9f13288e154ecdbc25 Mon Sep 17 00:00:00 2001 From: Vignesh Date: Wed, 4 Dec 2024 19:50:40 +0530 Subject: [PATCH] refactor: replace Dialog components with ResponsiveModel for improved UI consistency --- .../dashboard/_component/invite-button.tsx | 17 +- .../sidebar/orgs-sidebar/new-org-button.tsx | 8 +- .../(main)/projects/[id]/changelogs/page.tsx | 10 +- apps/web/components/empty-states/no-org.tsx | 19 +- apps/web/components/md/link-modal.tsx | 54 ++--- .../web/components/modals/changelog-modal.tsx | 182 ++++++++-------- apps/web/components/modals/confirm-modal.tsx | 2 +- apps/web/components/modals/feedback-modal.tsx | 196 +++++++++--------- apps/web/components/modals/input-modal.tsx | 66 +++--- apps/web/components/responsive-model.tsx | 57 +++-- apps/web/components/ui/date-picker.tsx | 2 +- packages/backend/convex/_generated/api.d.ts | 1 - packages/backend/convex/_generated/api.js | 1 - .../backend/convex/_generated/dataModel.d.ts | 1 - .../backend/convex/_generated/server.d.ts | 1 - packages/backend/convex/_generated/server.js | 1 - 16 files changed, 305 insertions(+), 313 deletions(-) diff --git a/apps/web/app/(main)/dashboard/_component/invite-button.tsx b/apps/web/app/(main)/dashboard/_component/invite-button.tsx index 6e82829..7c99674 100644 --- a/apps/web/app/(main)/dashboard/_component/invite-button.tsx +++ b/apps/web/app/(main)/dashboard/_component/invite-button.tsx @@ -1,21 +1,22 @@ import { OrganizationProfile } from "@clerk/nextjs"; import { Plus } from "lucide-react"; +import ResponsiveModel from "@/components/responsive-model"; import { Button } from "@/components/ui/button"; -import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; const InviteButton = () => { return ( - - + Invite members - - - - - + } + asChild + > + + ); }; diff --git a/apps/web/app/(main)/dashboard/_component/sidebar/orgs-sidebar/new-org-button.tsx b/apps/web/app/(main)/dashboard/_component/sidebar/orgs-sidebar/new-org-button.tsx index b1e6d04..efd3261 100644 --- a/apps/web/app/(main)/dashboard/_component/sidebar/orgs-sidebar/new-org-button.tsx +++ b/apps/web/app/(main)/dashboard/_component/sidebar/orgs-sidebar/new-org-button.tsx @@ -23,8 +23,12 @@ const NewButton = () => { - - + + + ); }; diff --git a/apps/web/app/(main)/projects/[id]/changelogs/page.tsx b/apps/web/app/(main)/projects/[id]/changelogs/page.tsx index 523991e..fa81687 100644 --- a/apps/web/app/(main)/projects/[id]/changelogs/page.tsx +++ b/apps/web/app/(main)/projects/[id]/changelogs/page.tsx @@ -19,15 +19,15 @@ const ChangelogsPage = ({ params: { id } }: PagePropsWithProjectId) => { const { onOpen } = useChangelogModal(); return ( - <> +

Changelogs

- - @@ -72,9 +72,9 @@ const ChangelogsPage = ({ params: { id } }: PagePropsWithProjectId) => {
- {" "} + - +
); }; diff --git a/apps/web/components/empty-states/no-org.tsx b/apps/web/components/empty-states/no-org.tsx index ea22e4a..50a674f 100644 --- a/apps/web/components/empty-states/no-org.tsx +++ b/apps/web/components/empty-states/no-org.tsx @@ -2,7 +2,7 @@ import { CreateOrganization } from "@clerk/nextjs"; import Image from "next/image"; import { Button } from "@/components/ui/button"; -import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; +import ResponsiveModel from "../responsive-model"; const NoOrg = () => { return ( @@ -14,17 +14,16 @@ const NoOrg = () => { Create an organization to get started

- - - - - - - - + Create organization} + asChild + className="p-0 bg-transparent border-none max-w-[510px]" + > + +
); }; -export default NoOrg; \ No newline at end of file +export default NoOrg; diff --git a/apps/web/components/md/link-modal.tsx b/apps/web/components/md/link-modal.tsx index 46362a2..53a9122 100644 --- a/apps/web/components/md/link-modal.tsx +++ b/apps/web/components/md/link-modal.tsx @@ -1,16 +1,9 @@ import { Button } from "@/components/ui/button"; -import { - Dialog, - DialogClose, - DialogContent, - DialogFooter, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@/components/ui/dialog"; +import { DialogClose } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { useState, type ReactNode } from "react"; +import ResponsiveModel, { ResponsiveModelTitle } from "../responsive-model"; type LinkModalProps = { value?: string; @@ -28,31 +21,24 @@ const LinkModal = ({ value, children, onSave }: LinkModalProps) => { }; return ( - - {children} - - - Enter destination - -
- - setLink(e.target.value)} - /> -
- - - - - -
-
+ + Enter destination +
+ + setLink(e.target.value)} + /> +
+ + + +
); }; diff --git a/apps/web/components/modals/changelog-modal.tsx b/apps/web/components/modals/changelog-modal.tsx index b653d32..8acacd3 100644 --- a/apps/web/components/modals/changelog-modal.tsx +++ b/apps/web/components/modals/changelog-modal.tsx @@ -1,11 +1,5 @@ import { Button } from "@/components/ui/button"; import { DatePicker } from "@/components/ui/date-picker"; -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; import { Form, FormControl, @@ -17,15 +11,16 @@ import { } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { Switch } from "@/components/ui/switch"; -import { api } from "@repo/backend/convex/_generated/api"; -import type { Id } from "@repo/backend/convex/_generated/dataModel"; import useApiMutation from "@/lib/hooks/use-api-mutation"; import { useChangelogModal } from "@/lib/store/use-changelog-modal"; import { zodResolver } from "@hookform/resolvers/zod"; +import { api } from "@repo/backend/convex/_generated/api"; +import type { Id } from "@repo/backend/convex/_generated/dataModel"; import { useParams } from "next/navigation"; import { useForm } from "react-hook-form"; import { z } from "zod"; import MDXEditor from "../md/mdx-editor"; +import ResponsiveModel, { ResponsiveModelTitle } from "../responsive-model"; const changelogFormSchema = z.object({ title: z.string().min(5), @@ -75,117 +70,110 @@ const ChangelogModal = () => { } return ( - !open && onClose()}> - {values?._id ? "Edit" : "Create"} Changelog - + !open && onClose()}> + + {values?._id ? "Edit" : "Create"} Changelog + +
+ + ( + + Title + + + + + + )} + /> - - +
( - Title + Release Date - + )} /> - -
- ( - - Release Date - - - - - - )} - /> - ( - - Version - -
- - v - - -
-
- -
- )} - /> -
- - ( - -
- Keep it public - - Enable this option to make the changelog public - -
- - - -
- )} - /> - ( - - Changes + + Version -
- +
+ + v + +
)} /> +
+ + ( + +
+ Keep it public + + Enable this option to make the changelog public + +
+ + + +
+ )} + /> + + ( + + Changes + +
+ +
+
+ +
+ )} + /> - - - - + + + + ); }; diff --git a/apps/web/components/modals/confirm-modal.tsx b/apps/web/components/modals/confirm-modal.tsx index 7fb49e8..1957cc0 100644 --- a/apps/web/components/modals/confirm-modal.tsx +++ b/apps/web/components/modals/confirm-modal.tsx @@ -40,7 +40,7 @@ const ConfirmModal = ({ {children} {header} - {description} + {description} Cancel { const param = useParams(); @@ -96,20 +90,62 @@ const FeedbackModal = () => { } return ( - !open && onClose()}> - {values?._id ? "Edit" : "Create"} Feedback - + !open && onClose()}> + + {values?._id ? "Edit" : "Create"} Feedback + +
+ + ( + + Name + + + + + + )} + /> + ( + + Email + + + + + + )} + /> - - +
( - Name + Status - + @@ -117,100 +153,58 @@ const FeedbackModal = () => { /> ( - Email + Priority - + )} /> +
-
- ( - - Status - - - - - - )} - /> - ( - - Priority - - - - - - )} - /> -
- - ( - - Feedback - - - - - - - +