feat: add account merging functionality with dialog support; update bulk actions to include merge option
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 1m39s

This commit is contained in:
Julien Froidefond
2025-12-20 11:42:42 +01:00
parent 376bc8f84e
commit 8b81dfe8c0
5 changed files with 367 additions and 2 deletions

View File

@@ -2,29 +2,35 @@
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
import { Trash2 } from "lucide-react";
import { Trash2, GitMerge } from "lucide-react";
import { useIsMobile } from "@/hooks/use-mobile";
import { cn } from "@/lib/utils";
interface AccountBulkActionsProps {
selectedCount: number;
selectedAccountIds: string[];
onDelete: () => void;
onMerge?: () => void;
}
export function AccountBulkActions({
selectedCount,
selectedAccountIds: _selectedAccountIds,
onDelete,
onMerge,
}: AccountBulkActionsProps) {
const isMobile = useIsMobile();
if (selectedCount === 0) return null;
const canMerge = selectedCount === 2 && onMerge;
return (
<Card className="bg-destructive/5 border-destructive/20 sticky top-0 z-10 mb-4">
<CardContent className={cn("py-3", isMobile && "px-3")}>
<div
className={cn(
"flex items-center gap-2 sm:gap-4",
"flex items-center gap-2 sm:gap-4 flex-wrap",
isMobile && "flex-col sm:flex-row",
)}
>
@@ -32,6 +38,19 @@ export function AccountBulkActions({
{selectedCount} compte{selectedCount > 1 ? "s" : ""} sélectionné
{selectedCount > 1 ? "s" : ""}
</span>
{canMerge && (
<Button
size={isMobile ? "sm" : "sm"}
variant="default"
onClick={onMerge}
className={cn(isMobile && "w-full sm:w-auto")}
>
<GitMerge
className={cn(isMobile ? "w-3.5 h-3.5" : "w-4 h-4", "mr-1")}
/>
Fusionner
</Button>
)}
<Button
size={isMobile ? "sm" : "sm"}
variant="destructive"