Skip to content

Commit b137ce9

Browse files
committed
feat: add doc menu link in side bar
1 parent d10835b commit b137ce9

9 files changed

Lines changed: 65 additions & 216 deletions

File tree

packages/manager/src/managers/telemetry/types.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ export const SegmentEventType = {
3535
devCollab_setUpWorkflowOpened: "dev-collab:set-up-workflow-opened",
3636
devCollab_workflowStubDisplayed: "dev-collab:workflow-stub-displayed",
3737
sliceMachine_start: "slice-machine:start",
38-
sliceLibrary_beta_modalOpened: "slice-library:beta:modal-opened",
39-
sliceLibrary_beta_codeOpened: "slice-library:beta:code-opened",
4038
postPush_emptyStateCtaClicked: "post-push:empty-state-cta-clicked",
4139
postPush_toastCtaClicked: "post-push:toast-cta-clicked",
4240
experiment_exposure: "experiment:exposure",
@@ -45,6 +43,7 @@ export const SegmentEventType = {
4543
sharedOnboarding_completed: "shared-onboarding:completed",
4644
sharedOnboarding_tutorial: "shared-onboarding:follow-tutorial",
4745
sliceGenerationFeedback: "slice-generation-feedback",
46+
navigation_documentationLinkClicked: "navigation:documentation-link-clicked",
4847
} as const;
4948
type SegmentEventTypes =
5049
(typeof SegmentEventType)[keyof typeof SegmentEventType];
@@ -88,10 +87,6 @@ export const HumanSegmentEventType = {
8887
[SegmentEventType.devCollab_workflowStubDisplayed]:
8988
"SliceMachine Dev Collab Workflow Stub Displayed",
9089
[SegmentEventType.sliceMachine_start]: "SliceMachine Start",
91-
[SegmentEventType.sliceLibrary_beta_modalOpened]:
92-
"SliceMachine Slice Library [BETA] CTA modal displayed",
93-
[SegmentEventType.sliceLibrary_beta_codeOpened]:
94-
"SliceMachine Slice Library [BETA] CTA example code opened",
9590
[SegmentEventType.postPush_emptyStateCtaClicked]:
9691
"SliceMachine Post Push Empty State CTA Clicked",
9792
[SegmentEventType.postPush_toastCtaClicked]:
@@ -106,6 +101,8 @@ export const HumanSegmentEventType = {
106101
[SegmentEventType.sharedOnboarding_tutorial]:
107102
"Prismic Onboarding Guide Follow Tutorial",
108103
[SegmentEventType.sliceGenerationFeedback]: "Slice Generation Feedback",
104+
[SegmentEventType.navigation_documentationLinkClicked]:
105+
"SliceMachine Documentation Link Clicked",
109106
} as const;
110107

111108
export type HumanSegmentEventTypes =
@@ -375,14 +372,6 @@ type SliceMachineStart = SegmentEvent<
375372
}
376373
>;
377374

378-
type SliceLibraryBetaModalOpened = SegmentEvent<
379-
typeof SegmentEventType.sliceLibrary_beta_modalOpened
380-
>;
381-
382-
type SliceLibraryBetaCodeOpened = SegmentEvent<
383-
typeof SegmentEventType.sliceLibrary_beta_codeOpened
384-
>;
385-
386375
type OnboardingCommonPayload = { stepId: string; stepTitle: string };
387376
type SharedOnboardingProperties<T = Record<string, string>> = T & {
388377
source: "SliceMachine";
@@ -431,6 +420,13 @@ type SliceGenerationFeedback = SegmentEvent<
431420
}
432421
>;
433422

423+
type NavigationDocumentationLinkClicked = SegmentEvent<
424+
typeof SegmentEventType.navigation_documentationLinkClicked,
425+
{
426+
framework: string;
427+
}
428+
>;
429+
434430
export type SegmentEvents =
435431
| CommandInitStartSegmentEvent
436432
| CommandInitIdentifySegmentEvent
@@ -461,13 +457,12 @@ export type SegmentEvents =
461457
| DevCollabSetUpWorkflowOpened
462458
| DevCollabWorkflowStubDisplayed
463459
| SliceMachineStart
464-
| SliceLibraryBetaModalOpened
465-
| SliceLibraryBetaCodeOpened
466460
| SliceMachineSharedOnboardingStepOpened
467461
| SliceMachineSharedOnboardingStepCompleted
468462
| SliceMachineSharedOnboardingCompleted
469463
| SliceMachineSharedOnboardingTutorial
470464
| SliceMachinePostPushEmptyStateCtaClicked
471465
| SliceMachinePostPushToastCtaClicked
472466
| SliceMachineExperimentExposure
473-
| SliceGenerationFeedback;
467+
| SliceGenerationFeedback
468+
| NavigationDocumentationLinkClicked;

packages/slice-machine/src/features/masterSliceLibrary/SliceLibraryPreviewModal.tsx

Lines changed: 0 additions & 73 deletions
This file was deleted.

packages/slice-machine/src/features/navigation/Navigation.tsx

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { ActionList, Box, Separator, Skeleton } from "@prismicio/editor-ui";
22
import { useRouter } from "next/router";
3-
import { Suspense, useState } from "react";
3+
import { Suspense } from "react";
44

55
import { telemetry } from "@/apiClient";
66
import { ErrorBoundary } from "@/ErrorBoundary";
77
import { CUSTOM_TYPES_CONFIG } from "@/features/customTypes/customTypesConfig";
88
import { CUSTOM_TYPES_MESSAGES } from "@/features/customTypes/customTypesMessages";
9-
import { MasterSliceLibraryPreviewModal } from "@/features/masterSliceLibrary/SliceLibraryPreviewModal";
109
import { RepositoryInfo } from "@/features/navigation/RepositoryInfo";
1110
import { OnboardingGuide } from "@/features/onboarding";
1211
import { useGitIntegrationExperiment } from "@/features/settings/git/useGitIntegrationExperiment";
12+
import { useAdapterName } from "@/hooks/useAdapterName";
1313
import { useMarketingContent } from "@/hooks/useMarketingContent";
1414
import { FolderIcon } from "@/icons/FolderIcon";
1515
import { LightningIcon } from "@/icons/Lightning";
16-
import { MasterSliceLibraryIcon } from "@/icons/MasterSliceLibraryIcon";
16+
import { MenuBookIcon } from "@/icons/MenuBookIcon";
1717
import { SettingsIcon } from "@/icons/SettingsIcon";
1818
import { capitalizeFirstLetter, pluralize } from "@/utils/textConversion";
1919

@@ -28,10 +28,9 @@ export function Navigation() {
2828
const router = useRouter();
2929

3030
const gitIntegrationExperiment = useGitIntegrationExperiment();
31-
const [isSliceLibraryDialogOpen, setIsSliceLibraryDialogOpen] =
32-
useState(false);
33-
const { masterSliceLibrary } = useMarketingContent();
31+
const { documentationLink } = useMarketingContent();
3432
const sectionsNamingExperiment = useSectionsNamingExperiment();
33+
const adapter = useAdapterName();
3534

3635
interface CustomTypeNavigationItemProps {
3736
type: "page" | "custom";
@@ -105,29 +104,18 @@ export function Navigation() {
105104
</Suspense>
106105
</ErrorBoundary>
107106

108-
{masterSliceLibrary && (
109-
<>
110-
<MasterSliceLibraryPreviewModal
111-
isOpen={isSliceLibraryDialogOpen}
112-
onClose={() => {
113-
setIsSliceLibraryDialogOpen(false);
114-
}}
115-
/>
116-
<NavigationItem
117-
title={`Master ${capitalizeFirstLetter(
118-
sectionsNamingExperiment.value,
119-
)} Library`}
120-
Icon={MasterSliceLibraryIcon}
121-
onClick={() => {
122-
void telemetry.track({
123-
event: "slice-library:beta:modal-opened",
124-
});
125-
126-
setIsSliceLibraryDialogOpen(true);
127-
}}
128-
/>
129-
</>
130-
)}
107+
<NavigationItem
108+
title="Documentation"
109+
href={documentationLink}
110+
target="_blank"
111+
Icon={MenuBookIcon}
112+
onClick={() => {
113+
void telemetry.track({
114+
event: "navigation:documentation-link-clicked",
115+
framework: adapter,
116+
});
117+
}}
118+
/>
131119

132120
{gitIntegrationExperiment.eligible && (
133121
<NavigationItem

packages/slice-machine/src/features/navigation/NavigationItem.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ type NavigationItemPropsBase = {
1818
type NavigationLinkItemProps = NavigationItemPropsBase & {
1919
href: string;
2020
target?: "_blank";
21-
onClick?: never;
21+
22+
// For telemetry (optional)
23+
onClick?: MouseEventHandler<Element>;
2224
};
2325

2426
type NavigationButtonItemProps = NavigationItemPropsBase & {
@@ -58,6 +60,7 @@ export function NavigationItem(props: NavigationItemProps) {
5860
target={target}
5961
style={{ textDecoration: "none" }}
6062
data-active={active}
63+
onClick={onClick}
6164
>
6265
{Content}
6366
</Link>

packages/slice-machine/src/hooks/useMarketingContent.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,18 @@
11
import { useAdapterName } from "./useAdapterName";
22

33
type MarketingContent = {
4-
tutorial?: {
5-
url: string;
6-
};
7-
masterSliceLibrary?: {
8-
exampleLinkUrl: string;
9-
codeLinkUrl: string;
10-
previewVideoUrl: string;
11-
};
4+
documentationLink: string;
125
};
136

147
const CONTENT_BY_ADAPTER: Record<string, MarketingContent> = {
158
"@slicemachine/adapter-next": {
16-
tutorial: {
17-
url: "https://prismic.dev/course/next",
18-
},
19-
masterSliceLibrary: {
20-
exampleLinkUrl: "https://slicify-app.vercel.app/slice-library",
21-
codeLinkUrl:
22-
"https://github.com/prismicio-solution-engineering/slicify-library#readme",
23-
previewVideoUrl:
24-
"https://res.cloudinary.com/dmtf1daqp/video/upload/v1715957263/Slice_library_video_oemhy0.mp4",
25-
},
9+
documentationLink: "https://prismic.io/docs/nextjs",
2610
},
2711
"@slicemachine/adapter-nuxt": {
28-
tutorial: {
29-
url: "https://prismic.dev/course/nuxt",
30-
},
12+
documentationLink: "https://prismic.io/docs/nuxt",
3113
},
3214
"@slicemachine/adapter-sveltekit": {
33-
tutorial: {
34-
url: "https://prismic.dev/course/sveltekit",
35-
},
15+
documentationLink: "https://prismic.io/docs/sveltekit",
3616
},
3717
};
3818

packages/slice-machine/src/icons/MasterSliceLibraryIcon.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { FC, SVGProps } from "react";
2+
3+
export const MenuBookIcon: FC<SVGProps<SVGSVGElement>> = (props) => (
4+
<svg
5+
xmlns="http://www.w3.org/2000/svg"
6+
width="24"
7+
height="24"
8+
viewBox="0 0 24 24"
9+
fill="none"
10+
{...props}
11+
>
12+
<path
13+
d="M14 9.9V8.2C14.55 7.96667 15.1125 7.79167 15.6875 7.675C16.2625 7.55833 16.8667 7.5 17.5 7.5C17.9333 7.5 18.3583 7.53333 18.775 7.6C19.1917 7.66667 19.6 7.75 20 7.85V9.45C19.6 9.3 19.1958 9.1875 18.7875 9.1125C18.3792 9.0375 17.95 9 17.5 9C16.8667 9 16.2583 9.07917 15.675 9.2375C15.0917 9.39583 14.5333 9.61667 14 9.9ZM14 15.4V13.7C14.55 13.4667 15.1125 13.2917 15.6875 13.175C16.2625 13.0583 16.8667 13 17.5 13C17.9333 13 18.3583 13.0333 18.775 13.1C19.1917 13.1667 19.6 13.25 20 13.35V14.95C19.6 14.8 19.1958 14.6875 18.7875 14.6125C18.3792 14.5375 17.95 14.5 17.5 14.5C16.8667 14.5 16.2583 14.575 15.675 14.725C15.0917 14.875 14.5333 15.1 14 15.4ZM14 12.65V10.95C14.55 10.7167 15.1125 10.5417 15.6875 10.425C16.2625 10.3083 16.8667 10.25 17.5 10.25C17.9333 10.25 18.3583 10.2833 18.775 10.35C19.1917 10.4167 19.6 10.5 20 10.6V12.2C19.6 12.05 19.1958 11.9375 18.7875 11.8625C18.3792 11.7875 17.95 11.75 17.5 11.75C16.8667 11.75 16.2583 11.8292 15.675 11.9875C15.0917 12.1458 14.5333 12.3667 14 12.65ZM6.5 16C7.28333 16 8.04583 16.0875 8.7875 16.2625C9.52917 16.4375 10.2667 16.7 11 17.05V7.2C10.3167 6.8 9.59167 6.5 8.825 6.3C8.05833 6.1 7.28333 6 6.5 6C5.9 6 5.30417 6.05833 4.7125 6.175C4.12083 6.29167 3.55 6.46667 3 6.7V16.6C3.58333 16.4 4.1625 16.25 4.7375 16.15C5.3125 16.05 5.9 16 6.5 16ZM13 17.05C13.7333 16.7 14.4708 16.4375 15.2125 16.2625C15.9542 16.0875 16.7167 16 17.5 16C18.1 16 18.6875 16.05 19.2625 16.15C19.8375 16.25 20.4167 16.4 21 16.6V6.7C20.45 6.46667 19.8792 6.29167 19.2875 6.175C18.6958 6.05833 18.1 6 17.5 6C16.7167 6 15.9417 6.1 15.175 6.3C14.4083 6.5 13.6833 6.8 13 7.2V17.05ZM12 20C11.2 19.3667 10.3333 18.875 9.4 18.525C8.46667 18.175 7.5 18 6.5 18C5.8 18 5.1125 18.0917 4.4375 18.275C3.7625 18.4583 3.11667 18.7167 2.5 19.05C2.15 19.2333 1.8125 19.225 1.4875 19.025C1.1625 18.825 1 18.5333 1 18.15V6.1C1 5.91667 1.04583 5.74167 1.1375 5.575C1.22917 5.40833 1.36667 5.28333 1.55 5.2C2.31667 4.8 3.11667 4.5 3.95 4.3C4.78333 4.1 5.63333 4 6.5 4C7.46667 4 8.4125 4.125 9.3375 4.375C10.2625 4.625 11.15 5 12 5.5C12.85 5 13.7375 4.625 14.6625 4.375C15.5875 4.125 16.5333 4 17.5 4C18.3667 4 19.2167 4.1 20.05 4.3C20.8833 4.5 21.6833 4.8 22.45 5.2C22.6333 5.28333 22.7708 5.40833 22.8625 5.575C22.9542 5.74167 23 5.91667 23 6.1V18.15C23 18.5333 22.8375 18.825 22.5125 19.025C22.1875 19.225 21.85 19.2333 21.5 19.05C20.8833 18.7167 20.2375 18.4583 19.5625 18.275C18.8875 18.0917 18.2 18 17.5 18C16.5 18 15.5333 18.175 14.6 18.525C13.6667 18.875 12.8 19.3667 12 20Z"
14+
fill="#6F6E77"
15+
/>
16+
</svg>
17+
);

playwright/pages/components/Menu.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ export class Menu {
1111
readonly customTypesLink: Locator;
1212
readonly slicesLink: Locator;
1313
readonly changesLink: Locator;
14-
readonly masterSliceLibraryButton: Locator;
15-
readonly learnPrismicLink: Locator;
14+
readonly documentationLink: Locator;
1615
readonly settingsLink: Locator;
1716
readonly changelogLink: Locator;
1817
readonly appVersion: Locator;
@@ -55,12 +54,8 @@ export class Menu {
5554
this.changesLink = this.menu.getByRole("button", {
5655
name: "Review changes",
5756
});
58-
this.masterSliceLibraryButton = this.menu.getByRole("button", {
59-
name: "Master Slice Library",
60-
exact: true,
61-
});
62-
this.learnPrismicLink = this.menu.getByRole("link", {
63-
name: "Learn Prismic",
57+
this.documentationLink = this.menu.getByRole("link", {
58+
name: "Documentation",
6459
exact: true,
6560
});
6661
this.settingsLink = this.menu.getByRole("link", {

0 commit comments

Comments
 (0)