Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(albums): constrain description cell width to truncate long text (#426)

pasitnussoffcba0859617
diff --git a/app/pages/dashboard/albums.vue b/app/pages/dashboard/albums.vue
index 44026601..35c0aede 100644
--- a/app/pages/dashboard/albums.vue
+++ b/app/pages/dashboard/albums.vue
@@ -611,7 +611,8 @@ const columns = computed<any[]>(() => [
<template #description-cell="{ row }">
<div
v-if="(row.original as unknown as AlbumItem).description"
- class="text-sm text-gray-600 dark:text-gray-400 line-clamp-1"
+ class="max-w-xs truncate text-sm text-gray-600 dark:text-gray-400"
+ :title="(row.original as unknown as AlbumItem).description"
>
{{ (row.original as unknown as AlbumItem).description }}
</div>
diff --git a/tests/albums-description-truncate.test.ts b/tests/albums-description-truncate.test.ts
new file mode 100644
index 00000000..76e8dfb4
--- /dev/null
+++ b/tests/albums-description-truncate.test.ts
@@ -0,0 +1,29 @@
+import assert from 'node:assert/strict'
+import { readFileSync } from 'node:fs'
+import test from 'node:test'
+
+const source = readFileSync(
+ new URL('../app/pages/dashboard/albums.vue', import.meta.url),
+ 'utf8',
+)
+
+const descriptionCell =
+ source.match(
+ /<template #description-cell="\{ row \}">([\s\S]*?)<\/template>/,
+ )?.[1] ?? ''
+
+test('albums table has a description cell slot', () => {
+ assert.notEqual(descriptionCell, '')
+})
+
+test('long album descriptions are width-constrained and truncated', () => {
+ assert.match(descriptionCell, /class="[^"]*\bmax-w-xs\b[^"]*"/)
+ assert.match(descriptionCell, /class="[^"]*\btruncate\b[^"]*"/)
+})
+
+test('full album description stays available on hover', () => {
+ assert.match(
+ descriptionCell,
+ /:title="\(row\.original as unknown as AlbumItem\)\.description"/,
+ )
+})