diff --git a/desktop/README.md b/desktop/README.md index 6cc24f1d..4fac65f5 100644 --- a/desktop/README.md +++ b/desktop/README.md @@ -11,12 +11,36 @@ The desktop component is an electron app. It uses a hybrid setup based of two ma ```bash # start local-app -cd local-app/ -yarn dev +yarn dev:local-app # start electron app LOCAL_APP_URL=http://localhost:3000 yarn dev # or create an executable by running: yarn bundle +``` + +## API for front + +TODO: + +```ts +if (window?.WorkAdventureDesktopApi?.desktop) { + alert('Yeah you are using the desktop app ;)'); +} + +let muted = false; + +window?.WorkAdventureDesktopApi?.onMutedKeyPress((event) => { + if (muted) { + document.getElementById("info-box").innerHTML = + "Ready to speak! Press ctrl-alt-m to mute."; + } else { + document.getElementById("info-box").innerHTML = + "Muted! Press ctrl-alt-m to unmute again."; + } + muted = !muted; +}); + +window.WorkAdventureDesktopApi.notify("Hello from front"); ``` \ No newline at end of file diff --git a/desktop/local-app/index.html b/desktop/local-app/index.html index 0cf06db5..4eef13fd 100644 --- a/desktop/local-app/index.html +++ b/desktop/local-app/index.html @@ -1,29 +1,31 @@ - - - - - WorkAdventure Desktop - - - -
- - + #app { + display: flex; + } + + + +
+ + diff --git a/desktop/local-app/index.js b/desktop/local-app/index.js deleted file mode 100644 index 337e0bd5..00000000 --- a/desktop/local-app/index.js +++ /dev/null @@ -1,20 +0,0 @@ -// let muted = false; - -document.getElementById("btn-reload").onclick = () => { - location.reload(); -}; - -// window?.WorkAdventureDesktopApi?.onMutedKeyPress((event) => { -// if (muted) { -// document.getElementById("demo").innerHTML = -// "Ready to speak! Press ctrl-alt-m to mute."; -// } else { -// document.getElementById("demo").innerHTML = -// "Muted! Press ctrl-alt-m to unmute again."; -// } -// muted = !muted; -// }); - -// document.getElementById("btn-api").onclick = () => { -// window.WorkAdventureDesktopApi.notify("Hello from website"); -// }; diff --git a/desktop/local-app/package.json b/desktop/local-app/package.json index 961e1caf..e1110d73 100644 --- a/desktop/local-app/package.json +++ b/desktop/local-app/package.json @@ -8,7 +8,7 @@ "build": "vite build", "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.json", - "pretty": "yarn prettier --write 'src/**/*.{ts,tsx}'", + "pretty": "yarn prettier --write 'src/**/*.{ts,tsx,svelte}'", "pretty-check": "yarn prettier --check 'src/**/*.{ts,tsx}'" }, "devDependencies": { diff --git a/desktop/local-app/src/App.svelte b/desktop/local-app/src/App.svelte index 9abbfaf0..31697514 100644 --- a/desktop/local-app/src/App.svelte +++ b/desktop/local-app/src/App.svelte @@ -34,6 +34,15 @@ } main { + /* TODO */ background-color: #30343d; + + /* background-color: #2b2f37; */ + + /* color: #62727c; + border: 1px solid #62727c; */ + + /* border-color: #e1e4e8; + color: #e1e4e8; */ } diff --git a/desktop/local-app/src/assets/svelte.png b/desktop/local-app/src/assets/svelte.png deleted file mode 100644 index e673c91c..00000000 Binary files a/desktop/local-app/src/assets/svelte.png and /dev/null differ diff --git a/desktop/local-app/src/lib/Sidebar.svelte b/desktop/local-app/src/lib/Sidebar.svelte index ab1ca92d..bea59715 100644 --- a/desktop/local-app/src/lib/Sidebar.svelte +++ b/desktop/local-app/src/lib/Sidebar.svelte @@ -38,12 +38,5 @@ diff --git a/desktop/package.json b/desktop/package.json index e4372914..57d76e63 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -7,8 +7,9 @@ "license": "SEE LICENSE IN LICENSE.txt", "scripts": { "build": "tsup-node ./src/main.ts ./src/preload-local-app/preload.ts ./src/preload-app/preload.ts", - "dev": "yarn build --watch --onSuccess 'yarn electron dist/main.js'", "build:local-app": "cd local-app && yarn && yarn build", + "dev": "yarn build --watch --onSuccess 'yarn electron dist/main.js'", + "dev:local-app": "cd local-app && yarn && yarn dev", "bundle": "yarn build:local-app && yarn build && electron-builder install-app-deps && electron-builder", "release": "yarn bundle", "typecheck": "tsc --noEmit",