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(ui): unify console tables and overlay components

Timothy Yinf555605d98e3
diff --git a/apps/cloud/app/assets/cloud.css b/apps/cloud/app/assets/cloud.css
index 85b7d951..06939765 100644
--- a/apps/cloud/app/assets/cloud.css
+++ b/apps/cloud/app/assets/cloud.css
@@ -1388,12 +1388,6 @@
width: 260px;
max-width: 100%;
}
-.cf-library-table {
- overflow-x: auto;
- border: 1px solid var(--border);
- border-radius: 10px;
- background: var(--card);
-}
.cf-library-thumb {
display: flex;
width: 52px;
@@ -1478,13 +1472,8 @@
.cf-photo-preview {
width: 100%;
max-height: 70vh;
- object-fit: contain;
-}
-.cf-preview-details {
- display: flex;
- gap: 12px;
- font-size: 12px;
- color: var(--muted-foreground);
+ overflow-y: auto;
+ border-radius: 8px;
}
.cf-selected-photo {
display: flex;
@@ -1662,17 +1651,9 @@
overflow-y: auto;
}
-.cf-photo-preview {
- overflow-y: auto;
- border-radius: 8px;
-}
.cf-photo-preview > * {
width: 100%;
}
-.cf-preview-details {
- padding: 12px 16px;
- flex-wrap: wrap;
-}
.cf-overview-stats {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
@@ -2208,30 +2189,8 @@ a.cf-domain-address:hover {
font-weight: 600;
margin-bottom: 8px;
}
-.cf-table-scroll {
- overflow: auto;
- border: 1px solid var(--border);
- border-radius: 10px;
+.cf-plan-comparison-table {
margin-top: 18px;
- background: var(--card);
-}
-.cf-table-scroll table {
- width: 100%;
- border-collapse: collapse;
- white-space: nowrap;
- text-align: left;
-}
-.cf-table-scroll th,
-.cf-table-scroll td {
- font-size: 12px;
- padding: 14px 18px;
- border-bottom: 1px solid var(--border);
-}
-.cf-table-scroll th {
- font-weight: 550;
-}
-.cf-table-scroll thead {
- background: var(--secondary);
}
.cf-plan-page {
display: grid;
diff --git a/apps/cloud/app/components/CloudAlbumsManager.vue b/apps/cloud/app/components/CloudAlbumsManager.vue
index 37255f29..588c3776 100644
--- a/apps/cloud/app/components/CloudAlbumsManager.vue
+++ b/apps/cloud/app/components/CloudAlbumsManager.vue
@@ -335,124 +335,119 @@ function menu(album: Album) {
@click="refreshMedia"
/>
</div>
- <div class="cf-library-table">
- <CfTable
- :data="rows"
- :columns="columns"
- :loading="loading && !albums.length"
- ><template #cover-cell="{ row }"
- ><button
- class="cf-library-thumb"
- :aria-label="
- $t('cloud.ui.editNamed', { title: row.original.title })
- "
- :disabled="!admin"
- @click="edit(row.original)"
- >
- <ThumbImage
- v-if="cover(row.original)"
- :src="cover(row.original)?.thumbnailUrl || ''"
- :alt="row.original.title"
- /><UIcon
- v-else
- name="i-lucide-images"
- class="size-5"
- /></button></template
- ><template #title-cell="{ row }"
- ><button
- class="cf-photo-title"
- :disabled="!admin"
- @click="edit(row.original)"
- >
- {{ row.original.title }}
- </button></template
- ><template #description-cell="{ row }"
- ><p class="cf-table-description">
- {{ row.original.description || '—' }}
- </p></template
- ><template #count-cell="{ row }"
- ><UBadge
- color="neutral"
- variant="soft"
- >{{ row.original.photoIds.length }}</UBadge
- ></template
- ><template #visibility-cell="{ row }"
- ><UBadge
- color="neutral"
- variant="soft"
- :icon="
- row.original.isHidden
- ? 'i-lucide-eye-off'
- : row.original.hasPassword
- ? 'i-lucide-lock'
- : 'i-lucide-globe'
- "
- >{{
- row.original.isHidden
- ? $t('cloud.messages.hidden')
- : row.original.hasPassword
- ? $t('cloud.messages.password')
- : $t('cloud.messages.public')
- }}</UBadge
- ></template
- ><template #actions-cell="{ row }"
- ><div class="flex items-center gap-1">
- <CfButton
- v-if="admin"
- variant="ghost"
- :icon="ButtonIconArrowUp"
- size="sm"
- :disabled="busy || albums[0]?.id === row.original.id"
- :aria-label="$t('cloud.ui.moveUp', { title: row.original.title })"
- @click="moveAlbum(row.original, -1)"
- /><CfButton
- v-if="admin"
+ <CfTable
+ class="cf-library-table"
+ :data="rows"
+ :columns="columns"
+ :loading="loading && !albums.length"
+ ><template #cover-cell="{ row }"
+ ><button
+ class="cf-library-thumb"
+ :aria-label="$t('cloud.ui.editNamed', { title: row.original.title })"
+ :disabled="!admin"
+ @click="edit(row.original)"
+ >
+ <ThumbImage
+ v-if="cover(row.original)"
+ :src="cover(row.original)?.thumbnailUrl || ''"
+ :alt="row.original.title"
+ /><UIcon
+ v-else
+ name="i-lucide-images"
+ class="size-5"
+ /></button></template
+ ><template #title-cell="{ row }"
+ ><button
+ class="cf-photo-title"
+ :disabled="!admin"
+ @click="edit(row.original)"
+ >
+ {{ row.original.title }}
+ </button></template
+ ><template #description-cell="{ row }"
+ ><p class="cf-table-description">
+ {{ row.original.description || '—' }}
+ </p></template
+ ><template #count-cell="{ row }"
+ ><UBadge
+ color="neutral"
+ variant="soft"
+ >{{ row.original.photoIds.length }}</UBadge
+ ></template
+ ><template #visibility-cell="{ row }"
+ ><UBadge
+ color="neutral"
+ variant="soft"
+ :icon="
+ row.original.isHidden
+ ? 'i-lucide-eye-off'
+ : row.original.hasPassword
+ ? 'i-lucide-lock'
+ : 'i-lucide-globe'
+ "
+ >{{
+ row.original.isHidden
+ ? $t('cloud.messages.hidden')
+ : row.original.hasPassword
+ ? $t('cloud.messages.password')
+ : $t('cloud.messages.public')
+ }}</UBadge
+ ></template
+ ><template #actions-cell="{ row }"
+ ><div class="flex items-center gap-1">
+ <CfButton
+ v-if="admin"
+ variant="ghost"
+ :icon="ButtonIconArrowUp"
+ size="sm"
+ :disabled="busy || albums[0]?.id === row.original.id"
+ :aria-label="$t('cloud.ui.moveUp', { title: row.original.title })"
+ @click="moveAlbum(row.original, -1)"
+ /><CfButton
+ v-if="admin"
+ variant="ghost"
+ :icon="ButtonIconArrowDown"
+ size="sm"
+ :disabled="busy || albums.at(-1)?.id === row.original.id"
+ :aria-label="$t('cloud.ui.moveDown', { title: row.original.title })"
+ @click="moveAlbum(row.original, 1)"
+ /><UDropdownMenu :items="menu(row.original)"
+ ><CfButton
variant="ghost"
- :icon="ButtonIconArrowDown"
- size="sm"
- :disabled="busy || albums.at(-1)?.id === row.original.id"
+ :icon="ButtonIconEllipsis"
:aria-label="
- $t('cloud.ui.moveDown', { title: row.original.title })
+ $t('cloud.ui.actionsNamed', { title: row.original.title })
"
- @click="moveAlbum(row.original, 1)"
- /><UDropdownMenu :items="menu(row.original)"
- ><CfButton
- variant="ghost"
- :icon="ButtonIconEllipsis"
- :aria-label="
- $t('cloud.ui.actionsNamed', { title: row.original.title })
- "
- /></UDropdownMenu></div></template
- ><template #empty
- ><div class="cf-library-empty">
- <UIcon
- name="i-lucide-library-big"
- class="size-8"
- />
- <h3>
- {{
- search
- ? $t('cloud.messages.noMatchingAlbums')
- : $t('cloud.messages.makeRoomForACollection')
- }}
- </h3>
- <p>
- {{
- $t(
- 'cloud.messages.createAnAlbumToBringRelatedPhotographsTogether',
- )
- }}
- </p>
- <CfButton
- v-if="admin && !albums.length"
- variant="soft"
- @click="create"
- >{{ $t('cloud.messages.createAlbum') }}</CfButton
- >
- </div></template
- ></CfTable
- >
- </div>
+ /></UDropdownMenu></div></template
+ ><template #empty
+ ><div class="cf-library-empty">
+ <UIcon
+ name="i-lucide-library-big"
+ class="size-8"
+ />
+ <h3>
+ {{
+ search
+ ? $t('cloud.messages.noMatchingAlbums')
+ : $t('cloud.messages.makeRoomForACollection')
+ }}
+ </h3>
+ <p>
+ {{
+ $t(
+ 'cloud.messages.createAnAlbumToBringRelatedPhotographsTogether',
+ )
+ }}
+ </p>
+ <CfButton
+ v-if="admin && !albums.length"
+ variant="soft"
+ @click="create"
+ >{{ $t('cloud.messages.createAlbum') }}</CfButton
+ >
+ </div></template
+ ></CfTable
+ >
<USlideover
v-model:open="editor"
:title="
diff --git a/apps/cloud/app/components/CloudPhotoLibrary.vue b/apps/cloud/app/components/CloudPhotoLibrary.vue
index 74d0de17..e3f0b71e 100644
--- a/apps/cloud/app/components/CloudPhotoLibrary.vue
+++ b/apps/cloud/app/components/CloudPhotoLibrary.vue
@@ -80,7 +80,11 @@ const rows = computed(() => {
.includes(search.value.toLowerCase())),
)
})
-const columnVisibility = useDashboardPhotoColumnVisibility()
+const columnVisibility = useDashboardPhotoColumnVisibility({
+ storageKey: 'cloud-photos-column-visibility',
+ hidden: ['id'],
+ locked: ['thumbnailUrl', 'actions'],
+})
const reactions = ref<Record<string, number> | null>(null)
watch(
photos,
@@ -113,7 +117,7 @@ const columns = computed<TableColumn<Photo>[]>(() => [
(key) => key !== 'actions' && key !== 'lastModified',
).map((key) => ({
id: key,
- enableHiding: !['thumbnailUrl', 'id'].includes(key),
+ enableHiding: key !== 'thumbnailUrl',
accessorFn: (photo: Photo) =>
key === 'colorSpace' ? photo.exif?.ColorSpace : photo[key as keyof Photo],
header: t(
@@ -252,18 +256,18 @@ watch(
:placeholder="$t('cloud.messages.searchPhotographs')"
:aria-label="$t('cloud.messages.searchPhotographs2')"
class="cf-library-search"
- /><UPopover
+ /><OverlayFilterPopover
><CfButton
:variant="hasActiveFilters ? 'soft' : 'secondary'"
:icon="ButtonIconFilter"
>{{ $t('cloud.messages.filters') }}</CfButton
- ><template #content><OverlayFilterPanel /></template></UPopover
- ><UPopover
+ ></OverlayFilterPopover
+ ><OverlaySortPopover
><CfButton
variant="secondary"
:icon="ButtonIconArrowUpDown"
>{{ $t('cloud.messages.sort') }}</CfButton
- ><template #content><OverlaySortPanel /></template></UPopover
+ ></OverlaySortPopover
><CfButton
variant="ghost"
:icon="ButtonIconRefreshCw"
@@ -276,8 +280,7 @@ watch(
columns
.filter(
(c) =>
- c.id &&
- !['select', 'thumbnailUrl', 'id', 'actions'].includes(c.id),
+ c.id && !['select', 'thumbnailUrl', 'actions'].includes(c.id),
)
.map((c) => ({
label: String(c.header),
@@ -325,163 +328,160 @@ watch(
>{{ $t('cloud.messages.clear') }}</CfButton
>
</ConsoleSelectionToolbar>
- <div class="cf-library-table">
- <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="
- 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 === true
- ? Object.fromEntries(rows.map((p) => [p.id, true]))
- : {}
- }
- " /></template
- ><template #select-cell="{ row }"
- ><UCheckbox
- :model-value="!!selection[row.original.id]"
- :aria-label="
- $t('cloud.ui.selectNamed', { title: row.original.title })
- "
- @update:model-value="
- (v) => (selection[row.original.id] = !!v)
- " /></template
- ><template #thumbnailUrl-cell="{ row }"
- ><button
- class="cf-library-thumb"
- :aria-label="
- $t('cloud.ui.previewNamed', { title: row.original.title })
- "
- @click="preview = row.original"
- >
- <ThumbImage
- :src="row.original.thumbnailUrl || row.original.originalUrl || ''"
- :thumbhash="row.original.thumbnailHash || ''"
- :alt="row.original.title"
- /><span
- v-if="row.original.isLivePhoto"
- class="cf-live-label"
- >{{ $t('cloud.messages.live') }}</span
- >
- </button></template
- ><template #title-cell="{ row }"
- ><button
- class="cf-photo-title"
- @click="preview = row.original"
+ <CfTable
+ class="cf-library-table"
+ 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="
+ 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 === true
+ ? Object.fromEntries(rows.map((p) => [p.id, true]))
+ : {}
+ }
+ " /></template
+ ><template #select-cell="{ row }"
+ ><UCheckbox
+ :model-value="!!selection[row.original.id]"
+ :aria-label="
+ $t('cloud.ui.selectNamed', { title: row.original.title })
+ "
+ @update:model-value="
+ (v) => (selection[row.original.id] = !!v)
+ " /></template
+ ><template #thumbnailUrl-cell="{ row }"
+ ><button
+ class="cf-library-thumb"
+ :aria-label="
+ $t('cloud.ui.previewNamed', { title: row.original.title })
+ "
+ @click="preview = row.original"
+ >
+ <ThumbImage
+ :src="row.original.thumbnailUrl || row.original.originalUrl || ''"
+ :thumbhash="row.original.thumbnailHash || ''"
+ :alt="row.original.title"
+ /><span
+ v-if="row.original.isLivePhoto"
+ class="cf-live-label"
+ >{{ $t('cloud.messages.live') }}</span
>
- {{ row.original.title }}</button
- ><span class="cf-photo-dimensions"
- >{{ row.original.width }} × {{ row.original.height }}</span
- ></template
- ><template #tags-cell="{ row }"
- ><div class="cf-tag-list">
- <UBadge
- v-for="tag in (row.original.tags ?? []).slice(0, 3)"
- :key="tag"
- color="neutral"
- variant="soft"
- size="sm"
- >{{ tag }}</UBadge
- ><span
- v-if="!row.original.tags?.length"
- class="text-muted"
- >—</span
- >
- </div></template
- ><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
- ? dayjs(row.original.dateTaken).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
+ </button></template
+ ><template #title-cell="{ row }"
+ ><button
+ class="cf-photo-title"
+ @click="preview = row.original"
>
- <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"
- :icon="ButtonIconEllipsis"
- :aria-label="
- $t('cloud.ui.actionsNamed', { title: row.original.title })
- " /></UDropdownMenu></template
- ><template #empty
- ><div class="cf-library-empty">
- <UIcon
- name="i-lucide-images"
- class="size-8"
- />
- <h3>
- {{
- search
- ? $t('cloud.messages.noMatchingPhotographs')
- : $t('cloud.messages.yourLibraryStartsHere')
- }}
- </h3>
- <p>
- {{
- search
- ? $t('cloud.messages.tryAnotherSearchOrClearYourFilters')
- : $t(
- 'cloud.messages.uploadPhotographsToStartTellingYourStory',
- )
- }}
- </p>
- <CfButton
- v-if="admin && !photos.length"
- variant="soft"
- :disabled="!uploadAdmission.allowed || !!quota.error.value"
- @click="openUpload"
- >{{ $t('cloud.messages.upload') }}</CfButton
- >
- </div></template
- ></CfTable
+ {{ row.original.title }}</button
+ ><span class="cf-photo-dimensions"
+ >{{ row.original.width }} × {{ row.original.height }}</span
+ ></template
+ ><template #tags-cell="{ row }"
+ ><div class="cf-tag-list">
+ <UBadge
+ v-for="tag in (row.original.tags ?? []).slice(0, 3)"
+ :key="tag"
+ color="neutral"
+ variant="soft"
+ size="sm"
+ >{{ tag }}</UBadge
+ ><span
+ v-if="!row.original.tags?.length"
+ class="text-muted"
+ >—</span
+ >
+ </div></template
+ ><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
+ ? dayjs(row.original.dateTaken).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
>
- </div>
+ <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"
+ :icon="ButtonIconEllipsis"
+ :aria-label="
+ $t('cloud.ui.actionsNamed', { title: row.original.title })
+ " /></UDropdownMenu></template
+ ><template #empty
+ ><div class="cf-library-empty">
+ <UIcon
+ name="i-lucide-images"
+ class="size-8"
+ />
+ <h3>
+ {{
+ search
+ ? $t('cloud.messages.noMatchingPhotographs')
+ : $t('cloud.messages.yourLibraryStartsHere')
+ }}
+ </h3>
+ <p>
+ {{
+ search
+ ? $t('cloud.messages.tryAnotherSearchOrClearYourFilters')
+ : $t('cloud.messages.uploadPhotographsToStartTellingYourStory')
+ }}
+ </p>
+ <CfButton
+ v-if="admin && !photos.length"
+ variant="soft"
+ :disabled="!uploadAdmission.allowed || !!quota.error.value"
+ @click="openUpload"
+ >{{ $t('cloud.messages.upload') }}</CfButton
+ >
+ </div></template
+ ></CfTable
+ >
<section
v-if="pendingJobs.length"
class="cf-processing-panel"
diff --git a/apps/cloud/app/components/CloudPricing.vue b/apps/cloud/app/components/CloudPricing.vue
index 75398104..98861354 100644
--- a/apps/cloud/app/components/CloudPricing.vue
+++ b/apps/cloud/app/components/CloudPricing.vue
@@ -33,6 +33,28 @@ const payments = props.portal
const { data, error, refresh } = await useFetch<any>('/api/billing/catalog', {
key: 'public-pricing-catalog',
})
+const comparisonColumns = computed(() => [
+ { accessorKey: 'label', header: t('cloud.billing.allowance') },
+ ...(data.value?.plans ?? []).map((plan: any) => ({
+ id: 'plan:' + plan.id,
+ header: plan.name,
+ accessorFn: (row: { values: Record<string, string> }) =>
+ row.values[plan.id],
+ })),
+])
+const comparisonRows = computed(() =>
+ [...BILLING_LIMITS, 'conditions'].map((key) => ({
+ label: t('cloud.billing.' + key),
+ values: Object.fromEntries(
+ (data.value?.plans ?? []).map((plan: any) => [
+ plan.id,
+ key === 'conditions'
+ ? String(plan.policy.rules.length || '—')
+ : allowance(key, plan.policy.limits[key], locale.value),
+ ]),
+ ),
+ })),
+)
if (billing) await billing.ready
const currentPlan = computed(() => billing?.data.value?.plan.id)
const amount = (plan: any) =>
@@ -353,52 +375,13 @@ async function checkout(plan: any) {
>
<h2>{{ $t('cloud.billing.compare') }}</h2>
<p class="cf-field-hint">{{ $t('cloud.billing.comparisonHelp') }}</p>
- <div class="cf-table-scroll">
- <CfTable>
- <caption class="sr-only">
- {{
- $t('cloud.billing.compare')
- }}
- </caption>
- <thead>
- <tr>
- <th scope="col">{{ $t('cloud.billing.allowance') }}</th>
- <th
- v-for="plan in data.plans"
- :key="plan.id"
- scope="col"
- >
- {{ plan.name }}
- </th>
- </tr>
- </thead>
- <tbody>
- <tr
- v-for="key in BILLING_LIMITS"
- :key="key"
- >
- <th scope="row">{{ $t('cloud.billing.' + key) }}</th>
- <td
- v-for="plan in data.plans"
- :key="plan.id"
- >
- {{ allowance(key, plan.policy.limits[key], locale) }}
- </td>
- </tr>
- <tr>
- <th scope="row">{{ $t('cloud.billing.conditions') }}</th>
- <td
- v-for="plan in data.plans"
- :key="plan.id"
- >
- {{ plan.policy.rules.length || '—' }}
- </td>
- </tr>
- </tbody>
- </CfTable>
- </div>
- </section></template
- >
+ <CfTable
+ class="cf-plan-comparison-table"
+ :data="comparisonRows"
+ :columns="comparisonColumns"
+ :aria-label="$t('cloud.billing.compare')"
+ /></section
+ ></template>
<CloudLegalLinks />
</div>
</template>
diff --git a/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts b/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts
index d48e45d6..3575201e 100644
--- a/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts
+++ b/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts
@@ -33,6 +33,7 @@ function createDefaultColumnVisibility(): DashboardPhotoColumnVisibility {
function mergeColumnVisibility(
storageValue: DashboardPhotoColumnVisibility,
defaults: DashboardPhotoColumnVisibility,
+ locked: readonly DashboardPhotoColumnId[] = lockedVisibleColumnIds,
): DashboardPhotoColumnVisibility {
const merged: DashboardPhotoColumnVisibility = { ...defaults }
@@ -51,19 +52,29 @@ function mergeColumnVisibility(
}
}
- for (const columnId of lockedVisibleColumnIds) {
+ for (const columnId of locked) {
merged[columnId] = true
}
return merged
}
-export function useDashboardPhotoColumnVisibility() {
+export function useDashboardPhotoColumnVisibility(
+ options: {
+ storageKey?: string
+ hidden?: readonly DashboardPhotoColumnId[]
+ locked?: readonly DashboardPhotoColumnId[]
+ } = {},
+) {
return useLocalStorage<DashboardPhotoColumnVisibility>(
- DASHBOARD_PHOTO_COLUMN_VISIBILITY_STORAGE_KEY,
- createDefaultColumnVisibility,
+ options.storageKey ?? DASHBOARD_PHOTO_COLUMN_VISIBILITY_STORAGE_KEY,
+ () => ({
+ ...createDefaultColumnVisibility(),
+ ...Object.fromEntries((options.hidden ?? []).map((id) => [id, false])),
+ }),
{
- mergeDefaults: mergeColumnVisibility,
+ mergeDefaults: (stored, defaults) =>
+ mergeColumnVisibility(stored, defaults, options.locked),
initOnMounted: true,
},
)
diff --git a/packages/console/app/pages/dashboard/albums.vue b/packages/console/app/pages/dashboard/albums.vue
index 5fa42bb4..47126e52 100644
--- a/packages/console/app/pages/dashboard/albums.vue
+++ b/packages/console/app/pages/dashboard/albums.vue
@@ -1063,7 +1063,7 @@ const columns = computed<any[]>(() => [
<div class="mt-4 space-y-3">
<div class="flex flex-wrap items-center gap-2">
- <UPopover
+ <OverlayFilterPopover
v-model:open="isSelectorFilterOpen"
:content="{
side: 'bottom',
@@ -1089,13 +1089,7 @@ const columns = computed<any[]>(() => [
{{ totalSelectedFilters }}
</UBadge>
</UButton>
-
- <template #content>
- <UCard variant="glassmorphism">
- <OverlayFilterPanel />
- </UCard>
- </template>
- </UPopover>
+ </OverlayFilterPopover>
<UButton
v-if="hasActiveFilters"
diff --git a/packages/console/app/pages/dashboard/photos.vue b/packages/console/app/pages/dashboard/photos.vue
index d410f174..a2086f6c 100644
--- a/packages/console/app/pages/dashboard/photos.vue
+++ b/packages/console/app/pages/dashboard/photos.vue
@@ -2626,7 +2626,7 @@ onUnmounted(() => {
</div>
<div class="flex items-center gap-2">
- <UPopover>
+ <OverlayFilterPopover>
<UTooltip :text="$t('ui.action.filter.tooltip')">
<UChip
inset
@@ -2643,14 +2643,8 @@ onUnmounted(() => {
/>
</UChip>
</UTooltip>
-
- <template #content>
- <UCard variant="glassmorphism">
- <OverlayFilterPanel />
- </UCard>
- </template>
- </UPopover>
- <UPopover>
+ </OverlayFilterPopover>
+ <OverlaySortPopover>
<UTooltip :text="$t('ui.action.sort.tooltip')">
<UButton
variant="soft"
@@ -2664,11 +2658,7 @@ onUnmounted(() => {
size="sm"
/>
</UTooltip>
-
- <template #content>
- <OverlaySortPanel />
- </template>
- </UPopover>
+ </OverlaySortPopover>
<!-- 过滤器 -->
<USelectMenu
data-tour="photo-filter"
diff --git a/packages/gallery/app/components/masonry/item/Actions.vue b/packages/gallery/app/components/masonry/item/Actions.vue
index e9d6cb4c..2284fb59 100644
--- a/packages/gallery/app/components/masonry/item/Actions.vue
+++ b/packages/gallery/app/components/masonry/item/Actions.vue
@@ -54,7 +54,7 @@ const totalSelectedFilters = computed(() =>
/>
</UTooltip>
</div>
- <UPopover>
+ <OverlayFilterPopover>
<UTooltip :text="$t('ui.action.filter.tooltip')">
<UChip
inset
@@ -71,11 +71,8 @@ const totalSelectedFilters = computed(() =>
/>
</UChip>
</UTooltip>
- <template #content>
- <UCard variant="glassmorphism"><OverlayFilterPanel /></UCard>
- </template>
- </UPopover>
- <UPopover>
+ </OverlayFilterPopover>
+ <OverlaySortPopover>
<UTooltip :text="$t('ui.action.sort.tooltip')">
<UButton
variant="soft"
@@ -87,10 +84,7 @@ const totalSelectedFilters = computed(() =>
size="sm"
/>
</UTooltip>
- <template #content>
- <OverlaySortPanel />
- </template>
- </UPopover>
+ </OverlaySortPopover>
<div
:class="compact ? 'hidden lg:flex' : 'flex'"
class="items-center"
diff --git a/packages/gallery/app/components/overlay/FilterPanel.vue b/packages/gallery/app/components/overlay/FilterPanel.vue
index dc7fe388..95b71292 100644
--- a/packages/gallery/app/components/overlay/FilterPanel.vue
+++ b/packages/gallery/app/components/overlay/FilterPanel.vue
@@ -78,7 +78,7 @@ const onShuffle = () => {
</script>
<template>
- <div class="space-y-1.5 w-[calc(100vw-34px)] sm:w-md">
+ <div class="space-y-1.5 w-[calc(100vw-34px)] max-w-full sm:w-md">
<div class="flex items-center justify-between">
<h3 class="text-sm font-bold text-neutral-900 dark:text-white p-2">
{{ $t('ui.action.filter.title') }}
diff --git a/packages/gallery/app/components/overlay/FilterPopover.vue b/packages/gallery/app/components/overlay/FilterPopover.vue
new file mode 100644
index 00000000..b42f08bb
--- /dev/null
+++ b/packages/gallery/app/components/overlay/FilterPopover.vue
@@ -0,0 +1,9 @@
+<template>
+ <UPopover
+ ><slot /><template #content
+ ><UCard
+ variant="glassmorphism"
+ class="max-w-[calc(100vw-1rem)]"
+ ><OverlayFilterPanel /></UCard></template
+ ></UPopover>
+</template>
diff --git a/packages/gallery/app/components/overlay/SortPopover.vue b/packages/gallery/app/components/overlay/SortPopover.vue
new file mode 100644
index 00000000..0be22c32
--- /dev/null
+++ b/packages/gallery/app/components/overlay/SortPopover.vue
@@ -0,0 +1,5 @@
+<template>
+ <UPopover
+ ><slot /><template #content><OverlaySortPanel /></template
+ ></UPopover>
+</template>
diff --git a/packages/saas-ui/app/app.config.ts b/packages/saas-ui/app/app.config.ts
index 0e69973e..4985fccf 100644
--- a/packages/saas-ui/app/app.config.ts
+++ b/packages/saas-ui/app/app.config.ts
@@ -11,12 +11,13 @@ export default defineAppConfig({
},
button: { slots: { base: 'cursor-pointer rounded-md font-medium' } },
modal: {
+ variants: { overlay: { true: { overlay: 'bg-black/55' } } },
slots: {
- overlay: 'bg-black/55',
- content: 'bg-default ring ring-default rounded-lg shadow-xl',
- header: 'px-5 py-4 min-h-0',
- body: 'p-5',
- footer: 'px-5 py-3 gap-2',
+ content:
+ 'bg-default ring ring-default rounded-lg shadow-xl max-h-[calc(100dvh-2rem)] overflow-hidden',
+ header: 'px-5 py-4 min-h-0 shrink-0',
+ body: 'p-5 min-h-0 overflow-y-auto',
+ footer: 'px-5 py-3 gap-2 justify-end shrink-0 flex-wrap',
title: 'text-sm font-semibold text-highlighted',
description: 'text-sm text-muted',
},
diff --git a/packages/saas-ui/app/assets/primitives.css b/packages/saas-ui/app/assets/primitives.css
index 2db28890..493b5e79 100644
--- a/packages/saas-ui/app/assets/primitives.css
+++ b/packages/saas-ui/app/assets/primitives.css
@@ -47,11 +47,6 @@
.cf-spin {
animation: cf-spin 1s linear infinite;
}
-.cf-table :is(th, td) {
- padding: 12px 16px;
- border-bottom: 1px solid var(--border);
- vertical-align: middle;
-}
.cf-button-primary {
background: var(--primary);
color: var(--primary-foreground);
@@ -203,42 +198,17 @@
width: 100%;
cursor: pointer;
}
+.cf-data-table {
+ --cf-table-hover: color-mix(in srgb, var(--muted) 50%, var(--card));
+ overflow-x: auto;
+}
.cf-table {
width: 100%;
- 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: 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;
@@ -452,22 +422,18 @@
/* A solid action surface keeps controls readable over horizontally scrolled cells. */
.cf-table .cf-table-actions {
--cf-action-background: var(--card);
- position: sticky;
- right: 0;
- z-index: 10;
width: 1%;
white-space: nowrap;
background: var(--cf-action-background);
}
.cf-table th.cf-table-actions {
--cf-action-background: var(--secondary);
- z-index: 20;
}
.cf-table .cf-table-actions::before {
content: '';
position: absolute;
top: 0;
- bottom: -1px;
+ bottom: 0;
right: 100%;
width: 28px;
background: linear-gradient(
@@ -478,5 +444,5 @@
pointer-events: none;
}
.cf-table tbody tr:hover .cf-table-actions {
- --cf-action-background: color-mix(in srgb, var(--muted) 50%, var(--card));
+ --cf-action-background: var(--cf-table-hover);
}
diff --git a/packages/saas-ui/app/components/CfTable.vue b/packages/saas-ui/app/components/CfTable.vue
index 3aee674c..cd2a38a0 100644
--- a/packages/saas-ui/app/components/CfTable.vue
+++ b/packages/saas-ui/app/components/CfTable.vue
@@ -2,7 +2,7 @@
import type { TableColumn } from '@nuxt/ui'
import { computed } from 'vue'
defineOptions({ inheritAttrs: false })
-const props = defineProps<{ data?: T[]; columns?: TableColumn<T>[] }>()
+const props = defineProps<{ data: T[]; columns: TableColumn<T>[] }>()
function actionClass<C>(
value: string | ((cell: C) => string) | undefined,
pinned: string,
@@ -13,7 +13,7 @@ function actionClass<C>(
.join(' ')
}
const renderedColumns = computed(() =>
- props.columns?.map((column) =>
+ props.columns.map((column) =>
column.id === 'actions'
? {
...column,
@@ -38,15 +38,15 @@ const renderedColumns = computed(() =>
</script>
<template>
<UTable
- v-if="data"
v-bind="$attrs"
:data="data"
:columns="renderedColumns"
:ui="{
- root: 'cf-data-table',
+ root: 'cf-data-table min-w-0 rounded-lg border border-[var(--border)] bg-[var(--card)]',
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',
+ tr: 'hover:bg-[var(--cf-table-hover)] transition-colors',
+ th: 'bg-[var(--secondary)] text-[var(--muted-foreground)] text-xs font-medium whitespace-nowrap px-4 py-3',
+ td: 'text-[var(--foreground)] text-[13px] whitespace-nowrap px-4 py-3',
}"
>
<template
@@ -57,11 +57,4 @@ const renderedColumns = computed(() =>
v-bind="slotData"
/></template>
</UTable>
- <table
- v-else
- v-bind="$attrs"
- class="cf-table"
- >
- <slot />
- </table>
</template>