fix(web): fix sidebar tooltip pluralization (#9952)

* fix(web): fix sidebar tooltip pluralization

* Rename property

* Remove data-testid attribute

* Fix variable type
This commit is contained in:
Snowknight26
2024-06-03 20:35:17 -05:00
committed by GitHub
parent b3ee394fdc
commit 471cf5eaf7
3 changed files with 50 additions and 59 deletions
@@ -0,0 +1,24 @@
<script lang="ts">
import { locale } from '$lib/stores/preferences.store.js';
import { s } from '$lib/utils.js';
import { type AlbumCountResponseDto, getAlbumCount } from '@immich/sdk';
import LoadingSpinner from '$lib/components/shared-components/loading-spinner.svelte';
export let albumCountType: keyof AlbumCountResponseDto;
const handleAlbumCount = async () => {
try {
return await getAlbumCount();
} catch {
return { owned: 0, shared: 0, notShared: 0 };
}
};
</script>
{#await handleAlbumCount()}
<LoadingSpinner />
{:then data}
<div>
<p>{data[albumCountType].toLocaleString($locale)} Album{s(data[albumCountType])}</p>
</div>
{/await}