mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
9404341f14
- Replace blue dot indicator with lucide ArrowUpCircle icon - Change color scheme from blue to green for better visibility - Enlarge button (h-8 w-8) and icon (h-5 w-5) for better UX - Move UpdateBadge from title area to after settings icon
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { useUpdate } from "@/contexts/UpdateContext";
|
|
import { useTranslation } from "react-i18next";
|
|
import { Button } from "@/components/ui/button";
|
|
import { ArrowUpCircle } from "lucide-react";
|
|
|
|
interface UpdateBadgeProps {
|
|
className?: string;
|
|
onClick?: () => void;
|
|
}
|
|
|
|
export function UpdateBadge({ className = "", onClick }: UpdateBadgeProps) {
|
|
const { hasUpdate, updateInfo } = useUpdate();
|
|
const { t } = useTranslation();
|
|
const isActive = hasUpdate && updateInfo;
|
|
const title = isActive
|
|
? t("settings.updateAvailable", {
|
|
version: updateInfo?.availableVersion ?? "",
|
|
})
|
|
: t("settings.checkForUpdates");
|
|
|
|
if (!isActive) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Button
|
|
type="button"
|
|
variant="ghost"
|
|
size="icon"
|
|
title={title}
|
|
aria-label={title}
|
|
onClick={onClick}
|
|
className={`
|
|
relative h-8 w-8 rounded-full
|
|
${isActive ? "text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-500/10" : "text-muted-foreground hover:bg-muted/60"}
|
|
${className}
|
|
`}
|
|
>
|
|
<ArrowUpCircle className="h-5 w-5" />
|
|
</Button>
|
|
);
|
|
}
|