diff --git a/app2/src/app.css b/app2/src/app.css index af6280c..d1ea8a5 100644 --- a/app2/src/app.css +++ b/app2/src/app.css @@ -2,6 +2,10 @@ @tailwind components; @tailwind utilities; +#nipple_0_0, #nipple_1_1 { + z-index: 10!important; +} + #three-gui-panel { top: 64px; right: 0px; diff --git a/app2/src/lib/utilities/model-utilities.ts b/app2/src/lib/utilities/model-utilities.ts index a5dd4e3..680513b 100644 --- a/app2/src/lib/utilities/model-utilities.ts +++ b/app2/src/lib/utilities/model-utilities.ts @@ -33,7 +33,7 @@ export const loadModelAsync = async ( resolve(Result.err('Failed to load model', error)); } }, - (error) => reject(error) + (error) => resolve(Result.err('Failed to load model', error)) ); }); }; diff --git a/app2/src/routes/+layout.svelte b/app2/src/routes/+layout.svelte index bb15e48..7dc08ef 100644 --- a/app2/src/routes/+layout.svelte +++ b/app2/src/routes/+layout.svelte @@ -17,11 +17,10 @@ export let data: LayoutData; - onMount(() => { + onMount(async () => { if ($user.bearer_token !== '') { validateUser($user); } - menuOpen = false; connectToEventSource(); }); @@ -29,10 +28,6 @@ NotificationSource?.close(); }); - onDestroy(() => { - NotificationSource.close(); - }); - async function validateUser(userdata: userProfile) { try { const response = await fetch('/rest/verifyAuthorization', { @@ -186,15 +181,13 @@ - +
diff --git a/app2/src/routes/+layout.ts b/app2/src/routes/+layout.ts index c6d78ce..506e6a7 100644 --- a/app2/src/routes/+layout.ts +++ b/app2/src/routes/+layout.ts @@ -14,17 +14,8 @@ const registerFetchIntercept = async () => { }; }; -const setup = async () => { - const outControllerData = (await import('$lib/stores/model-store')).outControllerData; - const mode = (await import('$lib/stores/model-store')).mode; - const socketLocation = (await import('$lib/utilities/location-utilities')).socketLocation; - const socketService = (await import('$lib/services/socket-service')).default; - socketService.connect(socketLocation); - socketService.addPublisher(outControllerData); - socketService.addPublisher(mode, 'mode'); - await registerFetchIntercept(); +const loadModelFiles = async () => { const modelRes = await loadModelAsync('/spot_micro.urdf.xacro'); - if (modelRes.isOk()) { const [urdf, JOINT_NAME] = modelRes.inner; jointNames.set(JOINT_NAME); @@ -34,8 +25,9 @@ const setup = async () => { } }; -export const load = async () => { - await setup(); +export const load = async ({ fetch }) => { + await registerFetchIntercept(); + await loadModelFiles(); const result = await fetch('/rest/features'); const features = await result.json(); return { diff --git a/app2/src/routes/+page.svelte b/app2/src/routes/+page.svelte index ca82d4f..53cb622 100644 --- a/app2/src/routes/+page.svelte +++ b/app2/src/routes/+page.svelte @@ -7,7 +7,7 @@
-
+
diff --git a/app2/src/routes/demo/Demo.svelte b/app2/src/routes/demo/Demo.svelte index b45b458..a950bfb 100644 --- a/app2/src/routes/demo/Demo.svelte +++ b/app2/src/routes/demo/Demo.svelte @@ -1,33 +1,24 @@ Light State
-

REST Example

-
- - The form below controls the LED via the RESTful service exposed by the ESP device. -
-
-
- -
-
- - -
-

Websocket Example

-
- - The switch below controls the LED via the WebSocket. It will automatically update whenever - the LED state changes. -
-
- +
+
+ {#each $servoAngles as angle, index} + updateAngle(index, parseFloat(event.target?.value))} + /> + {/each} +
diff --git a/app2/src/routes/menu.svelte b/app2/src/routes/menu.svelte index e50054c..b9d0c5a 100644 --- a/app2/src/routes/menu.svelte +++ b/app2/src/routes/menu.svelte @@ -180,7 +180,7 @@

{appName}