diff --git a/frontend/src/features/media/components/PhotoSelectionList.tsx b/frontend/src/features/media/components/PhotoSelectionList.tsx index f7b4e79..3454204 100644 --- a/frontend/src/features/media/components/PhotoSelectionList.tsx +++ b/frontend/src/features/media/components/PhotoSelectionList.tsx @@ -2,7 +2,7 @@ import { useRef } from 'react'; import { useTranslation } from 'react-i18next'; import { Checkbox } from '@/components/ui/checkbox'; import { formatBytes } from '../lib/format'; -import { usageLabel } from '../lib/usageLabel'; +import { usageHref, usageLabel } from '../lib/usageLabel'; import { selectAll, selectRange, stateOf, type Selection } from '../lib/selection'; export interface PhotoUse { @@ -112,7 +112,24 @@ export function PhotoSelectionList({ items, selection, onSelectionChange, isDisa {item.unusedSince ? t('media.use.noneSince', { date: dateFormat.format(new Date(item.unusedSince)) }) : t('media.use.none')} ) : ( - {item.uses.map((use) => usageLabel(t, use)).join('; ')} + + {item.uses.map((use, index) => { + const label = usageLabel(t, use); + const href = usageHref(use); + return ( + + {index > 0 && '; '} + {href ? ( + + {label} + + ) : ( + label + )} + + ); + })} + )}
diff --git a/frontend/src/features/media/lib/usageLabel.ts b/frontend/src/features/media/lib/usageLabel.ts index 2b1d98c..d2e32c2 100644 --- a/frontend/src/features/media/lib/usageLabel.ts +++ b/frontend/src/features/media/lib/usageLabel.ts @@ -13,3 +13,8 @@ export function usageLabel(t: TFunction, use: UsePlace): string { const where = use.position ? `${place} ${use.position}` : place; return `${t(`media.module.${use.module}`, { defaultValue: use.module })}, ${where}${use.active ? '' : ` (${t('media.use.off')})`}`; } + +/** Where the admin screen of the module that uses the photo lives (null when there is none). */ +export function usageHref(use: Pick{t('media.trash.note')} diff --git a/frontend/src/i18n/locales/en/translation.json b/frontend/src/i18n/locales/en/translation.json index 68fe6c5..7514f16 100644 --- a/frontend/src/i18n/locales/en/translation.json +++ b/frontend/src/i18n/locales/en/translation.json @@ -867,6 +867,12 @@ "close": "Close", "partial_one": "{{count}} photo could not be deleted. The rest went to the trash.", "partial_other": "{{count}} photos could not be deleted. The rest went to the trash." + }, + "filter": { + "label": "Filter", + "all": "All photos", + "used": "Used", + "unused": "Unused" } } } diff --git a/frontend/src/i18n/locales/nl/translation.json b/frontend/src/i18n/locales/nl/translation.json index d6c8049..29f047e 100644 --- a/frontend/src/i18n/locales/nl/translation.json +++ b/frontend/src/i18n/locales/nl/translation.json @@ -867,6 +867,12 @@ "close": "Sluiten", "partial_one": "{{count}} foto kon niet worden verwijderd. De rest is naar de prullenbak.", "partial_other": "{{count}} foto's konden niet worden verwijderd. De rest is naar de prullenbak." + }, + "filter": { + "label": "Filter", + "all": "Alle foto's", + "used": "Gebruikt", + "unused": "Ongebruikt" } } }