diff --git a/electron/src/main/index.ts b/electron/src/main/index.ts index 32cdf11..64a4712 100644 --- a/electron/src/main/index.ts +++ b/electron/src/main/index.ts @@ -35,7 +35,9 @@ function createWindow(): void { height: 900, show: false, autoHideMenuBar: true, + titleBarStyle: 'hidden', ...(process.platform === 'linux' ? { icon } : {}), + ...(process.platform !== "darwin" ? { titleBarOverlay: true } : {}), webPreferences: { preload: join(__dirname, '../preload/index.js'), sandbox: false diff --git a/ui/src/App.svelte b/ui/src/App.svelte index 8f746b8..62f373a 100644 --- a/ui/src/App.svelte +++ b/ui/src/App.svelte @@ -12,8 +12,11 @@ import { allowRemoteMessaging, connectionStatus, version } from 'api/src/vars' import UpdateStatus from './lib/UpdateStatus.svelte' import SettingsModal from './SettingsModal.svelte' - import { hasAccess } from './lib/util' + import { isElectron, hasAccess } from './lib/util' import News, { newsVisible } from './News.svelte' + import CustomTitleBar from './lib/CustomTitleBar.svelte' + import ButtonBar from './lib/ButtonBar.svelte' + import Welcome from './Welcome.svelte' export const ws = new WebSocketClient(`${import.meta.env.VITE_PATH || ''}/ws`) axios.defaults.baseURL = import.meta.env.VITE_PATH @@ -44,7 +47,11 @@ -
+{#if isElectron} + +{/if} + +
{#if $hasAccess} @@ -61,27 +68,7 @@ {#if $connectionStatus == 'connected'} {:else} -
-
Welcome to MeshSense!
-
-
Available bluetooth devices will appear on the left
-
If your device is on the network, enter it's IP address in the Device IP field and click Connect.
- - {#if !$hasAccess} -
If you do not see the option to connect, you can get access by connecting via localhost or by setting your Access and User key.
- {/if} - -
- For additional information, take a look at our FAQ and - Bluetooth Tips -
-
-
-
MeshSense {$version}
- - -
-
+ {/if} {#if !$expandedMap} diff --git a/ui/src/Map.svelte b/ui/src/Map.svelte index 05979d5..4dfb313 100644 --- a/ui/src/Map.svelte +++ b/ui/src/Map.svelte @@ -7,7 +7,7 @@ export function getSvgUri(name: string) { const hexId = parseInt(name).toString(16).padStart(8, '0') const colorId = hexId.slice(-6) - return 'data:image/svg+xml;utf8,' + encodeURIComponent(generateHexer({ + return 'data:image/svg+xml;utf8,' + encodeURIComponent(generateHexer({ name, borderColor: `#${colorId}` })) @@ -25,13 +25,14 @@ -

+

Map
- -
- +
+ {#if !isElectron} + + {/if}
-
MeshSense {$version}
- by Affirmatech - ♥ - - 🌎 -

+ import { hasAccess } from './lib/util' + import Card from './lib/Card.svelte' + import ButtonBar from './lib/ButtonBar.svelte' + import { isElectron } from './lib/util' + + + +

+
Welcome
+
+ {#if !isElectron} + + {/if} +
+

+ +
+ +
+
Welcome to MeshSense!
+
Available bluetooth devices will appear on the left
+
If your device is on the network, enter it's IP address in the Device IP field and click Connect.
+ + {#if !$hasAccess} +
If you do not see the option to connect, you can get access by connecting via localhost or by setting your Access and User key.
+ {/if} + +
+ For additional information, take a look at our FAQ and + Bluetooth Tips +
+
+
+
diff --git a/ui/src/app.css b/ui/src/app.css index 5a957be..b553e44 100644 --- a/ui/src/app.css +++ b/ui/src/app.css @@ -48,6 +48,11 @@ h2 { @apply select-none bg-gradient-to-br from-black to-blue-950 p-1 px-3 font-bold text-white; } +.titlebar { + @apply fixed flex top-0 left-0 right-0 z-0 select-none justify-center text-center p-2 px-3 font-bold text-white; + -webkit-app-region: drag; +} + .header-t { @apply select-none bg-gradient-to-br from-black to-blue-950 p-1 px-3 font-bold text-white rounded-t; } diff --git a/ui/src/lib/ButtonBar.svelte b/ui/src/lib/ButtonBar.svelte new file mode 100644 index 0000000..faf78b3 --- /dev/null +++ b/ui/src/lib/ButtonBar.svelte @@ -0,0 +1,16 @@ + + +
+
MeshSense {$version}
+ by Affirmatech + ♥ + + 🌎 + +
\ No newline at end of file diff --git a/ui/src/lib/CustomTitleBar.svelte b/ui/src/lib/CustomTitleBar.svelte new file mode 100644 index 0000000..88c0ef6 --- /dev/null +++ b/ui/src/lib/CustomTitleBar.svelte @@ -0,0 +1,13 @@ + + +
+
{$$restProps.title}
+ {#if isElectron} +
+ +
+ {/if} +
diff --git a/ui/src/lib/util.ts b/ui/src/lib/util.ts index 37a3d78..38d0824 100644 --- a/ui/src/lib/util.ts +++ b/ui/src/lib/util.ts @@ -6,7 +6,7 @@ import axios from 'axios' export let blockUserKey = writable(false) export const userKey = writable(localStorage.getItem('userKey') || '') - +export const isElectron = window?.api != null export const hasAccess = derived([accessKey, userKey], ([$accessKey, $userKey]) => window.location.hostname == 'localhost' || ($accessKey != '' && $accessKey == $userKey)) let failedUserKeyAttempts = 0