Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.
TypeScript albumsexif-extractiongeocodinglive-photomotion-photophoto-galleryphoto-sharingwebgl-viewer
feat(dashboard): add thumbnail preview modal in photos management (#98)
tanmantangddfc3fbe3039
diff --git a/app/pages/dashboard/photos.vue b/app/pages/dashboard/photos.vueindex 9c3f33ec..d2acf0f6 100644--- a/app/pages/dashboard/photos.vue+++ b/app/pages/dashboard/photos.vue@@ -527,7 +527,7 @@ const columns: TableColumn<Photo>[] = [},{accessorKey: 'thumbnailUrl',- header: $t('dashboard.photos.table.columns.thumbnail'),+ header: $t('dashboard.photos.table.columns.thumbnail.title'),cell: ({ row }) => {const url = row.original.thumbnailUrlreturn h(ThumbImage, {@@ -536,7 +536,7 @@ const columns: TableColumn<Photo>[] = [key: row.original.id,thumbhash: row.original.thumbnailHash || '',class: 'size-16 min-w-[100px] object-cover rounded-md shadow',- onClick: () => openInNewTab(url || row.original.originalUrl || ''),+ onClick: () => openImagePreview(url || row.original.originalUrl || '', row.original.title || 'Photo Preview'),style: { cursor: url ? 'pointer' : 'default' },})},@@ -967,6 +967,20 @@ const selectedLivePhoto = ref<{videoUrl: string} | null>(null)+// 图片预览弹窗+const isImagePreviewOpen = ref(false)+const previewImage = ref<{+ src: string+ alt: string+} | null>(null)++const openImagePreview = (src: string, alt: string) => {+ if (src) {+ previewImage.value = { src, alt }+ isImagePreviewOpen.value = true+ }+}+const openInNewTab = (url: string) => {if (typeof window !== 'undefined') {window.open(url, '_blank')@@ -1718,6 +1732,50 @@ onUnmounted(() => {</div></template></UModal>++ <!-- 图片预览模态框 -->+ <UModal v-model:open="isImagePreviewOpen">+ <template #content>+ <div class="p-4 md:p-6 flex flex-col items-center">+ <div class="w-full flex justify-end mb-2">+ <UButton+ variant="ghost"+ color="neutral"+ size="sm"+ icon="tabler:x"+ @click="isImagePreviewOpen = false"+ />+ </div>++ <div class="flex-grow flex items-center justify-center">+ <img+ v-if="previewImage"+ :src="previewImage.src"+ :alt="previewImage.alt"+ class="max-h-[70vh] max-w-full object-contain rounded-lg"+ />+ </div>++ <div class="mt-4 text-center">+ <p v-if="previewImage" class="text-sm text-neutral-600 dark:text-neutral-400">+ {{ previewImage.alt }}+ </p>+ <div class="flex justify-center gap-2 mt-4">+ <UButton+ variant="soft"+ color="info"+ size="sm"+ icon="tabler:external-link"+ v-if="previewImage"+ @click="openInNewTab(previewImage.src)"+ >+ {{ $t('dashboard.photos.table.columns.thumbnail.action') }}+ </UButton>+ </div>+ </div>+ </div>+ </template>+ </UModal></div></template>diff --git a/i18n/locales/en.json b/i18n/locales/en.jsonindex 93b14fb2..0c511716 100644--- a/i18n/locales/en.json+++ b/i18n/locales/en.json@@ -494,7 +494,10 @@},"table": {"columns": {- "thumbnail": "Thumbnail",+ "thumbnail": {+ "title": "Thumbnail",+ "action": "Open Photo in New Tab"+ },"id": "Photo ID","title": "Photo Title","tags": "Keywords",diff --git a/i18n/locales/ja.json b/i18n/locales/ja.jsonindex c5387db1..eaf5c03e 100644--- a/i18n/locales/ja.json+++ b/i18n/locales/ja.json@@ -437,7 +437,10 @@},"table": {"columns": {- "thumbnail": "サムネイル",+ "thumbnail": {+ "title": "サムネイル",+ "action": "新しいタブで写真を開く"+ },"id": "写真ID","title": "写真のタイトル","tags": "キーワード",diff --git a/i18n/locales/zh-Hans.json b/i18n/locales/zh-Hans.jsonindex 717a97c4..05fed86e 100644--- a/i18n/locales/zh-Hans.json+++ b/i18n/locales/zh-Hans.json@@ -494,7 +494,10 @@},"table": {"columns": {- "thumbnail": "缩略图",+ "thumbnail": {+ "title": "缩略图",+ "action": "在新窗口打开照片"+ },"id": "照片ID","title": "照片标题","tags": "关键词",diff --git a/i18n/locales/zh-Hant-HK.json b/i18n/locales/zh-Hant-HK.jsonindex cb2997a6..ff20e187 100644--- a/i18n/locales/zh-Hant-HK.json+++ b/i18n/locales/zh-Hant-HK.json@@ -437,7 +437,10 @@},"table": {"columns": {- "thumbnail": "縮圖",+ "thumbnail": {+ "title": "縮圖",+ "action": "在新視窗開啟相片"+ },"id": "相片 ID","title": "相片標題","tags": "關鍵字",diff --git a/i18n/locales/zh-Hant-TW.json b/i18n/locales/zh-Hant-TW.jsonindex 8255a8ad..db45a696 100644--- a/i18n/locales/zh-Hant-TW.json+++ b/i18n/locales/zh-Hant-TW.json@@ -437,7 +437,10 @@},"table": {"columns": {- "thumbnail": "縮圖",+ "thumbnail": {+ "title": "縮圖",+ "action": "在新視窗開啟照片"+ },"id": "照片 ID","title": "照片標題","tags": "關鍵字",