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): restore SaaS surfaces and control layouts

Timothy Yin585515903d80
diff --git a/apps/cloud/app/assets/cloud.css b/apps/cloud/app/assets/cloud.css
index a00ac23d..45dda2fc 100644
--- a/apps/cloud/app/assets/cloud.css
+++ b/apps/cloud/app/assets/cloud.css
@@ -1462,6 +1462,8 @@
max-width: 100%;
}
.cf-library-thumb {
+ padding: 0;
+ flex-shrink: 0;
display: flex;
width: 52px;
height: 44px;
@@ -2618,23 +2620,6 @@ a.cf-domain-address:hover {
margin-bottom: 8px;
}
-.cf-icon-picker {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: fit-content;
- border: 1px solid var(--border);
- border-radius: 6px;
- padding: 8px 14px;
- background: var(--secondary);
- color: var(--foreground);
- cursor: pointer;
- font-size: 13px;
- font-weight: 500;
-}
-.cf-icon-picker:focus-within {
- outline: 2px solid var(--primary);
-}
.cf-site-address-block {
background: var(--card);
border: 1px solid var(--border);
@@ -2671,25 +2656,6 @@ a.cf-domain-address:hover {
.cf-icon-field {
position: relative;
}
-.cf-site-settings input.cf-icon-file {
- position: absolute;
- width: 1px;
- height: 1px;
- padding: 0;
- border: 0;
- margin: -1px;
- overflow: hidden;
- clip-path: inset(50%);
- white-space: nowrap;
-}
-.cf-field:has(.cf-icon-file:focus-visible) .cf-icon-picker {
- outline: 2px solid var(--primary);
- outline-offset: 2px;
-}
-.cf-field:has(.cf-icon-file:disabled) .cf-icon-picker {
- opacity: 0.5;
- pointer-events: none;
-}
@media (max-width: 560px) {
.cf-storage-option {
align-items: flex-start;
diff --git a/apps/cloud/app/components/CloudPlatformStorageCard.vue b/apps/cloud/app/components/CloudPlatformStorageCard.vue
new file mode 100644
index 00000000..b187761a
--- /dev/null
+++ b/apps/cloud/app/components/CloudPlatformStorageCard.vue
@@ -0,0 +1,100 @@
+<script setup lang="ts">
+import { allowance as formatAllowance } from '../utils/billing-format'
+const props = defineProps<{
+ allowance: {
+ plan: { name: string }
+ storageBytes: number
+ limits: Record<string, number>
+ } | null
+ error?: string
+}>()
+const { t, locale } = useI18n()
+const used = computed(() => Math.max(0, props.allowance?.storageBytes ?? 0))
+const total = computed(() =>
+ Math.max(0, props.allowance?.limits.storageBytes ?? 0),
+)
+const percent = computed(() =>
+ total.value > 0
+ ? Math.min(100, (used.value / total.value) * 100)
+ : used.value > 0
+ ? 100
+ : 0,
+)
+const bytes = (value: number) =>
+ formatAllowance('storageBytes', value, locale.value)
+</script>
+<template>
+ <CfCard class="p-5 sm:p-6">
+ <div class="flex items-center justify-between gap-4">
+ <div class="flex items-center gap-3">
+ <div
+ class="flex size-9 items-center justify-center rounded-md bg-muted text-muted"
+ >
+ <UIcon
+ name="i-lucide-hard-drive"
+ class="size-5"
+ />
+ </div>
+ <h2 class="text-sm font-semibold">
+ {{ t('cloud.messages.platformStorage') }}
+ </h2>
+ </div>
+ <UBadge
+ v-if="allowance"
+ color="neutral"
+ variant="subtle"
+ >{{ allowance.plan.name }}</UBadge
+ ><USkeleton
+ v-else
+ class="h-5 w-16"
+ />
+ </div>
+ <div
+ v-if="allowance"
+ class="mt-5 grid gap-3"
+ >
+ <p class="text-xs text-muted">{{ t('cloud.storageAllowance.used') }}</p>
+ <div
+ class="flex flex-wrap items-baseline justify-between gap-x-5 gap-y-2"
+ >
+ <div class="flex flex-wrap items-baseline gap-x-2 gap-y-1">
+ <strong class="text-2xl font-semibold tabular-nums">{{
+ bytes(used)
+ }}</strong
+ ><span class="text-sm text-muted">{{
+ t('cloud.dashboard.ofLimit', { limit: bytes(total) })
+ }}</span>
+ </div>
+ <span class="text-xs text-muted tabular-nums">{{
+ t('cloud.billing.remaining', {
+ value: bytes(Math.max(0, total - used)),
+ })
+ }}</span>
+ </div>
+ <CfProgress
+ :value="percent"
+ :aria-label="t('cloud.messages.platformStorage')"
+ />
+ <p
+ v-if="used > total"
+ class="text-xs text-error"
+ >
+ {{ t('cloud.billing.overQuota') }}
+ </p>
+ </div>
+ <p
+ v-else-if="error"
+ role="status"
+ class="mt-5 text-sm text-muted"
+ >
+ {{ t('cloud.dashboard.quotaUnavailable') }}
+ </p>
+ <div
+ v-else
+ class="mt-5 grid gap-3"
+ aria-busy="true"
+ >
+ <USkeleton class="h-7 w-44" /><USkeleton class="h-1 w-full" />
+ </div>
+ </CfCard>
+</template>
diff --git a/apps/cloud/app/components/CloudSiteSettings.vue b/apps/cloud/app/components/CloudSiteSettings.vue
index f9831537..2ede7645 100644
--- a/apps/cloud/app/components/CloudSiteSettings.vue
+++ b/apps/cloud/app/components/CloudSiteSettings.vue
@@ -9,6 +9,11 @@ const { t } = useI18n()
const props = defineProps<{ siteId: number }>()
const context = useEntryContext()
+const iconInput = useTemplateRef<{ inputRef: HTMLInputElement }>('iconInput')
+const presentationChoiceUi = {
+ fieldset: 'flex-wrap gap-2',
+ item: 'min-h-[var(--cf-control-height)] items-center px-3 py-1.5 pointer-coarse:min-h-11',
+}
const {
data,
error: loadError,
@@ -259,12 +264,16 @@ async function save() {
width="64"
height="64"
class="cf-gallery-icon"
- /><label
- for="gallery-icon"
- class="cf-icon-picker"
- >{{ $t('cloud.ui.chooseIcon') }}</label
- ><UInput
- class="cf-icon-file"
+ /><CfButton
+ variant="secondary"
+ class="justify-self-start"
+ :disabled="busy || iconBusy"
+ @click="iconInput?.inputRef.click()"
+ >{{ $t('cloud.ui.chooseIcon') }}</CfButton
+ >
+ <UInput
+ ref="iconInput"
+ class="hidden"
id="gallery-icon"
type="file"
accept="image/png,image/jpeg,image/webp"
@@ -277,7 +286,7 @@ async function save() {
<CfButton
v-if="profile.avatarUrl"
variant="secondary"
- size="sm"
+ class="justify-self-start"
:disabled="busy || iconBusy"
@click="profile.avatarUrl = ''"
>{{ $t('cloud.messages.removeIcon') }}</CfButton
@@ -301,6 +310,8 @@ async function save() {
:aria-label="$t('cloud.presentation.theme')"
orientation="horizontal"
variant="card"
+ size="sm"
+ :ui="presentationChoiceUi"
:items="
(['light', 'dark', 'system'] as const).map((value) => ({
value,
@@ -320,6 +331,8 @@ async function save() {
:aria-label="$t('cloud.presentation.layout')"
orientation="horizontal"
variant="card"
+ size="sm"
+ :ui="presentationChoiceUi"
:items="
(['embedded', 'fixed'] as const).map((value) => ({
value,
diff --git a/apps/cloud/app/pages/analytics.vue b/apps/cloud/app/pages/analytics.vue
index 9569e2a1..fe260d67 100644
--- a/apps/cloud/app/pages/analytics.vue
+++ b/apps/cloud/app/pages/analytics.vue
@@ -120,6 +120,7 @@ await load()
type="button"
variant="secondary"
:disabled="loading"
+ size="icon"
:aria-label="tr('Refresh', '刷新')"
:title="tr('Refresh', '刷新')"
@click="refreshRange"
diff --git a/apps/cloud/app/pages/sites/[siteId]/domains.vue b/apps/cloud/app/pages/sites/[siteId]/domains.vue
index ac1a5cd3..efdd9bd8 100644
--- a/apps/cloud/app/pages/sites/[siteId]/domains.vue
+++ b/apps/cloud/app/pages/sites/[siteId]/domains.vue
@@ -349,15 +349,6 @@ async function copy(value: string) {
}}
</p>
</section>
- <details
- v-if="data.legacyHostname"
- class="cf-domain-technical"
- >
- <summary>{{ t('cloud.domainFlow.previousAddress') }}</summary>
- <p class="cf-field-hint">
- {{ t('cloud.domains.legacy', { hostname: data.legacyHostname }) }}
- </p>
- </details>
</template>
<UModal
v-model:open="addOpen"
diff --git a/apps/cloud/app/pages/sites/[siteId]/storage.vue b/apps/cloud/app/pages/sites/[siteId]/storage.vue
index ab644ade..85b03634 100644
--- a/apps/cloud/app/pages/sites/[siteId]/storage.vue
+++ b/apps/cloud/app/pages/sites/[siteId]/storage.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
const { t } = useI18n()
-const { allowance } = useCloudSiteMedia()
+const { allowance, loadError } = useCloudSiteMedia()
definePageMeta({ layout: 'portal' })
useSeoMeta({
@@ -18,17 +18,10 @@ useSeoMeta({
</p>
</div>
</div>
- <CfCard
- ><div class="cf-panel-heading">
- <h2>{{ $t('cloud.messages.platformStorage') }}</h2>
- <CfBadge>{{ allowance?.plan.name ?? '—' }}</CfBadge>
- <p>{{ $t('cloud.storageAllowance.description') }}</p>
- <p v-if="allowance">
- {{ (allowance.storageBytes / 1048576).toFixed(1) }} MiB /
- {{ (allowance.limits.storageBytes! / 1048576).toFixed(0) }} MiB
- </p>
- </div></CfCard
- >
+ <CloudPlatformStorageCard
+ :allowance="allowance"
+ :error="loadError"
+ />
<CloudStorageSettings />
</div>
</template>
diff --git a/apps/cloud/i18n/locales/en.json b/apps/cloud/i18n/locales/en.json
index de73ee98..bd2b6362 100644
--- a/apps/cloud/i18n/locales/en.json
+++ b/apps/cloud/i18n/locales/en.json
@@ -607,6 +607,7 @@
"checksPaused": "Checks are paused for this domain."
},
"storageAllowance": {
+ "used": "Used storage",
"description": "Storage is provided by your plan. Empty galleries are published automatically; uploading photographs is optional.",
"fileLimit": "Up to {size} MiB per photograph, including its paired video.",
"noCustomDomains": "Your plan does not include custom domains. Your default site address remains available.",
diff --git a/apps/cloud/i18n/locales/zh-Hans.json b/apps/cloud/i18n/locales/zh-Hans.json
index e43b5714..c5a1f023 100644
--- a/apps/cloud/i18n/locales/zh-Hans.json
+++ b/apps/cloud/i18n/locales/zh-Hans.json
@@ -607,6 +607,7 @@
"checksPaused": "已暂停此域名的状态检查。"
},
"storageAllowance": {
+ "used": "已用空间",
"description": "按套餐提供平台存储。创建站点后自动发布,上传照片不是发布前置条件。",
"fileLimit": "每张照片最大 {size} MiB(包含配对视频)",
"noCustomDomains": "当前套餐不包含自定义域名,你仍可使用站点的默认地址。",
diff --git a/packages/saas-ui/app/app.config.ts b/packages/saas-ui/app/app.config.ts
index 7927e364..7a5683c3 100644
--- a/packages/saas-ui/app/app.config.ts
+++ b/packages/saas-ui/app/app.config.ts
@@ -50,7 +50,26 @@ export default defineAppConfig({
},
},
textarea: { slots: { root: 'w-full', base: 'pointer-coarse:text-base' } },
- button: { slots: { base: 'cursor-pointer rounded-md font-medium' } },
+ button: {
+ slots: {
+ base: 'cursor-pointer rounded-md font-medium whitespace-nowrap shrink-0',
+ },
+ variants: {
+ size: {
+ md: {
+ base: 'min-h-[var(--cf-control-height)] pointer-coarse:min-h-11',
+ },
+ },
+ },
+ compoundVariants: [
+ {
+ size: 'md',
+ square: true,
+ class:
+ 'size-[var(--cf-control-height)] pointer-coarse:size-11 p-0 justify-center',
+ },
+ ],
+ },
modal: {
variants: { overlay: { true: { overlay: 'bg-black/55' } } },
slots: {
@@ -75,11 +94,15 @@ export default defineAppConfig({
variants: {
variant: {
outline: {
- root: 'bg-elevated ring ring-default divide-y divide-default',
+ root: 'bg-[var(--card)] ring ring-default divide-y divide-default',
+ },
+ soft: { root: 'bg-[var(--card)] divide-y divide-default' },
+ subtle: {
+ root: 'bg-[var(--card)] ring ring-default divide-y divide-default',
},
// Compatibility for inherited gallery/console surfaces, without glass.
glassmorphism: {
- root: 'bg-default ring ring-default rounded-lg divide-y divide-default',
+ root: 'bg-[var(--card)] ring ring-default rounded-lg divide-y divide-default',
header: 'p-4 font-medium',
body: 'p-4',
footer: 'p-4',
diff --git a/packages/saas-ui/app/components/CfAnalyticsRange.vue b/packages/saas-ui/app/components/CfAnalyticsRange.vue
index 258555f3..f1eb1f26 100644
--- a/packages/saas-ui/app/components/CfAnalyticsRange.vue
+++ b/packages/saas-ui/app/components/CfAnalyticsRange.vue
@@ -295,19 +295,22 @@ function changeZone() {
{{ error }}
</p>
<footer class="cf-range-footer">
- <CfSelect
- v-model="utc"
- class="cf-input"
- :aria-label="tr('Time zone', '时区')"
- @change="changeZone"
- >
- <option :value="false">
- {{
- zoneLabel === 'UTC' ? tr('Local time', '本地时间') : zoneLabel
- }}
- </option>
- <option :value="true">UTC</option></CfSelect
- ><CfButton
+ <div class="cf-range-zone">
+ <CfSelect
+ v-model="utc"
+ class="cf-input"
+ :aria-label="tr('Time zone', '时区')"
+ @change="changeZone"
+ >
+ <option :value="false">
+ {{
+ zoneLabel === 'UTC' ? tr('Local time', '本地时间') : zoneLabel
+ }}
+ </option>
+ <option :value="true">UTC</option></CfSelect
+ >
+ </div>
+ <CfButton
type="button"
@click="apply"
>{{ tr('Apply', '应用') }}</CfButton
@@ -386,20 +389,16 @@ function changeZone() {
font-size: 12px;
}
.cf-range-footer {
- display: flex;
- justify-content: space-between;
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
gap: 16px;
padding: 12px 16px;
border-top: 1px solid var(--border);
background: var(--background);
}
-.cf-range-footer .cf-select {
- width: auto;
- max-width: 70%;
- font-size: 12px;
- border: 0;
- background: transparent;
+.cf-range-zone {
+ min-width: 0;
}
.cf-range-error {
font-size: 12px;