From 522199483ce8a5c00dfbd366660b5da4688911d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vi=CC=81ctor=20Falco=CC=81n?= Date: Sat, 20 Jun 2026 19:41:43 +0200 Subject: [PATCH] feat(accounts): swap the account type icon with the drag handle on hover Revert to the icon-swap handle: on the dashboard card the drag handle takes the place of the account type icon (top-right) on hover. On the accounts list card, add the account type icon in the bottom-left of the actions row (buttons follow it) and apply the same hover swap, so both screens reveal the drag handle the same way. --- .../components/accounts/account-list-card.tsx | 29 ++++-- .../dashboard/account-balance-card.tsx | 88 ++++++++++--------- resources/js/components/sortable-grid.tsx | 4 +- 3 files changed, 68 insertions(+), 53 deletions(-) diff --git a/resources/js/components/accounts/account-list-card.tsx b/resources/js/components/accounts/account-list-card.tsx index a6ecd7ba..6416df9c 100644 --- a/resources/js/components/accounts/account-list-card.tsx +++ b/resources/js/components/accounts/account-list-card.tsx @@ -1,11 +1,13 @@ import { show } from '@/actions/App/Http/Controllers/AccountController'; import { AccountName } from '@/components/accounts/account-name'; import { BankLogo } from '@/components/bank-logo'; +import { AccountTypeIcon } from '@/components/dashboard/account-type-icon'; import { AmountTrendIndicator } from '@/components/dashboard/amount-trend-indicator'; import { AmountDisplay } from '@/components/ui/amount-display'; import { Card, CardContent } from '@/components/ui/card'; import { useChartColors } from '@/hooks/use-chart-color-scheme'; import { AccountWithMetrics } from '@/hooks/use-dashboard-data'; +import { cn } from '@/lib/utils'; import { formatAccountType, supportsInvestedAmount } from '@/types/account'; import { __ } from '@/utils/i18n'; import { Link } from '@inertiajs/react'; @@ -139,12 +141,11 @@ export function AccountListCard({
-
- {dragHandle} +

{account.bank && ( @@ -429,7 +430,22 @@ export function AccountListCard({

-
+
+
+ + {dragHandle && ( + + {dragHandle} + + )} +
+ {!isConnected && ( diff --git a/resources/js/components/dashboard/account-balance-card.tsx b/resources/js/components/dashboard/account-balance-card.tsx index c92a51bc..8d169829 100644 --- a/resources/js/components/dashboard/account-balance-card.tsx +++ b/resources/js/components/dashboard/account-balance-card.tsx @@ -6,6 +6,7 @@ import { AmountDisplay } from '@/components/ui/amount-display'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { useChartColors } from '@/hooks/use-chart-color-scheme'; import { AccountWithMetrics } from '@/hooks/use-dashboard-data'; +import { cn } from '@/lib/utils'; import { supportsInvestedAmount } from '@/types/account'; import { __ } from '@/utils/i18n'; import { Link } from '@inertiajs/react'; @@ -157,54 +158,57 @@ export function AccountBalanceCard({ return ( -
- {dragHandle} -
- - - +
+ + + - + + + {hasMortgage && linkedLoanMetrics.loanAccount && ( + + {__('Mortgage at')}{' '} + {linkedLoanMetrics.loanAccount.bank && ( + - - - {hasMortgage && linkedLoanMetrics.loanAccount && ( - - {__('Mortgage at')}{' '} - {linkedLoanMetrics.loanAccount.bank && ( - - )} - {linkedLoanMetrics.loanAccount.bank?.name ?? - linkedLoanMetrics.loanAccount.name} - - )} -
+ )} + {linkedLoanMetrics.loanAccount.bank?.name ?? + linkedLoanMetrics.loanAccount.name} + + )}
-
+
+ {dragHandle && ( + + {dragHandle} + + )}
diff --git a/resources/js/components/sortable-grid.tsx b/resources/js/components/sortable-grid.tsx index 97c54bc2..0ea26701 100644 --- a/resources/js/components/sortable-grid.tsx +++ b/resources/js/components/sortable-grid.tsx @@ -110,14 +110,12 @@ function SortableItem({ isDragging, } = useSortable({ id }); - // Collapsed to zero width by default; on card hover it expands and slides - // in, pushing the card's leading content (logo + name) to the right. const dragHandle = (