feat: add edit mode toggle to show/hide drag handles

- Add edit mode button next to settings in header
- Edit button turns blue when active
- Drag handles fade in/out with edit mode toggle
- Add smooth 200ms transition animation
- Add i18n support for edit mode (en/zh)
- Maintain consistent spacing between header elements
This commit is contained in:
Jason
2025-10-19 22:12:12 +08:00
parent 43ed1c7533
commit 491bbff11d
5 changed files with 40 additions and 6 deletions

View File

@@ -21,6 +21,7 @@ interface ProviderCardProps {
provider: Provider;
isCurrent: boolean;
appType: AppType;
isEditMode?: boolean;
onSwitch: (provider: Provider) => void;
onEdit: (provider: Provider) => void;
onDelete: (provider: Provider) => void;
@@ -59,6 +60,7 @@ export function ProviderCard({
provider,
isCurrent,
appType,
isEditMode = false,
onSwitch,
onEdit,
onDelete,
@@ -101,7 +103,10 @@ export function ProviderCard({
<button
type="button"
className={cn(
"mt-1 flex h-8 w-8 items-center justify-center rounded-md border border-transparent text-muted-foreground transition-colors hover:border-muted hover:text-foreground",
"mt-1 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md border text-muted-foreground transition-all duration-200",
isEditMode
? "border-muted hover:border-primary hover:text-foreground opacity-100"
: "border-transparent opacity-0 pointer-events-none",
dragHandleProps?.isDragging && "border-primary text-primary",
)}
aria-label={t("provider.dragHandle")}