diff --git a/web/src/components/misc/NotchSticker.svelte b/web/src/components/misc/NotchSticker.svelte new file mode 100644 index 00000000..84c3cc76 --- /dev/null +++ b/web/src/components/misc/NotchSticker.svelte @@ -0,0 +1,101 @@ + + + + + diff --git a/web/src/components/save/buttons/DownloadButton.svelte b/web/src/components/save/buttons/DownloadButton.svelte index 96dea5a5..da01fe4a 100644 --- a/web/src/components/save/buttons/DownloadButton.svelte +++ b/web/src/components/save/buttons/DownloadButton.svelte @@ -2,7 +2,7 @@ import '@fontsource-variable/noto-sans-mono'; import API from "$lib/api"; - import device from '$lib/device'; + import { device } from '$lib/device'; export let url: string; @@ -35,7 +35,7 @@ } const downloadFile = (url: string) => { - if (device.isIOS) { + if (device.is.iOS) { return navigator?.share({ url }).catch(() => {}); } else { return window.open(url, '_blank'); diff --git a/web/src/components/sidebar/Sidebar.svelte b/web/src/components/sidebar/Sidebar.svelte index 35a8e858..9eef6cc8 100644 --- a/web/src/components/sidebar/Sidebar.svelte +++ b/web/src/components/sidebar/Sidebar.svelte @@ -1,6 +1,8 @@ - {#if device.isMobile} + {#if device.is.mobile} {/if}
-
+
+ {#if device.is.iPhone && app.is.installed} + + {/if}
@@ -57,6 +61,8 @@ --sidebar-font-size: 11px; --sidebar-inner-padding: 4px; + --safe-area-inset-top: env(safe-area-inset-top); + --switcher-padding: var(--sidebar-inner-padding); --sidebar-mobile-gradient: linear-gradient( @@ -121,6 +127,18 @@ color: var(--secondary); } + /* add padding for notch / dynamic island in landscape */ + @media screen and (orientation: landscape) { + #cobalt.on-iPhone { + grid-template-columns: + calc(var(--sidebar-width) + env(safe-area-inset-left) + 8px) 1fr; + } + + #cobalt.on-iPhone #content { + padding-right: env(safe-area-inset-right); + } + } + #content { display: flex; overflow: scroll; diff --git a/web/src/routes/+layout.ts b/web/src/routes/+layout.ts index db068ff0..e28d0ed6 100644 --- a/web/src/routes/+layout.ts +++ b/web/src/routes/+layout.ts @@ -9,14 +9,13 @@ import type { Load } from '@sveltejs/kit'; import languages from '$i18n/languages.json'; import { loadTranslations, defaultLocale } from '$lib/i18n/translations'; -import device from '$lib/device.js'; - export const load: Load = async ({ url }) => { const { pathname } = url; let preferredLocale = defaultLocale; if (browser) { + const device = (await import('$lib/device')).device; const settings = get((await import('$lib/settings')).default); const deviceLanguage = device.preferredLocale; const settingsLanguage = settings.appearance.language;