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,594 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useStore } from '@nanostores/react';
|
|
3
|
+
import { epinetCustomFilters } from '@/stores/analytics';
|
|
4
|
+
import { Accordion } from '@ark-ui/react';
|
|
5
|
+
import ChevronLeftIcon from '@heroicons/react/24/outline/ChevronLeftIcon';
|
|
6
|
+
import ChevronRightIcon from '@heroicons/react/24/outline/ChevronRightIcon';
|
|
7
|
+
import ChevronDownIcon from '@heroicons/react/24/outline/ChevronDownIcon';
|
|
8
|
+
import NewspaperIcon from '@heroicons/react/24/outline/NewspaperIcon';
|
|
9
|
+
import DocumentCheckIcon from '@heroicons/react/24/outline/DocumentCheckIcon';
|
|
10
|
+
import DocumentPlusIcon from '@heroicons/react/24/outline/DocumentPlusIcon';
|
|
11
|
+
import UserGroupIcon from '@heroicons/react/24/outline/UserGroupIcon';
|
|
12
|
+
import MagnifyingGlassIcon from '@heroicons/react/24/outline/MagnifyingGlassIcon';
|
|
13
|
+
|
|
14
|
+
interface ContentEvent {
|
|
15
|
+
verb: string;
|
|
16
|
+
count: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ContentItem {
|
|
20
|
+
contentId: string;
|
|
21
|
+
title: string;
|
|
22
|
+
contentType: string;
|
|
23
|
+
events: ContentEvent[];
|
|
24
|
+
visitorIds: string[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ActiveHourData {
|
|
28
|
+
type: 'active';
|
|
29
|
+
hourKey: string;
|
|
30
|
+
hourNum: number;
|
|
31
|
+
hourDisplay: string;
|
|
32
|
+
humanReadableTime: string;
|
|
33
|
+
contentItems: ContentItem[];
|
|
34
|
+
hourlyTotal: number;
|
|
35
|
+
hourlyVisitors: number;
|
|
36
|
+
relativeToMax: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface EmptyHourRange {
|
|
40
|
+
type: 'empty';
|
|
41
|
+
startHour: number;
|
|
42
|
+
endHour: number;
|
|
43
|
+
display: string;
|
|
44
|
+
humanReadableDisplay: string;
|
|
45
|
+
isFuture: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type HourData = ActiveHourData | EmptyHourRange;
|
|
49
|
+
|
|
50
|
+
interface ContentMapItem {
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
type: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const EpinetTableView = ({
|
|
57
|
+
fullContentMap,
|
|
58
|
+
isLoading = false,
|
|
59
|
+
}: {
|
|
60
|
+
fullContentMap: ContentMapItem[];
|
|
61
|
+
isLoading?: boolean;
|
|
62
|
+
}) => {
|
|
63
|
+
const $epinetCustomFilters = useStore(epinetCustomFilters);
|
|
64
|
+
const [currentDay, setCurrentDay] = useState<string | null>(null);
|
|
65
|
+
const [availableDays, setAvailableDays] = useState<string[]>([]);
|
|
66
|
+
const [currentDayIndex, setCurrentDayIndex] = useState(0);
|
|
67
|
+
|
|
68
|
+
const getContentInfo = (
|
|
69
|
+
contentId: string
|
|
70
|
+
): { title: string; type: string } => {
|
|
71
|
+
const content = fullContentMap.find((item) => item.id === contentId);
|
|
72
|
+
if (content) {
|
|
73
|
+
return {
|
|
74
|
+
title: content.title,
|
|
75
|
+
type: content.type,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
title: contentId.substring(0, 8) + '...',
|
|
80
|
+
type: 'Unknown',
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const getHumanReadableTime = (hour: number): string => {
|
|
85
|
+
if (hour === 0) return 'midnight';
|
|
86
|
+
if (hour === 12) return 'noon';
|
|
87
|
+
if (hour < 12) return `${hour}am`;
|
|
88
|
+
return `${hour - 12}pm`;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const getHumanReadableTimeRange = (
|
|
92
|
+
startHour: number,
|
|
93
|
+
endHour: number
|
|
94
|
+
): string => {
|
|
95
|
+
if (startHour === endHour) {
|
|
96
|
+
return getHumanReadableTime(startHour);
|
|
97
|
+
}
|
|
98
|
+
const startTime = getHumanReadableTime(startHour);
|
|
99
|
+
// If end hour is 23 (11pm), show "end of day"
|
|
100
|
+
if (endHour === 23) {
|
|
101
|
+
return `${startTime} - end of day`;
|
|
102
|
+
}
|
|
103
|
+
// Show endHour:59 format
|
|
104
|
+
if (endHour === 0) {
|
|
105
|
+
return `${startTime} - 12:59am`;
|
|
106
|
+
} else if (endHour < 12) {
|
|
107
|
+
return `${startTime} - ${endHour}:59am`;
|
|
108
|
+
} else if (endHour === 12) {
|
|
109
|
+
return `${startTime} - 12:59pm`;
|
|
110
|
+
} else {
|
|
111
|
+
return `${startTime} - ${endHour - 12}:59pm`;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// Parse UTC hourKey and convert to local timezone for display
|
|
116
|
+
const getLocalDisplayTime = (
|
|
117
|
+
hourKey: string
|
|
118
|
+
): {
|
|
119
|
+
localDay: string;
|
|
120
|
+
localHour: number;
|
|
121
|
+
localHourDisplay: string;
|
|
122
|
+
humanReadableTime: string;
|
|
123
|
+
} => {
|
|
124
|
+
try {
|
|
125
|
+
const [year, month, day, hour] = hourKey.split('-').map(Number);
|
|
126
|
+
const utcDate = new Date(Date.UTC(year, month - 1, day, hour));
|
|
127
|
+
|
|
128
|
+
// Convert UTC to local timezone for display
|
|
129
|
+
const localDate = new Date(utcDate.toLocaleString());
|
|
130
|
+
|
|
131
|
+
const localDay = `${localDate.getFullYear()}-${String(
|
|
132
|
+
localDate.getMonth() + 1
|
|
133
|
+
).padStart(2, '0')}-${String(localDate.getDate()).padStart(2, '0')}`;
|
|
134
|
+
|
|
135
|
+
const localHour = localDate.getHours();
|
|
136
|
+
const localHourDisplay = `${localHour.toString().padStart(2, '0')}:00`;
|
|
137
|
+
const humanReadableTime = getHumanReadableTime(localHour);
|
|
138
|
+
|
|
139
|
+
return { localDay, localHour, localHourDisplay, humanReadableTime };
|
|
140
|
+
} catch (e) {
|
|
141
|
+
console.warn(`Failed to parse hourKey: ${hourKey}`, e);
|
|
142
|
+
// Fallback to treating as already local
|
|
143
|
+
const [year, month, day] = hourKey.split('-').slice(0, 3).map(Number);
|
|
144
|
+
const localDay = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
|
145
|
+
const localHour = Number(hourKey.split('-')[3]) || 0;
|
|
146
|
+
const localHourDisplay = `${localHour.toString().padStart(2, '0')}:00`;
|
|
147
|
+
const humanReadableTime = getHumanReadableTime(localHour);
|
|
148
|
+
return { localDay, localHour, localHourDisplay, humanReadableTime };
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// Convert hourKey (UTC) to exact UTC time range for focusing
|
|
153
|
+
const focusOnThisHour = (hourKey: string) => {
|
|
154
|
+
try {
|
|
155
|
+
const [year, month, day, hour] = hourKey.split('-').map(Number);
|
|
156
|
+
|
|
157
|
+
// Create exact UTC hour boundaries
|
|
158
|
+
const startTimeUTC = new Date(
|
|
159
|
+
Date.UTC(year, month - 1, day, hour, 0, 0, 0)
|
|
160
|
+
);
|
|
161
|
+
const endTimeUTC = new Date(
|
|
162
|
+
Date.UTC(year, month - 1, day, hour, 59, 59, 999)
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
epinetCustomFilters.set(window.TRACTSTACK_CONFIG?.tenantId || 'default', {
|
|
166
|
+
...$epinetCustomFilters,
|
|
167
|
+
startTimeUTC: startTimeUTC.toISOString(),
|
|
168
|
+
endTimeUTC: endTimeUTC.toISOString(),
|
|
169
|
+
});
|
|
170
|
+
} catch (e) {
|
|
171
|
+
console.warn(`Failed to focus on hour: ${hourKey}`, e);
|
|
172
|
+
// Fallback - do nothing rather than use legacy system
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
useEffect(() => {
|
|
177
|
+
const hourlyActivity = $epinetCustomFilters.hourlyNodeActivity || {};
|
|
178
|
+
const hourKeys = Object.keys(hourlyActivity);
|
|
179
|
+
|
|
180
|
+
if (hourKeys.length === 0) {
|
|
181
|
+
setAvailableDays([]);
|
|
182
|
+
setCurrentDay(null);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const days = Array.from(
|
|
187
|
+
new Set(hourKeys.map((key) => getLocalDisplayTime(key).localDay))
|
|
188
|
+
)
|
|
189
|
+
.sort()
|
|
190
|
+
.reverse();
|
|
191
|
+
|
|
192
|
+
setAvailableDays(days);
|
|
193
|
+
setCurrentDay(days[0] || null);
|
|
194
|
+
setCurrentDayIndex(0);
|
|
195
|
+
}, [$epinetCustomFilters.hourlyNodeActivity]);
|
|
196
|
+
|
|
197
|
+
const navigateDay = (direction: 'prev' | 'next') => {
|
|
198
|
+
const newIndex =
|
|
199
|
+
direction === 'prev'
|
|
200
|
+
? Math.min(currentDayIndex + 1, availableDays.length - 1)
|
|
201
|
+
: Math.max(currentDayIndex - 1, 0);
|
|
202
|
+
|
|
203
|
+
setCurrentDayIndex(newIndex);
|
|
204
|
+
setCurrentDay(availableDays[newIndex]);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const getCurrentDayData = (): {
|
|
208
|
+
data: HourData[];
|
|
209
|
+
dailyTotal: number;
|
|
210
|
+
dailyVisitors: number;
|
|
211
|
+
maxHourlyTotal: number;
|
|
212
|
+
} => {
|
|
213
|
+
if (!currentDay)
|
|
214
|
+
return { data: [], dailyTotal: 0, dailyVisitors: 0, maxHourlyTotal: 0 };
|
|
215
|
+
|
|
216
|
+
const hourlyActivity = $epinetCustomFilters.hourlyNodeActivity || {};
|
|
217
|
+
const result: HourData[] = [];
|
|
218
|
+
let emptyRangeStart: number | null = null;
|
|
219
|
+
let dailyTotal = 0;
|
|
220
|
+
let maxHourlyTotal = 0;
|
|
221
|
+
|
|
222
|
+
const dailyUniqueVisitors = new Set<string>();
|
|
223
|
+
|
|
224
|
+
// Get current local time for "future" detection
|
|
225
|
+
const now = new Date();
|
|
226
|
+
const today = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(
|
|
227
|
+
now.getDate()
|
|
228
|
+
).padStart(2, '0')}`;
|
|
229
|
+
const isToday = currentDay === today;
|
|
230
|
+
const currentLocalHour = now.getHours();
|
|
231
|
+
|
|
232
|
+
type ProcessedHourData = {
|
|
233
|
+
hourKey: string;
|
|
234
|
+
data: Record<string, ContentItem>;
|
|
235
|
+
hourlyTotal: number;
|
|
236
|
+
hourlyVisitors: number;
|
|
237
|
+
localHour: number;
|
|
238
|
+
localHourDisplay: string;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const activityByLocalHour: Record<number, ProcessedHourData> = {};
|
|
242
|
+
|
|
243
|
+
Object.entries(hourlyActivity).forEach(([hourKey, contentItems]) => {
|
|
244
|
+
const { localDay, localHour, localHourDisplay } =
|
|
245
|
+
getLocalDisplayTime(hourKey);
|
|
246
|
+
if (localDay === currentDay) {
|
|
247
|
+
let hourlyTotal = 0;
|
|
248
|
+
const hourlyUniqueVisitors = new Set<string>();
|
|
249
|
+
const processedData: Record<string, ContentItem> = {};
|
|
250
|
+
|
|
251
|
+
Object.entries(contentItems as Record<string, any>).forEach(
|
|
252
|
+
([contentId, data]) => {
|
|
253
|
+
const contentInfo = getContentInfo(contentId);
|
|
254
|
+
const events: ContentEvent[] = [];
|
|
255
|
+
|
|
256
|
+
Object.entries(data.events as Record<string, number>).forEach(
|
|
257
|
+
([verb, count]) => {
|
|
258
|
+
events.push({ verb, count: count as number });
|
|
259
|
+
hourlyTotal += count as number;
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
processedData[contentId] = {
|
|
263
|
+
contentId,
|
|
264
|
+
title: contentInfo.title,
|
|
265
|
+
contentType: contentInfo.type,
|
|
266
|
+
events,
|
|
267
|
+
visitorIds: (data.visitorIds as string[]) || [],
|
|
268
|
+
};
|
|
269
|
+
(data.visitorIds as string[])?.forEach((visitorId: string) => {
|
|
270
|
+
hourlyUniqueVisitors.add(visitorId);
|
|
271
|
+
dailyUniqueVisitors.add(visitorId);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
dailyTotal += hourlyTotal;
|
|
277
|
+
maxHourlyTotal = Math.max(maxHourlyTotal, hourlyTotal);
|
|
278
|
+
|
|
279
|
+
activityByLocalHour[localHour] = {
|
|
280
|
+
hourKey,
|
|
281
|
+
data: processedData,
|
|
282
|
+
hourlyTotal,
|
|
283
|
+
hourlyVisitors: hourlyUniqueVisitors.size,
|
|
284
|
+
localHour,
|
|
285
|
+
localHourDisplay,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
for (let localHour = 0; localHour < 24; localHour++) {
|
|
291
|
+
const activity = activityByLocalHour[localHour];
|
|
292
|
+
const hasActivity = activity && Object.keys(activity.data).length > 0;
|
|
293
|
+
|
|
294
|
+
if (hasActivity) {
|
|
295
|
+
if (emptyRangeStart !== null) {
|
|
296
|
+
const localEmptyEnd = localHour - 1;
|
|
297
|
+
const isFuture = isToday && emptyRangeStart > currentLocalHour;
|
|
298
|
+
result.push({
|
|
299
|
+
type: 'empty',
|
|
300
|
+
startHour: emptyRangeStart,
|
|
301
|
+
endHour: localEmptyEnd,
|
|
302
|
+
display:
|
|
303
|
+
emptyRangeStart === localEmptyEnd
|
|
304
|
+
? `${emptyRangeStart.toString().padStart(2, '0')}:00`
|
|
305
|
+
: `${emptyRangeStart.toString().padStart(2, '0')}:00 - ${localEmptyEnd.toString().padStart(2, '0')}:59`,
|
|
306
|
+
humanReadableDisplay: getHumanReadableTimeRange(
|
|
307
|
+
emptyRangeStart,
|
|
308
|
+
localEmptyEnd
|
|
309
|
+
),
|
|
310
|
+
isFuture,
|
|
311
|
+
});
|
|
312
|
+
emptyRangeStart = null;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const contentItems = Object.values(activity.data).sort((a, b) =>
|
|
316
|
+
a.title.localeCompare(b.title)
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
const relativeToMax =
|
|
320
|
+
maxHourlyTotal > 0 ? activity.hourlyTotal / maxHourlyTotal : 0;
|
|
321
|
+
|
|
322
|
+
result.push({
|
|
323
|
+
type: 'active',
|
|
324
|
+
hourKey: activity.hourKey,
|
|
325
|
+
hourNum: localHour,
|
|
326
|
+
hourDisplay: activity.localHourDisplay,
|
|
327
|
+
humanReadableTime: getHumanReadableTime(localHour),
|
|
328
|
+
contentItems,
|
|
329
|
+
hourlyTotal: activity.hourlyTotal,
|
|
330
|
+
hourlyVisitors: activity.hourlyVisitors,
|
|
331
|
+
relativeToMax,
|
|
332
|
+
});
|
|
333
|
+
} else {
|
|
334
|
+
if (emptyRangeStart === null) {
|
|
335
|
+
emptyRangeStart = localHour;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (emptyRangeStart !== null) {
|
|
341
|
+
const localEmptyEnd = 23;
|
|
342
|
+
const isFuture = isToday && emptyRangeStart > currentLocalHour;
|
|
343
|
+
result.push({
|
|
344
|
+
type: 'empty',
|
|
345
|
+
startHour: emptyRangeStart,
|
|
346
|
+
endHour: localEmptyEnd,
|
|
347
|
+
display:
|
|
348
|
+
emptyRangeStart === localEmptyEnd
|
|
349
|
+
? `${emptyRangeStart.toString().padStart(2, '0')}:00`
|
|
350
|
+
: `${emptyRangeStart.toString().padStart(2, '0')}:00 - ${localEmptyEnd.toString().padStart(2, '0')}:59`,
|
|
351
|
+
humanReadableDisplay: getHumanReadableTimeRange(
|
|
352
|
+
emptyRangeStart,
|
|
353
|
+
localEmptyEnd
|
|
354
|
+
),
|
|
355
|
+
isFuture,
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return {
|
|
360
|
+
data: result.sort((a, b) => {
|
|
361
|
+
if (a.type === 'active' && b.type === 'active') {
|
|
362
|
+
return a.hourNum - b.hourNum;
|
|
363
|
+
} else if (a.type === 'active' && b.type === 'empty') {
|
|
364
|
+
return a.hourNum - b.startHour;
|
|
365
|
+
} else if (a.type === 'empty' && b.type === 'active') {
|
|
366
|
+
return a.startHour - b.hourNum;
|
|
367
|
+
} else if (a.type === 'empty' && b.type === 'empty') {
|
|
368
|
+
return a.startHour - b.startHour;
|
|
369
|
+
}
|
|
370
|
+
return 0;
|
|
371
|
+
}),
|
|
372
|
+
dailyTotal,
|
|
373
|
+
dailyVisitors: dailyUniqueVisitors.size,
|
|
374
|
+
maxHourlyTotal,
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
const getContentIcon = (contentType: string) => {
|
|
379
|
+
switch (contentType) {
|
|
380
|
+
case 'StoryFragment':
|
|
381
|
+
return <NewspaperIcon className="mr-1 h-4 w-4" />;
|
|
382
|
+
case 'Pane':
|
|
383
|
+
return <DocumentCheckIcon className="mr-1 h-4 w-4" />;
|
|
384
|
+
default:
|
|
385
|
+
return <DocumentPlusIcon className="mr-1 h-4 w-4" />;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const { data: dayData, dailyTotal, dailyVisitors } = getCurrentDayData();
|
|
390
|
+
const hasData = availableDays.length > 0;
|
|
391
|
+
|
|
392
|
+
const formatDate = (dateStr: string): string => {
|
|
393
|
+
try {
|
|
394
|
+
const [year, month, day] = dateStr.split('-').map(Number);
|
|
395
|
+
const date = new Date(year, month - 1, day);
|
|
396
|
+
return date.toLocaleDateString(undefined, {
|
|
397
|
+
weekday: 'short',
|
|
398
|
+
year: 'numeric',
|
|
399
|
+
month: 'short',
|
|
400
|
+
day: 'numeric',
|
|
401
|
+
});
|
|
402
|
+
} catch (e) {
|
|
403
|
+
return dateStr;
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
const getTimezoneName = (): string => {
|
|
408
|
+
try {
|
|
409
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
410
|
+
} catch (e) {
|
|
411
|
+
return 'Local Time';
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
const classNames = (...classes: (string | boolean | undefined)[]): string => {
|
|
416
|
+
return classes.filter(Boolean).join(' ');
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
if (!hasData) return null;
|
|
420
|
+
|
|
421
|
+
return (
|
|
422
|
+
<div className="relative">
|
|
423
|
+
{isLoading && (
|
|
424
|
+
<div className="absolute inset-0 z-10 flex items-center justify-center rounded bg-black bg-opacity-80">
|
|
425
|
+
<div className="flex items-center space-x-2 text-white">
|
|
426
|
+
<div className="h-6 w-6 animate-spin rounded-full border-2 border-white border-t-transparent"></div>
|
|
427
|
+
<span className="text-sm font-bold">Loading table data...</span>
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
)}
|
|
431
|
+
<div className="border-t border-gray-200 bg-gray-50">
|
|
432
|
+
<div className="flex items-center justify-between border-b border-gray-200 p-3">
|
|
433
|
+
<h3 className="text-sm font-bold text-gray-800">
|
|
434
|
+
Hourly Activity ({getTimezoneName()}) - {dailyTotal} Total Events /{' '}
|
|
435
|
+
{dailyVisitors} Unique Visitors
|
|
436
|
+
</h3>
|
|
437
|
+
<div className="flex items-center space-x-2">
|
|
438
|
+
<div className="flex items-center space-x-1">
|
|
439
|
+
<button
|
|
440
|
+
onClick={() => navigateDay('prev')}
|
|
441
|
+
disabled={currentDayIndex >= availableDays.length - 1}
|
|
442
|
+
className={classNames(
|
|
443
|
+
'rounded-full p-1',
|
|
444
|
+
currentDayIndex >= availableDays.length - 1
|
|
445
|
+
? 'cursor-not-allowed text-gray-300'
|
|
446
|
+
: 'text-gray-700 hover:bg-gray-100'
|
|
447
|
+
)}
|
|
448
|
+
title="Previous day (older)"
|
|
449
|
+
>
|
|
450
|
+
<ChevronLeftIcon className="h-5 w-5" />
|
|
451
|
+
</button>
|
|
452
|
+
<span className="text-sm text-gray-600">
|
|
453
|
+
{currentDay ? formatDate(currentDay) : ''}
|
|
454
|
+
</span>
|
|
455
|
+
<button
|
|
456
|
+
onClick={() => navigateDay('next')}
|
|
457
|
+
disabled={currentDayIndex === 0}
|
|
458
|
+
className={classNames(
|
|
459
|
+
'rounded-full p-1',
|
|
460
|
+
currentDayIndex === 0
|
|
461
|
+
? 'cursor-not-allowed text-gray-300'
|
|
462
|
+
: 'text-gray-700 hover:bg-gray-100'
|
|
463
|
+
)}
|
|
464
|
+
title="Next day (newer)"
|
|
465
|
+
>
|
|
466
|
+
<ChevronRightIcon className="h-5 w-5" />
|
|
467
|
+
</button>
|
|
468
|
+
</div>
|
|
469
|
+
</div>
|
|
470
|
+
</div>
|
|
471
|
+
|
|
472
|
+
<Accordion.Root multiple className="w-full">
|
|
473
|
+
{dayData.map((item, index) => (
|
|
474
|
+
<Accordion.Item
|
|
475
|
+
key={item.type === 'active' ? item.hourKey : `empty-${index}`}
|
|
476
|
+
value={item.type === 'active' ? item.hourKey : `empty-${index}`}
|
|
477
|
+
className="border-b border-gray-100 last:border-b-0"
|
|
478
|
+
>
|
|
479
|
+
<Accordion.ItemTrigger className="flex w-full items-center justify-between p-3 text-left transition-colors duration-200 hover:bg-gray-50">
|
|
480
|
+
{item.type === 'active' ? (
|
|
481
|
+
<div className="flex flex-grow items-center space-x-3">
|
|
482
|
+
<span className="text-sm font-bold text-gray-700">
|
|
483
|
+
{item.humanReadableTime}
|
|
484
|
+
</span>
|
|
485
|
+
<span className="text-xs text-gray-600">
|
|
486
|
+
{item.hourlyTotal} event
|
|
487
|
+
{item.hourlyTotal !== 1 ? 's' : ''} /{' '}
|
|
488
|
+
{item.hourlyVisitors} visitor
|
|
489
|
+
{item.hourlyVisitors !== 1 ? 's' : ''}
|
|
490
|
+
</span>
|
|
491
|
+
<div className="relative h-2 w-full max-w-48 rounded bg-gray-200">
|
|
492
|
+
<div
|
|
493
|
+
className="absolute left-0 top-0 h-2 rounded bg-cyan-600"
|
|
494
|
+
style={{
|
|
495
|
+
width: `${Math.max(item.relativeToMax * 100, 5)}%`,
|
|
496
|
+
}}
|
|
497
|
+
title={`${item.hourlyTotal} events (${(item.relativeToMax * 100).toFixed(1)}% of busiest hour)`}
|
|
498
|
+
/>
|
|
499
|
+
</div>
|
|
500
|
+
<div
|
|
501
|
+
onClick={(e) => {
|
|
502
|
+
e.stopPropagation(); // Prevent accordion toggle
|
|
503
|
+
focusOnThisHour(item.hourKey);
|
|
504
|
+
}}
|
|
505
|
+
className="flex cursor-pointer items-center rounded-md bg-orange-100 px-2 py-1 text-xs font-bold text-orange-800 transition-colors duration-200 hover:bg-orange-200"
|
|
506
|
+
title="Focus analytics dashboard on this hour's user journeys"
|
|
507
|
+
role="button"
|
|
508
|
+
tabIndex={0}
|
|
509
|
+
onKeyDown={(e) => {
|
|
510
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
511
|
+
e.preventDefault();
|
|
512
|
+
e.stopPropagation();
|
|
513
|
+
focusOnThisHour(item.hourKey);
|
|
514
|
+
}
|
|
515
|
+
}}
|
|
516
|
+
>
|
|
517
|
+
<MagnifyingGlassIcon className="mr-1 h-3 w-3" />
|
|
518
|
+
Journeys this Hour
|
|
519
|
+
</div>
|
|
520
|
+
</div>
|
|
521
|
+
) : (
|
|
522
|
+
<div className="flex flex-grow items-center">
|
|
523
|
+
<span className="text-sm text-gray-700">
|
|
524
|
+
{item.humanReadableDisplay}
|
|
525
|
+
</span>
|
|
526
|
+
<span className="ml-2 text-xs italic text-gray-500">
|
|
527
|
+
{item.isFuture ? 'The future awaits!' : 'No activity'}
|
|
528
|
+
</span>
|
|
529
|
+
</div>
|
|
530
|
+
)}
|
|
531
|
+
<Accordion.ItemIndicator>
|
|
532
|
+
<ChevronDownIcon
|
|
533
|
+
className={classNames(
|
|
534
|
+
'h-5 w-5 text-gray-500 transition-transform duration-200',
|
|
535
|
+
'data-[state=open]:rotate-180'
|
|
536
|
+
)}
|
|
537
|
+
/>
|
|
538
|
+
</Accordion.ItemIndicator>
|
|
539
|
+
</Accordion.ItemTrigger>
|
|
540
|
+
|
|
541
|
+
<Accordion.ItemContent className="pt-2">
|
|
542
|
+
{item.type === 'active' && (
|
|
543
|
+
<div className="space-y-4">
|
|
544
|
+
{item.contentItems.map((content) => (
|
|
545
|
+
<div
|
|
546
|
+
key={`${item.hourKey}-${content.contentId}`}
|
|
547
|
+
className="mb-3"
|
|
548
|
+
>
|
|
549
|
+
<div className="mb-1 flex items-center justify-between text-sm font-bold text-gray-700">
|
|
550
|
+
<div className="flex items-center">
|
|
551
|
+
{getContentIcon(content.contentType)}
|
|
552
|
+
{content.title}
|
|
553
|
+
</div>
|
|
554
|
+
{content.visitorIds.length > 0 && (
|
|
555
|
+
<div
|
|
556
|
+
className="flex items-center text-xs text-gray-600"
|
|
557
|
+
title={content.visitorIds.join(', ')}
|
|
558
|
+
>
|
|
559
|
+
<UserGroupIcon className="mr-1 h-3 w-3" />
|
|
560
|
+
{content.visitorIds.length} unique visitor
|
|
561
|
+
{content.visitorIds.length !== 1 ? 's' : ''}
|
|
562
|
+
</div>
|
|
563
|
+
)}
|
|
564
|
+
</div>
|
|
565
|
+
<div className="flex flex-wrap gap-2">
|
|
566
|
+
{content.events.map((event, eventIdx) => (
|
|
567
|
+
<div
|
|
568
|
+
key={`${item.hourKey}-${content.contentId}-${event.verb}-${eventIdx}`}
|
|
569
|
+
className="rounded-full bg-cyan-100 px-2 py-0.5 text-xs font-bold text-cyan-800"
|
|
570
|
+
>
|
|
571
|
+
{event.verb} [{event.count}]
|
|
572
|
+
</div>
|
|
573
|
+
))}
|
|
574
|
+
</div>
|
|
575
|
+
</div>
|
|
576
|
+
))}
|
|
577
|
+
</div>
|
|
578
|
+
)}
|
|
579
|
+
</Accordion.ItemContent>
|
|
580
|
+
</Accordion.Item>
|
|
581
|
+
))}
|
|
582
|
+
|
|
583
|
+
{dayData.length === 0 && (
|
|
584
|
+
<div className="py-6 text-center text-sm text-gray-500">
|
|
585
|
+
No activity data available for this day
|
|
586
|
+
</div>
|
|
587
|
+
)}
|
|
588
|
+
</Accordion.Root>
|
|
589
|
+
</div>
|
|
590
|
+
</div>
|
|
591
|
+
);
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
export default EpinetTableView;
|