From a7808a471b707e1fd223dba4c1197cc03cc91e02 Mon Sep 17 00:00:00 2001 From: dc Date: Thu, 23 Oct 2025 15:07:11 +0530 Subject: [PATCH] Add basic touring feature --- app/[locale]/(user)/components/Content.tsx | 13 +- .../(user)/components/ListingComponent.tsx | 12 +- .../DatasetDetailsPage.tsx | 12 +- .../[entitySlug]/dataset/page.tsx | 6 + app/[locale]/dashboard/page.tsx | 7 +- components/Tour/TourButton.tsx | 75 +++ components/Tour/TourGuide.tsx | 171 ++++++ components/Tour/index.ts | 2 + components/provider.tsx | 17 +- config/tours.ts | 230 ++++++++ contexts/TourContext.tsx | 157 ++++++ docs/TOUR_GUIDE.md | 489 ++++++++++++++++++ hooks/use-tour-trigger.ts | 58 +++ lib/tour-utils.ts | 271 ++++++++++ package-lock.json | 145 ++++++ package.json | 1 + types/tour.ts | 180 +++++++ 17 files changed, 1829 insertions(+), 17 deletions(-) create mode 100644 components/Tour/TourButton.tsx create mode 100644 components/Tour/TourGuide.tsx create mode 100644 components/Tour/index.ts create mode 100644 config/tours.ts create mode 100644 contexts/TourContext.tsx create mode 100644 docs/TOUR_GUIDE.md create mode 100644 hooks/use-tour-trigger.ts create mode 100644 lib/tour-utils.ts create mode 100644 types/tour.ts diff --git a/app/[locale]/(user)/components/Content.tsx b/app/[locale]/(user)/components/Content.tsx index 8c96b20f..9fea2c38 100644 --- a/app/[locale]/(user)/components/Content.tsx +++ b/app/[locale]/(user)/components/Content.tsx @@ -10,6 +10,7 @@ import { SearchInput, Spinner, Tag, Text } from 'opub-ui'; import { GraphQL } from '@/lib/api'; import { cn } from '@/lib/utils'; import Styles from '../page.module.scss'; +import { useTourTrigger } from '@/hooks/use-tour-trigger'; const statsInfo: any = graphql(` query StatsList { @@ -34,6 +35,10 @@ const statsInfo: any = graphql(` export const Content = () => { const router = useRouter(); + + // Enable tour for first-time users + useTourTrigger(true, 1500); + const Stats: { data: any; isLoading: any } = useQuery([`statsDetails`], () => GraphQL(statsInfo, {}, []) ); @@ -104,7 +109,11 @@ export const Content = () => { ) : (
{Metrics.map((item, index) => ( - +
{ ))}
)} -
+
{ @@ -256,6 +257,8 @@ const ListingComponent: React.FC = ({ redirectionURL, lockedFilters = {}, }) => { + useTourTrigger(true, 1500); + const [facets, setFacets] = useState<{ results: any[]; total: number; @@ -397,7 +400,7 @@ const ListingComponent: React.FC = ({
-
+
= ({
-
+
= ({ />
-
+