From 6ebb72a400021541850964b4e5c05ad39cd0aa23 Mon Sep 17 00:00:00 2001 From: "Siaw A. Nicholas" Date: Fri, 5 Apr 2024 03:49:24 +0000 Subject: [PATCH 1/3] fix: fix type errors --- client/src/app/[username]/page.tsx | 1 + client/src/hooks/fetcher.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/app/[username]/page.tsx b/client/src/app/[username]/page.tsx index 0788890..f01c3f6 100644 --- a/client/src/app/[username]/page.tsx +++ b/client/src/app/[username]/page.tsx @@ -127,6 +127,7 @@ function UserProfile({ params }: { params: { username: string } }) {
{dataToDisplay ? ( dataToDisplay.length > 0 ? ( + // @ts-ignore dataToDisplay.map(item => { switch (selectedTab) { case 'posts': diff --git a/client/src/hooks/fetcher.tsx b/client/src/hooks/fetcher.tsx index 4e9eec9..0cbb83f 100644 --- a/client/src/hooks/fetcher.tsx +++ b/client/src/hooks/fetcher.tsx @@ -117,7 +117,7 @@ export const useFetcher = (filter = 'hot') => { } } - const searchPosts = async (key: string): Promise => { + const searchPosts = async (key: string): Promise => { const query = key.replace('searchPosts/', ''); try { const response = await axios.get(`/posts/filtered-posts/${query}`); From 3d38639c2f5eb51a867a8a643903533bcbe30ff3 Mon Sep 17 00:00:00 2001 From: "Siaw A. Nicholas" Date: Fri, 5 Apr 2024 03:50:04 +0000 Subject: [PATCH 2/3] feat: added ui component --- client/src/components/ui/dialog.tsx | 122 ++++++++++++++++++++++++++ client/src/components/ui/textarea.tsx | 24 +++++ 2 files changed, 146 insertions(+) create mode 100644 client/src/components/ui/dialog.tsx create mode 100644 client/src/components/ui/textarea.tsx diff --git a/client/src/components/ui/dialog.tsx b/client/src/components/ui/dialog.tsx new file mode 100644 index 0000000..9850daa --- /dev/null +++ b/client/src/components/ui/dialog.tsx @@ -0,0 +1,122 @@ +"use client" + +import * as React from "react" +import * as DialogPrimitive from "@radix-ui/react-dialog" +import { X } from "lucide-react" + +import { cn } from "~/lib/utils" + +const Dialog = DialogPrimitive.Root + +const DialogTrigger = DialogPrimitive.Trigger + +const DialogPortal = DialogPrimitive.Portal + +const DialogClose = DialogPrimitive.Close + +const DialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName + +const DialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + {children} + + + Close + + + +)) +DialogContent.displayName = DialogPrimitive.Content.displayName + +const DialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DialogHeader.displayName = "DialogHeader" + +const DialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DialogFooter.displayName = "DialogFooter" + +const DialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogTitle.displayName = DialogPrimitive.Title.displayName + +const DialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogDescription.displayName = DialogPrimitive.Description.displayName + +export { + Dialog, + DialogPortal, + DialogOverlay, + DialogClose, + DialogTrigger, + DialogContent, + DialogHeader, + DialogFooter, + DialogTitle, + DialogDescription, +} diff --git a/client/src/components/ui/textarea.tsx b/client/src/components/ui/textarea.tsx new file mode 100644 index 0000000..b9044e0 --- /dev/null +++ b/client/src/components/ui/textarea.tsx @@ -0,0 +1,24 @@ +import * as React from "react" + +import { cn } from "~/lib/utils" + +export interface TextareaProps + extends React.TextareaHTMLAttributes {} + +const Textarea = React.forwardRef( + ({ className, ...props }, ref) => { + return ( +