From aed484ee9542ccd57310a46b4404811f467b1fb1 Mon Sep 17 00:00:00 2001 From: Joshua Melville Date: Wed, 20 Nov 2024 23:22:49 +0200 Subject: [PATCH] add stricter rules --- apps/analytics-web/app/_actions/actions.ts | 2 - .../analytics/EventsTable/EventsTable.tsx | 6 +- .../analytics/EventsTable/TableFilter.tsx | 6 +- .../analytics/cards/TotalAppsCard.tsx | 4 +- .../analytics/cards/TotalDataExported.tsx | 4 +- .../analytics/cards/TotalErrorsCard.tsx | 4 +- .../users/UserManagementDialog.tsx | 2 +- .../users/UsersTable/VerifyUserSwitch.tsx | 4 +- .../analytics-web/app/api/event/route.test.ts | 1 + apps/analytics-web/app/verification/page.tsx | 4 +- .../components/DataTable/column-header.tsx | 2 +- .../components/DataTable/data-table.tsx | 2 +- .../analytics-web/components/DialogButton.tsx | 2 +- .../analytics-web/components/ExportButton.tsx | 8 +- apps/analytics-web/components/ui/button.tsx | 4 +- apps/analytics-web/components/ui/card.tsx | 2 +- apps/analytics-web/components/ui/dialog.tsx | 41 ++++---- .../components/ui/dropdown-menu.tsx | 65 ++++++------- apps/analytics-web/components/ui/select.tsx | 4 +- apps/analytics-web/components/ui/switch.tsx | 9 +- apps/analytics-web/components/ui/table.tsx | 2 +- apps/analytics-web/components/ui/tabs.tsx | 42 ++++----- apps/analytics-web/scripts/migrate.ts | 4 +- apps/analytics-web/scripts/seed.ts | 12 +-- .../[locale]/[project]/[...docPath]/page.tsx | 4 +- .../_components/InnerLanguageSwitcher.tsx | 4 +- .../app/[locale]/[project]/page.tsx | 4 +- apps/documentation/app/[locale]/layout.tsx | 11 ++- apps/documentation/app/icon.svg | 16 ++-- apps/documentation/app/not-found.tsx | 2 +- .../components/DocSearchComponent.tsx | 6 +- apps/documentation/components/Hero.tsx | 2 +- .../components/ProjectSwitcher.tsx | 2 +- .../components/SharedNav/Menu.tsx | 8 +- apps/documentation/components/Sidebar.tsx | 34 ++++--- .../components/TableOfContents.tsx | 8 +- .../documentation/components/ai-assistant.tsx | 2 +- apps/documentation/components/article.tsx | 2 +- .../customComponents/CodeCopyButton.tsx | 8 +- .../customComponents/VideoIFrame.tsx | 2 +- apps/documentation/lib/docs.tsx | 18 ++-- apps/documentation/lib/helper_functions.ts | 4 +- apps/documentation/lib/processPreTags.ts | 4 +- apps/documentation/lib/writeSidebarJson.ts | 15 +-- apps/documentation/public/algolia-logo.svg | 2 +- .../public/assets/img/logo-inline.svg | 2 +- apps/documentation/public/assets/img/logo.svg | 2 +- .../public/assets/img/sidebar-bg-cropped.svg | 2 +- .../public/assets/img/tip-caution.svg | 2 +- .../public/assets/img/tip-info.svg | 2 +- apps/documentation/public/favicons/icon.svg | 16 ++-- .../public/images/key-concept.svg | 4 +- apps/documentation/public/images/mark.svg | 16 ++-- apps/documentation/public/images/robot.svg | 94 +++++++++---------- .../public/images/tip-caution.svg | 34 +++---- apps/documentation/public/images/tip-info.svg | 2 +- .../public/images/typemark-negative.svg | 42 ++++----- .../public/images/typemark-positive.svg | 42 ++++----- .../public/images/work-in-progress.svg | 48 +++++----- biome.json | 25 +++++ packages/analytics/src/index.ts | 21 ++--- packages/analytics/src/utils.ts | 14 ++- .../src/BackgroundBlobs/BackgroundBlobs.tsx | 18 ++-- packages/shared-consts/src/index.ts | 10 -- packages/ui/src/Alert.tsx | 2 +- packages/ui/src/AlertDialog.tsx | 41 ++++---- packages/ui/src/Button.tsx | 6 +- packages/ui/src/FancyBox.tsx | 16 +++- packages/ui/src/FormattedDate.tsx | 2 +- packages/ui/src/Input.tsx | 2 +- packages/ui/src/accordion.tsx | 2 +- packages/ui/src/card.tsx | 2 +- packages/ui/src/command.tsx | 6 +- packages/ui/src/dialog.tsx | 10 +- packages/ui/src/dropdown-menu.tsx | 12 +-- packages/ui/src/form.tsx | 6 +- packages/ui/src/popover.tsx | 2 +- packages/ui/src/select.tsx | 4 +- packages/ui/src/sheet.tsx | 10 +- packages/ui/src/table.tsx | 2 +- packages/ui/src/tabs.tsx | 2 +- packages/ui/src/theme.tsx | 2 +- packages/ui/src/toast.tsx | 59 ++++++------ packages/ui/src/tooltip.tsx | 11 ++- packages/ui/src/typography/Details.tsx | 4 +- packages/ui/src/use-toast.ts | 26 ++--- tooling/tailwind/base.ts | 1 + 87 files changed, 533 insertions(+), 487 deletions(-) delete mode 100644 packages/shared-consts/src/index.ts diff --git a/apps/analytics-web/app/_actions/actions.ts b/apps/analytics-web/app/_actions/actions.ts index aeff3e93..3b2a13eb 100644 --- a/apps/analytics-web/app/_actions/actions.ts +++ b/apps/analytics-web/app/_actions/actions.ts @@ -11,7 +11,6 @@ export async function getEvents() { return events; } catch (error) { - console.error("Error getting events", error); return []; } } @@ -25,7 +24,6 @@ export async function insertEvent(event: EventInsertType) { return { data: insertedEvent, error: null }; } catch (error) { - console.error("Error inserting events", error); return { data: null, error: "Error inserting events" }; } } diff --git a/apps/analytics-web/app/_components/analytics/EventsTable/EventsTable.tsx b/apps/analytics-web/app/_components/analytics/EventsTable/EventsTable.tsx index dfa01d48..6b63d76f 100644 --- a/apps/analytics-web/app/_components/analytics/EventsTable/EventsTable.tsx +++ b/apps/analytics-web/app/_components/analytics/EventsTable/EventsTable.tsx @@ -44,13 +44,13 @@ export default function EventsTable() {

Events

- {!events.length &&

Loading...

} + {events.length === 0 &&

Loading...

}
- {!!events.length && } + {events.length > 0 && }
- {!!events.length && ( + {events.length > 0 && ( )}
diff --git a/apps/analytics-web/app/_components/analytics/EventsTable/TableFilter.tsx b/apps/analytics-web/app/_components/analytics/EventsTable/TableFilter.tsx index 80148497..61e35a6e 100644 --- a/apps/analytics-web/app/_components/analytics/EventsTable/TableFilter.tsx +++ b/apps/analytics-web/app/_components/analytics/EventsTable/TableFilter.tsx @@ -32,7 +32,7 @@ const TableFilter = ({ eventTypes, setEventTypes }: TableFilterProps) => { return ( - + @@ -43,7 +43,7 @@ const TableFilter = ({ eventTypes, setEventTypes }: TableFilterProps) => {
- + ); } diff --git a/apps/analytics-web/components/DataTable/column-header.tsx b/apps/analytics-web/components/DataTable/column-header.tsx index 0d6d74b7..afb0f260 100644 --- a/apps/analytics-web/components/DataTable/column-header.tsx +++ b/apps/analytics-web/components/DataTable/column-header.tsx @@ -27,7 +27,7 @@ export function DataTableColumnHeader({ return (
- + diff --git a/apps/analytics-web/components/ExportButton.tsx b/apps/analytics-web/components/ExportButton.tsx index b834a9d0..63f66230 100644 --- a/apps/analytics-web/components/ExportButton.tsx +++ b/apps/analytics-web/components/ExportButton.tsx @@ -10,8 +10,8 @@ type ExportButtonProps = { filename: string; }; -const ExportButton: React.FC = ({ data, filename }) => { - const handleExportCSV = () => { +export const ExportButton: React.FC = ({ data, filename }) => { + const handleExportCsv = () => { const csvData = Papa.unparse(data); const blob = new Blob([csvData], { type: "text/csv;charset=utf-8;" }); @@ -29,10 +29,8 @@ const ExportButton: React.FC = ({ data, filename }) => { }; return ( - ); }; - -export default ExportButton; diff --git a/apps/analytics-web/components/ui/button.tsx b/apps/analytics-web/components/ui/button.tsx index b21dc584..04a05e21 100644 --- a/apps/analytics-web/components/ui/button.tsx +++ b/apps/analytics-web/components/ui/button.tsx @@ -1,6 +1,6 @@ import { Slot } from "@radix-ui/react-slot"; import { type VariantProps, cva } from "class-variance-authority"; -import * as React from "react"; +import { forwardRef } from "react"; import { cn } from "~/utils/shadcn"; @@ -35,7 +35,7 @@ export type ButtonProps = { } & React.ButtonHTMLAttributes & VariantProps; -const Button = React.forwardRef( +const Button = forwardRef( ({ className, variant, size, asChild = false, ...props }, ref) => { const Comp = asChild ? Slot : "button"; return ; diff --git a/apps/analytics-web/components/ui/card.tsx b/apps/analytics-web/components/ui/card.tsx index b4d70925..5a582fd5 100644 --- a/apps/analytics-web/components/ui/card.tsx +++ b/apps/analytics-web/components/ui/card.tsx @@ -42,4 +42,4 @@ const CardFooter = React.forwardRef import * as DialogPrimitive from "@radix-ui/react-dialog"; import { X } from "lucide-react"; -import * as React from "react"; +import { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type HTMLAttributes } from "react"; import { cn } from "~/utils/shadcn"; @@ -14,9 +15,9 @@ const DialogPortal = DialogPrimitive.Portal; const DialogClose = DialogPrimitive.Close; -const DialogOverlay = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef +const DialogOverlay = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , - React.ComponentPropsWithoutRef +const DialogContent = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( @@ -53,19 +54,19 @@ const DialogContent = React.forwardRef< )); DialogContent.displayName = DialogPrimitive.Content.displayName; -const DialogHeader = ({ className, ...props }: React.HTMLAttributes) => ( +const DialogHeader = ({ className, ...props }: HTMLAttributes) => (
); DialogHeader.displayName = "DialogHeader"; -const DialogFooter = ({ className, ...props }: React.HTMLAttributes) => ( +const DialogFooter = ({ className, ...props }: HTMLAttributes) => (
); DialogFooter.displayName = "DialogFooter"; -const DialogTitle = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef +const DialogTitle = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , - React.ComponentPropsWithoutRef +const DialogDescription = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); @@ -85,13 +86,13 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, - DialogPortal, - DialogOverlay, DialogClose, - DialogTrigger, DialogContent, - DialogHeader, + DialogDescription, DialogFooter, + DialogHeader, + DialogOverlay, + DialogPortal, DialogTitle, - DialogDescription, + DialogTrigger, }; diff --git a/apps/analytics-web/components/ui/dropdown-menu.tsx b/apps/analytics-web/components/ui/dropdown-menu.tsx index bcbe2113..9440a526 100644 --- a/apps/analytics-web/components/ui/dropdown-menu.tsx +++ b/apps/analytics-web/components/ui/dropdown-menu.tsx @@ -1,8 +1,9 @@ "use client"; +// biome-ignore lint/style/noNamespaceImport: Correct for radix primitive import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; import { Check, ChevronRight, Circle } from "lucide-react"; -import * as React from "react"; +import { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type HTMLAttributes } from "react"; import { cn } from "~/utils/shadcn"; @@ -18,9 +19,9 @@ const DropdownMenuSub = DropdownMenuPrimitive.Sub; const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup; -const DropdownMenuSubTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { +const DropdownMenuSubTrigger = forwardRef< + ElementRef, + ComponentPropsWithoutRef & { inset?: boolean; } >(({ className, inset, children, ...props }, ref) => ( @@ -39,9 +40,9 @@ const DropdownMenuSubTrigger = React.forwardRef< )); DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName; -const DropdownMenuSubContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef +const DropdownMenuSubContent = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , - React.ComponentPropsWithoutRef +const DropdownMenuContent = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, sideOffset = 4, ...props }, ref) => ( , - React.ComponentPropsWithoutRef & { +const DropdownMenuItem = forwardRef< + ElementRef, + ComponentPropsWithoutRef & { inset?: boolean; } >(({ className, inset, ...props }, ref) => ( @@ -90,9 +91,9 @@ const DropdownMenuItem = React.forwardRef< )); DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; -const DropdownMenuCheckboxItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef +const DropdownMenuCheckboxItem = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, children, checked, ...props }, ref) => ( , - React.ComponentPropsWithoutRef +const DropdownMenuRadioItem = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( , - React.ComponentPropsWithoutRef & { +const DropdownMenuLabel = forwardRef< + ElementRef, + ComponentPropsWithoutRef & { inset?: boolean; } >(({ className, inset, ...props }, ref) => ( @@ -149,33 +150,33 @@ const DropdownMenuLabel = React.forwardRef< )); DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName; -const DropdownMenuSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef +const DropdownMenuSeparator = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName; -const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes) => { +const DropdownMenuShortcut = ({ className, ...props }: HTMLAttributes) => { return ; }; DropdownMenuShortcut.displayName = "DropdownMenuShortcut"; export { DropdownMenu, - DropdownMenuTrigger, + DropdownMenuCheckboxItem, DropdownMenuContent, + DropdownMenuGroup, DropdownMenuItem, - DropdownMenuCheckboxItem, - DropdownMenuRadioItem, DropdownMenuLabel, + DropdownMenuPortal, + DropdownMenuRadioGroup, + DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, - DropdownMenuGroup, - DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, - DropdownMenuRadioGroup, + DropdownMenuTrigger, }; diff --git a/apps/analytics-web/components/ui/select.tsx b/apps/analytics-web/components/ui/select.tsx index e433e3b2..71f2f7d0 100644 --- a/apps/analytics-web/components/ui/select.tsx +++ b/apps/analytics-web/components/ui/select.tsx @@ -25,7 +25,7 @@ const SelectTrigger = React.forwardRef< {...props} > {children} - + @@ -101,4 +101,4 @@ const SelectSeparator = React.forwardRef< )); SelectSeparator.displayName = SelectPrimitive.Separator.displayName; -export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator }; +export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue }; diff --git a/apps/analytics-web/components/ui/switch.tsx b/apps/analytics-web/components/ui/switch.tsx index a0907779..44666526 100644 --- a/apps/analytics-web/components/ui/switch.tsx +++ b/apps/analytics-web/components/ui/switch.tsx @@ -1,13 +1,14 @@ "use client"; +// biome-ignore lint/style/noNamespaceImport: import * as SwitchPrimitives from "@radix-ui/react-switch"; -import * as React from "react"; +import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from "react"; import { cn } from "~/utils/shadcn"; -const Switch = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef +const Switch = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); +const TabsList = forwardRef, ComponentPropsWithoutRef>( + ({ className, ...props }, ref) => ( + + ), +); TabsList.displayName = TabsPrimitive.List.displayName; -const TabsTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef +const TabsTrigger = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , - React.ComponentPropsWithoutRef +const TabsContent = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( + console.error(error); + process.exit(1); } process.exit(); diff --git a/apps/documentation/app/[locale]/[project]/[...docPath]/page.tsx b/apps/documentation/app/[locale]/[project]/[...docPath]/page.tsx index 89ce4066..f8243eb4 100644 --- a/apps/documentation/app/[locale]/[project]/[...docPath]/page.tsx +++ b/apps/documentation/app/[locale]/[project]/[...docPath]/page.tsx @@ -46,7 +46,9 @@ export default async function Page({ params }: { params: PageParams }) { pathSegment: docPath, }); - if (document === null) notFound(); + if (document === null) { + notFound(); + } return (
locale !== currentLocale); - if (!supportedLanguages.length) return null; + if (supportedLanguages.length === 0) { + return null; + } return (
diff --git a/apps/documentation/app/[locale]/[project]/page.tsx b/apps/documentation/app/[locale]/[project]/page.tsx index ea4c6d18..924382c8 100644 --- a/apps/documentation/app/[locale]/[project]/page.tsx +++ b/apps/documentation/app/[locale]/[project]/page.tsx @@ -17,7 +17,9 @@ export default async function Page({ params }: PageProps) { project, }); - if (document === null) notFound(); + if (document === null) { + notFound(); + } return (
cur === locale); - if (!isValidLocale) notFound(); + if (!isValidLocale) { + notFound(); + } // setting setRequestLocale to support next-intl for static rendering setRequestLocale(locale); @@ -64,12 +65,12 @@ export default async function MainLayout({ children, params: { locale } }: MainL } return ( - + - + {children} - + diff --git a/apps/documentation/app/icon.svg b/apps/documentation/app/icon.svg index f19819df..52f50a5b 100644 --- a/apps/documentation/app/icon.svg +++ b/apps/documentation/app/icon.svg @@ -12,12 +12,12 @@ .st6{fill:#0FA3CF;} .st7{fill:#13B3E2;} - - - - - - - - + + + + + + + + diff --git a/apps/documentation/app/not-found.tsx b/apps/documentation/app/not-found.tsx index 67fbc611..a6b7634a 100644 --- a/apps/documentation/app/not-found.tsx +++ b/apps/documentation/app/not-found.tsx @@ -13,7 +13,7 @@ const quicksand = Quicksand({ export default function NotFound() { return ( - +
404 - Not found diff --git a/apps/documentation/components/DocSearchComponent.tsx b/apps/documentation/components/DocSearchComponent.tsx index 87de1f36..cb842c65 100644 --- a/apps/documentation/components/DocSearchComponent.tsx +++ b/apps/documentation/components/DocSearchComponent.tsx @@ -1,10 +1,10 @@ "use client"; -import { DocSearch } from "@docsearch/react"; -import { useLocale, useTranslations } from "next-intl"; -import "@docsearch/css"; import { inputVariants } from "@codaco/ui"; +import "@docsearch/css"; +import { DocSearch } from "@docsearch/react"; import { Search } from "lucide-react"; +import { useLocale, useTranslations } from "next-intl"; import { env } from "~/env"; import { cn } from "~/lib/utils"; diff --git a/apps/documentation/components/Hero.tsx b/apps/documentation/components/Hero.tsx index 27a4b6a7..7ac9240a 100644 --- a/apps/documentation/components/Hero.tsx +++ b/apps/documentation/components/Hero.tsx @@ -58,7 +58,7 @@ export function Hero() { {t("Hero.title")} {t("Hero.tagline")} - +
{resolvedTheme !== "dark" && (
diff --git a/apps/documentation/components/ProjectSwitcher.tsx b/apps/documentation/components/ProjectSwitcher.tsx index e614c5d6..94c8a9e1 100644 --- a/apps/documentation/components/ProjectSwitcher.tsx +++ b/apps/documentation/components/ProjectSwitcher.tsx @@ -68,7 +68,7 @@ export default function ProjectSwitcher() { {projects.map((p) => ( - + ))} diff --git a/apps/documentation/components/SharedNav/Menu.tsx b/apps/documentation/components/SharedNav/Menu.tsx index b17b6c3e..c0be451d 100644 --- a/apps/documentation/components/SharedNav/Menu.tsx +++ b/apps/documentation/components/SharedNav/Menu.tsx @@ -54,7 +54,7 @@ export const NavigationMenuDemo = () => { const t = useTranslations("SharedNavigation"); return ( - + @@ -143,7 +153,7 @@ const SidebarFolder = ({ @@ -192,7 +202,7 @@ const SidebarLink = ({ }; const renderSidebarItem = ( - item: TSidebarFolder | SidebarPage, + item: tSidebarFolder | SidebarPage, locale: Locale, sidebarContainerRef: RefObject, ) => { diff --git a/apps/documentation/components/TableOfContents.tsx b/apps/documentation/components/TableOfContents.tsx index b01c5711..36e5ae48 100644 --- a/apps/documentation/components/TableOfContents.tsx +++ b/apps/documentation/components/TableOfContents.tsx @@ -7,7 +7,7 @@ import useHighlighted from "~/hooks/useHighlighted"; import type { HeadingNode } from "~/lib/tableOfContents"; import { cn } from "~/lib/utils"; -const TOCLink = ({ +const tocLink = ({ node, sideBar, }: { @@ -18,7 +18,9 @@ const TOCLink = ({ const [highlighted] = useHighlighted(node.id); useEffect(() => { - if (!sideBar) return; + if (!sideBar) { + return; + } if (highlighted && ref.current) { ref.current.scrollIntoView({ @@ -73,7 +75,7 @@ function renderNodes(nodes: HeadingNode[], sideBar: boolean) {
    {nodes.map((node) => (
  1. - + {node.children?.length > 0 && renderNodes(node.children, sideBar)}
  2. ))} diff --git a/apps/documentation/components/ai-assistant.tsx b/apps/documentation/components/ai-assistant.tsx index 9fdf8e2d..db4b644f 100644 --- a/apps/documentation/components/ai-assistant.tsx +++ b/apps/documentation/components/ai-assistant.tsx @@ -41,7 +41,7 @@ const TriggerButton = () => { return ( - + } {content}
- {showToc && } + {showToc && } ); } diff --git a/apps/documentation/components/customComponents/CodeCopyButton.tsx b/apps/documentation/components/customComponents/CodeCopyButton.tsx index 06d9a5b7..85fba26d 100644 --- a/apps/documentation/components/customComponents/CodeCopyButton.tsx +++ b/apps/documentation/components/customComponents/CodeCopyButton.tsx @@ -13,15 +13,13 @@ const CodeCopyButton = ({ code }: { code: string }) => { await navigator.clipboard.writeText(text); setIsCopied(true); setTimeout(() => setIsCopied(false), 2000); // Reset state after 2 seconds - } catch (error) { - console.error("Failed to copy to clipboard:", error); - } + } catch (error) {} }; return (
- - + + {isCopied ? (