Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): my immich shortcut #12007

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion web/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
import { loadConfig, serverConfig } from '$lib/stores/server-config.store';
import { user } from '$lib/stores/user.store';
import { closeWebsocketConnection, openWebsocketConnection } from '$lib/stores/websocket';
import { setKey } from '$lib/utils';
import { copyToClipboard, setKey } from '$lib/utils';
import { handleError } from '$lib/utils/handle-error';
import { onDestroy, onMount } from 'svelte';
import '../app.css';
import { isAssetViewerRoute, isSharedLinkRoute } from '$lib/utils/navigation';
import DialogWrapper from '$lib/components/shared-components/dialog/dialog-wrapper.svelte';
import { t } from 'svelte-i18n';
import { shortcut } from '$lib/actions/shortcut';

let showNavigationLoadingBar = false;
$: changeTheme($colorTheme);
Expand Down Expand Up @@ -49,6 +50,10 @@
}
};

const getMyImmichLink = () => {
return new URL($page.url.pathname + $page.url.search, 'https://my.immich.app');
};

onMount(() => {
// if the browser theme changes, changes the Immich theme too
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', handleChangeTheme);
Expand Down Expand Up @@ -123,6 +128,12 @@
</FullscreenContainer>
</noscript>

<svelte:window
use:shortcut={{
shortcut: { ctrl: true, shift: true, key: 'm' },
onShortcut: () => copyToClipboard(getMyImmichLink().toString()),
}}
/>
<slot />

{#if showNavigationLoadingBar}
Expand Down
Loading