@superwall/studio 1.2.0 → 1.3.0-beta.4
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/README.md +27 -14
- package/dist/assets/index-CEz-HnIH.js +11 -0
- package/dist/index.html +1 -1
- package/dist/lib/StudioApp.d.ts +4 -4
- package/dist/lib/components/PaywallToasts.d.ts +3 -0
- package/dist/lib/components/SurfaceCard.d.ts +4 -2
- package/dist/lib/components/{TopBar.d.ts → chrome/TopBar.d.ts} +1 -2
- package/dist/lib/components/icons.d.ts +0 -2
- package/dist/lib/components/{ActionMenu.d.ts → menus/ActionMenu.d.ts} +2 -1
- package/dist/lib/components/{CompareMenu.d.ts → menus/CompareMenu.d.ts} +1 -1
- package/dist/lib/components/{VariablesPanel.d.ts → panels/VariablesPanel.d.ts} +3 -3
- package/dist/lib/components/{DeviceChrome.d.ts → preview/DeviceChrome.d.ts} +1 -1
- package/dist/lib/components/{DeviceFrame.d.ts → preview/DeviceFrame.d.ts} +5 -2
- package/dist/lib/components/preview/HostedIframe.d.ts +7 -0
- package/dist/lib/index.d.ts +14 -6
- package/dist/lib/index.js +1490 -998
- package/dist/lib/lib/actions.d.ts +1 -1
- package/dist/lib/lib/contract.d.ts +33 -0
- package/dist/lib/lib/devices.d.ts +1 -1
- package/dist/lib/lib/host.d.ts +15 -0
- package/dist/lib/lib/notices.d.ts +9 -0
- package/dist/lib/lib/preview.d.ts +2 -4
- package/dist/lib/lib/project.d.ts +2 -1
- package/dist/lib/lib/steps.d.ts +5 -0
- package/dist/lib/lib/studio-host.d.ts +34 -0
- package/dist/lib/lib/surfaces.d.ts +36 -0
- package/dist/lib/lib/variables.d.ts +12 -0
- package/dist/lib/products.js +26 -12
- package/dist/lib/screens/SurfaceEditor.d.ts +2 -3
- package/dist/lib/screens/SurfaceList.d.ts +2 -3
- package/package.json +5 -1
- package/src/StudioApp.tsx +25 -28
- package/src/components/PaywallToasts.tsx +162 -86
- package/src/components/SurfaceCard.tsx +9 -2
- package/src/components/chrome/TopBar.tsx +45 -0
- package/src/components/icons.tsx +0 -13
- package/src/components/{ActionMenu.tsx → menus/ActionMenu.tsx} +3 -3
- package/src/components/{CompareMenu.tsx → menus/CompareMenu.tsx} +2 -2
- package/src/components/{SidePanel.tsx → panels/SidePanel.tsx} +1 -1
- package/src/components/{VariablesPanel.tsx → panels/VariablesPanel.tsx} +4 -4
- package/src/components/{DeviceChrome.tsx → preview/DeviceChrome.tsx} +1 -1
- package/src/components/{DeviceFrame.tsx → preview/DeviceFrame.tsx} +14 -55
- package/src/components/preview/HostedIframe.tsx +46 -0
- package/src/index.ts +32 -12
- package/src/lib/actions.ts +1 -1
- package/src/lib/contract.ts +30 -0
- package/src/lib/devices.ts +5 -4
- package/src/lib/host.ts +79 -0
- package/src/lib/notices.ts +63 -0
- package/src/lib/preview.ts +8 -40
- package/src/lib/products.ts +20 -1
- package/src/lib/project.ts +2 -1
- package/src/lib/steps.ts +20 -0
- package/src/lib/studio-host.tsx +61 -0
- package/src/lib/surfaces.ts +43 -0
- package/src/lib/time.ts +1 -2
- package/src/lib/variables.ts +13 -0
- package/src/main.tsx +6 -5
- package/src/screens/SurfaceEditor.tsx +79 -70
- package/src/screens/SurfaceList.tsx +27 -12
- package/src/vite-env.d.ts +1 -0
- package/dist/assets/index-CVKQ82YR.js +0 -11
- package/dist/lib/lib/events.d.ts +0 -27
- package/dist/lib/lib/types.d.ts +0 -77
- package/src/components/TopBar.tsx +0 -41
- package/src/lib/events.ts +0 -86
- package/src/lib/types.ts +0 -87
- /package/dist/lib/components/{StudioShell.d.ts → chrome/StudioShell.d.ts} +0 -0
- /package/dist/lib/components/{Toolbar.d.ts → chrome/Toolbar.d.ts} +0 -0
- /package/dist/lib/components/{MissingProducts.d.ts → panels/MissingProducts.d.ts} +0 -0
- /package/dist/lib/components/{SidePanel.d.ts → panels/SidePanel.d.ts} +0 -0
- /package/src/components/{StudioShell.tsx → chrome/StudioShell.tsx} +0 -0
- /package/src/components/{Toolbar.tsx → chrome/Toolbar.tsx} +0 -0
- /package/src/components/{MissingProducts.tsx → panels/MissingProducts.tsx} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Samples, StudioActionName, StudioActionResult, StudioStatus, StudioSurface } from "./
|
|
1
|
+
import type { Samples, StudioActionName, StudioActionResult, StudioStatus, StudioSurface } from "./surfaces";
|
|
2
2
|
export declare const runAction: (surface: StudioSurface, action: StudioActionName, onStep?: (step: string, state: "start" | "done") => void) => Promise<StudioActionResult>;
|
|
3
3
|
export declare const fetchStatus: (surface: StudioSurface) => Promise<StudioStatus>;
|
|
4
4
|
export declare const fetchSamples: () => Promise<Samples>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type StudioActionName = "push" | "promote" | "publish";
|
|
2
|
+
export type StudioActionResult = {
|
|
3
|
+
ok: true;
|
|
4
|
+
version: number;
|
|
5
|
+
live: boolean;
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
error: string;
|
|
9
|
+
};
|
|
10
|
+
export type StudioActionProgress = (step: string, state: "start" | "done") => void;
|
|
11
|
+
export type StudioStatus = {
|
|
12
|
+
paywallId?: string;
|
|
13
|
+
identifier?: string;
|
|
14
|
+
liveUrl?: string;
|
|
15
|
+
active?: boolean;
|
|
16
|
+
updatedAt?: string;
|
|
17
|
+
unreachable?: string;
|
|
18
|
+
};
|
|
19
|
+
export type Samples = {
|
|
20
|
+
device?: Record<string, unknown>;
|
|
21
|
+
user?: Record<string, unknown>;
|
|
22
|
+
products?: Record<string, Record<string, unknown>>;
|
|
23
|
+
live?: {
|
|
24
|
+
device: boolean;
|
|
25
|
+
user: boolean;
|
|
26
|
+
};
|
|
27
|
+
unreachable?: string;
|
|
28
|
+
};
|
|
29
|
+
export type AppScheme = {
|
|
30
|
+
scheme?: string;
|
|
31
|
+
source?: "dashboard" | "app";
|
|
32
|
+
blocksLocalNetworking?: string;
|
|
33
|
+
};
|
|
@@ -16,7 +16,7 @@ export type StudioDevice = {
|
|
|
16
16
|
};
|
|
17
17
|
chrome?: DeviceChromeSpec;
|
|
18
18
|
};
|
|
19
|
-
export declare const STUDIO_DEVICES: readonly StudioDevice[];
|
|
19
|
+
export declare const STUDIO_DEVICES: readonly [StudioDevice, ...StudioDevice[]];
|
|
20
20
|
export declare const DEFAULT_DEVICE_ID = "iphone-17";
|
|
21
21
|
export declare const RESPONSIVE_ID = "responsive";
|
|
22
22
|
export declare const RESPONSIVE_DEFAULT: {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type HostState } from "@superwall/host";
|
|
2
|
+
import type { Samples, StudioSurface } from "./surfaces";
|
|
3
|
+
import type { SampleDefaults, VariableOverrides } from "./variables";
|
|
4
|
+
export type HostInputs = {
|
|
5
|
+
surface: StudioSurface;
|
|
6
|
+
defaults: SampleDefaults;
|
|
7
|
+
sourceSamples?: SampleDefaults;
|
|
8
|
+
samples: Samples;
|
|
9
|
+
frame?: Record<string, unknown>;
|
|
10
|
+
theme: "light" | "dark";
|
|
11
|
+
locale?: string;
|
|
12
|
+
edited: VariableOverrides;
|
|
13
|
+
};
|
|
14
|
+
export declare const studioDefaults: () => SampleDefaults;
|
|
15
|
+
export declare const hostStateFor: ({ surface, defaults, sourceSamples, samples, frame, theme, locale, edited, }: HostInputs) => HostState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TIncomingMessage, TOutgoingMessage } from "@superwall/host";
|
|
2
|
+
export type PaywallEventName = TOutgoingMessage["event_name"];
|
|
3
|
+
export type PaywallMessageName = PaywallEventName | TIncomingMessage["event_name"];
|
|
4
|
+
export type EventNotice = {
|
|
5
|
+
action: PaywallEventName;
|
|
6
|
+
subject?: string;
|
|
7
|
+
tone: "info" | "success" | "warning";
|
|
8
|
+
};
|
|
9
|
+
export declare const noticeFor: (event: TOutgoingMessage) => EventNotice | undefined;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PreviewUrlBuilder, StudioSurface } from "./surfaces";
|
|
2
2
|
export declare const surfacePath: (surface: StudioSurface) => string;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const hostedUrl: (url: string) => string;
|
|
4
4
|
export declare const buildPreviewPath: PreviewUrlBuilder;
|
|
5
|
-
export declare const withOverrides: (url: string, overrides: PreviewOverrides) => string;
|
|
6
|
-
export declare const withPreviewOptIn: (url: string) => string;
|
|
7
5
|
export declare const snapshotPreviewUrl: (urlOf: (surface: StudioSurface) => string) => PreviewUrlBuilder;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StudioActionName } from "./contract";
|
|
2
|
+
export type StudioStepState = "pending" | "active" | "done" | "failed";
|
|
3
|
+
export type StudioActionStep = "link" | "build" | "assets" | "push" | "source" | "promote";
|
|
4
|
+
export declare const ACTION_STEPS: Record<StudioActionName, StudioActionStep[]>;
|
|
5
|
+
export declare const STEP_LABELS: Record<StudioActionStep, string>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* How the studio is being viewed.
|
|
4
|
+
*
|
|
5
|
+
* - `local` — served by `superwall dev` on a desktop browser.
|
|
6
|
+
* - `device` — the same server, opened on a phone: trimmed chrome, and every
|
|
7
|
+
* card is a real link because touch navigation is browser navigation.
|
|
8
|
+
* - `hosted` — embedded in the dashboard, where the studio is one route inside
|
|
9
|
+
* a larger app rather than the whole page.
|
|
10
|
+
*/
|
|
11
|
+
export type StudioMode = "local" | "device" | "hosted";
|
|
12
|
+
/**
|
|
13
|
+
* Where the logo goes.
|
|
14
|
+
*
|
|
15
|
+
* Two mechanisms for one destination: `href` is what the browser opens on a
|
|
16
|
+
* middle or modified click, and `navigate` is what a plain click runs in-app.
|
|
17
|
+
* A hosted studio needs both — following the href there would reload the whole
|
|
18
|
+
* dashboard.
|
|
19
|
+
*/
|
|
20
|
+
export type StudioHome = {
|
|
21
|
+
href: string;
|
|
22
|
+
navigate: () => void;
|
|
23
|
+
};
|
|
24
|
+
export type StudioHostValue = {
|
|
25
|
+
mode: StudioMode;
|
|
26
|
+
home: StudioHome;
|
|
27
|
+
};
|
|
28
|
+
export declare const StudioHostProvider: ({ mode, home, children, }: {
|
|
29
|
+
mode: StudioMode;
|
|
30
|
+
home: StudioHome;
|
|
31
|
+
children: React.ReactNode;
|
|
32
|
+
}) => React.JSX.Element;
|
|
33
|
+
export declare const useStudioMode: () => StudioMode;
|
|
34
|
+
export declare const useStudioHome: () => StudioHome;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SampleDefaults } from "./variables";
|
|
2
|
+
export type { AppScheme, Samples, StudioActionName, StudioActionProgress, StudioActionResult, StudioStatus, } from "./contract";
|
|
3
|
+
export type StudioSurfaceKind = "paywall" | "funnel";
|
|
4
|
+
export type StudioSurface = {
|
|
5
|
+
kind: StudioSurfaceKind;
|
|
6
|
+
id: string;
|
|
7
|
+
project?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
products?: Record<string, string>;
|
|
10
|
+
routes: string[];
|
|
11
|
+
locales: string[];
|
|
12
|
+
platforms?: string[];
|
|
13
|
+
paywallId?: string;
|
|
14
|
+
paywallIdentifier?: string;
|
|
15
|
+
};
|
|
16
|
+
export type PreviewUrlBuilder = (surface: StudioSurface) => string;
|
|
17
|
+
export type CompareTarget = {
|
|
18
|
+
type: "live";
|
|
19
|
+
} | {
|
|
20
|
+
type: "surface";
|
|
21
|
+
surface: StudioSurface;
|
|
22
|
+
};
|
|
23
|
+
export type StudioSource = {
|
|
24
|
+
scheme?: string;
|
|
25
|
+
title: string;
|
|
26
|
+
surfaces: StudioSurface[];
|
|
27
|
+
diagnostics?: string[];
|
|
28
|
+
samples?: SampleDefaults;
|
|
29
|
+
previewUrl: PreviewUrlBuilder;
|
|
30
|
+
standaloneUrl?: PreviewUrlBuilder;
|
|
31
|
+
capabilities?: {
|
|
32
|
+
actions: boolean;
|
|
33
|
+
};
|
|
34
|
+
compareHint?: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const hasActions: (source: StudioSource) => boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type SampleDefaults = {
|
|
2
|
+
device: Record<string, unknown>;
|
|
3
|
+
user: Record<string, unknown>;
|
|
4
|
+
params: Record<string, unknown>;
|
|
5
|
+
};
|
|
6
|
+
export type VariableOverrides = {
|
|
7
|
+
device?: Record<string, unknown>;
|
|
8
|
+
user?: Record<string, unknown>;
|
|
9
|
+
params?: Record<string, unknown>;
|
|
10
|
+
products?: Record<string, Record<string, unknown>>;
|
|
11
|
+
introductoryOfferEligible?: boolean;
|
|
12
|
+
};
|
package/dist/lib/products.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l = {
|
|
2
2
|
USD: "$",
|
|
3
3
|
CAD: "$",
|
|
4
4
|
AUD: "$",
|
|
@@ -19,30 +19,44 @@ const p = {
|
|
|
19
19
|
TRY: "₺",
|
|
20
20
|
RUB: "₽",
|
|
21
21
|
ZAR: "R"
|
|
22
|
-
},
|
|
22
|
+
}, p = 100, m = { day: 365, week: 52, month: 12, year: 1 }, d = (r) => l[r.toUpperCase()] ?? "", i = (r, e) => {
|
|
23
23
|
try {
|
|
24
24
|
return new Intl.NumberFormat("en-US", { style: "currency", currency: e }).format(r);
|
|
25
25
|
} catch {
|
|
26
|
-
return `${
|
|
26
|
+
return `${d(e)}${r.toFixed(2)}`;
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, u = {
|
|
29
29
|
day: "daily",
|
|
30
30
|
week: "weekly",
|
|
31
31
|
month: "monthly",
|
|
32
32
|
year: "yearly"
|
|
33
|
+
}, h = {
|
|
34
|
+
day: { days: 1, weeks: 1 / 7, months: 1 / 30, years: 1 / 365 },
|
|
35
|
+
week: { days: 7, weeks: 1, months: 1 / 4, years: 1 / 52 },
|
|
36
|
+
month: { days: 30, weeks: 4, months: 1, years: 1 / 12 },
|
|
37
|
+
year: { days: 365, weeks: 52, months: 12, years: 1 }
|
|
38
|
+
}, k = (r, e) => {
|
|
39
|
+
const o = h[r];
|
|
40
|
+
if (o)
|
|
41
|
+
return {
|
|
42
|
+
periodDays: o.days * e,
|
|
43
|
+
periodWeeks: Math.round(o.weeks * e),
|
|
44
|
+
periodMonths: Math.floor(o.months * e),
|
|
45
|
+
periodYears: Math.floor(o.years * e)
|
|
46
|
+
};
|
|
33
47
|
}, R = (r) => {
|
|
34
48
|
const e = {};
|
|
35
49
|
r.identifier && (e.identifier = r.identifier);
|
|
36
50
|
const o = r.price;
|
|
37
51
|
if (!o || typeof o.amount != "number" || !o.currency) return e;
|
|
38
|
-
const
|
|
39
|
-
e.price =
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
42
|
-
const
|
|
43
|
-
e.period =
|
|
44
|
-
const
|
|
45
|
-
e.yearlyPrice =
|
|
52
|
+
const s = o.currency.toUpperCase(), t = o.amount / p;
|
|
53
|
+
e.price = i(t, s), e.rawPrice = t, e.currencyCode = s, e.currencySymbol = d(s);
|
|
54
|
+
const n = r.subscription?.period;
|
|
55
|
+
if (!n) return e;
|
|
56
|
+
const c = r.subscription?.period_count ?? 1;
|
|
57
|
+
e.period = n, e.periodly = u[n] ?? `${n}ly`, Object.assign(e, k(n, c) ?? {});
|
|
58
|
+
const a = (m[n] ?? 1) / c;
|
|
59
|
+
e.yearlyPrice = i(t * a, s), e.monthlyPrice = i(t * a / 12, s), e.weeklyPrice = i(t * a / 52, s), e.dailyPrice = i(t * a / 365, s);
|
|
46
60
|
const y = r.subscription?.trial_period_days;
|
|
47
61
|
return typeof y == "number" && y > 0 && (e.trialPeriodDays = y, e.trialPeriodText = `${y}-day`), e;
|
|
48
62
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { type Samples, type StudioSource, type StudioSurface } from "../lib/
|
|
3
|
-
export declare const SurfaceEditor: ({ source, surface, samples,
|
|
2
|
+
import { type Samples, type StudioSource, type StudioSurface } from "../lib/surfaces";
|
|
3
|
+
export declare const SurfaceEditor: ({ source, surface, samples, actions, }: {
|
|
4
4
|
source: StudioSource;
|
|
5
5
|
surface: StudioSurface;
|
|
6
6
|
samples: Samples;
|
|
7
|
-
onBack: () => void;
|
|
8
7
|
actions?: React.ReactNode;
|
|
9
8
|
}) => React.JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type
|
|
3
|
-
export declare const SurfaceList: ({ source, onOpen,
|
|
2
|
+
import { type StudioSource, type StudioSurface } from "../lib/surfaces";
|
|
3
|
+
export declare const SurfaceList: ({ source, onOpen, }: {
|
|
4
4
|
source: StudioSource;
|
|
5
5
|
onOpen: (surface: StudioSurface) => void;
|
|
6
|
-
device?: boolean;
|
|
7
6
|
}) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superwall/studio",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-beta.4",
|
|
4
4
|
"description": "The Superwall studio: paywall browsing, device preview, and editing surfaces. Shared between `superwall dev` (local studio) and the hosted dashboard.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"paywall",
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
"types": "./dist/lib/lib/products.d.ts",
|
|
36
36
|
"default": "./dist/lib/products.js"
|
|
37
37
|
},
|
|
38
|
+
"./contract": {
|
|
39
|
+
"types": "./dist/lib/lib/contract.d.ts"
|
|
40
|
+
},
|
|
38
41
|
"./studio.css": "./dist/lib/studio.css",
|
|
39
42
|
"./styles.css": "./src/styles.css",
|
|
40
43
|
"./package.json": "./package.json"
|
|
@@ -53,6 +56,7 @@
|
|
|
53
56
|
"clean": "rm -rf dist coverage"
|
|
54
57
|
},
|
|
55
58
|
"dependencies": {
|
|
59
|
+
"@superwall/host": "1.3.0-beta.4",
|
|
56
60
|
"sonner": "^2.0.7"
|
|
57
61
|
},
|
|
58
62
|
"devDependencies": {
|
package/src/StudioApp.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { StudioShell } from "./components/StudioShell";
|
|
2
|
+
import { StudioShell } from "./components/chrome/StudioShell";
|
|
3
3
|
import { SurfaceEditor } from "./screens/SurfaceEditor";
|
|
4
4
|
import { SurfaceList } from "./screens/SurfaceList";
|
|
5
|
-
import {
|
|
5
|
+
import { surfacePath } from "./lib/preview";
|
|
6
6
|
import { fetchSamples } from "./lib/actions";
|
|
7
|
-
import
|
|
7
|
+
import { StudioHostProvider, type StudioMode } from "./lib/studio-host";
|
|
8
|
+
import type { Samples, StudioSource, StudioSurface } from "./lib/surfaces";
|
|
8
9
|
|
|
9
10
|
const surfaceFromPath = (
|
|
10
11
|
surfaces: StudioSurface[],
|
|
@@ -22,12 +23,10 @@ const surfaceFromPath = (
|
|
|
22
23
|
|
|
23
24
|
export const StudioApp = ({
|
|
24
25
|
source,
|
|
25
|
-
|
|
26
|
-
openPreview = (url) => window.location.assign(url),
|
|
26
|
+
mode = "local",
|
|
27
27
|
}: {
|
|
28
28
|
source: StudioSource;
|
|
29
|
-
|
|
30
|
-
openPreview?: (url: string) => void;
|
|
29
|
+
mode?: StudioMode;
|
|
31
30
|
}) => {
|
|
32
31
|
const [pathname, setPathname] = React.useState(() => window.location.pathname);
|
|
33
32
|
const [samples, setSamples] = React.useState<Samples>({});
|
|
@@ -49,31 +48,29 @@ export const StudioApp = ({
|
|
|
49
48
|
};
|
|
50
49
|
}, [source.capabilities?.actions]);
|
|
51
50
|
|
|
52
|
-
const
|
|
51
|
+
const homePath = mode === "device" ? "/device" : "/";
|
|
52
|
+
|
|
53
|
+
const navigate = React.useCallback((path: string) => {
|
|
53
54
|
window.history.pushState(null, "", path);
|
|
54
55
|
setPathname(path);
|
|
55
|
-
};
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
const home = React.useMemo(
|
|
59
|
+
() => ({ href: homePath, navigate: () => navigate(homePath) }),
|
|
60
|
+
[homePath, navigate],
|
|
61
|
+
);
|
|
56
62
|
|
|
57
|
-
const active =
|
|
63
|
+
const active = surfaceFromPath(source.surfaces, pathname);
|
|
58
64
|
|
|
59
65
|
return (
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
source={source}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<SurfaceList
|
|
70
|
-
source={source}
|
|
71
|
-
device={device}
|
|
72
|
-
onOpen={(surface) =>
|
|
73
|
-
device ? openPreview(devicePreviewPath(surface)) : navigate(surfacePath(surface))
|
|
74
|
-
}
|
|
75
|
-
/>
|
|
76
|
-
)}
|
|
77
|
-
</StudioShell>
|
|
66
|
+
<StudioHostProvider mode={mode} home={home}>
|
|
67
|
+
<StudioShell>
|
|
68
|
+
{active ? (
|
|
69
|
+
<SurfaceEditor source={source} surface={active} samples={samples} />
|
|
70
|
+
) : (
|
|
71
|
+
<SurfaceList source={source} onOpen={(surface) => navigate(surfacePath(surface))} />
|
|
72
|
+
)}
|
|
73
|
+
</StudioShell>
|
|
74
|
+
</StudioHostProvider>
|
|
78
75
|
);
|
|
79
76
|
};
|