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
refactor(dashboard): photo editing modal and enhance UI and selection features (#262)
Timothy Yin13752490db1a
diff --git a/app/pages/dashboard/albums.vue b/app/pages/dashboard/albums.vueindex 99ba4b3b..247f69ff 100644--- a/app/pages/dashboard/albums.vue+++ b/app/pages/dashboard/albums.vue@@ -44,7 +44,24 @@ const isSubmittingForm = ref(false)const selectedPhotoIds = ref<string[]>([])const coverPhotoId = ref('')-const photoSelectorSearchQuery = ref('')++const draftSelectedPhotoIds = ref<string[]>([])+const draftCoverPhotoId = ref('')+const {+ filteredPhotos: unifiedFilteredPhotos,+ selectedCounts,+ hasActiveFilters,+ clearAllFilters,+} = usePhotoFilters()++const isSelectorFilterOpen = ref(false)++const totalSelectedFilters = computed(() => {+ return Object.values(selectedCounts.value).reduce(+ (total, count) => total + count,+ 0,+ )+})const validateForm = (state: any): FormError[] => {const errors: FormError[] = []@@ -226,43 +243,114 @@ const togglePhotoSelection = (photoId: string) => {}}-const setCoverPhoto = (photoId: string) => {- if (!selectedPhotoIds.value.includes(photoId)) {- selectedPhotoIds.value.push(photoId)+const openPhotoSelector = () => {+ draftSelectedPhotoIds.value = [...selectedPhotoIds.value]+ draftCoverPhotoId.value =+ coverPhotoId.value && selectedPhotoIds.value.includes(coverPhotoId.value)+ ? coverPhotoId.value+ : ''+ isSelectorFilterOpen.value = false+ isPhotoSelectorOpen.value = true+}++const closePhotoSelector = () => {+ isSelectorFilterOpen.value = false+ isPhotoSelectorOpen.value = false+}++const confirmPhotoSelection = () => {+ selectedPhotoIds.value = [...draftSelectedPhotoIds.value]+ coverPhotoId.value = draftSelectedPhotoIds.value.includes(+ draftCoverPhotoId.value,+ )+ ? draftCoverPhotoId.value+ : ''+ isPhotoSelectorOpen.value = false+}++const toggleDraftPhotoSelection = (photoId: string) => {+ const index = draftSelectedPhotoIds.value.indexOf(photoId)+ if (index > -1) {+ draftSelectedPhotoIds.value.splice(index, 1)+ if (draftCoverPhotoId.value === photoId) {+ draftCoverPhotoId.value = ''+ }+ return+ }++ draftSelectedPhotoIds.value.push(photoId)+}++const setDraftCoverPhoto = (photoId: string) => {+ if (!draftSelectedPhotoIds.value.includes(photoId)) {+ draftSelectedPhotoIds.value.push(photoId)}- coverPhotoId.value = photoId+ draftCoverPhotoId.value = photoId+}++const getDraftPhotoOrder = (photoId: string) => {+ const index = draftSelectedPhotoIds.value.indexOf(photoId)+ return index >= 0 ? index + 1 : null}-const areAllPhotosSelected = computed(() => {+const areAllFilteredPhotosSelected = computed(() => {return (- allPhotos.value.length > 0 &&- selectedPhotoIds.value.length === allPhotos.value.length+ selectorFilteredPhotos.value.length > 0 &&+ selectorFilteredPhotos.value.every((photo) =>+ draftSelectedPhotoIds.value.includes(photo.id),+ ))})-const areSomePhotosSelected = computed(() => {+const areSomeFilteredPhotosSelected = computed(() => {+ const selectedInFiltered = selectorFilteredPhotos.value.filter((photo) =>+ draftSelectedPhotoIds.value.includes(photo.id),+ ).lengthreturn (- selectedPhotoIds.value.length > 0 &&- selectedPhotoIds.value.length < allPhotos.value.length+ selectedInFiltered > 0 &&+ selectedInFiltered < selectorFilteredPhotos.value.length)})-const toggleAllPhotos = () => {- if (areAllPhotosSelected.value) {- selectedPhotoIds.value = []- } else {- selectedPhotoIds.value = allPhotos.value.map((p) => p.id)+const toggleAllFilteredPhotos = () => {+ if (areAllFilteredPhotosSelected.value) {+ draftSelectedPhotoIds.value = draftSelectedPhotoIds.value.filter(+ (id) => !selectorFilteredPhotos.value.some((photo) => photo.id === id),+ )+ if (+ draftCoverPhotoId.value &&+ !draftSelectedPhotoIds.value.includes(draftCoverPhotoId.value)+ ) {+ draftCoverPhotoId.value = ''+ }+ return}++ const merged = new Set(draftSelectedPhotoIds.value)+ for (const photo of selectorFilteredPhotos.value) {+ merged.add(photo.id)+ }+ draftSelectedPhotoIds.value = [...merged]}-const filteredPhotos = computed(() => {- const query = photoSelectorSearchQuery.value.toLowerCase()- if (!query) return allPhotos.value+const selectorFilteredPhotos = computed(() => {+ if (allPhotos.value.length === 0) return []- return allPhotos.value.filter(- (photo) =>- (photo.title?.toLowerCase() || '').includes(query) ||- (photo.description?.toLowerCase() || '').includes(query),+ const ids = new Set(allPhotos.value.map((photo) => photo.id))+ return unifiedFilteredPhotos.value.filter((photo) => ids.has(photo.id))+})++const selectedPhotosPreview = computed(() => {+ return draftSelectedPhotoIds.value+ .map((id) => allPhotos.value.find((photo) => photo.id === id))+ .filter((photo): photo is Photo => Boolean(photo))+ .slice(0, 8)+})++const selectedPhotosOverflowCount = computed(() => {+ return Math.max(+ draftSelectedPhotoIds.value.length - selectedPhotosPreview.value.length,+ 0,)})@@ -513,7 +601,7 @@ const columns: any[] = [<buttonv-elseclass="w-full h-48 bg-gray-100 dark:bg-neutral-800 flex flex-col items-center justify-center text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 hover:bg-gray-200 dark:hover:bg-neutral-700 transition-colors cursor-pointer"- @click="isPhotoSelectorOpen = true"+ @click="openPhotoSelector"><Iconname="tabler:photo"@@ -578,7 +666,7 @@ const columns: any[] = [icon="tabler:photo-plus"size="lg"class="w-full"- @click="isPhotoSelectorOpen = true"+ @click="openPhotoSelector">{{selectedPhotoIds.length > 0@@ -671,183 +759,328 @@ const columns: any[] = [<UModalv-model:open="isPhotoSelectorOpen"- :ui="{ content: 'w-full max-w-6xl overflow-hidden' }"+ portal+ scrollable+ :ui="{+ wrapper: 'z-220',+ overlay: 'z-220',+ content: 'z-221 w-full max-w-6xl overflow-hidden',+ }"><template #content>- <div class="flex flex-col h-[85vh] max-h-[85vh]">+ <div class="flex h-[88vh] max-h-[88vh] flex-col"><div- class="shrink-0 border-b border-gray-200 dark:border-neutral-700 p-3 sm:p-4 md:p-6"+ class="shrink-0 border-b border-gray-200 bg-white/80 p-4 backdrop-blur-sm dark:border-neutral-700 dark:bg-neutral-900/80 sm:p-5">- <div class="flex items-center justify-between mb-3 sm:mb-4">+ <div class="flex items-center justify-between gap-2"><div>- <h2 class="text-lg sm:text-xl font-bold">+ <h2 class="text-lg font-semibold sm:text-xl">{{ $t('dashboard.albums.modal.selectPhotos') }}</h2>- <p- class="text-xs sm:text-sm text-gray-500 dark:text-gray-400 mt-1"- >- {{- $t('dashboard.albums.modal.totalPhotos', {- count: allPhotos.length,- })- }}- ·- {{- $t('dashboard.albums.modal.selectedPhotos', {- count: selectedPhotoIds.length,- })- }}- </p></div><UButton- variant="ghost"- color="neutral"- size="md"icon="tabler:x"- @click="isPhotoSelectorOpen = false"+ color="neutral"+ variant="ghost"+ @click="closePhotoSelector"/></div>- <div- class="flex flex-col sm:flex-row gap-2 items-stretch sm:items-center"- >- <UInput- v-model="photoSelectorSearchQuery"- icon="tabler:search"- :placeholder="- $t('dashboard.albums.modal.searchPlaceholder')- "- class="flex-1 text-sm"- />- <div- class="hidden sm:flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-neutral-800 rounded-lg whitespace-nowrap"- >- <UCheckbox- :model-value="areAllPhotosSelected"- :indeterminate="areSomePhotosSelected"- @update:model-value="toggleAllPhotos"- />- <span class="text-sm font-medium">{{- $t('dashboard.albums.modal.selectAll')- }}</span>+ <div class="mt-4 space-y-3">+ <div class="flex flex-wrap items-center gap-2">+ <UPopover+ v-model:open="isSelectorFilterOpen"+ :content="{+ side: 'bottom',+ align: 'start',+ sideOffset: 8,+ }"+ :ui="{ content: 'z-230' }"+ >+ <UButton+ icon="tabler:filter"+ :color="hasActiveFilters ? 'info' : 'neutral'"+ :variant="hasActiveFilters ? 'soft' : 'outline'"+ size="sm"+ >+ {{ $t('ui.action.filter.title') }}+ <UBadge+ v-if="totalSelectedFilters > 0"+ size="xs"+ color="info"+ variant="solid"+ class="ml-1"+ >+ {{ totalSelectedFilters }}+ </UBadge>+ </UButton>++ <template #content>+ <UCard variant="glassmorphism">+ <OverlayFilterPanel />+ </UCard>+ </template>+ </UPopover>++ <UButton+ v-if="hasActiveFilters"+ icon="tabler:filter-x"+ color="neutral"+ variant="ghost"+ size="sm"+ @click="clearAllFilters()"+ >+ {{ $t('ui.action.filter.clearAll') }}+ </UButton>++ <UButton+ color="neutral"+ variant="soft"+ size="sm"+ class="justify-center"+ :icon="+ areAllFilteredPhotosSelected+ ? 'tabler:checkbox'+ : areSomeFilteredPhotosSelected+ ? 'tabler:minus'+ : 'tabler:square'+ "+ @click="toggleAllFilteredPhotos"+ >+ {{ $t('dashboard.albums.modal.selectAll') }}+ </UButton>++ <div class="ml-auto flex flex-wrap items-center gap-1.5">+ <UBadge+ color="primary"+ variant="soft"+ >+ {{+ $t('dashboard.albums.modal.selectedPhotos', {+ count: draftSelectedPhotoIds.length,+ })+ }}+ </UBadge>+ <UBadge+ v-if="draftCoverPhotoId"+ color="warning"+ variant="soft"+ icon="tabler:star-filled"+ >+ {{ $t('dashboard.albums.modal.coverSetInfo') }}+ </UBadge>+ </div></div>- <UButton- v-show="!areAllPhotosSelected && allPhotos.length > 0"- class="sm:hidden"- size="sm"- color="neutral"- variant="soft"- @click="toggleAllPhotos"- >- {{ $t('dashboard.albums.modal.selectAll') }}- </UButton>- </div>- <div- v-if="photoSelectorSearchQuery"- class="text-xs text-gray-500 dark:text-gray-400 mt-2"- >- {{- $t('dashboard.albums.modal.searchResults', {- current: filteredPhotos.length,- total: allPhotos.length,- })- }}+ <div class="flex flex-wrap gap-1">+ <UBadge+ v-if="selectedCounts.tags"+ size="xs"+ color="neutral"+ variant="outline"+ >+ {{ $t('ui.action.filter.tabs.tags') }}:+ {{ selectedCounts.tags }}+ </UBadge>+ <UBadge+ v-if="selectedCounts.cameras"+ size="xs"+ color="neutral"+ variant="outline"+ >+ {{ $t('ui.action.filter.tabs.cameras') }}:+ {{ selectedCounts.cameras }}+ </UBadge>+ <UBadge+ v-if="selectedCounts.lenses"+ size="xs"+ color="neutral"+ variant="outline"+ >+ {{ $t('ui.action.filter.tabs.lenses') }}:+ {{ selectedCounts.lenses }}+ </UBadge>+ <UBadge+ v-if="selectedCounts.cities"+ size="xs"+ color="neutral"+ variant="outline"+ >+ {{ $t('ui.action.filter.tabs.cities') }}:+ {{ selectedCounts.cities }}+ </UBadge>+ <UBadge+ v-if="selectedCounts.ratings"+ size="xs"+ color="neutral"+ variant="outline"+ >+ {{ $t('ui.action.filter.tabs.ratings') }}+ </UBadge>+ </div>++ <UCard+ variant="subtle"+ :ui="{+ body: 'p-2 sm:p-2',+ }"+ >+ <div>+ <div+ v-if="selectedPhotosPreview.length > 0"+ class="flex h-full items-center gap-2 overflow-x-auto"+ >+ <button+ v-for="photo in selectedPhotosPreview"+ :key="photo.id"+ class="relative h-12 w-12 shrink-0 overflow-hidden rounded-md border-2 transition"+ :class="+ draftCoverPhotoId === photo.id+ ? 'border-warning-500'+ : 'border-transparent hover:border-gray-300 dark:hover:border-neutral-500'+ "+ @click="setDraftCoverPhoto(photo.id)"+ >+ <ThumbImage+ :src="photo.thumbnailUrl || ''"+ :alt="photo.title || 'Photo'"+ class="h-full w-full object-cover"+ />+ <div+ v-if="draftCoverPhotoId === photo.id"+ class="absolute inset-x-0 bottom-0 flex items-center justify-center bg-warning-500/90 py-0.5"+ >+ <Icon+ name="tabler:star-filled"+ size="12"+ class="text-white"+ />+ </div>+ </button>++ <UBadge+ v-if="selectedPhotosOverflowCount > 0"+ variant="soft"+ color="neutral"+ class="shrink-0"+ >+ +{{ selectedPhotosOverflowCount }}+ </UBadge>+ </div>+ <div+ v-else+ class="flex h-full items-center"+ >+ <div+ class="flex h-12 w-full items-center gap-2 rounded-md border border-dashed border-gray-300 bg-gray-50/80 px-3 text-xs text-gray-600 dark:border-neutral-700 dark:bg-neutral-800/60 dark:text-gray-300"+ >+ <Icon+ name="tabler:photo-plus"+ size="14"+ class="shrink-0 text-gray-500 dark:text-gray-400"+ />+ <span class="truncate">+ {{ $t('dashboard.albums.form.selectPhotos') }}+ </span>+ </div>+ </div>+ </div>+ </UCard></div></div>- <div class="flex-1 overflow-y-auto p-2 sm:p-3 md:p-6">+ <div class="flex-1 overflow-y-auto p-3 sm:p-5"><div- v-if="filteredPhotos.length > 0"- class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 sm:gap-3"+ v-if="selectorFilteredPhotos.length > 0"+ class="grid grid-cols-3 gap-1.5 sm:grid-cols-4 sm:gap-2 lg:grid-cols-5 xl:grid-cols-6">- <div- v-for="photo in filteredPhotos"+ <button+ v-for="photo in selectorFilteredPhotos":key="photo.id"- class="relative group cursor-pointer"- @click="togglePhotoSelection(photo.id)"+ class="group text-left rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400/60"+ @click="toggleDraftPhotoSelection(photo.id)"><div- class="relative aspect-square rounded-lg overflow-hidden bg-gray-200 dark:bg-neutral-700 border-2 sm:border-3 transition-all"+ class="relative aspect-square overflow-hidden rounded-lg border bg-gray-200/90 transition-all duration-200 dark:bg-neutral-700/80":class="{- 'border-primary-500 shadow-lg ring-2 ring-primary-300 dark:ring-primary-700':- selectedPhotoIds.includes(photo.id),- 'border-gray-300 dark:border-neutral-600 hover:border-gray-400 dark:hover:border-neutral-500':- !selectedPhotoIds.includes(photo.id),+ 'border-primary-400 ring-1 ring-primary-300/60 dark:ring-primary-700/50':+ draftSelectedPhotoIds.includes(photo.id),+ 'border-gray-200/70 hover:border-gray-300/90 dark:border-neutral-700 dark:hover:border-neutral-500':+ !draftSelectedPhotoIds.includes(photo.id),}"><ThumbImage:src="photo.thumbnailUrl || ''":alt="photo.title || 'Photo'"- class="w-full h-full object-cover"+ class="h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]"+ />++ <div+ class="absolute inset-x-0 bottom-0 h-10 bg-linear-to-t from-black/55 via-black/10 to-transparent"/><div- v-if="selectedPhotoIds.includes(photo.id)"- class="absolute top-1 left-1 sm:top-2 sm:left-2 flex items-center justify-center w-5 h-5 sm:w-6 sm:h-6 rounded-full bg-primary-500 border-2 border-white shadow-md"+ class="absolute inset-x-2 bottom-1.5 flex items-end justify-between gap-2">+ <div class="min-w-0">+ <p+ class="truncate text-[10px] font-medium text-white/92"+ >+ {{ photo.title || photo.storageKey || 'Untitled' }}+ </p>+ <p class="truncate text-[9px] text-white/72">+ {{+ photo.city+ ? `${photo.city} · ${dayjs(photo.createdAt).format('MM-DD')}`+ : dayjs(photo.createdAt).format('YYYY-MM-DD')+ }}+ </p>+ </div>+ </div>++ <div+ v-if="draftSelectedPhotoIds.includes(photo.id)"+ class="absolute left-1.5 top-1.5 flex h-5 min-w-5 items-center justify-center rounded-full border border-white/85 bg-primary-500 px-1 text-white shadow-sm"+ >+ <span+ v-if="getDraftPhotoOrder(photo.id)"+ class="text-[10px] font-semibold"+ >+ {{ getDraftPhotoOrder(photo.id) }}+ </span><Icon- name="tabler:check"- size="12"- class="text-white sm:hidden"- />- <Icon+ v-elsename="tabler:check"size="14"- class="text-white hidden sm:block"/></div>- <UBadge- v-if="coverPhotoId === photo.id"- class="absolute top-1 right-1 sm:top-2 sm:right-2"+ <UButton+ v-if="draftCoverPhotoId !== photo.id"+ size="xs"+ color="warning"variant="solid"+ icon="tabler:star"+ class="absolute right-1.5 top-1.5 opacity-100 transition sm:opacity-0 sm:group-hover:opacity-100"+ @click.stop="setDraftCoverPhoto(photo.id)"+ />++ <UBadge+ v-elsecolor="warning"- size="sm"+ variant="solid"+ icon="tabler:star-filled"+ class="absolute right-1.5 top-1.5">- <Icon- name="tabler:star-filled"- class="inline mr-0.5"- size="14"- />{{ $t('dashboard.albums.modal.setCover') }}</UBadge>- <UButton- v-if="coverPhotoId !== photo.id"- class="absolute bottom-1 right-1 sm:bottom-2 sm:right-2 opacity-0 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity"- variant="solid"- color="warning"- size="xs"- @click.stop="setCoverPhoto(photo.id)"- >- <Icon- name="tabler:star"- class="inline"- size="12"- />- <span class="hidden sm:inline ml-1">{{- $t('dashboard.albums.modal.setCover')- }}</span>- </UButton>-- <button- v-if="coverPhotoId !== photo.id"- class="sm:hidden absolute bottom-0 right-0 left-0 bg-linear-to-t from-black/80 to-transparent p-1 text-white flex items-center justify-center text-xs gap-1 rounded-b-lg"- @click.stop="setCoverPhoto(photo.id)"- >- <Icon- name="tabler:star"- size="14"- />- <span>{{ $t('dashboard.albums.modal.setCover') }}</span>- </button></div>- </div>+ </button></div><divv-else- class="flex flex-col items-center justify-center h-64 text-gray-500"+ class="flex h-64 flex-col items-center justify-center text-gray-500"><Iconname="tabler:image-off"@@ -856,14 +1089,14 @@ const columns: any[] = [/><p class="font-medium">{{- photoSelectorSearchQuery+ hasActiveFilters? $t('dashboard.albums.modal.noResults'): $t('dashboard.albums.modal.noPhotos')}}</p><p- v-if="photoSelectorSearchQuery"- class="text-sm mt-1"+ v-if="hasActiveFilters"+ class="mt-1 text-sm">{{ $t('dashboard.albums.modal.tryOtherKeywords') }}</p>@@ -871,64 +1104,31 @@ const columns: any[] = [</div><div- class="shrink-0 border-t border-gray-200 dark:border-neutral-700 bg-gray-50 dark:bg-neutral-900/50 p-3 sm:p-4 md:p-6"+ class="shrink-0 border-t border-gray-200 bg-white p-3 dark:border-neutral-700 dark:bg-neutral-900 sm:p-4"><div- class="flex flex-col sm:flex-row gap-3 sm:gap-4 items-center justify-between"+ class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end">- <div- class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-4 text-xs sm:text-sm w-full sm:w-auto"+ <UButton+ variant="outline"+ color="neutral"+ class="w-full sm:w-auto"+ @click="closePhotoSelector">- <div>- <span class="font-medium">{{- $t('dashboard.albums.modal.selectedInfo')- }}</span>- <span- class="text-primary-600 dark:text-primary-400 font-bold"- >- {{ selectedPhotoIds.length }}- </span>- <span class="text-gray-600 dark:text-gray-400"- >/ {{ allPhotos.length }}</span- >- </div>- <div- v-if="coverPhotoId"- class="text-amber-600 dark:text-amber-400 flex items-center gap-1"- >- <Icon- name="tabler:star-filled"- size="16"- />- {{ $t('dashboard.albums.modal.coverSetInfo') }}- </div>- </div>-- <div class="flex gap-2 w-full sm:w-auto">- <UButton- variant="outline"- color="neutral"- class="flex-1 sm:flex-none"- size="sm"- @click="isPhotoSelectorOpen = false"- >- {{ $t('dashboard.albums.slideover.cancel') }}- </UButton>- <UButton- icon="tabler:check"- color="primary"- class="flex-1 sm:flex-none"- size="sm"- :disabled="selectedPhotoIds.length === 0"- @click="isPhotoSelectorOpen = false"- >- {{- $t('dashboard.albums.modal.confirm', {- count: selectedPhotoIds.length,- })- }}- </UButton>- </div>+ {{ $t('dashboard.albums.slideover.cancel') }}+ </UButton>+ <UButton+ icon="tabler:check"+ color="primary"+ class="w-full sm:w-auto"+ @click="confirmPhotoSelection"+ >+ {{+ $t('dashboard.albums.modal.confirm', {+ count: draftSelectedPhotoIds.length,+ })+ }}+ </UButton></div></div></div>diff --git a/app/pages/dashboard/photos.vue b/app/pages/dashboard/photos.vueindex 11f53d46..9d13f7e5 100644--- a/app/pages/dashboard/photos.vue+++ b/app/pages/dashboard/photos.vue@@ -330,8 +330,7 @@ const uploadImage = async (}if (signedUrlResponse.warningInfo) {- uploadingFile.error =- undefined+ uploadingFile.error = undefineduploadingFile.warning =signedUrlResponse.warningInfo.warning ||signedUrlResponse.warningInfo.message@@ -451,8 +450,7 @@ const uploadImage = async (if (isDuplicateConflict) {uploadingFile.status = 'blocked'uploadingFile.error =- error.data.message ||- $t('upload.duplicate.block.message', { fileName })+ error.data.message || $t('upload.duplicate.block.message', { fileName })toast.add({title: error.data?.title || $t('upload.duplicate.block.title'),@@ -1793,7 +1791,7 @@ const handleBatchReprocess = async () => {try {const reprocessToast = toast.add({- title: $t('dashboard.photos.messages.batchSelectRequired'),+ title: $t('dashboard.photos.messages.batchReprocessing'),description: '',color: 'info',})@@ -1815,7 +1813,7 @@ const handleBatchReprocess = async () => {if (result.success) {toast.update(reprocessToast.id, {title: $t('dashboard.photos.messages.reprocessSuccess'),- description: $t('dashboard.queue.title', {+ description: $t('dashboard.photos.messages.batchReprocessSuccess', {count: photosWithStorageKey.length,}),color: 'success',@@ -2060,11 +2058,34 @@ onUnmounted(() => {<template><UDashboardPanel><template #header>- <UDashboardNavbar :title="$t('dashboard.photos.toolbar.title')" />+ <UDashboardNavbar :title="$t('dashboard.photos.toolbar.title')">+ <template #right>+ <div class="flex gap-2 items-center">+ <UButton+ variant="soft"+ color="neutral"+ icon="tabler:list-check"+ @click="$router.push('/dashboard/queue')"+ >+ <span class="hidden sm:inline">{{+ $t('dashboard.photos.buttons.queue')+ }}</span>+ </UButton>+ <UButton+ icon="tabler:cloud-upload"+ @click="openUploadSlideover"+ >+ <span class="hidden sm:inline">{{+ $t('dashboard.photos.buttons.upload')+ }}</span>+ </UButton>+ </div>+ </template>+ </UDashboardNavbar></template><template #body>- <div class="flex flex-col gap-3">+ <div class="flex flex-col gap-4 h-full flex-1 min-h-0"><!-- 上传队列容器 --><UploadQueuePanel:uploading-files="uploadingFiles"@@ -2072,119 +2093,9 @@ onUnmounted(() => {@clear-completed="clearCompletedUploads"@clear-all="clearAllUploads"@go-to-queue="$router.push('/dashboard/queue')"+ class="shrink-0"/>- <!-- 文件上传入口 -->- <div- class="relative overflow-hidden rounded-3xl border border-neutral-200/80 bg-linear-to-br from-white via-white to-neutral-50 shadow-sm transition dark:border-neutral-800/70 dark:from-neutral-900 dark:via-neutral-900/80 dark:to-neutral-900"- >- <div- class="pointer-events-none absolute -left-32 -top-24 h-72 w-[18rem] rounded-full bg-primary-400/20 blur-3xl dark:bg-primary-500/20"- />- <div class="relative flex flex-col gap-6 p-5 sm:p-8">- <div- class="flex flex-col gap-5 sm:flex-row sm:items-center sm:justify-between"- >- <div class="space-y-4">- <div class="flex items-center gap-3">- <span- class="flex size-12 items-center justify-center rounded-2xl bg-primary-500/10 text-primary-600 dark:bg-primary-500/15 dark:text-primary-300"- >- <Icon- name="tabler:cloud-upload"- class="size-6"- />- </span>- <div>- <h2- class="text-lg font-semibold text-neutral-800 dark:text-neutral-100"- >- {{ $t('dashboard.photos.title') }}- </h2>- <i18n-t- keypath="dashboard.photos.subtitle"- tag="p"- class="mt-1 text-sm text-neutral-500 dark:text-neutral-400"- >- <template #default>- <NuxtLink- to="/dashboard/albums"- class="text-primary font-medium"- >- {{ $t('title.albums') }}- </NuxtLink>- </template>- </i18n-t>- </div>- </div>- <div- class="flex flex-wrap items-center gap-1 text-xs font-medium text-neutral-500 dark:text-neutral-400"- >- <UBadge- variant="soft"- color="primary"- size="sm"- >- JPEG / PNG- </UBadge>- <UBadge- variant="soft"- color="primary"- size="sm"- >- HEIC- </UBadge>- <UBadge- variant="soft"- color="primary"- size="sm"- >- {{ $t('ui.livePhoto') }}- </UBadge>- <UBadge- variant="soft"- color="primary"- size="sm"- >- Motion Photo- </UBadge>- <UBadge- variant="outline"- color="neutral"- size="sm"- >- {{- $t('dashboard.photos.maxFileSize', {- size: maxFileSizeMB,- })- }}- </UBadge>- </div>- </div>-- <div class="flex gap-2 items-center">- <UButton- variant="soft"- size="lg"- class="w-full sm:w-auto"- icon="tabler:list-check"- @click="$router.push('/dashboard/queue')"- >- {{ $t('dashboard.photos.buttons.queue') }}- </UButton>- <UButton- size="lg"- class="w-full sm:w-auto"- icon="tabler:cloud-upload"- @click="openUploadSlideover"- >- {{ $t('dashboard.photos.buttons.upload') }}- </UButton>- </div>- </div>- </div>- </div>-<USlideoverv-model:open="isUploadSlideoverOpen":title="$t('dashboard.photos.slideover.title')"@@ -2261,7 +2172,6 @@ onUnmounted(() => {<USwitch v-model="uploadEraseLocationEnabled" /></div></UCard>-</div></template>@@ -2309,21 +2219,29 @@ onUnmounted(() => {</template></USlideover>- <!-- 工具栏 -->+ <!-- 统合容器:工具栏 + 照片列表 --><div- class="flex flex-row sm:items-center justify-between gap-3 sm:gap-0 p-3 sm:p-4 bg-neutral-50 dark:bg-neutral-900/50 border border-neutral-200 dark:border-neutral-700 rounded-lg"+ class="relative flex-1 min-h-0 flex flex-col bg-white dark:bg-neutral-900 border border-neutral-200/80 dark:border-neutral-800/80 rounded-2xl shadow-sm overflow-hidden">- <div class="flex items-center gap-2">- <UIcon- name="tabler:photo"- class="text-neutral-500"- />- <span- class="font-medium text-neutral-700 dark:text-neutral-300 hidden sm:inline"- >- {{ $t('dashboard.photos.toolbar.title') }}- </span>- <div class="flex items-center gap-1 sm:gap-2">+ <!-- 工具栏 -->+ <div+ class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-3 sm:px-4 sm:py-3 bg-neutral-50/50 dark:bg-neutral-900/50 backdrop-blur-sm border-b border-neutral-200/80 dark:border-neutral-800/80 z-20"+ >+ <div class="flex items-center gap-3">+ <div+ class="flex size-8 items-center justify-center rounded-[10px] bg-neutral-200/50 dark:bg-neutral-800/50 border border-neutral-200/50 dark:border-neutral-700/50"+ >+ <UIcon+ name="tabler:photo"+ class="size-4.5 text-neutral-600 dark:text-neutral-400"+ />+ </div>+ <span+ class="font-semibold text-sm text-neutral-700 dark:text-neutral-300 hidden sm:inline"+ >+ {{ $t('dashboard.photos.toolbar.title') }}+ </span>+ <div class="flex items-center gap-1 sm:gap-2 sm:ml-1"><UBadgev-if="livePhotoStats.staticPhotos > 0"variant="soft"@@ -2472,9 +2390,7 @@ onUnmounted(() => {</div><!-- 照片列表 -->- <div- class="border border-neutral-300 dark:border-neutral-800 rounded overflow-hidden"- >+ <div class="relative flex-1 min-h-0 flex flex-col"><UTableref="table"v-model:row-selection="rowSelection"@@ -2486,9 +2402,31 @@ onUnmounted(() => {:columns="columns":loading="status === 'pending'"sticky- class="h-[calc(100vh-27rem)] sm:h-[calc(100vh-24.5rem)]"+ class="h-full flex-1":ui="{- separator: 'bg-neutral-200 dark:bg-neutral-700',+ wrapper: 'relative scroll-smooth h-full overflow-auto',+ base: 'min-w-full table-fixed',+ divide:+ 'divide-y divide-neutral-200/80 dark:divide-neutral-800/80',+ thead:+ 'bg-neutral-50/80 dark:bg-neutral-900/80 backdrop-blur-md sticky top-0 z-10 whitespace-nowrap',+ tbody:+ 'divide-y divide-neutral-200/80 dark:divide-neutral-800/80 bg-white dark:bg-neutral-900',+ tr: {+ base: 'hover:bg-neutral-50/50 dark:hover:bg-neutral-800/50 transition-colors',+ selected: 'bg-primary-50/50 dark:bg-primary-900/20',+ },+ th: {+ base: 'text-left rtl:text-right ',+ padding: 'px-4 py-3.5',+ color: 'text-neutral-500 dark:text-neutral-400',+ font: 'font-medium text-sm',+ },+ td: {+ padding: 'px-4 py-3',+ color: 'text-neutral-700 dark:text-neutral-300 text-sm',+ },+ separator: 'bg-neutral-200/80 dark:bg-neutral-800/80',}"><template #actions-cell="{ row }">@@ -2511,102 +2449,118 @@ onUnmounted(() => {</template></UTable>- <!-- 选择状态信息和批量操作 -->- <div- class="px-4 py-4 border-t border-neutral-200 dark:border-neutral-700"+ <!-- 悬浮版批量操作菜单 -->+ <transition+ enter-active-class="transition-all duration-300 ease-out"+ enter-from-class="translate-y-8 opacity-0 scale-95"+ enter-to-class="translate-y-0 opacity-100 scale-100"+ leave-active-class="transition-all duration-200 ease-in"+ leave-from-class="translate-y-0 opacity-100 scale-100"+ leave-to-class="translate-y-8 opacity-0 scale-95"><div- class="text-sm text-neutral-600 dark:text-neutral-400 flex items-center gap-2"+ v-if="selectedRowsCount > 0"+ class="fixed bottom-8 left-1/2 -translate-x-1/2 px-2 py-1.5 bg-white/90 dark:bg-neutral-900/90 backdrop-blur-xl shadow-xl rounded-full border border-neutral-200/80 dark:border-neutral-800/80 z-[60] flex items-center gap-3 sm:gap-6 shadow-black/5 dark:shadow-black/20">- <div class="leading-6">- {{- $t('dashboard.photos.selection.selected', {- count: selectedRowsCount,- total: totalRowsCount,- })- }}- </div><div- v-if="selectedRowsCount > 0"- class="flex items-center gap-1 sm:gap-2"+ class="pl-4 pr-1 border-r border-neutral-200 dark:border-neutral-800 min-w-max">+ <p+ class="text-sm font-medium tracking-wide text-neutral-700 dark:text-neutral-200"+ >+ {{+ $t('dashboard.photos.selection.selected', {+ count: selectedRowsCount,+ total: totalRowsCount,+ })+ }}+ </p>+ </div>++ <div class="flex items-center gap-1 sm:gap-1.5 pr-2"><UButton- variant="soft"- color="info"- size="xs"+ color="neutral"+ variant="ghost"+ size="sm"+ class="rounded-full text-neutral-600 hover:text-neutral-900 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-white dark:hover:bg-neutral-800"icon="tabler:refresh"- class="flex-1 sm:flex-none"@click="handleBatchReprocess">- <span>{{+ <span class="hidden sm:inline">{{$t('dashboard.photos.selection.batchReprocess')}}</span></UButton><UButton- variant="soft"- color="primary"- size="xs"+ color="neutral"+ variant="ghost"+ size="sm"+ class="rounded-full text-neutral-600 hover:text-neutral-900 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-white dark:hover:bg-neutral-800"icon="tabler:map-off"- class="flex-1 sm:flex-none"@click="handleBatchEraseLocation">- <span>{{+ <span class="hidden sm:inline">{{$t('dashboard.photos.selection.batchEraseLocation')}}</span></UButton><UButton- variant="soft"- color="primary"- size="xs"+ color="neutral"+ variant="ghost"+ size="sm"+ class="rounded-full text-neutral-600 hover:text-neutral-900 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-white dark:hover:bg-neutral-800"icon="tabler:download"- class="flex-1 sm:flex-none"@click="handleBatchDownload">- <span>{{+ <span class="hidden sm:inline">{{$t('dashboard.photos.selection.batchDownload')}}</span></UButton><UButtoncolor="error"- variant="soft"- size="xs"+ variant="ghost"+ size="sm"+ class="rounded-full hover:bg-error-50 dark:hover:bg-error-500/20"icon="tabler:trash"- class="flex-1 sm:flex-none"@click="handleBatchDelete">- <span>{{+ <span class="hidden sm:inline">{{$t('dashboard.photos.selection.batchDelete')}}</span></UButton></div></div>- </div>+ </transition></div>+ </div>- <UModal v-model:open="isEditModalOpen">- <template #content>- <div class="p-6 space-y-6">- <div class="space-y-1">- <h2- class="text-lg font-semibold text-neutral-800 dark:text-neutral-100"- >- {{ $t('dashboard.photos.editModal.title') }}- </h2>- <p class="text-sm text-neutral-500 dark:text-neutral-400">- {{ $t('dashboard.photos.editModal.description') }}- </p>- <p- v-if="editingPhoto"- class="text-xs text-neutral-500 dark:text-neutral-500"- >+ <USlideover+ v-model:open="isEditModalOpen"+ :title="$t('dashboard.photos.editModal.title')"+ :description="$t('dashboard.photos.editModal.description')"+ :ui="{+ content: 'sm:max-w-xl',+ body: 'p-2',+ header:+ 'px-6 py-5 border-b border-neutral-200 dark:border-neutral-800',+ footer:+ 'px-6 py-5 border-t border-neutral-200 dark:border-neutral-800',+ }"+ >+ <template #body>+ <div class="space-y-6">+ <div+ v-if="editingPhoto"+ class="space-y-1"+ >+ <p class="text-xs text-neutral-500 dark:text-neutral-500">{{ editingPhoto.title || editingPhoto.id }}</p></div><UForm+ id="edit-photo-form":state="editFormState"class="space-y-5"@submit="handleEditSubmit"@@ -2731,48 +2685,57 @@ onUnmounted(() => {</span></div></div>-- <div- class="flex items-center justify-end gap-2 pt-4 border-t border-neutral-200 dark:border-neutral-800"- >- <UButton- variant="ghost"- color="neutral"- @click.prevent="isEditModalOpen = false"- >- {{ $t('dashboard.photos.editModal.actions.cancel') }}- </UButton>- <UButton- type="submit"- :loading="isSavingMetadata"- :disabled="!isMetadataDirty || isSavingMetadata"- icon="tabler:device-floppy"- >- {{ $t('dashboard.photos.editModal.actions.save') }}- </UButton>- </div></UForm></div></template>- </UModal>++ <template #footer>+ <div class="flex items-center justify-end gap-2 w-full">+ <UButton+ variant="ghost"+ color="neutral"+ @click.prevent="isEditModalOpen = false"+ >+ {{ $t('dashboard.photos.editModal.actions.cancel') }}+ </UButton>+ <UButton+ type="submit"+ form="edit-photo-form"+ :loading="isSavingMetadata"+ :disabled="!isMetadataDirty || isSavingMetadata"+ icon="tabler:device-floppy"+ >+ {{ $t('dashboard.photos.editModal.actions.save') }}+ </UButton>+ </div>+ </template>+ </USlideover><UModal v-model:open="isDeleteConfirmOpen">- <template #content>- <div class="p-6 space-y-4">- <div class="flex items-start gap-3">- <Icon- name="tabler:trash"- class="mt-1 size-6 shrink-0 text-error-500"- />- <div class="space-y-2">- <h3 class="text-lg font-semibold">+ <template #body>+ <div class="space-y-4">+ <div class="flex items-start gap-4">+ <div+ class="flex size-10 items-center justify-center rounded-full bg-error-100 dark:bg-error-900/40 text-error-600 dark:text-error-400 shrink-0"+ >+ <Icon+ name="tabler:trash"+ class="size-6"+ />+ </div>+ <div class="space-y-1.5 pt-1">+ <h3+ class="text-lg font-semibold text-neutral-900 dark:text-white leading-5"+ >{{deleteMode === 'single'? $t('dashboard.photos.delete.single.title'): $t('dashboard.photos.delete.batch.title')}}</h3>- <p class="text-sm text-neutral-600 dark:text-neutral-400">+ <p+ class="text-sm text-neutral-500 dark:text-neutral-400 leading-relaxed"+ >{{deleteMode === 'single'? $t('dashboard.photos.delete.single.message')@@ -2781,29 +2744,41 @@ onUnmounted(() => {})}}</p>- <p class="text-sm text-error-500 dark:text-error-400">- {{ $t('dashboard.photos.delete.warning') }}- </p>+ <div+ class="mt-4 p-3 bg-error-50 dark:bg-error-500/10 border border-error-200/50 dark:border-error-500/20 rounded-lg"+ >+ <p+ class="text-sm font-medium text-error-600 dark:text-error-400 flex items-center gap-2"+ >+ <Icon+ name="tabler:alert-triangle-filled"+ class="size-4"+ />+ {{ $t('dashboard.photos.delete.warning') }}+ </p>+ </div></div></div>- <div class="flex justify-end gap-2">- <UButton- variant="ghost"- color="neutral"- :disabled="isDeleting"- @click="isDeleteConfirmOpen = false"- >- {{ $t('dashboard.photos.delete.buttons.cancel') }}- </UButton>- <UButton- color="error"- icon="tabler:trash"- :loading="isDeleting"- @click="confirmDelete"- >- {{ $t('dashboard.photos.delete.buttons.confirm') }}- </UButton>- </div>+ </div>+ </template>+ <template #footer>+ <div class="flex justify-end gap-3 w-full">+ <UButton+ variant="ghost"+ color="neutral"+ :disabled="isDeleting"+ @click="isDeleteConfirmOpen = false"+ >+ {{ $t('dashboard.photos.delete.buttons.cancel') }}+ </UButton>+ <UButton+ color="error"+ icon="tabler:trash"+ :loading="isDeleting"+ @click="confirmDelete"+ >+ {{ $t('dashboard.photos.delete.buttons.confirm') }}+ </UButton></div></template></UModal>diff --git a/i18n/locales/en.json b/i18n/locales/en.jsonindex a48e7517..b2be6267 100644--- a/i18n/locales/en.json+++ b/i18n/locales/en.json@@ -607,6 +607,8 @@"uploadSuccess": "Photo uploaded successfully, processing...","uploadMultipleSuccess": "{count} photos uploaded successfully, processing...","reprocessSuccess": "Reprocessing task added",+ "batchReprocessSuccess": "Successfully submitted {count} photos to the reprocessing queue",+ "batchReprocessing": "Submitting reprocessing tasks...","reprocessTaskId": "Task ID: {taskId}","deleteSuccess": "Photo deleted successfully","batchDeleteSuccess": "Successfully deleted {count} photos",diff --git a/i18n/locales/ja.json b/i18n/locales/ja.jsonindex f6ec9bc8..c09707e8 100644--- a/i18n/locales/ja.json+++ b/i18n/locales/ja.json@@ -542,6 +542,8 @@"uploadSuccess": "写真が正常にアップロードされました。処理中です...","uploadMultipleSuccess": "{count}枚の写真が正常にアップロードされました。処理中です...","reprocessSuccess": "再処理タスクが追加されました",+ "batchReprocessSuccess": "{count}枚の写真の再処理タスクをキューに正常に送信しました",+ "batchReprocessing": "再処理タスクを送信しています...","reprocessTaskId": "タスク ID:{taskId}","deleteSuccess": "写真が正常に削除されました","batchDeleteSuccess": "{count}枚の写真を正常に削除しました",diff --git a/i18n/locales/zh-Hans.json b/i18n/locales/zh-Hans.jsonindex abd57e8b..6d447bf7 100644--- a/i18n/locales/zh-Hans.json+++ b/i18n/locales/zh-Hans.json@@ -609,6 +609,8 @@"uploadSuccess": "照片已成功上传,正在处理中...","uploadMultipleSuccess": "已成功上传 {count} 张照片,正在处理中...","reprocessSuccess": "已添加重新处理任务",+ "batchReprocessSuccess": "已成功提交 {count} 张照片至重新处理队列",+ "batchReprocessing": "正在提交重新处理任务...","reprocessTaskId": "任务ID: {taskId}","deleteSuccess": "照片删除成功","batchDeleteSuccess": "已成功删除 {count} 张照片",diff --git a/i18n/locales/zh-Hant-HK.json b/i18n/locales/zh-Hant-HK.jsonindex ee6b8e2f..bf2546b2 100644--- a/i18n/locales/zh-Hant-HK.json+++ b/i18n/locales/zh-Hant-HK.json@@ -542,6 +542,8 @@"uploadSuccess": "相片上傳成功,處理中...","uploadMultipleSuccess": "{count} 張相片上傳成功,處理中...","reprocessSuccess": "重新處理任務已新增",+ "batchReprocessSuccess": "已成功提交 {count} 張相片至重新處理佇列",+ "batchReprocessing": "正在提交重新處理任務...","reprocessTaskId": "任務 ID:{taskId}","deleteSuccess": "相片已成功刪除","batchDeleteSuccess": "成功刪除 {count} 張相片",diff --git a/i18n/locales/zh-Hant-TW.json b/i18n/locales/zh-Hant-TW.jsonindex ab24b25f..185b2e7c 100644--- a/i18n/locales/zh-Hant-TW.json+++ b/i18n/locales/zh-Hant-TW.json@@ -542,6 +542,8 @@"uploadSuccess": "照片上傳成功,處理中...","uploadMultipleSuccess": "{count} 張照片上傳成功,處理中...","reprocessSuccess": "重新處理任務已新增",+ "batchReprocessSuccess": "已成功提交 {count} 張照片至重新處理佇列",+ "batchReprocessing": "正在提交重新處理任務...","reprocessTaskId": "任務 ID:{taskId}","deleteSuccess": "照片已成功刪除","batchDeleteSuccess": "成功刪除 {count} 張照片",