From 567fbc1c30af5a1facc415c04e202030599cdd5f Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Wed, 27 Nov 2024 09:54:39 +0100 Subject: [PATCH] fix(web): resolve issues with user usage statistics and refactor --- i18n/en.json | 1 + .../user-usage-statistic.svelte | 106 ++++++++---------- 2 files changed, 49 insertions(+), 58 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 9224597febfbf..277db70a23f29 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1306,6 +1306,7 @@ "view_all_users": "View all users", "view_in_timeline": "View in timeline", "view_links": "View links", + "view_name": "View", "view_next_asset": "View next asset", "view_previous_asset": "View previous asset", "view_stack": "View Stack", diff --git a/web/src/lib/components/user-settings-page/user-usage-statistic.svelte b/web/src/lib/components/user-settings-page/user-usage-statistic.svelte index 8833d266ea285..f7de1d8f64b91 100644 --- a/web/src/lib/components/user-settings-page/user-usage-statistic.svelte +++ b/web/src/lib/components/user-settings-page/user-usage-statistic.svelte @@ -1,4 +1,5 @@ -{#snippet row(viewName: string, imageCount: number, videoCount: number, totalCount: number)} - {viewName} - {imageCount} - {videoCount} - {totalCount} +{#snippet row(viewName: string, stats: AssetStatsResponseDto)} + + {viewName} + {stats.images.toLocaleString($locale)} + {stats.videos.toLocaleString($locale)} + {stats.total.toLocaleString($locale)} + {/snippet}

{$t('photos_and_videos')}

- - - - - - - - - - - +
{$t('view').toLocaleString()}{$t('photos').toLocaleString()}{$t('videos').toLocaleString()}{$t('total').toLocaleString()}
+ - {@render row($t('timeline'), timelineStats.images, timelineStats.videos, timelineStats.total)} - - - - {@render row($t('favorites'), favoriteStats.images, favoriteStats.videos, favoriteStats.total)} - - - - {@render row($t('archive'), archiveStats.images, archiveStats.videos, archiveStats.total)} - - - - {@render row($t('trash'), trashStats.images, trashStats.videos, trashStats.total)} - - -
+ + {$t('view_name')} + {$t('photos')} + {$t('videos')} + {$t('total')} + + + + {@render row($t('timeline'), timelineStats)} + {@render row($t('favorites'), favoriteStats)} + {@render row($t('archive'), archiveStats)} + {@render row($t('trash'), trashStats)} + + +

{$t('albums')}

- - - - - - - - - +
{$t('owned')}{$t('shared')}
+ - - - - -
{albumStats.owned.toLocaleString()}{albumStats.shared.toLocaleString()}
+ + {$t('owned')} + {$t('shared')} + + + + + {albumStats.owned.toLocaleString($locale)} + {albumStats.shared.toLocaleString($locale)} + + + +