astro-tractstack 2.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +110 -0
- package/README.md +56 -0
- package/astro.d.ts +64 -0
- package/bin/create-tractstack.js +483 -0
- package/dist/config.js +80 -0
- package/dist/index.js +2129 -0
- package/package.json +89 -0
- package/templates/artpacks/kCz/captainBreakfast_1080px.webp +0 -0
- package/templates/artpacks/kCz/captainBreakfast_1920px.webp +0 -0
- package/templates/artpacks/kCz/captainBreakfast_600px.webp +0 -0
- package/templates/artpacks/kCz/cleanDrips_1080px.webp +0 -0
- package/templates/artpacks/kCz/cleanDrips_1920px.webp +0 -0
- package/templates/artpacks/kCz/cleanDrips_600px.webp +0 -0
- package/templates/artpacks/kCz/crispwaves_1080px.webp +0 -0
- package/templates/artpacks/kCz/crispwaves_1920px.webp +0 -0
- package/templates/artpacks/kCz/crispwaves_600px.webp +0 -0
- package/templates/artpacks/kCz/dragonSkin_1080px.webp +0 -0
- package/templates/artpacks/kCz/dragonSkin_1920px.webp +0 -0
- package/templates/artpacks/kCz/dragonSkin_600px.webp +0 -0
- package/templates/artpacks/kCz/dragon_1080px.webp +0 -0
- package/templates/artpacks/kCz/dragon_1920px.webp +0 -0
- package/templates/artpacks/kCz/dragon_600px.webp +0 -0
- package/templates/artpacks/kCz/nightcity_1080px.webp +0 -0
- package/templates/artpacks/kCz/nightcity_1920px.webp +0 -0
- package/templates/artpacks/kCz/nightcity_600px.webp +0 -0
- package/templates/artpacks/kCz/pattern1_1080px.webp +0 -0
- package/templates/artpacks/kCz/pattern1_1920px.webp +0 -0
- package/templates/artpacks/kCz/pattern1_600px.webp +0 -0
- package/templates/artpacks/kCz/pattern2_1080px.webp +0 -0
- package/templates/artpacks/kCz/pattern2_1920px.webp +0 -0
- package/templates/artpacks/kCz/pattern2_600px.webp +0 -0
- package/templates/artpacks/kCz/skindrips_1080px.webp +0 -0
- package/templates/artpacks/kCz/skindrips_1920px.webp +0 -0
- package/templates/artpacks/kCz/skindrips_600px.webp +0 -0
- package/templates/artpacks/kCz/slimetime_1080px.webp +0 -0
- package/templates/artpacks/kCz/slimetime_1920px.webp +0 -0
- package/templates/artpacks/kCz/slimetime_600px.webp +0 -0
- package/templates/artpacks/kCz/snake_1080px.webp +0 -0
- package/templates/artpacks/kCz/snake_1920px.webp +0 -0
- package/templates/artpacks/kCz/snake_600px.webp +0 -0
- package/templates/artpacks/kCz/toxicshock_1080px.webp +0 -0
- package/templates/artpacks/kCz/toxicshock_1920px.webp +0 -0
- package/templates/artpacks/kCz/toxicshock_600px.webp +0 -0
- package/templates/artpacks/kCz/tractstack_1080px.webp +0 -0
- package/templates/artpacks/kCz/tractstack_1920px.webp +0 -0
- package/templates/artpacks/kCz/tractstack_600px.webp +0 -0
- package/templates/artpacks/kCz/tripdrips_1080px.webp +0 -0
- package/templates/artpacks/kCz/tripdrips_1920px.webp +0 -0
- package/templates/artpacks/kCz/tripdrips_600px.webp +0 -0
- package/templates/artpacks/kCz/wavedrips_1080px.webp +0 -0
- package/templates/artpacks/kCz/wavedrips_1920px.webp +0 -0
- package/templates/artpacks/kCz/wavedrips_600px.webp +0 -0
- package/templates/artpacks/t8k/beach_1080px.webp +0 -0
- package/templates/artpacks/t8k/beach_1920px.webp +0 -0
- package/templates/artpacks/t8k/beach_600px.webp +0 -0
- package/templates/artpacks/t8k/blast_1080px.webp +0 -0
- package/templates/artpacks/t8k/blast_1920px.webp +0 -0
- package/templates/artpacks/t8k/blast_600px.webp +0 -0
- package/templates/artpacks/t8k/bokeh_1080px.webp +0 -0
- package/templates/artpacks/t8k/bokeh_1920px.webp +0 -0
- package/templates/artpacks/t8k/bokeh_600px.webp +0 -0
- package/templates/artpacks/t8k/cartoon_1080px.webp +0 -0
- package/templates/artpacks/t8k/cartoon_1920px.webp +0 -0
- package/templates/artpacks/t8k/cartoon_600px.webp +0 -0
- package/templates/artpacks/t8k/darkeggshell_1080px.webp +0 -0
- package/templates/artpacks/t8k/darkeggshell_1920px.webp +0 -0
- package/templates/artpacks/t8k/darkeggshell_600px.webp +0 -0
- package/templates/artpacks/t8k/explosion_1080px.webp +0 -0
- package/templates/artpacks/t8k/explosion_1920px.webp +0 -0
- package/templates/artpacks/t8k/explosion_600px.webp +0 -0
- package/templates/artpacks/t8k/floral_1080px.webp +0 -0
- package/templates/artpacks/t8k/floral_1920px.webp +0 -0
- package/templates/artpacks/t8k/floral_600px.webp +0 -0
- package/templates/artpacks/t8k/flower_1080px.webp +0 -0
- package/templates/artpacks/t8k/flower_1920px.webp +0 -0
- package/templates/artpacks/t8k/flower_600px.webp +0 -0
- package/templates/artpacks/t8k/foliage_1080px.webp +0 -0
- package/templates/artpacks/t8k/foliage_1920px.webp +0 -0
- package/templates/artpacks/t8k/foliage_600px.webp +0 -0
- package/templates/artpacks/t8k/mist_1080px.webp +0 -0
- package/templates/artpacks/t8k/mist_1920px.webp +0 -0
- package/templates/artpacks/t8k/mist_600px.webp +0 -0
- package/templates/artpacks/t8k/portal_1080px.webp +0 -0
- package/templates/artpacks/t8k/portal_1920px.webp +0 -0
- package/templates/artpacks/t8k/portal_600px.webp +0 -0
- package/templates/artpacks/t8k/storytime_1080px.webp +0 -0
- package/templates/artpacks/t8k/storytime_1920px.webp +0 -0
- package/templates/artpacks/t8k/storytime_600px.webp +0 -0
- package/templates/artpacks/t8k/tacky_1080px.webp +0 -0
- package/templates/artpacks/t8k/tacky_1920px.webp +0 -0
- package/templates/artpacks/t8k/tacky_600px.webp +0 -0
- package/templates/artpacks/t8k/wallpaper_1080px.webp +0 -0
- package/templates/artpacks/t8k/wallpaper_1920px.webp +0 -0
- package/templates/artpacks/t8k/wallpaper_600px.webp +0 -0
- package/templates/brand/favicon.ico +0 -0
- package/templates/brand/logo.svg +19 -0
- package/templates/brand/static.jpg +0 -0
- package/templates/brand/wordmark.svg +4 -0
- package/templates/css/custom.css +51 -0
- package/templates/css/frontend.css +3519 -0
- package/templates/css/storykeep.css +92872 -0
- package/templates/custom/minimal/CodeHook.astro +53 -0
- package/templates/custom/minimal/CustomRoutes.astro +46 -0
- package/templates/custom/with-examples/CodeHook.astro +49 -0
- package/templates/custom/with-examples/CustomHero.astro +13 -0
- package/templates/custom/with-examples/CustomRoutes.astro +39 -0
- package/templates/custom/with-examples/pages/Collections.astro +110 -0
- package/templates/env.example +8 -0
- package/templates/fonts/Inter-Black.woff2 +0 -0
- package/templates/fonts/Inter-Bold.woff2 +0 -0
- package/templates/fonts/Inter-Regular.woff2 +0 -0
- package/templates/icons/h2.svg +1 -0
- package/templates/icons/h3.svg +1 -0
- package/templates/icons/h4.svg +1 -0
- package/templates/icons/h5.svg +1 -0
- package/templates/icons/image.svg +7 -0
- package/templates/icons/text.svg +6 -0
- package/templates/socials/codepen.svg +1 -0
- package/templates/socials/discord.svg +1 -0
- package/templates/socials/facebook.svg +1 -0
- package/templates/socials/github.svg +1 -0
- package/templates/socials/instagram.svg +1 -0
- package/templates/socials/linkedin.svg +1 -0
- package/templates/socials/mail.svg +1 -0
- package/templates/socials/rumble.svg +1 -0
- package/templates/socials/tiktok.svg +1 -0
- package/templates/socials/twitch.svg +1 -0
- package/templates/socials/twitter.svg +1 -0
- package/templates/socials/x.svg +1 -0
- package/templates/socials/youtube.svg +1 -0
- package/templates/src/client/analytics-events.ts +213 -0
- package/templates/src/client/belief-events.ts +205 -0
- package/templates/src/client/sse.ts +667 -0
- package/templates/src/components/Footer.astro +246 -0
- package/templates/src/components/Fragment.astro +70 -0
- package/templates/src/components/Header.astro +458 -0
- package/templates/src/components/Menu.tsx +196 -0
- package/templates/src/components/codehooks/BunnyVideoSetup.tsx +692 -0
- package/templates/src/components/codehooks/BunnyVideoWrapper.astro +78 -0
- package/templates/src/components/codehooks/EpinetDurationSelector.tsx +1020 -0
- package/templates/src/components/codehooks/EpinetTableView.tsx +594 -0
- package/templates/src/components/codehooks/EpinetWrapper.tsx +424 -0
- package/templates/src/components/codehooks/FeaturedContent.astro +273 -0
- package/templates/src/components/codehooks/FeaturedContentSetup.tsx +738 -0
- package/templates/src/components/codehooks/ListContent.astro +460 -0
- package/templates/src/components/codehooks/ListContentSetup.tsx +649 -0
- package/templates/src/components/codehooks/SankeyDiagram.tsx +359 -0
- package/templates/src/components/compositor/Compositor.tsx +144 -0
- package/templates/src/components/compositor/Node.tsx +415 -0
- package/templates/src/components/compositor/NodeWithGuid.tsx +25 -0
- package/templates/src/components/compositor/PanelVisibilityWrapper.tsx +87 -0
- package/templates/src/components/compositor/elements/Belief.tsx +148 -0
- package/templates/src/components/compositor/elements/BgImage.tsx +118 -0
- package/templates/src/components/compositor/elements/BgVisualBreak.tsx +102 -0
- package/templates/src/components/compositor/elements/BunnyVideo.tsx +63 -0
- package/templates/src/components/compositor/elements/IdentifyAs.tsx +66 -0
- package/templates/src/components/compositor/elements/PlayButton.tsx +19 -0
- package/templates/src/components/compositor/elements/SignUp.tsx +179 -0
- package/templates/src/components/compositor/elements/Svg.tsx +33 -0
- package/templates/src/components/compositor/elements/ToggleBelief.tsx +36 -0
- package/templates/src/components/compositor/elements/YouTubeWrapper.tsx +33 -0
- package/templates/src/components/compositor/nodes/BgPaneWrapper.tsx +35 -0
- package/templates/src/components/compositor/nodes/GhostInsertBlock.tsx +189 -0
- package/templates/src/components/compositor/nodes/Markdown.tsx +179 -0
- package/templates/src/components/compositor/nodes/Pane.tsx +277 -0
- package/templates/src/components/compositor/nodes/Pane_eraser.tsx +69 -0
- package/templates/src/components/compositor/nodes/Pane_layout.tsx +77 -0
- package/templates/src/components/compositor/nodes/RenderChildren.tsx +19 -0
- package/templates/src/components/compositor/nodes/StoryFragment.tsx +35 -0
- package/templates/src/components/compositor/nodes/TagElement.tsx +14 -0
- package/templates/src/components/compositor/nodes/Widget.tsx +115 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeA.tsx +4 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeA_eraser.tsx +26 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeAnchorComponent.tsx +248 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag.tsx +684 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag_eraser.tsx +62 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag_insert.tsx +120 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag_settings.tsx +62 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeButton.tsx +5 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeButton_eraser.tsx +26 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeImg.tsx +28 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeText.tsx +18 -0
- package/templates/src/components/compositor/nodes/tagElements/TabIndicator.tsx +51 -0
- package/templates/src/components/compositor/preview/FeaturedContentPreview.tsx +128 -0
- package/templates/src/components/compositor/preview/ListContentPreview.tsx +213 -0
- package/templates/src/components/compositor/preview/OgImagePreview.tsx +223 -0
- package/templates/src/components/compositor/preview/PaneSnapshotGenerator.tsx +199 -0
- package/templates/src/components/compositor/preview/PanesPreviewGenerator.tsx +123 -0
- package/templates/src/components/compositor/preview/VisualBreakPreview.tsx +154 -0
- package/templates/src/components/edit/Header.tsx +181 -0
- package/templates/src/components/edit/PanelSwitch.tsx +446 -0
- package/templates/src/components/edit/SettingsPanel.tsx +70 -0
- package/templates/src/components/edit/ToolBar.tsx +101 -0
- package/templates/src/components/edit/ToolMode.tsx +121 -0
- package/templates/src/components/edit/context/ContextPaneConfig.tsx +91 -0
- package/templates/src/components/edit/context/ContextPaneConfig_slug.tsx +174 -0
- package/templates/src/components/edit/context/ContextPaneConfig_title.tsx +186 -0
- package/templates/src/components/edit/pane/AddPanePanel.tsx +136 -0
- package/templates/src/components/edit/pane/AddPanePanel_break.tsx +470 -0
- package/templates/src/components/edit/pane/AddPanePanel_codehook.tsx +264 -0
- package/templates/src/components/edit/pane/AddPanePanel_new.tsx +623 -0
- package/templates/src/components/edit/pane/AddPanePanel_newAICopy.tsx +107 -0
- package/templates/src/components/edit/pane/AddPanePanel_newAICopy_modal.tsx +217 -0
- package/templates/src/components/edit/pane/AddPanePanel_newCopyMode.tsx +109 -0
- package/templates/src/components/edit/pane/AddPanePanel_newCustomCopy.tsx +39 -0
- package/templates/src/components/edit/pane/AddPanePanel_reuse.tsx +445 -0
- package/templates/src/components/edit/pane/ConfigPanePanel.tsx +245 -0
- package/templates/src/components/edit/pane/PageGen.tsx +485 -0
- package/templates/src/components/edit/pane/PageGenSelector.tsx +238 -0
- package/templates/src/components/edit/pane/PageGenSpecial.tsx +362 -0
- package/templates/src/components/edit/pane/PageGen_preview.tsx +495 -0
- package/templates/src/components/edit/pane/PanePanel_impression.tsx +258 -0
- package/templates/src/components/edit/pane/PanePanel_path.tsx +268 -0
- package/templates/src/components/edit/pane/PanePanel_slug.tsx +219 -0
- package/templates/src/components/edit/pane/PanePanel_title.tsx +142 -0
- package/templates/src/components/edit/panels/StyleBreakPanel.tsx +182 -0
- package/templates/src/components/edit/panels/StyleCodeHookPanel.tsx +439 -0
- package/templates/src/components/edit/panels/StyleElementPanel.tsx +177 -0
- package/templates/src/components/edit/panels/StyleElementPanel_add.tsx +349 -0
- package/templates/src/components/edit/panels/StyleElementPanel_remove.tsx +159 -0
- package/templates/src/components/edit/panels/StyleElementPanel_update.tsx +320 -0
- package/templates/src/components/edit/panels/StyleImagePanel.tsx +460 -0
- package/templates/src/components/edit/panels/StyleImagePanel_add.tsx +296 -0
- package/templates/src/components/edit/panels/StyleImagePanel_remove.tsx +153 -0
- package/templates/src/components/edit/panels/StyleImagePanel_update.tsx +312 -0
- package/templates/src/components/edit/panels/StyleLiElementPanel.tsx +273 -0
- package/templates/src/components/edit/panels/StyleLiElementPanel_add.tsx +301 -0
- package/templates/src/components/edit/panels/StyleLiElementPanel_remove.tsx +132 -0
- package/templates/src/components/edit/panels/StyleLiElementPanel_update.tsx +313 -0
- package/templates/src/components/edit/panels/StyleLinkPanel.tsx +346 -0
- package/templates/src/components/edit/panels/StyleLinkPanel_add.tsx +265 -0
- package/templates/src/components/edit/panels/StyleLinkPanel_config.tsx +240 -0
- package/templates/src/components/edit/panels/StyleLinkPanel_remove.tsx +94 -0
- package/templates/src/components/edit/panels/StyleLinkPanel_update.tsx +110 -0
- package/templates/src/components/edit/panels/StyleParentPanel.tsx +263 -0
- package/templates/src/components/edit/panels/StyleParentPanel_add.tsx +275 -0
- package/templates/src/components/edit/panels/StyleParentPanel_deleteLayer.tsx +112 -0
- package/templates/src/components/edit/panels/StyleParentPanel_remove.tsx +87 -0
- package/templates/src/components/edit/panels/StyleParentPanel_update.tsx +141 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel.tsx +428 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel_add.tsx +292 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel_config.tsx +190 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel_remove.tsx +152 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel_update.tsx +308 -0
- package/templates/src/components/edit/state/SaveModal.tsx +811 -0
- package/templates/src/components/edit/state/StylesMemory.tsx +310 -0
- package/templates/src/components/edit/storyfragment/StoryFragmentConfigPanel.tsx +289 -0
- package/templates/src/components/edit/storyfragment/StoryFragmentPanel_menu.tsx +320 -0
- package/templates/src/components/edit/storyfragment/StoryFragmentPanel_og.tsx +888 -0
- package/templates/src/components/edit/storyfragment/StoryFragmentPanel_slug.tsx +269 -0
- package/templates/src/components/edit/storyfragment/StoryFragmentPanel_title.tsx +190 -0
- package/templates/src/components/edit/widgets/BeliefWidget.tsx +183 -0
- package/templates/src/components/edit/widgets/BunnyWidget.tsx +134 -0
- package/templates/src/components/edit/widgets/IdentifyAsWidget.tsx +193 -0
- package/templates/src/components/edit/widgets/SignupWidget.tsx +177 -0
- package/templates/src/components/edit/widgets/ToggleWidget.tsx +152 -0
- package/templates/src/components/edit/widgets/YouTubeWidget.tsx +65 -0
- package/templates/src/components/fields/ActionBuilderTimeSelector.tsx +353 -0
- package/templates/src/components/fields/ArtpackImage.tsx +480 -0
- package/templates/src/components/fields/BackgroundImage.tsx +530 -0
- package/templates/src/components/fields/BackgroundImageWrapper.tsx +192 -0
- package/templates/src/components/fields/BooleanParam.tsx +67 -0
- package/templates/src/components/fields/BunnyMomentSelector.tsx +56 -0
- package/templates/src/components/fields/ColorPickerCombo.tsx +284 -0
- package/templates/src/components/fields/ImageUpload.tsx +405 -0
- package/templates/src/components/fields/MultiParam.tsx +75 -0
- package/templates/src/components/fields/PaneBreakCollectionSelector.tsx +97 -0
- package/templates/src/components/fields/PaneBreakShapeSelector.tsx +134 -0
- package/templates/src/components/fields/SelectedTailwindClass.tsx +44 -0
- package/templates/src/components/fields/SingleParam.tsx +73 -0
- package/templates/src/components/fields/ViewportComboBox.tsx +252 -0
- package/templates/src/components/form/ActionBuilderField.tsx +282 -0
- package/templates/src/components/form/ActionBuilderSlugSelector.tsx +182 -0
- package/templates/src/components/form/BooleanToggle.tsx +94 -0
- package/templates/src/components/form/ColorPicker.tsx +153 -0
- package/templates/src/components/form/DateTimeInput.tsx +638 -0
- package/templates/src/components/form/EnumSelect.tsx +88 -0
- package/templates/src/components/form/FileUpload.tsx +465 -0
- package/templates/src/components/form/MagicPathBuilder.tsx +546 -0
- package/templates/src/components/form/NumberInput.tsx +101 -0
- package/templates/src/components/form/ParagraphArrayInput.tsx +207 -0
- package/templates/src/components/form/StringArrayInput.tsx +163 -0
- package/templates/src/components/form/StringInput.tsx +88 -0
- package/templates/src/components/form/UnsavedChangesBar.tsx +295 -0
- package/templates/src/components/form/advanced/APIConfigSection.tsx +69 -0
- package/templates/src/components/form/advanced/AuthConfigSection.tsx +97 -0
- package/templates/src/components/form/brand/BrandAssetsSection.tsx +93 -0
- package/templates/src/components/form/brand/BrandColorsSection.tsx +201 -0
- package/templates/src/components/form/brand/SEOSection.tsx +101 -0
- package/templates/src/components/form/brand/SiteConfigSection.tsx +61 -0
- package/templates/src/components/form/brand/SocialLinksSection.tsx +393 -0
- package/templates/src/components/profile/ProfileConsent.tsx +65 -0
- package/templates/src/components/profile/ProfileCreate.tsx +462 -0
- package/templates/src/components/profile/ProfileEdit.tsx +409 -0
- package/templates/src/components/profile/ProfileSwitch.tsx +255 -0
- package/templates/src/components/profile/ProfileUnlock.tsx +221 -0
- package/templates/src/components/storykeep/Dashboard.tsx +160 -0
- package/templates/src/components/storykeep/Dashboard_Activity.tsx +56 -0
- package/templates/src/components/storykeep/Dashboard_Advanced.tsx +165 -0
- package/templates/src/components/storykeep/Dashboard_Analytics.tsx +451 -0
- package/templates/src/components/storykeep/Dashboard_Branding.tsx +95 -0
- package/templates/src/components/storykeep/Dashboard_Content.tsx +191 -0
- package/templates/src/components/storykeep/controls/UsageCell.tsx +71 -0
- package/templates/src/components/storykeep/controls/content/BeliefForm.tsx +378 -0
- package/templates/src/components/storykeep/controls/content/BeliefTable.tsx +329 -0
- package/templates/src/components/storykeep/controls/content/ContentBrowser.tsx +385 -0
- package/templates/src/components/storykeep/controls/content/ContentSummary.tsx +149 -0
- package/templates/src/components/storykeep/controls/content/KnownResourceForm.tsx +397 -0
- package/templates/src/components/storykeep/controls/content/KnownResourceTable.tsx +260 -0
- package/templates/src/components/storykeep/controls/content/ManageContent.tsx +439 -0
- package/templates/src/components/storykeep/controls/content/MenuForm.tsx +239 -0
- package/templates/src/components/storykeep/controls/content/MenuTable.tsx +332 -0
- package/templates/src/components/storykeep/controls/content/ResourceBulkIngest.tsx +724 -0
- package/templates/src/components/storykeep/controls/content/ResourceForm.tsx +355 -0
- package/templates/src/components/storykeep/controls/content/ResourceTable.tsx +222 -0
- package/templates/src/components/storykeep/controls/content/StoryFragmentTable.tsx +482 -0
- package/templates/src/components/storykeep/state/BrandingWrapper.tsx +42 -0
- package/templates/src/components/storykeep/state/FetchAnalytics.tsx +350 -0
- package/templates/src/components/storykeep/widgets/ResponsiveLine.tsx +319 -0
- package/templates/src/components/storykeep/widgets/Wizard.tsx +278 -0
- package/templates/src/components/tenant/RegistrationForm.tsx +447 -0
- package/templates/src/components/widgets/BunnyVideoHero.astro +775 -0
- package/templates/src/components/widgets/Impression.tsx +102 -0
- package/templates/src/components/widgets/ImpressionWrapper.tsx +214 -0
- package/templates/src/constants/beliefs.ts +61 -0
- package/templates/src/constants/brandThemes.ts +133 -0
- package/templates/src/constants/prompts.json +55 -0
- package/templates/src/constants/shapes.ts +556 -0
- package/templates/src/constants/stopWords.ts +116 -0
- package/templates/src/constants/tailwindColors.json +344 -0
- package/templates/src/constants.ts +274 -0
- package/templates/src/hooks/useFormState.ts +203 -0
- package/templates/src/layouts/Layout.astro +290 -0
- package/templates/src/lib/session.ts +126 -0
- package/templates/src/lib/storyData.ts +56 -0
- package/templates/src/middleware.ts +52 -0
- package/templates/src/pages/404.astro +54 -0
- package/templates/src/pages/[...slug]/edit.astro +216 -0
- package/templates/src/pages/[...slug].astro +148 -0
- package/templates/src/pages/api/auth/decode.ts +101 -0
- package/templates/src/pages/api/auth/login.ts +122 -0
- package/templates/src/pages/api/auth/logout.ts +37 -0
- package/templates/src/pages/api/auth/profile.ts +76 -0
- package/templates/src/pages/api/orphan-analysis.ts +106 -0
- package/templates/src/pages/api/tailwind.ts +116 -0
- package/templates/src/pages/collections/[param1].astro +65 -0
- package/templates/src/pages/context/[...contextSlug]/edit.astro +207 -0
- package/templates/src/pages/context/[...contextSlug].astro +161 -0
- package/templates/src/pages/llms.txt.ts +122 -0
- package/templates/src/pages/maint.astro +183 -0
- package/templates/src/pages/media/[...slug].astro +67 -0
- package/templates/src/pages/robots.txt.ts +36 -0
- package/templates/src/pages/sandbox/activate.astro +258 -0
- package/templates/src/pages/sandbox/register.astro +44 -0
- package/templates/src/pages/sandbox/success.astro +179 -0
- package/templates/src/pages/sitemap.xml.ts +119 -0
- package/templates/src/pages/storykeep/advanced.astro +69 -0
- package/templates/src/pages/storykeep/branding.astro +57 -0
- package/templates/src/pages/storykeep/content.astro +71 -0
- package/templates/src/pages/storykeep/init.astro +36 -0
- package/templates/src/pages/storykeep/login.astro +266 -0
- package/templates/src/pages/storykeep/logout.astro +84 -0
- package/templates/src/pages/storykeep/profile.astro +98 -0
- package/templates/src/pages/storykeep.astro +81 -0
- package/templates/src/stores/analytics.ts +171 -0
- package/templates/src/stores/backend.ts +16 -0
- package/templates/src/stores/navigation.ts +149 -0
- package/templates/src/stores/nodes.ts +2390 -0
- package/templates/src/stores/nodesHistory.ts +85 -0
- package/templates/src/stores/notificationSystem.ts +41 -0
- package/templates/src/stores/orphanAnalysis.ts +409 -0
- package/templates/src/stores/storykeep.ts +247 -0
- package/templates/src/types/astro.ts +86 -0
- package/templates/src/types/compositorTypes.ts +456 -0
- package/templates/src/types/formTypes.ts +281 -0
- package/templates/src/types/multiTenant.ts +77 -0
- package/templates/src/types/nodeProps.ts +66 -0
- package/templates/src/types/tractstack.ts +445 -0
- package/templates/src/utils/aai/getTitleSlug.ts +72 -0
- package/templates/src/utils/actions/actionButton.ts +101 -0
- package/templates/src/utils/actions/lispLexer.ts +57 -0
- package/templates/src/utils/actions/preParse_Action.ts +85 -0
- package/templates/src/utils/actions/preParse_Bunny.ts +50 -0
- package/templates/src/utils/actions/preParse_Clicked.ts +87 -0
- package/templates/src/utils/actions/preParse_Impression.ts +71 -0
- package/templates/src/utils/api/advancedConfig.ts +66 -0
- package/templates/src/utils/api/advancedHelpers.ts +134 -0
- package/templates/src/utils/api/beliefConfig.ts +87 -0
- package/templates/src/utils/api/beliefHelpers.ts +196 -0
- package/templates/src/utils/api/brandConfig.ts +126 -0
- package/templates/src/utils/api/brandHelpers.ts +155 -0
- package/templates/src/utils/api/fileHelpers.ts +306 -0
- package/templates/src/utils/api/menuConfig.ts +57 -0
- package/templates/src/utils/api/menuHelpers.ts +156 -0
- package/templates/src/utils/api/resourceConfig.ts +158 -0
- package/templates/src/utils/api/resourceHelpers.ts +72 -0
- package/templates/src/utils/api/tenantConfig.ts +97 -0
- package/templates/src/utils/api/tenantHelpers.ts +172 -0
- package/templates/src/utils/api.ts +183 -0
- package/templates/src/utils/auth.ts +150 -0
- package/templates/src/utils/backend.ts +243 -0
- package/templates/src/utils/compositor/TemplateMarkdowns.ts +118 -0
- package/templates/src/utils/compositor/TemplateNodes.ts +138 -0
- package/templates/src/utils/compositor/TemplatePanes.ts +100 -0
- package/templates/src/utils/compositor/allowInsert.ts +100 -0
- package/templates/src/utils/compositor/domHelpers.ts +37 -0
- package/templates/src/utils/compositor/handleClickEvent.ts +131 -0
- package/templates/src/utils/compositor/nodesHelper.ts +491 -0
- package/templates/src/utils/compositor/nodesMarkdownGenerator.ts +292 -0
- package/templates/src/utils/compositor/processMarkdown.ts +431 -0
- package/templates/src/utils/compositor/reduceNodesClassNames.ts +192 -0
- package/templates/src/utils/compositor/tailwindClasses.ts +1795 -0
- package/templates/src/utils/compositor/tailwindColors.ts +227 -0
- package/templates/src/utils/compositor/templateMarkdownStyles.ts +1265 -0
- package/templates/src/utils/compositor/typeGuards.ts +193 -0
- package/templates/src/utils/etl/extractor.ts +119 -0
- package/templates/src/utils/etl/index.ts +88 -0
- package/templates/src/utils/etl/loader.ts +36 -0
- package/templates/src/utils/etl/transformer.ts +286 -0
- package/templates/src/utils/helpers.ts +435 -0
- package/templates/src/utils/layout.ts +209 -0
- package/templates/src/utils/profileStorage.ts +306 -0
- package/templates/src/utils/useInterval.ts +27 -0
- package/templates/tailwind.config.cjs +169 -0
- package/utils/create-resolver.ts +10 -0
- package/utils/inject-files.ts +2140 -0
- package/utils/validate-config.ts +43 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
handleManageSubtabChange,
|
|
4
|
+
restoreTabNavigation,
|
|
5
|
+
} from '@/stores/navigation';
|
|
6
|
+
import { getFullContentMap } from '@/stores/analytics';
|
|
7
|
+
import { getBrandConfig } from '@/utils/api/brandConfig';
|
|
8
|
+
import { classNames } from '@/utils/helpers';
|
|
9
|
+
import { getMenuById } from '@/utils/api/menuConfig';
|
|
10
|
+
import { getBeliefById } from '@/utils/api/beliefConfig';
|
|
11
|
+
import { getResource } from '@/utils/api/resourceConfig';
|
|
12
|
+
import ContentSummary from './ContentSummary';
|
|
13
|
+
import StoryFragmentTable from './StoryFragmentTable';
|
|
14
|
+
import MenuTable from './MenuTable';
|
|
15
|
+
import MenuForm from './MenuForm';
|
|
16
|
+
import BeliefTable from './BeliefTable';
|
|
17
|
+
import BeliefForm from './BeliefForm';
|
|
18
|
+
import KnownResourceTable from './KnownResourceTable';
|
|
19
|
+
import KnownResourceForm from './KnownResourceForm';
|
|
20
|
+
import ResourceTable from './ResourceTable';
|
|
21
|
+
import ResourceForm from './ResourceForm';
|
|
22
|
+
import type {
|
|
23
|
+
FullContentMapItem,
|
|
24
|
+
MenuNode,
|
|
25
|
+
BeliefNode,
|
|
26
|
+
ResourceConfig,
|
|
27
|
+
BrandConfig,
|
|
28
|
+
} from '@/types/tractstack';
|
|
29
|
+
|
|
30
|
+
interface ManageContentProps {
|
|
31
|
+
fullContentMap: FullContentMapItem[];
|
|
32
|
+
homeSlug: string;
|
|
33
|
+
createMenu: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface ContentManagementTab {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
isResourceCategory?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const staticContentManagementTabs: ContentManagementTab[] = [
|
|
43
|
+
{ id: 'summary', name: 'Summary' },
|
|
44
|
+
{ id: 'storyfragments', name: 'Story Fragments' },
|
|
45
|
+
{ id: 'menus', name: 'Menus' },
|
|
46
|
+
{ id: 'resources', name: 'Resources' },
|
|
47
|
+
{ id: 'beliefs', name: 'Beliefs' },
|
|
48
|
+
//{ id: 'panes', name: 'Panes' },
|
|
49
|
+
//{ id: 'epinets', name: 'Epinets' },
|
|
50
|
+
//{ id: 'files', name: 'Files' },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const ManageContent = ({
|
|
54
|
+
fullContentMap: initialContentMap,
|
|
55
|
+
homeSlug,
|
|
56
|
+
createMenu,
|
|
57
|
+
}: ManageContentProps) => {
|
|
58
|
+
const [brandConfig, setBrandConfig] = useState<BrandConfig | null>(null);
|
|
59
|
+
const [loading, setLoading] = useState(false);
|
|
60
|
+
const [activeTab, setActiveTab] = useState('summary');
|
|
61
|
+
const [navigationRestored, setNavigationRestored] = useState(false);
|
|
62
|
+
const [currentContentMap, setCurrentContentMap] =
|
|
63
|
+
useState<FullContentMapItem[]>(initialContentMap);
|
|
64
|
+
|
|
65
|
+
const [activeMenuForm, setActiveMenuForm] = useState<
|
|
66
|
+
MenuNode | 'create' | null
|
|
67
|
+
>(null);
|
|
68
|
+
const [activeBeliefForm, setActiveBeliefForm] = useState<
|
|
69
|
+
BeliefNode | 'create' | null
|
|
70
|
+
>(null);
|
|
71
|
+
const [activeKnownResourceForm, setActiveKnownResourceForm] = useState<
|
|
72
|
+
string | null
|
|
73
|
+
>(null);
|
|
74
|
+
const [activeResourceForm, setActiveResourceForm] = useState<{
|
|
75
|
+
resource: ResourceConfig | null;
|
|
76
|
+
category: string;
|
|
77
|
+
} | null>(null);
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (createMenu && !navigationRestored) {
|
|
81
|
+
// Set manage subtab to 'menus'
|
|
82
|
+
setActiveTab('menus');
|
|
83
|
+
handleManageSubtabChange('menus', setActiveTab);
|
|
84
|
+
// Trigger create menu after short delay
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
setActiveMenuForm('create');
|
|
87
|
+
}, 100);
|
|
88
|
+
}
|
|
89
|
+
}, [createMenu, navigationRestored]);
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!brandConfig && !loading) {
|
|
93
|
+
setLoading(true);
|
|
94
|
+
getBrandConfig(window.TRACTSTACK_CONFIG?.tenantId || 'default')
|
|
95
|
+
.then(setBrandConfig)
|
|
96
|
+
.catch(console.error)
|
|
97
|
+
.finally(() => setLoading(false));
|
|
98
|
+
}
|
|
99
|
+
}, [brandConfig, loading]);
|
|
100
|
+
|
|
101
|
+
// Data refresh function - uses EXISTING API functions
|
|
102
|
+
const refreshData = async () => {
|
|
103
|
+
try {
|
|
104
|
+
// Use existing getFullContentMap function from analytics store
|
|
105
|
+
const newContentMap = await getFullContentMap(
|
|
106
|
+
window.TRACTSTACK_CONFIG?.tenantId || 'default'
|
|
107
|
+
);
|
|
108
|
+
setCurrentContentMap(newContentMap);
|
|
109
|
+
getBrandConfig(window.TRACTSTACK_CONFIG?.tenantId || 'default').then(
|
|
110
|
+
setBrandConfig
|
|
111
|
+
);
|
|
112
|
+
} catch (error) {
|
|
113
|
+
console.error('Failed to refresh data:', error);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Update content map when prop changes
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
setCurrentContentMap(initialContentMap);
|
|
120
|
+
}, [initialContentMap]);
|
|
121
|
+
|
|
122
|
+
// Generate dynamic tabs including resource categories
|
|
123
|
+
const knownResources = brandConfig?.KNOWN_RESOURCES || {};
|
|
124
|
+
const resourceCategories = Object.keys(knownResources);
|
|
125
|
+
|
|
126
|
+
const contentManagementTabs: ContentManagementTab[] = [
|
|
127
|
+
...staticContentManagementTabs.filter((tab) => tab.id !== 'resources'),
|
|
128
|
+
{ id: 'resources', name: 'Resources' },
|
|
129
|
+
...resourceCategories.map((category) => ({
|
|
130
|
+
id: category,
|
|
131
|
+
name: category.charAt(0).toUpperCase() + category.slice(1),
|
|
132
|
+
isResourceCategory: true,
|
|
133
|
+
})),
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
// Restore navigation state when component mounts
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (!navigationRestored) {
|
|
139
|
+
const contentNavigation = restoreTabNavigation();
|
|
140
|
+
if (contentNavigation) {
|
|
141
|
+
setActiveTab(contentNavigation.manageSubtab);
|
|
142
|
+
}
|
|
143
|
+
setNavigationRestored(true);
|
|
144
|
+
}
|
|
145
|
+
}, [navigationRestored]);
|
|
146
|
+
|
|
147
|
+
// Enhanced manage tab change with navigation tracking
|
|
148
|
+
const handleManageTabChange = (tabId: string) => {
|
|
149
|
+
handleManageSubtabChange(tabId as any, setActiveTab);
|
|
150
|
+
|
|
151
|
+
// Close all forms when switching tabs
|
|
152
|
+
setActiveMenuForm(null);
|
|
153
|
+
setActiveBeliefForm(null);
|
|
154
|
+
setActiveKnownResourceForm(null);
|
|
155
|
+
setActiveResourceForm(null);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// Menu handlers - simplified
|
|
159
|
+
const handleCreateMenu = () => {
|
|
160
|
+
setActiveMenuForm('create');
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const handleEditMenu = async (menuId: string) => {
|
|
164
|
+
try {
|
|
165
|
+
const menu = await getMenuById(
|
|
166
|
+
window.TRACTSTACK_CONFIG?.tenantId || 'default',
|
|
167
|
+
menuId
|
|
168
|
+
);
|
|
169
|
+
setActiveMenuForm(menu);
|
|
170
|
+
} catch (error) {
|
|
171
|
+
console.error('Failed to load menu for editing:', error);
|
|
172
|
+
alert('Failed to load menu. Please try again.');
|
|
173
|
+
} finally {
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// Belief handlers - simplified
|
|
178
|
+
const handleCreateBelief = () => {
|
|
179
|
+
setActiveBeliefForm('create');
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const handleEditBelief = async (beliefId: string) => {
|
|
183
|
+
if (!beliefId) {
|
|
184
|
+
handleCreateBelief();
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
try {
|
|
189
|
+
const belief = await getBeliefById(
|
|
190
|
+
window.TRACTSTACK_CONFIG?.tenantId || 'default',
|
|
191
|
+
beliefId
|
|
192
|
+
);
|
|
193
|
+
setActiveBeliefForm(belief);
|
|
194
|
+
} catch (error) {
|
|
195
|
+
console.error('Failed to load belief for editing:', error);
|
|
196
|
+
alert('Failed to load belief. Please try again.');
|
|
197
|
+
} finally {
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// Known resource handlers - simplified
|
|
202
|
+
const handleEditKnownResource = (categorySlug: string) => {
|
|
203
|
+
setActiveKnownResourceForm(categorySlug);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// Resource handlers - simplified
|
|
207
|
+
const handleCreateResource = () => {
|
|
208
|
+
setActiveResourceForm({
|
|
209
|
+
resource: null,
|
|
210
|
+
category: activeTab,
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const handleEditResource = async (resourceId: string) => {
|
|
215
|
+
try {
|
|
216
|
+
const resource = await getResource(
|
|
217
|
+
window.TRACTSTACK_CONFIG?.tenantId || 'default',
|
|
218
|
+
resourceId
|
|
219
|
+
);
|
|
220
|
+
setActiveResourceForm({
|
|
221
|
+
resource,
|
|
222
|
+
category: activeTab,
|
|
223
|
+
});
|
|
224
|
+
} catch (error) {
|
|
225
|
+
console.error('Failed to load resource for editing:', error);
|
|
226
|
+
alert('Failed to load resource. Please try again.');
|
|
227
|
+
} finally {
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const renderTabContent = () => {
|
|
232
|
+
// Forms take precedence - simplified logic
|
|
233
|
+
if (activeTab === 'menus' && activeMenuForm) {
|
|
234
|
+
return (
|
|
235
|
+
<MenuForm
|
|
236
|
+
menu={activeMenuForm === 'create' ? undefined : activeMenuForm}
|
|
237
|
+
isCreate={activeMenuForm === 'create'}
|
|
238
|
+
contentMap={currentContentMap}
|
|
239
|
+
onClose={async (saved: boolean) => {
|
|
240
|
+
setActiveMenuForm(null);
|
|
241
|
+
if (saved) await refreshData();
|
|
242
|
+
}}
|
|
243
|
+
/>
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (activeTab === 'beliefs' && activeBeliefForm) {
|
|
248
|
+
return (
|
|
249
|
+
<BeliefForm
|
|
250
|
+
belief={activeBeliefForm === 'create' ? undefined : activeBeliefForm}
|
|
251
|
+
isCreate={activeBeliefForm === 'create'}
|
|
252
|
+
onClose={async (saved: boolean) => {
|
|
253
|
+
setActiveBeliefForm(null);
|
|
254
|
+
if (saved) await refreshData();
|
|
255
|
+
}}
|
|
256
|
+
/>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (activeTab === 'resources' && activeKnownResourceForm) {
|
|
261
|
+
return (
|
|
262
|
+
<KnownResourceForm
|
|
263
|
+
categorySlug={activeKnownResourceForm}
|
|
264
|
+
contentMap={currentContentMap}
|
|
265
|
+
onClose={async (saved: boolean) => {
|
|
266
|
+
setActiveKnownResourceForm(null);
|
|
267
|
+
if (saved) await refreshData();
|
|
268
|
+
}}
|
|
269
|
+
/>
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (activeResourceForm) {
|
|
274
|
+
return (
|
|
275
|
+
<ResourceForm
|
|
276
|
+
resourceData={activeResourceForm.resource || undefined}
|
|
277
|
+
fullContentMap={currentContentMap}
|
|
278
|
+
categorySlug={activeResourceForm.category}
|
|
279
|
+
categorySchema={knownResources[activeResourceForm.category] || {}}
|
|
280
|
+
onClose={async (saved: boolean) => {
|
|
281
|
+
setActiveResourceForm(null);
|
|
282
|
+
if (saved) await refreshData();
|
|
283
|
+
}}
|
|
284
|
+
/>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Resource category tables
|
|
289
|
+
if (resourceCategories.includes(activeTab)) {
|
|
290
|
+
return (
|
|
291
|
+
<ResourceTable
|
|
292
|
+
categorySlug={activeTab}
|
|
293
|
+
fullContentMap={currentContentMap}
|
|
294
|
+
onEdit={handleEditResource}
|
|
295
|
+
onCreate={handleCreateResource}
|
|
296
|
+
onRefresh={refreshData}
|
|
297
|
+
/>
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Static tab content
|
|
302
|
+
switch (activeTab) {
|
|
303
|
+
case 'summary':
|
|
304
|
+
return <ContentSummary fullContentMap={currentContentMap} />;
|
|
305
|
+
|
|
306
|
+
case 'storyfragments':
|
|
307
|
+
return (
|
|
308
|
+
<StoryFragmentTable
|
|
309
|
+
fullContentMap={currentContentMap}
|
|
310
|
+
homeSlug={homeSlug}
|
|
311
|
+
/>
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
case 'panes':
|
|
315
|
+
return (
|
|
316
|
+
<div className="rounded-lg bg-white p-8 text-center shadow">
|
|
317
|
+
<div className="text-lg text-gray-600">
|
|
318
|
+
Panes management - Coming soon
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
case 'menus':
|
|
324
|
+
return (
|
|
325
|
+
<MenuTable
|
|
326
|
+
fullContentMap={currentContentMap}
|
|
327
|
+
onEdit={handleEditMenu}
|
|
328
|
+
onCreate={handleCreateMenu}
|
|
329
|
+
onRefresh={refreshData}
|
|
330
|
+
/>
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
case 'resources':
|
|
334
|
+
return (
|
|
335
|
+
<div className="space-y-6">
|
|
336
|
+
<div>
|
|
337
|
+
<h3 className="mb-4 text-lg font-bold text-gray-900">
|
|
338
|
+
Resource Categories
|
|
339
|
+
</h3>
|
|
340
|
+
<KnownResourceTable
|
|
341
|
+
contentMap={currentContentMap}
|
|
342
|
+
onEdit={handleEditKnownResource}
|
|
343
|
+
/>
|
|
344
|
+
</div>
|
|
345
|
+
</div>
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
case 'beliefs':
|
|
349
|
+
const beliefs = currentContentMap
|
|
350
|
+
.filter((item) => item.type === 'Belief')
|
|
351
|
+
.map((item) => ({
|
|
352
|
+
id: item.id,
|
|
353
|
+
title: item.title,
|
|
354
|
+
slug: item.slug,
|
|
355
|
+
scale: item.scale || '',
|
|
356
|
+
customValues: [], // Will be loaded when editing
|
|
357
|
+
})) as BeliefNode[];
|
|
358
|
+
|
|
359
|
+
return (
|
|
360
|
+
<BeliefTable
|
|
361
|
+
beliefs={beliefs}
|
|
362
|
+
onEdit={handleEditBelief}
|
|
363
|
+
onRefresh={refreshData}
|
|
364
|
+
/>
|
|
365
|
+
);
|
|
366
|
+
|
|
367
|
+
//case 'epinets':
|
|
368
|
+
// return (
|
|
369
|
+
// <div className="rounded-lg bg-white p-8 text-center shadow">
|
|
370
|
+
// <div className="text-lg text-gray-600">
|
|
371
|
+
// Epinets management - Coming soon
|
|
372
|
+
// </div>
|
|
373
|
+
// </div>
|
|
374
|
+
// );
|
|
375
|
+
|
|
376
|
+
//case 'files':
|
|
377
|
+
// return (
|
|
378
|
+
// <div className="rounded-lg bg-white p-8 text-center shadow">
|
|
379
|
+
// <div className="text-lg text-gray-600">
|
|
380
|
+
// Files management - Coming soon
|
|
381
|
+
// </div>
|
|
382
|
+
// </div>
|
|
383
|
+
// );
|
|
384
|
+
|
|
385
|
+
default:
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
return (
|
|
391
|
+
<div className="w-full">
|
|
392
|
+
{/* Content Management Sub-Navigation */}
|
|
393
|
+
<div className="mb-6">
|
|
394
|
+
<div className="border-b border-gray-200 pb-2.5">
|
|
395
|
+
<nav
|
|
396
|
+
className="flex flex-wrap gap-2"
|
|
397
|
+
aria-label="Content management tabs"
|
|
398
|
+
>
|
|
399
|
+
{contentManagementTabs.map((tab) => (
|
|
400
|
+
<button
|
|
401
|
+
key={tab.id}
|
|
402
|
+
onClick={() => handleManageTabChange(tab.id)}
|
|
403
|
+
className={classNames(
|
|
404
|
+
activeTab === tab.id
|
|
405
|
+
? tab.isResourceCategory
|
|
406
|
+
? 'text-mydarkgrey border-dashed border-gray-500 bg-white'
|
|
407
|
+
: 'border-cyan-500 bg-cyan-100 text-cyan-700'
|
|
408
|
+
: tab.isResourceCategory
|
|
409
|
+
? 'text-mydarkgrey border-transparent bg-orange-50 hover:bg-orange-100'
|
|
410
|
+
: 'border-transparent bg-gray-100 text-gray-500 hover:bg-gray-200',
|
|
411
|
+
'rounded-xl border-2 px-4 py-1.5 text-sm font-bold transition-colors duration-200'
|
|
412
|
+
)}
|
|
413
|
+
aria-current={activeTab === tab.id ? 'page' : undefined}
|
|
414
|
+
>
|
|
415
|
+
{tab.name}
|
|
416
|
+
{tab.isResourceCategory && (
|
|
417
|
+
<span className="ml-2 inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-xs text-gray-600">
|
|
418
|
+
{
|
|
419
|
+
currentContentMap.filter(
|
|
420
|
+
(item) =>
|
|
421
|
+
item.type === 'Resource' &&
|
|
422
|
+
item.categorySlug === tab.id
|
|
423
|
+
).length
|
|
424
|
+
}
|
|
425
|
+
</span>
|
|
426
|
+
)}
|
|
427
|
+
</button>
|
|
428
|
+
))}
|
|
429
|
+
</nav>
|
|
430
|
+
</div>
|
|
431
|
+
</div>
|
|
432
|
+
|
|
433
|
+
{/* Tab Content */}
|
|
434
|
+
<div>{renderTabContent()}</div>
|
|
435
|
+
</div>
|
|
436
|
+
);
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
export default ManageContent;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { useFormState } from '@/hooks/useFormState';
|
|
2
|
+
import {
|
|
3
|
+
convertToLocalState,
|
|
4
|
+
validateMenuNode,
|
|
5
|
+
menuStateIntercept,
|
|
6
|
+
addMenuLink,
|
|
7
|
+
removeMenuLink,
|
|
8
|
+
updateMenuLink,
|
|
9
|
+
} from '@/utils/api/menuHelpers';
|
|
10
|
+
import { createMenu, saveMenu } from '@/utils/api/menuConfig';
|
|
11
|
+
import StringInput from '@/components/form/StringInput';
|
|
12
|
+
import EnumSelect from '@/components/form/EnumSelect';
|
|
13
|
+
import ActionBuilderField from '@/components/form/ActionBuilderField';
|
|
14
|
+
import UnsavedChangesBar from '@/components/form/UnsavedChangesBar';
|
|
15
|
+
import type {
|
|
16
|
+
MenuNode,
|
|
17
|
+
MenuNodeState,
|
|
18
|
+
FullContentMapItem,
|
|
19
|
+
} from '@/types/tractstack';
|
|
20
|
+
|
|
21
|
+
interface MenuFormProps {
|
|
22
|
+
menu?: MenuNode;
|
|
23
|
+
isCreate?: boolean;
|
|
24
|
+
contentMap: FullContentMapItem[];
|
|
25
|
+
onClose?: (saved: boolean) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const THEME_OPTIONS = [{ value: 'default', label: 'Default' }];
|
|
29
|
+
|
|
30
|
+
export default function MenuForm({
|
|
31
|
+
menu,
|
|
32
|
+
isCreate = false,
|
|
33
|
+
contentMap,
|
|
34
|
+
onClose,
|
|
35
|
+
}: MenuFormProps) {
|
|
36
|
+
// Initialize form state
|
|
37
|
+
const initialState: MenuNodeState = menu
|
|
38
|
+
? convertToLocalState(menu)
|
|
39
|
+
: {
|
|
40
|
+
id: '',
|
|
41
|
+
title: '',
|
|
42
|
+
theme: 'default',
|
|
43
|
+
menuLinks: [],
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const formState = useFormState({
|
|
47
|
+
initialData: initialState,
|
|
48
|
+
interceptor: menuStateIntercept,
|
|
49
|
+
validator: validateMenuNode,
|
|
50
|
+
onSave: async (data) => {
|
|
51
|
+
try {
|
|
52
|
+
const tenantId = window.TRACTSTACK_CONFIG?.tenantId || 'default';
|
|
53
|
+
|
|
54
|
+
if (!data.id || data.id === '') {
|
|
55
|
+
await createMenu(tenantId, data);
|
|
56
|
+
} else {
|
|
57
|
+
await saveMenu(tenantId, data);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
onClose?.(true);
|
|
62
|
+
}, 1000);
|
|
63
|
+
|
|
64
|
+
return data; // Return current state for useFormState
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error('Menu save failed:', error);
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
unsavedChanges: {
|
|
71
|
+
enableBrowserWarning: true,
|
|
72
|
+
browserWarningMessage: 'Your menu changes will be lost!',
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const handleAddLink = () => {
|
|
77
|
+
const newState = addMenuLink(formState.state);
|
|
78
|
+
formState.updateField('menuLinks', newState.menuLinks);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const handleRemoveLink = (index: number) => {
|
|
82
|
+
const newState = removeMenuLink(formState.state, index);
|
|
83
|
+
formState.updateField('menuLinks', newState.menuLinks);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const handleUpdateLink = (index: number, field: string, value: any) => {
|
|
87
|
+
const newState = updateMenuLink(formState.state, index, field, value);
|
|
88
|
+
formState.updateField('menuLinks', newState.menuLinks);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const handleCancel = () => {
|
|
92
|
+
onClose?.(false);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<div className="space-y-8">
|
|
97
|
+
{/* Header */}
|
|
98
|
+
<div className="border-b border-gray-200 pb-4">
|
|
99
|
+
<h2 className="text-2xl font-bold text-gray-900">
|
|
100
|
+
{isCreate ? 'Create Menu' : 'Edit Menu'}
|
|
101
|
+
</h2>
|
|
102
|
+
<p className="mt-2 text-sm text-gray-600">
|
|
103
|
+
{isCreate
|
|
104
|
+
? 'Create a new navigation menu for your site.'
|
|
105
|
+
: 'Edit the menu configuration and links.'}
|
|
106
|
+
</p>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
{/* Basic Menu Information */}
|
|
110
|
+
<div className="space-y-6">
|
|
111
|
+
<StringInput
|
|
112
|
+
label="Menu Title"
|
|
113
|
+
value={formState.state.title}
|
|
114
|
+
onChange={(value) => formState.updateField('title', value)}
|
|
115
|
+
error={formState.errors.title}
|
|
116
|
+
placeholder="Enter menu title"
|
|
117
|
+
required
|
|
118
|
+
/>
|
|
119
|
+
|
|
120
|
+
<EnumSelect
|
|
121
|
+
label="Theme"
|
|
122
|
+
value={formState.state.theme}
|
|
123
|
+
onChange={(value) => formState.updateField('theme', value)}
|
|
124
|
+
error={formState.errors.theme}
|
|
125
|
+
options={THEME_OPTIONS}
|
|
126
|
+
required
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
{/* Menu Links Section */}
|
|
131
|
+
<div className="space-y-6">
|
|
132
|
+
<div className="flex items-center justify-between">
|
|
133
|
+
<h3 className="text-lg font-bold text-gray-900">Menu Links</h3>
|
|
134
|
+
<button
|
|
135
|
+
type="button"
|
|
136
|
+
onClick={handleAddLink}
|
|
137
|
+
className="inline-flex items-center rounded-md bg-cyan-600 px-3 py-2 text-sm font-bold text-white shadow-sm hover:bg-cyan-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cyan-600"
|
|
138
|
+
>
|
|
139
|
+
Add Link
|
|
140
|
+
</button>
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
{formState.state.menuLinks.length === 0 ? (
|
|
144
|
+
<div className="py-6 text-center text-gray-500">
|
|
145
|
+
No menu links yet. Click "Add Link" to create your first link.
|
|
146
|
+
</div>
|
|
147
|
+
) : (
|
|
148
|
+
<div className="space-y-4">
|
|
149
|
+
{formState.state.menuLinks.map((link, index) => (
|
|
150
|
+
<div
|
|
151
|
+
key={index}
|
|
152
|
+
className="space-y-4 rounded-lg border border-gray-200 p-4"
|
|
153
|
+
>
|
|
154
|
+
<div className="flex items-center justify-between">
|
|
155
|
+
<h4 className="text-sm font-bold text-gray-900">
|
|
156
|
+
Link {index + 1}
|
|
157
|
+
</h4>
|
|
158
|
+
<button
|
|
159
|
+
type="button"
|
|
160
|
+
onClick={() => handleRemoveLink(index)}
|
|
161
|
+
className="text-sm font-bold text-red-600 hover:text-red-800"
|
|
162
|
+
>
|
|
163
|
+
Remove
|
|
164
|
+
</button>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
168
|
+
<StringInput
|
|
169
|
+
label="Link Name"
|
|
170
|
+
value={link.name}
|
|
171
|
+
onChange={(value) => handleUpdateLink(index, 'name', value)}
|
|
172
|
+
placeholder="Enter link text"
|
|
173
|
+
required
|
|
174
|
+
/>
|
|
175
|
+
|
|
176
|
+
<StringInput
|
|
177
|
+
label="Description"
|
|
178
|
+
value={link.description}
|
|
179
|
+
onChange={(value) =>
|
|
180
|
+
handleUpdateLink(index, 'description', value)
|
|
181
|
+
}
|
|
182
|
+
placeholder="Brief description"
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<ActionBuilderField
|
|
187
|
+
label="Link Action"
|
|
188
|
+
value={link.actionLisp}
|
|
189
|
+
onChange={(value) =>
|
|
190
|
+
handleUpdateLink(index, 'actionLisp', value)
|
|
191
|
+
}
|
|
192
|
+
contentMap={contentMap}
|
|
193
|
+
error={formState.errors[`menuLinks.${index}.actionLisp`]}
|
|
194
|
+
/>
|
|
195
|
+
|
|
196
|
+
<div className="flex items-center">
|
|
197
|
+
<input
|
|
198
|
+
type="checkbox"
|
|
199
|
+
id={`featured-${index}`}
|
|
200
|
+
checked={link.featured}
|
|
201
|
+
onChange={(e) =>
|
|
202
|
+
handleUpdateLink(index, 'featured', e.target.checked)
|
|
203
|
+
}
|
|
204
|
+
className="h-4 w-4 rounded border-gray-300 text-cyan-600 focus:ring-cyan-500"
|
|
205
|
+
/>
|
|
206
|
+
<label
|
|
207
|
+
htmlFor={`featured-${index}`}
|
|
208
|
+
className="ml-2 block text-sm text-gray-900"
|
|
209
|
+
>
|
|
210
|
+
Featured link
|
|
211
|
+
</label>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
))}
|
|
215
|
+
</div>
|
|
216
|
+
)}
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
{/* Save/Cancel Bar */}
|
|
220
|
+
<UnsavedChangesBar
|
|
221
|
+
formState={formState}
|
|
222
|
+
message="You have unsaved menu changes"
|
|
223
|
+
saveLabel="Save Menu"
|
|
224
|
+
cancelLabel="Discard Changes"
|
|
225
|
+
/>
|
|
226
|
+
|
|
227
|
+
{/* Cancel Navigation Button */}
|
|
228
|
+
<div className="flex justify-start">
|
|
229
|
+
<button
|
|
230
|
+
type="button"
|
|
231
|
+
onClick={handleCancel}
|
|
232
|
+
className="text-sm font-bold text-gray-600 hover:text-gray-800"
|
|
233
|
+
>
|
|
234
|
+
← Back to Menu List
|
|
235
|
+
</button>
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
);
|
|
239
|
+
}
|