11"use client" ;
22
3- import { useState } from 'react' ;
3+ import { useState , useEffect } from 'react' ;
44import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card' ;
55import { Button } from '@/components/ui/button' ;
66import { CurrencyDisplay } from '@/components/shared/CurrencyDisplay' ;
@@ -93,6 +93,15 @@ export default function DashboardPage() {
9393 const { user } = useAuthStore ( ) ;
9494 const [ activePeriod , setActivePeriod ] = useState < Period > ( '7D' ) ;
9595 const [ selectedTx , setSelectedTx ] = useState < Transaction | null > ( null ) ;
96+ const [ isMobile , setIsMobile ] = useState ( false ) ;
97+
98+ useEffect ( ( ) => {
99+ const mq = window . matchMedia ( '(max-width: 639px)' ) ;
100+ setIsMobile ( mq . matches ) ;
101+ const handler = ( e : MediaQueryListEvent ) => setIsMobile ( e . matches ) ;
102+ mq . addEventListener ( 'change' , handler ) ;
103+ return ( ) => mq . removeEventListener ( 'change' , handler ) ;
104+ } , [ ] ) ;
96105
97106 // Error simulation states
98107 const [ simulationEnabled , setSimulationEnabled ] = useState ( false ) ;
@@ -268,7 +277,7 @@ export default function DashboardPage() {
268277 key = { p }
269278 onClick = { ( ) => setActivePeriod ( p ) }
270279 className = { cn (
271- 'px-3 py-1 rounded-md text-xs font-semibold transition-all' ,
280+ 'min-h-[44px] min-w-[44px] px-3 py-1 rounded-md text-xs font-semibold transition-all' ,
272281 activePeriod === p
273282 ? 'bg-white text-slate-900 shadow-sm'
274283 : 'text-slate-400 hover:text-slate-600'
@@ -291,7 +300,7 @@ export default function DashboardPage() {
291300 ) : (
292301 < div className = "h-[260px] w-full" >
293302 < ResponsiveContainer width = "100%" height = "100%" >
294- < AreaChart data = { mockChartData } margin = { { top : 4 , right : 4 , bottom : 0 , left : - 16 } } >
303+ < AreaChart data = { mockChartData } margin = { { top : 4 , right : 4 , bottom : 0 , left : isMobile ? 0 : - 16 } } >
295304 < defs >
296305 < linearGradient id = "colorRevenue" x1 = "0" y1 = "0" x2 = "0" y2 = "1" >
297306 < stop offset = "5%" stopColor = "#F0A500" stopOpacity = { 0.25 } />
@@ -354,7 +363,7 @@ export default function DashboardPage() {
354363 < div className = "flex items-center justify-between" >
355364 < CardTitle className = "text-base font-semibold text-slate-900" > Recent Activity</ CardTitle >
356365 < Link href = "/transactions" >
357- < Button variant = "ghost" className = "text-xs text-amber-600 hover:text-amber-700 hover:bg-amber-50 h-7 px-2 rounded-lg font-semibold" >
366+ < Button variant = "ghost" className = "text-xs text-amber-600 hover:text-amber-700 hover:bg-amber-50 min-h-[44px] px-2 rounded-lg font-semibold" >
358367 View all < ChevronRight className = "w-3 h-3 ml-0.5" />
359368 </ Button >
360369 </ Link >
@@ -443,7 +452,7 @@ export default function DashboardPage() {
443452 < div className = "flex items-center justify-between" >
444453 < CardTitle className = "text-base font-semibold text-slate-900" > Payment Link Performance</ CardTitle >
445454 < Link href = "/payments" >
446- < Button variant = "ghost" className = "text-xs text-amber-600 hover:text-amber-700 hover:bg-amber-50 h-7 px-2 rounded-lg font-semibold" >
455+ < Button variant = "ghost" className = "text-xs text-amber-600 hover:text-amber-700 hover:bg-amber-50 min-h-[44px] px-2 rounded-lg font-semibold" >
447456 Manage < ArrowRight className = "w-3 h-3 ml-0.5" />
448457 </ Button >
449458 </ Link >
@@ -485,11 +494,11 @@ export default function DashboardPage() {
485494 < span className = "text-xs text-slate-400" > { link . clicks } clicks</ span >
486495 </ div >
487496 < div className = "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity" >
488- < Button variant = "ghost" size = "icon" aria-label = "Copy payment link" className = "h-7 w-7 rounded-lg" onClick = { ( ) => handleCopy ( `https://${ link . url } ` ) } >
497+ < Button variant = "ghost" size = "icon" aria-label = "Copy payment link" className = "min-h-[44px] min-w-[44px] rounded-lg" onClick = { ( ) => handleCopy ( `https://${ link . url } ` ) } >
489498 < Copy className = "w-3 h-3 text-slate-400" />
490499 </ Button >
491500 < Link href = { `https://${ link . url } ` } target = "_blank" >
492- < Button variant = "ghost" size = "icon" aria-label = "Open payment link" className = "h-7 w-7 rounded-lg" >
501+ < Button variant = "ghost" size = "icon" aria-label = "Open payment link" className = "min-h-[44px] min-w-[44px] rounded-lg" >
493502 < ExternalLink className = "w-3 h-3 text-slate-400" />
494503 </ Button >
495504 </ Link >
0 commit comments