Files
CC-Switch/src/components/UpdateBadge.tsx
T
Jason 9404341f14 feat(ui): replace update badge dot with ArrowUpCircle icon
- 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
2026-01-24 23:32:05 +08:00

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>
);
}