Skip to content

Commit 2483486

Browse files
Persisting the onboarding button
1 parent c23ca58 commit 2483486

2 files changed

Lines changed: 24 additions & 26 deletions

File tree

frontend/app/dashboard/new-image/page.tsx

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ export default function NewImagePage() {
9696
const [noRecommendationsMessage, setNoRecommendationsMessage] = useState<string | null>(null);
9797
const [numScans, setNumScans] = useState<number>(0);
9898
const [isPro, setIsPro] = useState<boolean>(false);
99-
const [onboardingActive, setOnboardingActive] = useState(false);
100-
const [onboardingCompleted, setOnboardingCompleted] = useState(false);
10199

102100
const loadUsage = useCallback(async () => {
103101
try {
@@ -123,26 +121,7 @@ export default function NewImagePage() {
123121
void loadUsage();
124122
}, [loadUsage]);
125123

126-
useEffect(() => {
127-
try {
128-
const active = localStorage.getItem("book_onboarding_active") === "true";
129-
// const completed = localStorage.getItem("book_onboarding_completed") === "true";
130-
setOnboardingActive(active);
131-
// setOnboardingCompleted(completed);
132-
} catch {
133-
// Ignore
134-
}
135-
}, []);
136-
137124
const handleStartOnboarding = () => {
138-
try {
139-
localStorage.setItem("book_onboarding_active", "true");
140-
// localStorage.setItem("book_onboarding_completed", "false");
141-
} catch {
142-
// Ignore
143-
}
144-
setOnboardingActive(true);
145-
// setOnboardingCompleted(false);
146125
window.dispatchEvent(new Event("book:onboarding-start"));
147126
};
148127

@@ -334,7 +313,6 @@ export default function NewImagePage() {
334313
<p className="mt-2 text-muted-foreground">
335314
Paste from clipboard (Ctrl+V / Cmd+V), or drag and drop an image here.
336315
</p>
337-
{!onboardingCompleted && !onboardingActive && (
338316
<Button
339317
type="button"
340318
variant="outline"
@@ -344,7 +322,6 @@ export default function NewImagePage() {
344322
>
345323
Start onboarding
346324
</Button>
347-
)}
348325
</div>
349326

350327
<div className="rounded-lg border border-border bg-card px-4 py-3 w-1/2">

frontend/components/dashboard-sidebar.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,27 @@ export function DashboardSidebar({ children }: { children: React.ReactNode }) {
121121
description: "Upload a photo of a shelf to generate recommendations.",
122122
},
123123
},
124+
{
125+
element: "#onboarding-history",
126+
popover: {
127+
title: "History",
128+
description: "See your previous scans and recommendations.",
129+
},
130+
},
131+
{
132+
element: "#onboarding-usage",
133+
popover: {
134+
title: "Usage",
135+
description: "Track scans used and how many remain this cycle.",
136+
},
137+
},
138+
{
139+
element: "#onboarding-billing",
140+
popover: {
141+
title: "Billing",
142+
description: "Manage your subscription and payment details.",
143+
},
144+
},
124145
],
125146
}).drive();
126147
}, 0);
@@ -186,21 +207,21 @@ export function DashboardSidebar({ children }: { children: React.ReactNode }) {
186207
<div className="min-h-0 flex-1" aria-hidden />
187208

188209
<SidebarMenu>
189-
<SidebarMenuItem>
210+
<SidebarMenuItem id="onboarding-history">
190211
<SidebarMenuButton
191212
render={<Link href="/dashboard/history"><History />History</Link>}
192213
isActive={pathname === "/dashboard/history"}
193214
tooltip="History"
194215
/>
195216
</SidebarMenuItem>
196-
<SidebarMenuItem>
217+
<SidebarMenuItem id="onboarding-usage">
197218
<SidebarMenuButton
198219
render={<Link href="/dashboard/usage"><Gauge />Usage</Link>}
199220
isActive={pathname === "/dashboard/usage"}
200221
tooltip="Usage"
201222
/>
202223
</SidebarMenuItem>
203-
<SidebarMenuItem>
224+
<SidebarMenuItem id="onboarding-billing">
204225
<SidebarMenuButton
205226
render={<Link href="/dashboard/billing"><CreditCard />Billing</Link>}
206227
isActive={pathname === "/dashboard/billing"}

0 commit comments

Comments
 (0)