From 4337264157b71802d946ab54de785eafc96047eb Mon Sep 17 00:00:00 2001 From: Anton Bracke Date: Sun, 20 Feb 2022 21:06:27 +0100 Subject: [PATCH] cleanup --- desktop/README.md | 28 ++++++++++++- desktop/local-app/index.html | 50 ++++++++++++----------- desktop/local-app/index.js | 20 --------- desktop/local-app/package.json | 2 +- desktop/local-app/src/App.svelte | 9 ++++ desktop/local-app/src/assets/svelte.png | Bin 5185 -> 0 bytes desktop/local-app/src/lib/Sidebar.svelte | 7 ---- desktop/package.json | 3 +- 8 files changed, 64 insertions(+), 55 deletions(-) delete mode 100644 desktop/local-app/index.js delete mode 100644 desktop/local-app/src/assets/svelte.png 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 e673c91c7bcb0e3a1be737745af56990613a641e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5185 zcmb7Ic{r5c+ka+Z#*(pQFEeFJ2}O~Z8EF@d5F#cN<(nC6vWyuCh3ZR|LZ*_XWJ_TN zGm@>cg|g2KDNlX&N=se&V8QiJoo*%Kj+*cI2_v~tsxBn zz@`(&51#=5sJICQkT7x8Ql!%%u6zlnoR5ga1q=NDo|E#Tvlx+&i6{s!iYADXh@uR# zsDLVZaZglB7qwK1df1}TUeOF!w7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J4)t!~JyB2ikK)7;hr{KEi1Gggj~dWS 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",