From 78207d049464febd6c40683f618169ab51157feb Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 24 Dec 2023 20:54:39 -0500 Subject: [PATCH] fix: remove use client --- app/components/Feed.tsx | 2 -- app/components/SearchBar.tsx | 2 -- app/components/ui/command.tsx | 54 +++++++++++++++++------------------ app/components/ui/dialog.tsx | 44 ++++++++++++++-------------- app/components/ui/popover.tsx | 18 ++++++------ app/components/ui/select.tsx | 50 ++++++++++++++++---------------- 6 files changed, 81 insertions(+), 89 deletions(-) diff --git a/app/components/Feed.tsx b/app/components/Feed.tsx index 387d68f..5d9f853 100644 --- a/app/components/Feed.tsx +++ b/app/components/Feed.tsx @@ -1,5 +1,3 @@ -"use client"; - import { formatDate } from "@/utils"; import * as ScrollArea from "@radix-ui/react-scroll-area"; import { useEffect, useState } from "react"; diff --git a/app/components/SearchBar.tsx b/app/components/SearchBar.tsx index ae258b8..efef42d 100644 --- a/app/components/SearchBar.tsx +++ b/app/components/SearchBar.tsx @@ -1,5 +1,3 @@ -"use client"; - import React, { type FormEvent, useCallback, diff --git a/app/components/ui/command.tsx b/app/components/ui/command.tsx index 462c9cf..a1fed81 100644 --- a/app/components/ui/command.tsx +++ b/app/components/ui/command.tsx @@ -1,12 +1,10 @@ -"use client" +import * as React from "react"; +import { type DialogProps } from "@radix-ui/react-dialog"; +import { Command as CommandPrimitive } from "cmdk"; +import { MagnifyingGlassIcon as Search } from "@radix-ui/react-icons"; -import * as React from "react" -import { type DialogProps } from "@radix-ui/react-dialog" -import { Command as CommandPrimitive } from "cmdk" -import { MagnifyingGlassIcon as Search } from "@radix-ui/react-icons" - -import { cn } from "@/utils" -import { Dialog, DialogContent } from "@/components/ui/dialog" +import { cn } from "@/utils"; +import { Dialog, DialogContent } from "@/components/ui/dialog"; const Command = React.forwardRef< React.ElementRef, @@ -20,8 +18,8 @@ const Command = React.forwardRef< )} {...props} /> -)) -Command.displayName = CommandPrimitive.displayName +)); +Command.displayName = CommandPrimitive.displayName; interface CommandDialogProps extends DialogProps {} @@ -34,8 +32,8 @@ const CommandDialog = ({ children, ...props }: CommandDialogProps) => { - ) -} + ); +}; const CommandInput = React.forwardRef< React.ElementRef, @@ -52,9 +50,9 @@ const CommandInput = React.forwardRef< {...props} /> -)) +)); -CommandInput.displayName = CommandPrimitive.Input.displayName +CommandInput.displayName = CommandPrimitive.Input.displayName; const CommandList = React.forwardRef< React.ElementRef, @@ -65,9 +63,9 @@ const CommandList = React.forwardRef< className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)} {...props} /> -)) +)); -CommandList.displayName = CommandPrimitive.List.displayName +CommandList.displayName = CommandPrimitive.List.displayName; const CommandEmpty = React.forwardRef< React.ElementRef, @@ -78,9 +76,9 @@ const CommandEmpty = React.forwardRef< className="py-6 text-center text-sm" {...props} /> -)) +)); -CommandEmpty.displayName = CommandPrimitive.Empty.displayName +CommandEmpty.displayName = CommandPrimitive.Empty.displayName; const CommandGroup = React.forwardRef< React.ElementRef, @@ -94,9 +92,9 @@ const CommandGroup = React.forwardRef< )} {...props} /> -)) +)); -CommandGroup.displayName = CommandPrimitive.Group.displayName +CommandGroup.displayName = CommandPrimitive.Group.displayName; const CommandSeparator = React.forwardRef< React.ElementRef, @@ -107,8 +105,8 @@ const CommandSeparator = React.forwardRef< className={cn("-mx-1 h-px bg-border", className)} {...props} /> -)) -CommandSeparator.displayName = CommandPrimitive.Separator.displayName +)); +CommandSeparator.displayName = CommandPrimitive.Separator.displayName; const CommandItem = React.forwardRef< React.ElementRef, @@ -122,9 +120,9 @@ const CommandItem = React.forwardRef< )} {...props} /> -)) +)); -CommandItem.displayName = CommandPrimitive.Item.displayName +CommandItem.displayName = CommandPrimitive.Item.displayName; const CommandShortcut = ({ className, @@ -138,9 +136,9 @@ const CommandShortcut = ({ )} {...props} /> - ) -} -CommandShortcut.displayName = "CommandShortcut" + ); +}; +CommandShortcut.displayName = "CommandShortcut"; export { Command, @@ -152,4 +150,4 @@ export { CommandItem, CommandShortcut, CommandSeparator, -} +}; diff --git a/app/components/ui/dialog.tsx b/app/components/ui/dialog.tsx index 9a51a36..ec8de4c 100644 --- a/app/components/ui/dialog.tsx +++ b/app/components/ui/dialog.tsx @@ -1,18 +1,16 @@ -"use client" +import * as React from "react"; +import * as DialogPrimitive from "@radix-ui/react-dialog"; +import { Cross2Icon as X } from "@radix-ui/react-icons"; -import * as React from "react" -import * as DialogPrimitive from "@radix-ui/react-dialog" -import { Cross2Icon as X } from "@radix-ui/react-icons" +import { cn } from "@/utils"; -import { cn } from "@/utils" +const Dialog = DialogPrimitive.Root; -const Dialog = DialogPrimitive.Root +const DialogTrigger = DialogPrimitive.Trigger; -const DialogTrigger = DialogPrimitive.Trigger +const DialogPortal = DialogPrimitive.Portal; -const DialogPortal = DialogPrimitive.Portal - -const DialogClose = DialogPrimitive.Close +const DialogClose = DialogPrimitive.Close; const DialogOverlay = React.forwardRef< React.ElementRef, @@ -26,8 +24,8 @@ const DialogOverlay = React.forwardRef< )} {...props} /> -)) -DialogOverlay.displayName = DialogPrimitive.Overlay.displayName +)); +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; const DialogContent = React.forwardRef< React.ElementRef, @@ -50,8 +48,8 @@ const DialogContent = React.forwardRef< -)) -DialogContent.displayName = DialogPrimitive.Content.displayName +)); +DialogContent.displayName = DialogPrimitive.Content.displayName; const DialogHeader = ({ className, @@ -64,8 +62,8 @@ const DialogHeader = ({ )} {...props} /> -) -DialogHeader.displayName = "DialogHeader" +); +DialogHeader.displayName = "DialogHeader"; const DialogFooter = ({ className, @@ -78,8 +76,8 @@ const DialogFooter = ({ )} {...props} /> -) -DialogFooter.displayName = "DialogFooter" +); +DialogFooter.displayName = "DialogFooter"; const DialogTitle = React.forwardRef< React.ElementRef, @@ -93,8 +91,8 @@ const DialogTitle = React.forwardRef< )} {...props} /> -)) -DialogTitle.displayName = DialogPrimitive.Title.displayName +)); +DialogTitle.displayName = DialogPrimitive.Title.displayName; const DialogDescription = React.forwardRef< React.ElementRef, @@ -105,8 +103,8 @@ const DialogDescription = React.forwardRef< className={cn("text-sm text-muted-foreground", className)} {...props} /> -)) -DialogDescription.displayName = DialogPrimitive.Description.displayName +)); +DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, @@ -119,4 +117,4 @@ export { DialogFooter, DialogTitle, DialogDescription, -} +}; diff --git a/app/components/ui/popover.tsx b/app/components/ui/popover.tsx index 2bd5a03..4b5196c 100644 --- a/app/components/ui/popover.tsx +++ b/app/components/ui/popover.tsx @@ -1,13 +1,11 @@ -"use client" +import * as React from "react"; +import * as PopoverPrimitive from "@radix-ui/react-popover"; -import * as React from "react" -import * as PopoverPrimitive from "@radix-ui/react-popover" +import { cn } from "@/utils"; -import { cn } from "@/utils" +const Popover = PopoverPrimitive.Root; -const Popover = PopoverPrimitive.Root - -const PopoverTrigger = PopoverPrimitive.Trigger +const PopoverTrigger = PopoverPrimitive.Trigger; const PopoverContent = React.forwardRef< React.ElementRef, @@ -25,7 +23,7 @@ const PopoverContent = React.forwardRef< {...props} /> -)) -PopoverContent.displayName = PopoverPrimitive.Content.displayName +)); +PopoverContent.displayName = PopoverPrimitive.Content.displayName; -export { Popover, PopoverTrigger, PopoverContent } +export { Popover, PopoverTrigger, PopoverContent }; diff --git a/app/components/ui/select.tsx b/app/components/ui/select.tsx index 85270b9..3786ba6 100644 --- a/app/components/ui/select.tsx +++ b/app/components/ui/select.tsx @@ -1,16 +1,18 @@ -"use client" +import * as React from "react"; +import * as SelectPrimitive from "@radix-ui/react-select"; +import { + CheckIcon, + ChevronDownIcon, + ChevronUpIcon, +} from "@heroicons/react/24/outline"; -import * as React from "react" -import * as SelectPrimitive from "@radix-ui/react-select" -import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/outline" +import { cn } from "../../utils"; -import { cn } from "../../utils" +const Select = SelectPrimitive.Root; -const Select = SelectPrimitive.Root +const SelectGroup = SelectPrimitive.Group; -const SelectGroup = SelectPrimitive.Group - -const SelectValue = SelectPrimitive.Value +const SelectValue = SelectPrimitive.Value; const SelectTrigger = React.forwardRef< React.ElementRef, @@ -29,8 +31,8 @@ const SelectTrigger = React.forwardRef< -)) -SelectTrigger.displayName = SelectPrimitive.Trigger.displayName +)); +SelectTrigger.displayName = SelectPrimitive.Trigger.displayName; const SelectScrollUpButton = React.forwardRef< React.ElementRef, @@ -46,8 +48,8 @@ const SelectScrollUpButton = React.forwardRef< > -)) -SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName +)); +SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName; const SelectScrollDownButton = React.forwardRef< React.ElementRef, @@ -63,9 +65,9 @@ const SelectScrollDownButton = React.forwardRef< > -)) +)); SelectScrollDownButton.displayName = - SelectPrimitive.ScrollDownButton.displayName + SelectPrimitive.ScrollDownButton.displayName; const SelectContent = React.forwardRef< React.ElementRef, @@ -96,8 +98,8 @@ const SelectContent = React.forwardRef< -)) -SelectContent.displayName = SelectPrimitive.Content.displayName +)); +SelectContent.displayName = SelectPrimitive.Content.displayName; const SelectLabel = React.forwardRef< React.ElementRef, @@ -108,8 +110,8 @@ const SelectLabel = React.forwardRef< className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)} {...props} /> -)) -SelectLabel.displayName = SelectPrimitive.Label.displayName +)); +SelectLabel.displayName = SelectPrimitive.Label.displayName; const SelectItem = React.forwardRef< React.ElementRef, @@ -131,8 +133,8 @@ const SelectItem = React.forwardRef< {children} -)) -SelectItem.displayName = SelectPrimitive.Item.displayName +)); +SelectItem.displayName = SelectPrimitive.Item.displayName; const SelectSeparator = React.forwardRef< React.ElementRef, @@ -143,8 +145,8 @@ const SelectSeparator = React.forwardRef< className={cn("-mx-1 my-1 h-px bg-muted", className)} {...props} /> -)) -SelectSeparator.displayName = SelectPrimitive.Separator.displayName +)); +SelectSeparator.displayName = SelectPrimitive.Separator.displayName; export { Select, @@ -157,4 +159,4 @@ export { SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, -} +};