11import { Editor } from "@/client/Editor" ;
22import { Preview } from "@/client/Preview" ;
3- import { Logo } from "@/client/components/Logo" ;
4- import {
5- ResizableHandle ,
6- ResizablePanelGroup ,
7- } from "@/client/components/Resizable" ;
3+ import { Button } from "@/client/components/Button" ;
84import {
95 DropdownMenu ,
106 DropdownMenuContent ,
117 DropdownMenuItem ,
128 DropdownMenuPortal ,
139 DropdownMenuTrigger ,
1410} from "@/client/components/DropdownMenu" ;
15- import { type FC , useEffect , useMemo , useRef , useState } from "react" ;
16- import { useTheme } from "@/client/contexts/theme" ;
17- import { MoonIcon , ShareIcon , SunIcon , SunMoonIcon } from "lucide-react" ;
18- import { Button } from "@/client/components/Button" ;
11+ import { Logo } from "@/client/components/Logo" ;
12+ import {
13+ ResizableHandle ,
14+ ResizablePanelGroup ,
15+ } from "@/client/components/Resizable" ;
1916import {
2017 Tooltip ,
2118 TooltipContent ,
2219 TooltipTrigger ,
2320} from "@/client/components/Tooltip" ;
21+ import { useTheme } from "@/client/contexts/theme" ;
22+ import { defaultCode } from "@/client/snippets" ;
23+ import type {
24+ ParameterWithSource ,
25+ PreviewOutput ,
26+ WorkspaceOwner ,
27+ } from "@/gen/types" ;
2428import { rpc } from "@/utils/rpc" ;
25- import { useLoaderData , type LoaderFunctionArgs } from "react-router" ;
2629import {
30+ type WasmLoadState ,
2731 getDynamicParametersOutput ,
2832 initWasm ,
29- type WasmLoadState ,
3033} from "@/utils/wasm" ;
31- import { defaultCode } from "@/client/snippets" ;
32- import type { ParameterWithSource , PreviewOutput } from "@/gen/types" ;
33- import { useDebouncedValue } from "./hooks/debounce" ;
3434import isEqual from "lodash/isEqual" ;
35+ import { MoonIcon , ShareIcon , SunIcon , SunMoonIcon } from "lucide-react" ;
36+ import { type FC , useEffect , useMemo , useRef , useState } from "react" ;
37+ import { type LoaderFunctionArgs , useLoaderData } from "react-router" ;
38+ import { useDebouncedValue } from "./hooks/debounce" ;
39+ import { mockUsers } from "@/owner" ;
3540
3641/**
3742 * Load the shared code if present.
@@ -69,6 +74,7 @@ export const App = () => {
6974 > ( { } ) ;
7075 const [ output , setOutput ] = useState < PreviewOutput | null > ( null ) ;
7176 const [ parameters , setParameters ] = useState < ParameterWithSource [ ] > ( [ ] ) ;
77+ const [ owner , setOwner ] = useState < WorkspaceOwner > ( mockUsers . admin ) ;
7278
7379 const onDownloadOutput = ( ) => {
7480 const blob = new Blob ( [ JSON . stringify ( output , null , 2 ) ] , {
@@ -149,7 +155,7 @@ export const App = () => {
149155 return ;
150156 }
151157
152- getDynamicParametersOutput ( debouncedCode , parameterValues )
158+ getDynamicParametersOutput ( debouncedCode , parameterValues , owner )
153159 . catch ( ( e ) => {
154160 console . error ( e ) ;
155161 setWasmLoadingState ( "error" ) ;
@@ -159,7 +165,7 @@ export const App = () => {
159165 . then ( ( output ) => {
160166 setOutput ( output ) ;
161167 } ) ;
162- } , [ debouncedCode , parameterValues , wasmLoadState ] ) ;
168+ } , [ debouncedCode , parameterValues , wasmLoadState , owner ] ) ;
163169
164170 return (
165171 < main className = "flex h-dvh w-screen flex-col items-center bg-surface-primary" >
@@ -221,6 +227,10 @@ export const App = () => {
221227 setParameterValues = { setParameterValues }
222228 parameters = { parameters }
223229 onReset = { onReset }
230+ setOwner = { ( owner ) => {
231+ onReset ( ) ;
232+ setOwner ( owner ) ;
233+ } }
224234 />
225235 </ ResizablePanelGroup >
226236 </ main >
0 commit comments