The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix the sections
Kiran K104eebd85f0b
diff --git a/apps/web/ui/guides/guide-list.tsx b/apps/web/ui/guides/guide-list.tsxindex cb8cfc67d0..a6bcd6dcc3 100644--- a/apps/web/ui/guides/guide-list.tsx+++ b/apps/web/ui/guides/guide-list.tsx@@ -15,13 +15,28 @@ import Link from "next/link";import { usePathname } from "next/navigation";import { useState } from "react";import { toast } from "sonner";-import { guides, IntegrationGuide, IntegrationType } from "./integrations";-import { sections } from "./sections";+import {+ guides,+ IntegrationGuide,+ IntegrationType,+ sections,+} from "./integrations";interface GuideListProps {showConnectLaterButton?: boolean;}+const guidesByType = guides.reduce(+ (acc, guide) => {+ if (!acc[guide.type]) {+ acc[guide.type] = [];+ }+ acc[guide.type].push(guide);+ return acc;+ },+ {} as Record<IntegrationType, IntegrationGuide[]>,+);+export function GuideList({ showConnectLaterButton = true }: GuideListProps) {const pathname = usePathname();const { slug: workspaceSlug } = useWorkspace();@@ -35,33 +50,18 @@ export function GuideList({ showConnectLaterButton = true }: GuideListProps) {sections[0].type,]);- const guidesByType = guides.reduce(- (acc, guide) => {- if (!acc[guide.type]) {- acc[guide.type] = [];- }- acc[guide.type].push(guide);- return acc;- },- {} as Record<IntegrationType, IntegrationGuide[]>,- );-- const handleComplete = (sectionType: IntegrationType) => {+ const handleComplete = (type: IntegrationType) => {setCompletedSections((prev) => {const newSet = new Set(prev);- newSet.add(sectionType);+ newSet.add(type);return newSet;});- const completedSectionIndex = sections.findIndex(- (s) => s.type === sectionType,- );+ const completedSectionIndex = sections.findIndex((s) => s.type === type);setOpenSections((prevOpenSections) => {- // close current section- const newOpenSections = prevOpenSections.filter((s) => s !== sectionType);+ const newOpenSections = prevOpenSections.filter((s) => s !== type);- // open next sectionif (completedSectionIndex < sections.length - 1) {const nextSection = sections[completedSectionIndex + 1];newOpenSections.push(nextSection.type);diff --git a/apps/web/ui/guides/integrations.ts b/apps/web/ui/guides/integrations.tsindex 4a637ca715..10bade8917 100644--- a/apps/web/ui/guides/integrations.ts+++ b/apps/web/ui/guides/integrations.ts@@ -33,6 +33,37 @@ export type IntegrationGuide = {content?: string;};+export const sections: {+ type: IntegrationType;+ title: string;+ description: string;+}[] = [+ {+ type: "client-sdk",+ title: "Set up client-side script",+ description:+ "The step allows Dub to track clicks, automatically fetch the partner and discount data for a given link. Select the guide for instructions.",+ },+ {+ type: "server-sdk",+ title: "Set up server-side SDK",+ description:+ "Install the server-side SDK of your choice and select the guide for instructions.",+ },+ {+ type: "track-leads",+ title: "Track lead events",+ description:+ "The step allows your app to send lead events to Dub. Select the guide for instructions.",+ },+ {+ type: "track-sales",+ title: "Track sale events",+ description:+ "The step allows your app to send sale events to Dub. Select the guide for instructions.",+ },+];+export const guides: IntegrationGuide[] = [// Client SDK{@@ -176,10 +207,10 @@ export const guides: IntegrationGuide[] = [description: "Customers",icon: Stripe,},- {- type: "track-sales",- key: "segment-track-sales",- title: "Segment",- icon: Segment,- },+ // {+ // type: "track-sales",+ // key: "segment-track-sales",+ // title: "Segment",+ // icon: Segment,+ // },];diff --git a/apps/web/ui/guides/sections.ts b/apps/web/ui/guides/sections.tsdeleted file mode 100644index 3c6fe60574..0000000000--- a/apps/web/ui/guides/sections.ts+++ /dev/null@@ -1,32 +0,0 @@-import { IntegrationType } from "./integrations";--export const sections: {- type: IntegrationType;- title: string;- description: string;-}[] = [- {- type: "client-sdk",- title: "Set up client-side script",- description:- "The step allows Dub to track clicks, automatically fetch the partner and discount data for a given link. Select the guide for instructions.",- },- {- type: "server-sdk",- title: "Set up server-side SDK",- description:- "Install the server-side SDK of your choice and select the guide for instructions.",- },- {- type: "track-leads",- title: "Track lead events",- description:- "The step allows your app to send lead events to Dub. Select the guide for instructions.",- },- {- type: "track-sales",- title: "Track sale events",- description:- "The step allows your app to send sale events to Dub. Select the guide for instructions.",- },-];