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(cloud): align library and shared console presentation

Timothy Yinf1479b870259
diff --git a/apps/cloud/app/assets/cloud.css b/apps/cloud/app/assets/cloud.css
index a03f81ce..85b7d951 100644
--- a/apps/cloud/app/assets/cloud.css
+++ b/apps/cloud/app/assets/cloud.css
@@ -1394,9 +1394,6 @@
border-radius: 10px;
background: var(--card);
}
-.cf-library-table table {
- font-size: 12px;
-}
.cf-library-thumb {
display: flex;
width: 52px;
@@ -1452,16 +1449,16 @@
font-size: 14px;
font-weight: 500;
}
-.cf-selection-bar {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- gap: 8px;
- padding: 10px 12px;
- margin-bottom: 10px;
- border: 1px solid var(--border);
- border-radius: 8px;
- background: var(--secondary);
+.console-selection-toolbar .cf-button {
+ border-radius: 999px;
+ flex-shrink: 0;
+}
+.console-selection-toolbar .cf-bulk-delete {
+ color: var(--destructive);
+}
+.cf-library-date {
+ font-family: ui-monospace, monospace;
+ white-space: nowrap;
font-size: 12px;
}
.cf-processing-panel {
@@ -1665,8 +1662,12 @@
overflow-y: auto;
}
-.cf-photo-preview > .webgl-image-viewer {
- height: min(65svh, 650px);
+.cf-photo-preview {
+ overflow-y: auto;
+ border-radius: 8px;
+}
+.cf-photo-preview > * {
+ width: 100%;
}
.cf-preview-details {
padding: 12px 16px;
@@ -2924,15 +2925,35 @@ a.cf-domain-address:hover {
flex-wrap: wrap;
align-items: center;
justify-content: center;
- gap: 10px;
+ gap: 4px 16px;
+ padding-block: 12px;
color: var(--muted-foreground);
font-size: 12px;
line-height: 1.6;
}
+.cf-legal-links a {
+ display: inline-flex;
+ align-items: center;
+ min-height: 32px;
+ padding: 4px 2px;
+ text-underline-offset: 4px;
+ border-radius: 4px;
+}
.cf-legal-links a:hover {
color: var(--foreground);
text-decoration: underline;
}
+.cf-legal-links a:focus-visible {
+ outline: 2px solid var(--ring);
+ outline-offset: 4px;
+}
+.cf-legal-toolbar .cf-legal-links {
+ justify-content: flex-start;
+ padding-block: 0;
+}
+.cf-auth-main .cf-legal-links {
+ padding-block: 2px;
+}
.cf-legal-page {
width: min(100% - 40px, 800px);
margin-inline: auto;
@@ -2984,3 +3005,28 @@ a.cf-domain-address:hover {
font-size: 12px;
margin-top: 20px;
}
+
+.cf-marketing-footer .cf-legal-links {
+ padding-block: 0;
+ gap: 4px 16px;
+}
+.cf-auth-bottom .cf-text-link {
+ display: inline-block;
+ margin-inline-start: 6px;
+}
+.cf-pricing > .cf-legal-links,
+.cf-redeem-page > .cf-legal-links {
+ margin-top: 8px;
+}
+
+.cf-marketing-footer {
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 12px 24px;
+}
+.cf-auth-main .cf-legal-disclosure {
+ width: 100%;
+ max-width: 370px;
+ margin: 0 auto 12px;
+ gap: 2px;
+}
diff --git a/apps/cloud/app/components/CloudLegalLinks.vue b/apps/cloud/app/components/CloudLegalLinks.vue
index ff787e70..109f4cb6 100644
--- a/apps/cloud/app/components/CloudLegalLinks.vue
+++ b/apps/cloud/app/components/CloudLegalLinks.vue
@@ -4,7 +4,6 @@
:aria-label="$t('cloud.legal.navigation')"
>
<NuxtLink to="/legal/terms">{{ $t('cloud.legal.terms') }}</NuxtLink>
- <span aria-hidden="true">·</span>
<NuxtLink to="/legal/privacy">{{ $t('cloud.legal.privacy') }}</NuxtLink>
</nav>
</template>
diff --git a/apps/cloud/app/components/CloudPhotoLibrary.vue b/apps/cloud/app/components/CloudPhotoLibrary.vue
index 2f897236..b11aed3a 100644
--- a/apps/cloud/app/components/CloudPhotoLibrary.vue
+++ b/apps/cloud/app/components/CloudPhotoLibrary.vue
@@ -1,6 +1,7 @@
<script setup lang="ts">
import {
ArrowUpDown as ButtonIconArrowUpDown,
+ Columns3,
Ellipsis as ButtonIconEllipsis,
Filter as ButtonIconFilter,
FolderPlus as ButtonIconFolderPlus,
@@ -9,7 +10,11 @@ import {
Upload as ButtonIconUpload,
} from 'lucide-vue-next'
import { uploadQuotaGate } from '../utils/quota-gate'
-const { t, locale } = useI18n()
+import { DASHBOARD_PHOTO_COLUMN_IDS } from '#console/composables/useDashboardPhotoColumnVisibility'
+const { t } = useI18n()
+const dayjs = useDayjs()
+const locationLabel = useLocationLabel()
+const entryContext = useEntryContext()
import type { Photo } from '@chronoframe/contracts/resources'
import type { TableColumn } from '@nuxt/ui'
@@ -76,19 +81,59 @@ const rows = computed(() => {
.includes(search.value.toLowerCase())),
)
})
+const columnVisibility = useDashboardPhotoColumnVisibility()
+const reactions = ref<Record<string, number> | null>(null)
+watch(
+ photos,
+ async (_, __, onCleanup) => {
+ let active = true
+ onCleanup(() => {
+ active = false
+ })
+ try {
+ const counts = await api<Record<string, number>>(
+ base.value + '/photos/reactions',
+ )
+ if (active) reactions.value = counts
+ } catch {
+ if (active) reactions.value = null
+ }
+ },
+ { immediate: true },
+)
+function openPreviewOriginal() {
+ const photo = preview.value
+ if (!photo) return
+ const entry = entryContext.value
+ const url =
+ entry?.published && entry.canonicalOrigin
+ ? new URL('/' + encodeURIComponent(photo.id), entry.canonicalOrigin).href
+ : photo.originalUrl
+ if (url) window.open(url, '_blank', 'noopener,noreferrer')
+}
const chosen = computed(() => rows.value.filter((p) => selection.value[p.id]))
-const columns: TableColumn<Photo>[] = [
- { id: 'select', header: '', size: 32 },
- { accessorKey: 'thumbnailUrl', header: t('cloud.messages.photograph') },
- { accessorKey: 'title', header: t('cloud.messages.title') },
- { accessorKey: 'tags', header: t('cloud.messages.tags') },
- { accessorKey: 'dateTaken', header: t('cloud.messages.dateTaken') },
- { accessorKey: 'fileSize', header: t('cloud.messages.size') },
+const columns = computed<TableColumn<Photo>[]>(() => [
+ { id: 'select', header: '', size: 32, enableHiding: false },
+ ...DASHBOARD_PHOTO_COLUMN_IDS.filter((key) => key !== 'actions').map(
+ (key) => ({
+ id: key,
+ enableHiding: !['thumbnailUrl', 'id'].includes(key),
+ accessorFn: (photo: Photo) =>
+ key === 'colorSpace'
+ ? photo.exif?.ColorSpace
+ : photo[key as keyof Photo],
+ header: t(
+ 'dashboard.photos.table.columns.' +
+ (key === 'thumbnailUrl' ? 'thumbnail.title' : key),
+ ),
+ }),
+ ),
{
id: 'actions',
+ enableHiding: false,
header: () => h('span', { class: 'sr-only' }, t('cloud.dashboard.actions')),
},
-]
+])
const pendingJobs = computed(() =>
jobs.value.filter((j) => j.state !== 'succeeded'),
)
@@ -233,21 +278,48 @@ watch(
:loading="loading"
@click="refreshMedia"
/>
+ <UDropdownMenu
+ :items="
+ columns
+ .filter(
+ (c) =>
+ c.id &&
+ !['select', 'thumbnailUrl', 'id', 'actions'].includes(c.id),
+ )
+ .map((c) => ({
+ label: String(c.header),
+ type: 'checkbox' as const,
+ checked: columnVisibility[c.id as keyof typeof columnVisibility],
+ onUpdateChecked: (checked: boolean) => {
+ columnVisibility[c.id as keyof typeof columnVisibility] =
+ checked
+ },
+ onSelect: (event: Event) => event.preventDefault(),
+ }))
+ "
+ >
+ <CfButton
+ variant="secondary"
+ :icon="Columns3"
+ >{{ $t('dashboard.photos.table.columnVisibility.button') }}</CfButton
+ >
+ </UDropdownMenu>
</div>
- <div
- v-if="chosen.length"
- class="cf-selection-bar"
+ <ConsoleSelectionToolbar
+ :count="chosen.length"
+ :total="rows.length"
+ teleport
>
- <span>{{ $t('cloud.ui.selectedCount', { count: chosen.length }) }}</span
- ><CfButton
+ <CfButton
v-if="admin"
size="sm"
- variant="soft"
+ variant="ghost"
:icon="ButtonIconFolderPlus"
@click="albumOpen = true"
>{{ $t('cloud.messages.addToAlbum') }}</CfButton
><CfButton
- variant="destructive"
+ variant="ghost"
+ class="cf-bulk-delete"
v-if="admin"
size="sm"
:icon="ButtonIconTrash2"
@@ -259,22 +331,28 @@ watch(
@click="selection = {}"
>{{ $t('cloud.messages.clear') }}</CfButton
>
- </div>
+ </ConsoleSelectionToolbar>
<div class="cf-library-table">
- <ConsoleMediaTable
+ <CfTable
+ v-model:column-visibility="columnVisibility"
:data="rows"
:columns="columns"
:loading="loading && !photos.length"
:get-row-id="(row: Photo) => row.id"
><template #select-header
><UCheckbox
- :model-value="rows.length > 0 && rows.every((p) => selection[p.id])"
+ :model-value="
+ chosen.length && chosen.length < rows.length
+ ? 'indeterminate'
+ : rows.length > 0 && chosen.length === rows.length
+ "
:aria-label="$t('cloud.messages.selectAllPhotographs')"
@update:model-value="
(v) => {
- selection = v
- ? Object.fromEntries(rows.map((p) => [p.id, true]))
- : {}
+ selection =
+ v === true
+ ? Object.fromEntries(rows.map((p) => [p.id, true]))
+ : {}
}
" /></template
><template #select-cell="{ row }"
@@ -295,7 +373,8 @@ watch(
@click="preview = row.original"
>
<ThumbImage
- :src="row.original.thumbnailUrl || ''"
+ :src="row.original.thumbnailUrl || row.original.originalUrl || ''"
+ :thumbhash="row.original.thumbnailHash || ''"
:alt="row.original.title"
/><span
v-if="row.original.isLivePhoto"
@@ -327,19 +406,55 @@ watch(
>—</span
>
</div></template
- ><template #dateTaken-cell="{ row }"
- ><span class="text-xs text-muted">{{
+ ><template #rating-cell="{ row }">
+ <Rating
+ v-if="row.original.exif?.Rating != null"
+ :model-value="row.original.exif.Rating"
+ readonly
+ size="xs"
+ />
+ <span v-else>—</span> </template
+ ><template #isLivePhoto-cell="{ row }">
+ <span>{{
+ row.original.isLivePhoto
+ ? $t('ui.livePhoto')
+ : $t('dashboard.photos.table.cells.staticPhoto')
+ }}</span> </template
+ ><template #location-cell="{ row }">
+ <span>{{
+ row.original.exif?.GPSLongitude != null &&
+ row.original.exif?.GPSLatitude != null
+ ? locationLabel(row.original) ||
+ $t('dashboard.photos.table.cells.unknown')
+ : $t('dashboard.photos.table.cells.noGps')
+ }}</span> </template
+ ><template #dateTaken-cell="{ row }">
+ <span class="cf-library-date">{{
row.original.dateTaken
- ? new Date(row.original.dateTaken).toLocaleDateString(
- locale === 'zh-Hans' ? 'zh-CN' : 'en-US',
- )
+ ? dayjs(row.original.dateTaken).format('YYYY-MM-DD HH:mm:ss')
: '—'
+ }}</span> </template
+ ><template #lastModified-cell="{ row }">
+ <span class="cf-library-date">{{
+ row.original.lastModified
+ ? dayjs(row.original.lastModified).format('YYYY-MM-DD HH:mm:ss')
+ : '—'
+ }}</span> </template
+ ><template #colorSpace-cell="{ row }">
+ <span>{{ row.original.exif?.ColorSpace ?? '—' }}</span> </template
+ ><template #reactions-cell="{ row }"
+ ><span>{{
+ reactions ? reactions[row.original.id] || 0 : '—'
}}</span></template
- ><template #fileSize-cell="{ row }"
- ><span class="text-xs text-muted">{{
- row.original.fileSize ? formatBytes(row.original.fileSize) : '—'
- }}</span></template
- ><template #actions-cell="{ row }"
+ >
+ <template #fileSize-cell="{ row }">
+ <span>{{
+ row.original.fileSize != null
+ ? formatBytes(row.original.fileSize)
+ : '—'
+ }}</span>
+ </template>
+ <template #actions-cell="{ row }"
><UDropdownMenu :items="actions(row.original)"
><CfButton
variant="ghost"
@@ -377,7 +492,7 @@ watch(
>{{ $t('cloud.messages.upload') }}</CfButton
>
</div></template
- ></ConsoleMediaTable
+ ></CfTable
>
</div>
<section
@@ -497,7 +612,7 @@ watch(
:open="!!preview"
:title="preview?.title || $t('cloud.messages.photograph')"
:description="$t('cloud.messages.previewPhotograph')"
- :ui="{ content: 'max-w-5xl', body: 'p-0' }"
+ :ui="{ content: 'max-w-2xl' }"
@update:open="
(v) => {
if (!v) preview = null
@@ -508,17 +623,13 @@ watch(
v-if="preview"
class="cf-photo-preview"
>
- <WebGLImageViewer
- :src="preview.originalUrl || preview.thumbnailUrl || ''"
- :alt="preview.title"
- />
- <div class="cf-preview-details">
- <strong>{{ preview.title }}</strong>
- <p>{{ preview.description }}</p>
- </div>
- </div></template
- ></UModal
- >
+ <MasonryItemPhoto
+ :key="preview.id"
+ :photo="preview"
+ :index="0"
+ @open-viewer="openPreviewOriginal"
+ /></div></template
+ ></UModal>
<UModal
v-model:open="deleteOpen"
:title="$t('cloud.messages.deletePhotographs')"
diff --git a/apps/cloud/server/api/sites/[siteId]/media/[...operation].ts b/apps/cloud/server/api/sites/[siteId]/media/[...operation].ts
index be86dd79..bbf775e8 100644
--- a/apps/cloud/server/api/sites/[siteId]/media/[...operation].ts
+++ b/apps/cloud/server/api/sites/[siteId]/media/[...operation].ts
@@ -481,6 +481,18 @@ export default definePlatformHandler(async (event) => {
return { jobId: id }
}
}
+ if (
+ kind === 'photos' &&
+ id === 'reactions' &&
+ !action &&
+ event.method === 'GET'
+ ) {
+ const counts = await sql<{ photo_id: string; total: number }>(
+ 'SELECT r.photo_id, COUNT(*) AS total FROM platform_photo_reactions r JOIN cloud_photos p ON p.site_id=r.site_id AND p.id=r.photo_id WHERE r.site_id=? AND p.deleted=0 GROUP BY r.photo_id',
+ siteId,
+ )
+ return Object.fromEntries(counts.map((row) => [row.photo_id, row.total]))
+ }
if (kind === 'photos' && !id && event.method === 'GET')
return {
photos: await ctx.resources.listPhotos(),
diff --git a/packages/console/app/components/ConsoleSelectionToolbar.vue b/packages/console/app/components/ConsoleSelectionToolbar.vue
new file mode 100644
index 00000000..0250dd02
--- /dev/null
+++ b/packages/console/app/components/ConsoleSelectionToolbar.vue
@@ -0,0 +1,57 @@
+<script setup lang="ts">
+defineProps<{
+ count: number
+ total: number
+ rangeTip?: boolean
+ teleport?: boolean
+}>()
+</script>
+<template>
+ <Teleport
+ to="body"
+ :disabled="!teleport"
+ >
+ <Transition
+ enter-active-class="transition-all duration-300 ease-out motion-reduce:transition-none"
+ 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 motion-reduce:transition-none"
+ leave-from-class="translate-y-0 opacity-100 scale-100"
+ leave-to-class="translate-y-8 opacity-0 scale-95"
+ >
+ <div
+ v-if="count > 0"
+ class="console-selection-toolbar fixed bottom-8 left-1/2 -translate-x-1/2 z-60 w-max flex flex-col items-center gap-2"
+ role="toolbar"
+ :aria-label="
+ $t('dashboard.photos.selection.selected', { count, total })
+ "
+ >
+ <p
+ v-if="rangeTip"
+ class="hidden items-center gap-1.5 max-w-[calc(100vw-2rem)] px-3 py-1 rounded-full bg-white/80 dark:bg-neutral-900/80 backdrop-blur-xl border border-neutral-200/80 dark:border-neutral-800/80 text-xs text-neutral-500 dark:text-neutral-400 pointer-fine:flex"
+ >
+ <UIcon
+ name="i-tabler-info-circle"
+ class="size-3.5 shrink-0"
+ />
+ {{ $t('ui.action.select.rangeTip') }}
+ </p>
+ <div
+ class="max-w-[calc(100vw-1rem)] overflow-x-auto 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 flex items-center gap-3 sm:gap-6 shadow-black/5 dark:shadow-black/20"
+ >
+ <div
+ 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, total }) }}
+ </p>
+ </div>
+ <div class="flex items-center gap-1 sm:gap-1.5 pr-2"><slot /></div>
+ </div>
+ </div>
+ </Transition>
+ </Teleport>
+</template>
diff --git a/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts b/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts
index 4ad78fba..d48e45d6 100644
--- a/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts
+++ b/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts
@@ -3,7 +3,7 @@ import { useLocalStorage } from '@vueuse/core'
const DASHBOARD_PHOTO_COLUMN_VISIBILITY_STORAGE_KEY =
'dashboard-photos-column-visibility'
-const dashboardPhotoColumnIds = [
+export const DASHBOARD_PHOTO_COLUMN_IDS = [
'thumbnailUrl',
'id',
'actions',
@@ -21,12 +21,12 @@ const dashboardPhotoColumnIds = [
const lockedVisibleColumnIds = ['thumbnailUrl', 'id', 'actions'] as const
-type DashboardPhotoColumnId = (typeof dashboardPhotoColumnIds)[number]
+type DashboardPhotoColumnId = (typeof DASHBOARD_PHOTO_COLUMN_IDS)[number]
type DashboardPhotoColumnVisibility = Record<DashboardPhotoColumnId, boolean>
function createDefaultColumnVisibility(): DashboardPhotoColumnVisibility {
return Object.fromEntries(
- dashboardPhotoColumnIds.map((columnId) => [columnId, true]),
+ DASHBOARD_PHOTO_COLUMN_IDS.map((columnId) => [columnId, true]),
) as DashboardPhotoColumnVisibility
}
@@ -44,7 +44,7 @@ function mergeColumnVisibility(
return merged
}
- for (const columnId of dashboardPhotoColumnIds) {
+ for (const columnId of DASHBOARD_PHOTO_COLUMN_IDS) {
const value = storageValue[columnId]
if (typeof value === 'boolean') {
merged[columnId] = value
diff --git a/packages/console/app/pages/dashboard/photos.vue b/packages/console/app/pages/dashboard/photos.vue
index 8fc43d90..d410f174 100644
--- a/packages/console/app/pages/dashboard/photos.vue
+++ b/packages/console/app/pages/dashboard/photos.vue
@@ -2824,126 +2824,82 @@ onUnmounted(() => {
</template>
</ConsoleMediaTable>
- <!-- 悬浮版批量操作菜单 -->
- <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"
+ <ConsoleSelectionToolbar
+ :count="selectedRowsCount"
+ :total="totalRowsCount"
+ range-tip
>
- <div
- v-if="selectedRowsCount > 0"
- class="fixed bottom-8 left-1/2 -translate-x-1/2 z-60 w-max flex flex-col items-center gap-2"
+ <UButton
+ color="primary"
+ variant="ghost"
+ size="sm"
+ class="rounded-full"
+ icon="tabler:album"
+ :aria-label="$t('dashboard.photos.selection.addToAlbum')"
+ @click="openAddToAlbum"
>
- <p
- class="hidden items-center gap-1.5 max-w-[calc(100vw-2rem)] px-3 py-1 rounded-full bg-white/80 dark:bg-neutral-900/80 backdrop-blur-xl border border-neutral-200/80 dark:border-neutral-800/80 text-xs text-neutral-500 dark:text-neutral-400 pointer-fine:flex"
- >
- <Icon
- name="tabler:info-circle"
- class="size-3.5 shrink-0"
- />
- {{ $t('ui.action.select.rangeTip') }}
- </p>
-
- <div
- class="max-w-[calc(100vw-1rem)] overflow-x-auto 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 flex items-center gap-3 sm:gap-6 shadow-black/5 dark:shadow-black/20"
- >
- <div
- 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
- color="primary"
- variant="ghost"
- size="sm"
- class="rounded-full"
- icon="tabler:album"
- :aria-label="$t('dashboard.photos.selection.addToAlbum')"
- @click="openAddToAlbum"
- >
- <span class="hidden sm:inline">{{
- $t('dashboard.photos.selection.addToAlbum')
- }}</span>
- </UButton>
- <UButton
- 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"
- :aria-label="
- $t('dashboard.photos.selection.batchReprocess')
- "
- @click="handleBatchReprocess"
- >
- <span class="hidden sm:inline">{{
- $t('dashboard.photos.selection.batchReprocess')
- }}</span>
- </UButton>
+ <span class="hidden sm:inline">{{
+ $t('dashboard.photos.selection.addToAlbum')
+ }}</span>
+ </UButton>
+ <UButton
+ 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"
+ :aria-label="$t('dashboard.photos.selection.batchReprocess')"
+ @click="handleBatchReprocess"
+ >
+ <span class="hidden sm:inline">{{
+ $t('dashboard.photos.selection.batchReprocess')
+ }}</span>
+ </UButton>
- <UButton
- 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"
- :aria-label="
- $t('dashboard.photos.selection.batchEraseLocation')
- "
- @click="handleBatchEraseLocation"
- >
- <span class="hidden sm:inline">{{
- $t('dashboard.photos.selection.batchEraseLocation')
- }}</span>
- </UButton>
+ <UButton
+ 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"
+ :aria-label="
+ $t('dashboard.photos.selection.batchEraseLocation')
+ "
+ @click="handleBatchEraseLocation"
+ >
+ <span class="hidden sm:inline">{{
+ $t('dashboard.photos.selection.batchEraseLocation')
+ }}</span>
+ </UButton>
- <UButton
- 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"
- :aria-label="
- $t('dashboard.photos.selection.batchDownload')
- "
- @click="handleBatchDownload"
- >
- <span class="hidden sm:inline">{{
- $t('dashboard.photos.selection.batchDownload')
- }}</span>
- </UButton>
+ <UButton
+ 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"
+ :aria-label="$t('dashboard.photos.selection.batchDownload')"
+ @click="handleBatchDownload"
+ >
+ <span class="hidden sm:inline">{{
+ $t('dashboard.photos.selection.batchDownload')
+ }}</span>
+ </UButton>
- <UButton
- color="error"
- variant="ghost"
- size="sm"
- class="rounded-full hover:bg-error-50 dark:hover:bg-error-500/20"
- icon="tabler:trash"
- :aria-label="$t('dashboard.photos.selection.batchDelete')"
- @click="handleBatchDelete"
- >
- <span class="hidden sm:inline">{{
- $t('dashboard.photos.selection.batchDelete')
- }}</span>
- </UButton>
- </div>
- </div>
- </div>
- </transition>
+ <UButton
+ color="error"
+ variant="ghost"
+ size="sm"
+ class="rounded-full hover:bg-error-50 dark:hover:bg-error-500/20"
+ icon="tabler:trash"
+ :aria-label="$t('dashboard.photos.selection.batchDelete')"
+ @click="handleBatchDelete"
+ >
+ <span class="hidden sm:inline">{{
+ $t('dashboard.photos.selection.batchDelete')
+ }}</span>
+ </UButton>
+ </ConsoleSelectionToolbar>
</div>
</div>
diff --git a/packages/saas-ui/app/assets/primitives.css b/packages/saas-ui/app/assets/primitives.css
index bedce506..6f2230eb 100644
--- a/packages/saas-ui/app/assets/primitives.css
+++ b/packages/saas-ui/app/assets/primitives.css
@@ -208,15 +208,37 @@
border-collapse: collapse;
font-size: 13px;
text-align: left;
+ color: var(--foreground);
+ background: var(--card);
+}
+.cf-table :is(th, td) {
+ padding: 12px 16px;
+ border-bottom: 1px solid var(--border);
+ vertical-align: middle;
}
.cf-table th {
- font-size: 11px;
+ font-size: 12px;
font-weight: 550;
color: var(--muted-foreground);
+ background: var(--secondary);
+ white-space: nowrap;
+}
+.cf-table td {
+ font-size: 13px;
+ color: var(--foreground);
+}
+.cf-table tbody tr:hover {
+ background: color-mix(in srgb, var(--muted) 50%, transparent);
}
.cf-table tbody tr:last-child td {
border-bottom: 0;
}
+.cf-table td > .cf-button + .cf-button {
+ margin-inline-start: 6px;
+}
+.cf-data-table {
+ overflow-x: auto;
+}
.cf-segmented-control {
display: inline-flex;
padding: 4px;
diff --git a/packages/saas-ui/app/components/CfTable.vue b/packages/saas-ui/app/components/CfTable.vue
index 23c21291..37f5dc65 100644
--- a/packages/saas-ui/app/components/CfTable.vue
+++ b/packages/saas-ui/app/components/CfTable.vue
@@ -1,5 +1,34 @@
+<script setup lang="ts" generic="T">
+import type { TableColumn } from '@nuxt/ui'
+defineOptions({ inheritAttrs: false })
+defineProps<{ data?: T[]; columns?: TableColumn<T>[] }>()
+</script>
<template>
- <table class="cf-table">
+ <UTable
+ v-if="data"
+ v-bind="$attrs"
+ :data="data"
+ :columns="columns"
+ :ui="{
+ root: 'cf-data-table',
+ base: 'cf-table table-auto border-collapse',
+ th: 'cf-table-heading bg-[var(--secondary)] text-[var(--muted-foreground)] text-xs font-medium px-4 py-3',
+ td: 'cf-table-cell text-[var(--foreground)] text-[13px] px-4 py-3',
+ }"
+ >
+ <template
+ v-for="(_, name) in $slots"
+ #[name]="slotData"
+ ><slot
+ :name="name"
+ v-bind="slotData"
+ /></template>
+ </UTable>
+ <table
+ v-else
+ v-bind="$attrs"
+ class="cf-table"
+ >
<slot />
</table>
</template>