MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / useSteps

Function useSteps

apps/start/src/components/onboarding/steps.tsx:15–53  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

13};
14
15function useSteps(path: string) {
16 const steps: Step[] = [
17 {
18 name: 'Create an account',
19 status: 'pending',
20 match: '/onboarding',
21 },
22 {
23 name: 'Create a project',
24 status: 'pending',
25 match: '/onboarding/project',
26 },
27 {
28 name: 'Connect your data',
29 status: 'pending',
30 match: '/onboarding/(.+)/connect',
31 },
32 {
33 name: 'Verify',
34 status: 'pending',
35 match: '/onboarding/(.+)/verify',
36 },
37 ];
38
39 // @ts-ignore
40 const matchIndex = steps.findLastIndex((step) =>
41 path.match(new RegExp(step.match)),
42 );
43
44 return steps.map((step, index) => {
45 if (index < matchIndex) {
46 return { ...step, status: 'completed' };
47 }
48 if (index === matchIndex) {
49 return { ...step, status: 'current' };
50 }
51 return step;
52 });
53}
54
55export const OnboardingSteps = ({ className }: Props) => {
56 const location = useLocation();

Callers 1

OnboardingStepsFunction · 0.85

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected