Skip to content

Commit 6110dfe

Browse files
committed
chore(frontend): add basic callback to joyride
1 parent 4d84603 commit 6110dfe

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

apps/frontend/app/lib/state/general.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { atom, useAtom } from "jotai";
22
import { atomWithStorage } from "jotai/utils";
3-
import type { Step } from "react-joyride";
3+
import { useEffect } from "react";
4+
import type { CallBackProps, Step } from "react-joyride";
45

56
export const TourStepTargets = {
67
One: "tour-step-1",
@@ -10,6 +11,7 @@ export const TourStepTargets = {
1011
export const tourSteps = (
1112
[
1213
{
14+
disableBeacon: true,
1315
target: TourStepTargets.One,
1416
content:
1517
"Welcome to Ryot! Let's get started by adding a movie to your watchlist. Click on the media section in the sidebar to see what all you can track.",
@@ -24,11 +26,19 @@ export const tourSteps = (
2426

2527
const onboardingTourAtom = atom<{ currentStepIndex: number } | undefined>();
2628

29+
export const handleJoyrideCallback = (data: CallBackProps) => {
30+
console.log(data);
31+
};
32+
2733
export const useOnboardingTour = () => {
2834
const [tourState, setTourState] = useAtom(onboardingTourAtom);
2935

30-
const startTour = () => setTourState({ currentStepIndex: 0 });
3136
const stopTour = () => setTourState(undefined);
37+
const startTour = () => setTourState({ currentStepIndex: 0 });
38+
39+
useEffect(() => {
40+
console.log(new Date().toISOString());
41+
}, []);
3242

3343
return {
3444
stopTour,
@@ -46,7 +56,7 @@ type OpenedSidebarLinks = {
4656
};
4757

4858
const openedSidebarLinksAtom = atomWithStorage<OpenedSidebarLinks>(
49-
"openedSidebarLinks",
59+
"OpenedSidebarLinks",
5060
{
5161
media: false,
5262
fitness: false,

apps/frontend/app/routes/_dashboard.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ import {
138138
tourSteps,
139139
useOnboardingTour,
140140
useOpenedSidebarLinks,
141+
handleJoyrideCallback,
141142
} from "~/lib/state/general";
142143
import {
143144
type UpdateProgressData,
@@ -403,12 +404,14 @@ export default function Layout() {
403404
<ClientOnly>
404405
{() => (
405406
<Joyride
407+
continuous
406408
hideBackButton
407409
hideCloseButton
408410
steps={tourSteps}
409411
run={isTourStarted}
410412
spotlightPadding={0}
411413
stepIndex={stepIndex}
414+
callback={handleJoyrideCallback}
412415
/>
413416
)}
414417
</ClientOnly>

0 commit comments

Comments
 (0)