chore(deps): align packages and enforce unused checks

This commit is contained in:
2026-08-09 21:25:55 +07:00 Unverified
parent 950d3d4afe
commit c06b2ef88f
7 changed files with 238 additions and 250 deletions
-55
View File
@@ -1,55 +0,0 @@
"use client";
import React, { useState } from "react";
import { Check, Copy } from "lucide-react";
import { Button, buttonVariants } from "@/components/ui/button";
import { copyToClipboard } from "@/lib/utils";
import { cn } from "@/lib/utils";
import type { VariantProps } from "class-variance-authority";
export interface CopyButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
text?: string | (() => string);
onCopy?: () => void;
iconOnly?: boolean;
variant?: VariantProps<typeof buttonVariants>["variant"];
}
export const CopyButton = React.forwardRef<HTMLButtonElement, CopyButtonProps>(
({ text, onCopy, iconOnly = true, className, variant = "link", children, onClick, ...props }, ref) => {
const [copied, setCopied] = useState(false);
const handleCopy = (e: React.MouseEvent<HTMLButtonElement>) => {
e.stopPropagation();
if (text) {
const copyContent = typeof text === "function" ? text() : text;
copyToClipboard(copyContent);
}
if (onCopy) {
onCopy();
}
if (onClick) {
onClick(e);
}
setCopied(true);
setTimeout(() => setCopied(false), 2000);
};
return (
<Button
ref={ref}
onClick={handleCopy}
variant={variant}
className={cn(iconOnly ? "h-auto p-0 text-green-400 hover:text-green-300" : "", className)}
{...props}
>
{copied ? <Check className={iconOnly ? "w-3 h-3" : "w-4 h-4 mr-2 text-green-400"} /> : <Copy className={iconOnly ? "w-3 h-3" : "w-4 h-4 mr-2"} />}
{!iconOnly && children}
</Button>
);
}
);
CopyButton.displayName = "CopyButton";
-31
View File
@@ -1,31 +0,0 @@
"use client";
import type { ReactNode } from "react";
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
export function SimpleTooltip({
text,
children,
side,
className,
align,
...props
}: {
text?: ReactNode;
side?: "top" | "right" | "bottom" | "left" | undefined;
className?: string;
align?: "center" | "start" | "end" | undefined;
} & React.ComponentProps<typeof Tooltip>) {
return (
<Tooltip {...props}>
<TooltipTrigger asChild>{children}</TooltipTrigger>
<TooltipContent
side={side}
align={align}
className={className}
>
{text}
</TooltipContent>
</Tooltip>
);
}
-49
View File
@@ -1,49 +0,0 @@
"use client"
import { useTheme } from "next-themes"
import { Toaster as Sonner, type ToasterProps } from "sonner"
import { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from "lucide-react"
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "system" } = useTheme()
return (
<Sonner
theme={theme as ToasterProps["theme"]}
className="toaster group"
icons={{
success: (
<CircleCheckIcon className="size-4" />
),
info: (
<InfoIcon className="size-4" />
),
warning: (
<TriangleAlertIcon className="size-4" />
),
error: (
<OctagonXIcon className="size-4" />
),
loading: (
<Loader2Icon className="size-4 animate-spin" />
),
}}
style={
{
"--normal-bg": "var(--popover)",
"--normal-text": "var(--popover-foreground)",
"--normal-border": "var(--border)",
"--border-radius": "var(--radius)",
} as React.CSSProperties
}
toastOptions={{
classNames: {
toast: "cn-toast",
},
}}
{...props}
/>
)
}
export { Toaster }