Skip to content

Commit aaaaed3

Browse files
authored
Fixing mobile UI bug (#72)
* Fixing mobile UI bug * Cleanups
1 parent 7f15d21 commit aaaaed3

File tree

2 files changed

+43
-48
lines changed

2 files changed

+43
-48
lines changed

src/features/dashboard/components/Dashboard.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,6 @@ export default function Dashboard() {
199199
}
200200
}, [selectedStrategy]);
201201

202-
const handleCTAClick = useCallback(() => {
203-
if (selectedStrategy) {
204-
// Strategy selected: open email capture
205-
setAlertsDialogOpen(true);
206-
} else {
207-
// No strategy: open strategy selector
208-
setStrategiesSheetOpen(true);
209-
}
210-
}, [selectedStrategy]);
211-
212202
const handleRefresh = useCallback(() => {
213203
setRefreshTrigger((t) => t + 1);
214204
}, []);
@@ -221,7 +211,7 @@ export default function Dashboard() {
221211
handleStrategySelect(linkId, detailStats); // Set selection so chart shows mobile header (1D, YTD/1Y/3Y)
222212
openStrategyDrawer(detailStats);
223213
}
224-
}, [mergedStrategies, openStrategyDrawer, handleStrategySelect]);
214+
}, [strategies, openStrategyDrawer, handleStrategySelect]);
225215

226216

227217

@@ -364,7 +354,7 @@ export default function Dashboard() {
364354
</div>
365355

366356
{/* Sticky Action Bar */}
367-
{selectedStrategyId && selectedStrategy && (
357+
{!isMobile && selectedStrategyId && selectedStrategy && (
368358
<div className="sticky bottom-0 mt-4 pt-4 border-t border-border bg-background">
369359
<div className="space-y-2">
370360
<Button
@@ -388,7 +378,7 @@ export default function Dashboard() {
388378
</div>
389379
</div>
390380
)}
391-
{selectedStrategyId && !selectedStrategy && (
381+
{!isMobile && selectedStrategyId && !selectedStrategy && (
392382
<div className="sticky bottom-0 mt-4 pt-4 border-t border-border bg-background">
393383
<p className="text-sm text-muted-foreground text-center">
394384
Select a strategy to enable actions
@@ -399,7 +389,7 @@ export default function Dashboard() {
399389
</div>
400390

401391
{/* Mobile Sticky CTA Bar */}
402-
{isMobile && !autoTradeWaitlistOpen && (
392+
{isMobile && !autoTradeWaitlistOpen && !drawerOpen && (
403393
<div className="fixed bottom-0 left-0 right-0 z-[100] bg-background/95 backdrop-blur-sm border-t border-border shadow-lg pointer-events-auto">
404394
{selectedStrategy ? (
405395
<div className="px-4 py-3 space-y-2 pointer-events-auto">
@@ -429,7 +419,7 @@ export default function Dashboard() {
429419
variant="default"
430420
size="lg"
431421
className="w-full h-11 text-base font-medium"
432-
onClick={handleCTAClick}
422+
onClick={handleGetAlerts}
433423
>
434424
Get trade alerts
435425
</Button>
@@ -511,6 +501,7 @@ export default function Dashboard() {
511501
if (!open) closeStrategyDrawer();
512502
}}
513503
strategy={selectedStrategy}
504+
onAutoTrade={handleAutoTrade}
514505
/>
515506

516507
{/* Alerts Dialog */}
@@ -560,4 +551,4 @@ export default function Dashboard() {
560551
)}
561552
</div>
562553
);
563-
}
554+
}

src/features/dashboard/components/StrategyDetailDrawer.tsx

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ interface StrategyDetailDrawerProps {
6060
open: boolean;
6161
onOpenChange: (open: boolean) => void;
6262
strategy: StrategyDetailStats | null;
63+
onAutoTrade: () => void;
6364
}
6465

6566
function formatTradeDate(dateStr: string): string {
@@ -111,6 +112,7 @@ export default function StrategyDetailDrawer({
111112
open,
112113
onOpenChange,
113114
strategy,
115+
onAutoTrade,
114116
}: StrategyDetailDrawerProps) {
115117
const isMobile = useIsMobile();
116118
const [followAlertsOpen, setFollowAlertsOpen] = useState(false);
@@ -278,50 +280,52 @@ export default function StrategyDetailDrawer({
278280
<span>Sharpe {metrics.sharpe.toFixed(2)}</span>
279281
</div>
280282
</details>
283+
</div>
284+
);
281285

282-
<div className="flex flex-col gap-2 pt-2 border-t border-border">
283-
<div className="flex gap-2">
284-
<Button
285-
type="button"
286-
variant="secondary"
287-
size="sm"
288-
className="flex-1"
289-
onClick={handleFollowAlerts}
290-
>
291-
Follow Alerts
292-
</Button>
293-
<Button
294-
type="button"
295-
variant="default"
296-
size="sm"
297-
className="flex-1"
298-
disabled
299-
title="Auto-Trade (Alpaca / IBKR / Tradier) coming soon"
300-
>
301-
Auto-Trade
302-
</Button>
303-
</div>
304-
<Button variant="outline" size="sm" asChild>
305-
<Link href={`/strategies/${strategy.linkId}`} onClick={() => onOpenChange(false)}>
306-
Open full strategy →
307-
</Link>
286+
const actionBar = (
287+
<div className="flex flex-col gap-2">
288+
<div className="flex gap-2">
289+
<Button
290+
type="button"
291+
variant="secondary"
292+
size="sm"
293+
className="flex-1"
294+
onClick={handleFollowAlerts}
295+
>
296+
Follow Alerts
297+
</Button>
298+
<Button
299+
type="button"
300+
variant="default"
301+
size="sm"
302+
className="flex-1"
303+
onClick={onAutoTrade}
304+
>
305+
Auto-Trade
308306
</Button>
309307
</div>
308+
<Button variant="outline" size="sm" asChild>
309+
<Link href={`/strategies/${strategy.linkId}`} onClick={() => onOpenChange(false)}>
310+
Open full strategy →
311+
</Link>
312+
</Button>
310313
</div>
311314
);
312315

313316
if (isMobile) {
314317
return (
315318
<>
316319
<Drawer open={open} onOpenChange={onOpenChange}>
317-
<DrawerContent>
320+
<DrawerContent className="h-[85vh] max-h-[85vh] flex flex-col">
318321
<DrawerHeader>
319322
<DrawerTitle className="text-left">{displayName}</DrawerTitle>
320323
<DrawerDescription className="text-left">
321324
Strategy performance and allocation details
322325
</DrawerDescription>
323326
</DrawerHeader>
324-
<div className="px-4 pb-6 overflow-y-auto">{content}</div>
327+
<div className="px-4 flex-1 overflow-y-auto pb-4">{content}</div>
328+
<div className="border-t border-border p-4 pt-3 bg-background">{actionBar}</div>
325329
</DrawerContent>
326330
</Drawer>
327331
{followAlertsOpen && (
@@ -340,12 +344,13 @@ export default function StrategyDetailDrawer({
340344
return (
341345
<>
342346
<Dialog open={open} onOpenChange={onOpenChange}>
343-
<DialogContent className="max-w-md max-h-[90vh] overflow-y-auto">
344-
<DialogHeader>
347+
<DialogContent className="max-w-md max-h-[90vh] flex flex-col p-0 gap-0 overflow-hidden">
348+
<DialogHeader className="px-6 pt-6 pb-3">
345349
<DialogTitle>{displayName}</DialogTitle>
346350
<DialogDescription>Strategy performance and allocation details</DialogDescription>
347351
</DialogHeader>
348-
{content}
352+
<div className="px-6 flex-1 overflow-y-auto pb-4">{content}</div>
353+
<div className="border-t border-border px-6 pb-6 pt-3 bg-background">{actionBar}</div>
349354
</DialogContent>
350355
</Dialog>
351356
{followAlertsOpen && (
@@ -360,4 +365,3 @@ export default function StrategyDetailDrawer({
360365
</>
361366
);
362367
}
363-

0 commit comments

Comments
 (0)