Skip to content

Commit

Permalink
feat(web): added toggle for Sharing button in the sidebar (immich-app…
Browse files Browse the repository at this point in the history
…#4674)

* Added toggle for Sharing button in the sidebar

* fix: format

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
  • Loading branch information
upsetdog and alextran1502 authored Oct 29, 2023
1 parent 8a68895 commit daad025
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
36 changes: 19 additions & 17 deletions web/src/lib/components/shared-components/side-bar/side-bar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,25 @@
<SideBarButton title="People" icon={mdiAccount} isSelected={$page.route.id === '/(user)/people'} />
</a>
{/if}
<a data-sveltekit-preload-data="hover" href={AppRoute.SHARING} draggable="false">
<SideBarButton
title="Sharing"
icon={isSharingSelected ? mdiAccountMultiple : mdiAccountMultipleOutline}
isSelected={isSharingSelected}
>
<svelte:fragment slot="moreInformation">
{#await getAlbumCount()}
<LoadingSpinner />
{:then data}
<div>
<p>{data.shared.toLocaleString($locale)} Albums</p>
</div>
{/await}
</svelte:fragment>
</SideBarButton>
</a>
{#if $sidebarSettings.sharing}
<a data-sveltekit-preload-data="hover" href={AppRoute.SHARING} draggable="false">
<SideBarButton
title="Sharing"
icon={isSharingSelected ? mdiAccountMultiple : mdiAccountMultipleOutline}
isSelected={isSharingSelected}
>
<svelte:fragment slot="moreInformation">
{#await getAlbumCount()}
<LoadingSpinner />
{:then data}
<div>
<p>{data.shared.toLocaleString($locale)} Albums</p>
</div>
{/await}
</svelte:fragment>
</SideBarButton>
</a>
{/if}

<div class="text-xs transition-all duration-200 dark:text-immich-dark-fg">
<p class="hidden p-6 group-hover:sm:block md:block">LIBRARY</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<div class="ml-4">
<SettingSwitch title="People" subtitle="Display a link to People" bind:checked={$sidebarSettings.people} />
</div>
<div class="ml-4">
<SettingSwitch title="Sharing" subtitle="Display a link to Sharing" bind:checked={$sidebarSettings.sharing} />
</div>
</div>
</div>
</section>
2 changes: 2 additions & 0 deletions web/src/lib/stores/preferences.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ export interface AlbumViewSettings {

export interface SidebarSettings {
people: boolean;
sharing: boolean;
}

export const sidebarSettings = persisted<SidebarSettings>('sidebar-settings', {
people: false,
sharing: true,
});

export enum AlbumViewMode {
Expand Down

0 comments on commit daad025

Please sign in to comment.