Open History to see the last commit
1"use client";
2
3import type { ScopedThreadRef } from "@t3tools/contracts";
4
5import { isPreviewSupportedInRuntime } from "~/previewStateStore";
6
7import { PreviewPanelShell, type PreviewPanelMode } from "./PreviewPanelShell";
8import { PreviewView } from "./PreviewView";
9
10interface Props {
11 mode: PreviewPanelMode;
12 threadRef: ScopedThreadRef;
13 tabId?: string | null;
14 configuredUrls?: ReadonlyArray<string> | undefined;
15 visible: boolean;
16}
17
18export function PreviewPanel({ mode, threadRef, tabId, configuredUrls, visible }: Props) {
19 if (!isPreviewSupportedInRuntime()) {
20 return (
21 <PreviewPanelShell mode={mode}>
22 <div className="flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-8 text-center">
23 <p className="max-w-sm text-sm text-muted-foreground">
24 Preview is only available in the T3 Code desktop app.
25 </p>
26 </div>
27 </PreviewPanelShell>
28 );
29 }
30
31 return (
32 <PreviewPanelShell mode={mode}>
33 <PreviewView
34 threadRef={threadRef}
35 {...(tabId !== undefined ? { tabId } : {})}
36 configuredUrls={configuredUrls}
37 visible={visible}
38 />
39 </PreviewPanelShell>
40 );
41}