PluginProbe
Extendify / 2.2.0
Extendify v2.2.0
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Launch / lib / pages.js

pages.js in Extendify 2.2.0, at src/Launch/lib/pages.js

85 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {
2 ContentGathering,
3 state as contentGatheringState,
4 } from '@launch/pages/ContentGathering';
5 import { HomeSelect, state as homeSelectState } from '@launch/pages/HomeSelect';
6 import {
7 ObjectiveSelection,
8 state as objectiveSelectionState,
9 } from '@launch/pages/ObjectiveSelection';
10 import {
11 PagesSelect,
12 state as pagesSelectState,
13 } from '@launch/pages/PagesSelect';
14 import {
15 SiteInformation,
16 state as siteInfoState,
17 } from '@launch/pages/SiteInformation';
18 import { SitePrep, state as sitePrepState } from '@launch/pages/SitePrep';
19 import {
20 SiteQuestions,
21 state as siteQuestionsState,
22 } from '@launch/pages/SiteQuestions';
23 import {
24 SiteStructure,
25 state as siteStructureState,
26 } from '@launch/pages/SiteStructure';
27 import { useUserSelectionStore } from '@launch/state/user-selections';
28
29 const showSiteQuestions = window.extSharedData?.showSiteQuestions ?? false;
30
31 // This is the default pages array
32 // You can add pre-fetch functions to start fetching data for the next page
33 // Supports both [] and single fetcher functions
34 const initialPagesList = {
35 'website-objective': {
36 component: ObjectiveSelection,
37 state: objectiveSelectionState,
38 condition: () => !showSiteQuestions,
39 },
40 'site-information': {
41 component: SiteInformation,
42 state: siteInfoState,
43 },
44 'site-prep': {
45 component: SitePrep,
46 state: sitePrepState,
47 },
48 'site-questions': {
49 component: SiteQuestions,
50 state: siteQuestionsState,
51 condition: () => showSiteQuestions,
52 },
53 'site-structure': {
54 component: SiteStructure,
55 state: siteStructureState,
56 condition: ({ siteObjective }) =>
57 siteObjective !== 'landing-page' || !showSiteQuestions,
58 },
59 'content-fetching': {
60 component: ContentGathering,
61 state: contentGatheringState,
62 },
63 layout: {
64 component: HomeSelect,
65 state: homeSelectState,
66 },
67 'page-select': {
68 component: PagesSelect,
69 state: pagesSelectState,
70 condition: ({ siteStructure }) => siteStructure === 'multi-page',
71 },
72 };
73
74 export const getPages = () => {
75 const { siteStructure, siteObjective } =
76 useUserSelectionStore?.getState() ?? {};
77 const conditionData = { siteStructure, siteObjective };
78
79 return Object.entries(initialPagesList).filter(
80 ([_, page]) => !page.condition || page.condition(conditionData),
81 );
82 };
83
84 export const pages = getPages();
85