mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 10:48:20 +01:00
fix(today): mobile scroll affordance for SummaryBar chips
ui-scroll-fade-right alone is too subtle on iOS — native scrollbars hide at rest, so a user landing on Today doesn't realize they can swipe through more chips past the right edge. Caught during a live mobile (414px) audit: chips visually fade off-screen with no "there's more here" cue. Wrap the scroll row in a relative container and add a ChevronRight icon pinned to the right edge inside the fade area. pointer-events- none so a chip tap underneath still lands. drop-shadow gives a subtle halo that lifts the icon off the fading background. Conditional on totalChipCount >= 3 — single-chip days don't need the hint and 3+ is the rough threshold where overflow is likely on a 414px viewport. sm:hidden ensures the chevron disappears once chips wrap naturally on desktop. Skeleton wrapper also gets the same relative div for consistent layout while loading (no chevron — skeleton is fixed-width).
This commit is contained in:
1 file changed
+42
-22
@@ -1,4 +1,4 @@
|
||||
import { Target, Bell, Inbox, AlertCircle, Clock, Calendar, Users, Repeat2, Bot, Activity, CirclePause } from "lucide-react";
|
||||
import { Target, Bell, Inbox, AlertCircle, Clock, Calendar, Users, Repeat2, Bot, Activity, CirclePause, ChevronRight } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { IvyDispatchButton } from "@/components/shared/IvyDispatchButton";
|
||||
import { getTodaySummary, getFleetSummary } from "@/db/queries/today";
|
||||
@@ -9,14 +9,16 @@ import { APP_LOCALE } from "@/lib/constants";
|
||||
export function SummaryBarSkeleton() {
|
||||
const widths = ["5rem", "7rem", "6rem", "5rem", "5rem"];
|
||||
return (
|
||||
<div className="flex gap-3 overflow-x-auto ui-scroll-fade-right [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden sm:flex-wrap sm:overflow-x-visible">
|
||||
{widths.map((w, i) => (
|
||||
<div
|
||||
key={i}
|
||||
style={{ width: w }}
|
||||
className="h-8 animate-pulse rounded-full border border-border-default bg-surface-raised"
|
||||
/>
|
||||
))}
|
||||
<div className="relative">
|
||||
<div className="flex gap-3 overflow-x-auto ui-scroll-fade-right [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden sm:flex-wrap sm:overflow-x-visible">
|
||||
{widths.map((w, i) => (
|
||||
<div
|
||||
key={i}
|
||||
style={{ width: w }}
|
||||
className="h-8 animate-pulse rounded-full border border-border-default bg-surface-raised"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -86,20 +88,38 @@ export async function SummaryBar() {
|
||||
<span aria-hidden className="hidden sm:inline-block h-6 w-px bg-border-subtle self-center mx-1" />
|
||||
);
|
||||
|
||||
// Mobile-only scroll affordance: a small chevron pinned to the right edge
|
||||
// tells the user "more chips this way." ui-scroll-fade-right alone is too
|
||||
// subtle on iOS (native scrollbars hide at rest). pointer-events-none so
|
||||
// it never blocks a chip tap underneath. Hidden on sm+ where chips wrap.
|
||||
const scrollHint = (
|
||||
<span
|
||||
aria-hidden
|
||||
className="pointer-events-none absolute inset-y-0 right-0 z-10 flex items-center pr-1 text-text-tertiary sm:hidden"
|
||||
>
|
||||
<ChevronRight className="h-4 w-4 drop-shadow-[0_0_4px_var(--surface-page)]" />
|
||||
</span>
|
||||
);
|
||||
|
||||
const totalChipCount = counters.length + alerts.length + fleetPills.length;
|
||||
|
||||
return (
|
||||
<div className="flex gap-3 overflow-x-auto ui-scroll-fade-right [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden sm:flex-wrap sm:overflow-x-visible">
|
||||
{counters}
|
||||
{counters.length > 0 && (alerts.length > 0 || fleetPills.length > 0) && divider}
|
||||
{alerts}
|
||||
{alerts.length > 0 && fleetPills.length > 0 && divider}
|
||||
{fleetPills}
|
||||
{(counters.length > 0 || alerts.length > 0 || fleetPills.length > 0) && divider}
|
||||
<IvyDispatchButton
|
||||
prompt={todayBriefPrompt}
|
||||
title="Brief Ivy on today"
|
||||
label="Brief Ivy"
|
||||
className="inline-flex items-center gap-1.5 rounded-full border border-status-positive/30 bg-status-positive-subtle/40 px-3 py-2 text-xs font-semibold text-status-positive hover:bg-status-positive-subtle transition-colors min-h-11 sm:min-h-0 shrink-0"
|
||||
/>
|
||||
<div className="relative">
|
||||
<div className="flex gap-3 overflow-x-auto ui-scroll-fade-right [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden sm:flex-wrap sm:overflow-x-visible">
|
||||
{counters}
|
||||
{counters.length > 0 && (alerts.length > 0 || fleetPills.length > 0) && divider}
|
||||
{alerts}
|
||||
{alerts.length > 0 && fleetPills.length > 0 && divider}
|
||||
{fleetPills}
|
||||
{(counters.length > 0 || alerts.length > 0 || fleetPills.length > 0) && divider}
|
||||
<IvyDispatchButton
|
||||
prompt={todayBriefPrompt}
|
||||
title="Brief Ivy on today"
|
||||
label="Brief Ivy"
|
||||
className="inline-flex items-center gap-1.5 rounded-full border border-status-positive/30 bg-status-positive-subtle/40 px-3 py-2 text-xs font-semibold text-status-positive hover:bg-status-positive-subtle transition-colors min-h-11 sm:min-h-0 shrink-0"
|
||||
/>
|
||||
</div>
|
||||
{totalChipCount >= 3 && scrollHint}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user