fix(web): show full path on hover in duplicates utility (#31468)

This commit is contained in:
Timon
2026-09-12 20:55:06 -05:00
committed by GitHub
parent 0f901eea5e
commit 070ef03258
3 changed files with 17 additions and 9 deletions
+8 -5
View File
@@ -59,6 +59,7 @@ type MetadataFieldDefinition = {
titleKey: string; titleKey: string;
keys: readonly string[]; keys: readonly string[];
render: (asset: AssetResponseDto, $t: MessageFormatter, locale: string | undefined) => string; render: (asset: AssetResponseDto, $t: MessageFormatter, locale: string | undefined) => string;
tooltip?: (asset: AssetResponseDto, $t: MessageFormatter) => string;
}; };
const metadataFields = [ const metadataFields = [
@@ -73,6 +74,7 @@ const metadataFields = [
titleKey: 'path', titleKey: 'path',
keys: ['originalPath'], keys: ['originalPath'],
render: (asset, $t) => truncateMiddle(asset.originalPath) || $t('unknown'), render: (asset, $t) => truncateMiddle(asset.originalPath) || $t('unknown'),
tooltip: (asset, $t) => $t('full_path', { values: { path: asset.originalPath } }),
}, },
{ {
icon: mdiWeightKilogram, icon: mdiWeightKilogram,
@@ -233,11 +235,12 @@ export const countDifferingMetadataItems = (differing: DifferingMetadataFields):
metadataFields.filter(({ keys }) => keys.some((k) => differing[k as MetadataFieldKey])).length; metadataFields.filter(({ keys }) => keys.some((k) => differing[k as MetadataFieldKey])).length;
export const getAllMetadataItems = (asset: AssetResponseDto, $t: MessageFormatter, locale: string | undefined) => export const getAllMetadataItems = (asset: AssetResponseDto, $t: MessageFormatter, locale: string | undefined) =>
metadataFields.map(({ icon, titleKey, keys, render }) => ({ metadataFields.map((field) => ({
icon, icon: field.icon,
title: $t(titleKey), title: $t(field.titleKey),
render: render(asset, $t, locale), render: field.render(asset, $t, locale),
keys, tooltip: 'tooltip' in field ? field.tooltip(asset, $t) : undefined,
keys: field.keys,
})); }));
const normalizeForComparison = (key: MetadataFieldKey, value: unknown): unknown => { const normalizeForComparison = (key: MetadataFieldKey, value: unknown): unknown => {
@@ -106,8 +106,8 @@
? 'bg-success/15 dark:bg-[#001a06]' ? 'bg-success/15 dark:bg-[#001a06]'
: 'bg-transparent'}" : 'bg-transparent'}"
> >
{#each visibleMetadataItems as { icon, title, render, keys } (keys[0])} {#each visibleMetadataItems as { icon, title, render, tooltip, keys } (keys[0])}
<InfoRow {icon} {title}> <InfoRow {icon} {title} {tooltip}>
{render} {render}
</InfoRow> </InfoRow>
{/each} {/each}
@@ -7,12 +7,17 @@
children?: Snippet; children?: Snippet;
borderBottom?: boolean; borderBottom?: boolean;
title?: string; title?: string;
tooltip?: string;
} }
let { icon, children, borderBottom = true, title }: Props = $props(); let { icon, children, borderBottom = true, title, tooltip }: Props = $props();
</script> </script>
<div class="grid w-full grid-cols-[20px_auto_1fr] overflow-hidden px-1 py-0.5" class:border-b={borderBottom} {title}> <div
class="grid w-full grid-cols-[20px_auto_1fr] overflow-hidden px-1 py-0.5"
class:border-b={borderBottom}
title={tooltip ?? title}
>
<Icon {icon} size="16" class="self-center text-dark/25" /> <Icon {icon} size="16" class="self-center text-dark/25" />
{#if title} {#if title}