"use client"; import type { PrototypeComponentRegistry } from "@prototype/lib/prototypes/prototype-component-registry"; import { PrototypeCommentRoot } from "@prototype/components/prototypes/prototype-comment-provider"; import { PrototypeCommentToolbar } from "@prototype/components/prototypes/prototype-comment-toolbar"; import { PrototypeCommentReviewBridge } from "@prototype/lib/prototypes/prototype-comment-review-bridge"; import { PROTOTYPE_MOBILE_VIEWPORT_HEIGHT_PX, PROTOTYPE_MOBILE_VIEWPORT_WIDTH_PX, PrototypeReviewProvider, usePrototypeReview, } from "@prototype/lib/prototypes/prototype-review-context"; import { PROTOTYPE_CHROME_ROOT_ID, PROTOTYPE_COMMENTS_SIDEBAR_ROOT_ID, PROTOTYPE_PREVIEW_STAGE_ID, PROTOTYPE_TOOL_OVERLAY_ROOT_ID, PROTOTYPE_VIEWPORT_ID, } from "@prototype/lib/tool-portal"; import { usePrototypeProductPreviewTheme } from "@prototype/lib/prototypes/prototype-product-preview-theme"; import { cn } from "@prototype/lib/utils"; import { PrototypeProvider } from "@prototype/components/prototype-provider"; import { PrototypeScreenshotCapture } from "./prototype-screenshot-capture"; import { PrototypeStateScreenshotCapture } from "./prototype-state-screenshot-capture"; import styles from "./prototype-shell.module.scss"; import { usePathname } from "next/navigation"; type PrototypeShellProps = { slug: string; componentRegistry?: PrototypeComponentRegistry; children: React.ReactNode; }; function PrototypeCommentsSidebarHost() { const review = usePrototypeReview(); const isMobileViewport = review.viewportLayout === "mobile"; const hideWhenClosed = isMobileViewport && !review.open; return (
); } function useOnStateMapPage(): boolean { const pathname = usePathname(); const review = usePrototypeReview(); const stateMapPath = review.stateCanvasPagePath; if (stateMapPath != null) { return pathname.startsWith(stateMapPath); } return /\/prototypes\/[^/]+\/states\/?$/.test(pathname); } function PrototypePreviewArea({ slug, children, }: { slug: string; children: React.ReactNode; }) { const review = usePrototypeReview(); const isMobileViewport = review.viewportLayout === "mobile"; const onStateMapPage = useOnStateMapPage(); const productPreviewTheme = usePrototypeProductPreviewTheme(); return (
{children}
{!onStateMapPage ? ( <> ) : null}
{!onStateMapPage ? (
) : null}
); } function PrototypeShellLayout({ children }: { children: React.ReactNode }) { const onStateMapPage = useOnStateMapPage(); return ( {children} ); } export function PrototypeShell({ slug, componentRegistry, children, }: PrototypeShellProps) { return (
{children}
); }