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): clarify site address and preview homepage layouts

Timothy Yin0f43a74f2342
diff --git a/apps/cloud/app/components/CloudHeaderLayoutChoice.vue b/apps/cloud/app/components/CloudHeaderLayoutChoice.vue
new file mode 100644
index 00000000..e7e0f864
--- /dev/null
+++ b/apps/cloud/app/components/CloudHeaderLayoutChoice.vue
@@ -0,0 +1,114 @@
+<script setup lang="ts">
+defineProps<{ disabled?: boolean }>()
+const model = defineModel<'embedded' | 'fixed'>({ required: true })
+const { t } = useI18n()
+const items = computed(() =>
+ (['embedded', 'fixed'] as const).map((value) => ({
+ value,
+ label: t('cloud.presentation.' + value),
+ })),
+)
+</script>
+
+<template>
+ <URadioGroup
+ v-model="model"
+ :disabled="disabled"
+ :aria-label="t('cloud.presentation.layout')"
+ :items="items"
+ orientation="horizontal"
+ variant="card"
+ size="sm"
+ :ui="{
+ root: 'w-full',
+ fieldset: 'grid grid-cols-2 gap-3',
+ item: 'relative min-w-0 p-3',
+ container: 'absolute bottom-3.5 left-3',
+ wrapper: 'w-full min-w-0',
+ label: 'block w-full',
+ }"
+ >
+ <template #label="{ item }">
+ <span class="flex flex-col gap-3">
+ <span
+ aria-hidden="true"
+ class="flex h-32 flex-col gap-2 overflow-hidden rounded border border-default bg-default p-2"
+ >
+ <span
+ v-if="item.value === 'fixed'"
+ class="flex items-center gap-2 border-b border-default pb-2"
+ >
+ <USkeleton
+ as="span"
+ class="size-5 shrink-0 animate-none rounded-full"
+ />
+ <span class="flex flex-1 flex-col gap-1">
+ <USkeleton
+ as="span"
+ class="h-1.5 w-1/2 animate-none"
+ />
+ <USkeleton
+ as="span"
+ class="h-1 w-1/3 animate-none"
+ />
+ </span>
+ <USkeleton
+ as="span"
+ class="h-2 w-5 animate-none"
+ />
+ </span>
+ <span class="grid flex-1 grid-cols-3 items-start gap-1.5">
+ <span class="flex flex-col gap-1.5">
+ <span
+ v-if="item.value === 'embedded'"
+ class="flex h-16 flex-col items-center justify-center gap-1.5 rounded bg-elevated/50"
+ >
+ <USkeleton
+ as="span"
+ class="size-5 animate-none rounded-full"
+ />
+ <USkeleton
+ as="span"
+ class="h-1.5 w-3/4 animate-none"
+ />
+ <USkeleton
+ as="span"
+ class="h-1 w-1/2 animate-none"
+ />
+ </span>
+ <USkeleton
+ as="span"
+ class="h-11 w-full animate-none rounded-sm"
+ />
+ <USkeleton
+ as="span"
+ class="h-12 w-full animate-none rounded-sm"
+ />
+ </span>
+ <span class="flex flex-col gap-1.5">
+ <USkeleton
+ as="span"
+ class="h-12 w-full animate-none rounded-sm"
+ />
+ <USkeleton
+ as="span"
+ class="h-16 w-full animate-none rounded-sm"
+ />
+ </span>
+ <span class="flex flex-col gap-1.5">
+ <USkeleton
+ as="span"
+ class="h-16 w-full animate-none rounded-sm"
+ />
+ <USkeleton
+ as="span"
+ class="h-11 w-full animate-none rounded-sm"
+ />
+ </span>
+ </span>
+ </span>
+ <span class="pl-6">{{ item.label }}</span>
+ </span>
+ </template>
+ </URadioGroup>
+</template>
diff --git a/apps/cloud/app/components/CloudSiteCreate.vue b/apps/cloud/app/components/CloudSiteCreate.vue
index 8140b535..8133d0cc 100644
--- a/apps/cloud/app/components/CloudSiteCreate.vue
+++ b/apps/cloud/app/components/CloudSiteCreate.vue
@@ -121,22 +121,37 @@ async function create() {
@submit.prevent="create"
>
<div class="cf-create-fields">
- <div class="cf-field">
- <label for="site-name">{{ $t('cloud.messages.siteName') }}</label
- ><CfInput
+ <UFormField
+ :label="$t('cloud.messages.siteName')"
+ name="name"
+ >
+ <CfInput
id="site-name"
v-model="name"
+ :placeholder="$t('cloud.messages.siteNamePlaceholder')"
required
maxlength="80"
autocomplete="off"
:disabled="busy"
/>
- </div>
- <div class="cf-field">
- <label for="site-slug">{{ $t('cloud.messages.siteAddress') }}</label
- ><CfInput
+ </UFormField>
+ <UFormField
+ :label="$t('cloud.messages.siteAddress')"
+ :help="
+ $t('cloud.messages.use340LowercaseLettersNumbersOrHyphensSome')
+ "
+ name="slug"
+ >
+ <UInput
id="site-slug"
v-model="slug"
+ class="w-full"
+ :style="{ '--site-domain-width': `${siteBaseDomain.length + 1}ch` }"
+ :ui="{
+ base: 'font-mono pe-[calc(var(--site-domain-width)+1.5rem)]',
+ trailing: 'pointer-events-none',
+ }"
+ placeholder="your-site"
required
minlength="3"
maxlength="40"
@@ -144,23 +159,16 @@ async function create() {
autocomplete="off"
autocapitalize="none"
spellcheck="false"
- aria-describedby="site-address-help site-address-preview"
:disabled="busy"
- />
- </div>
+ >
+ <template #trailing>
+ <span class="font-mono text-sm text-muted"
+ >.{{ siteBaseDomain }}</span
+ >
+ </template>
+ </UInput>
+ </UFormField>
</div>
- <p
- id="site-address-preview"
- class="cf-address-preview"
- >
- {{ slug || 'your-site' }}.{{ siteBaseDomain }}
- </p>
- <p
- id="site-address-help"
- class="cf-field-hint"
- >
- {{ $t('cloud.messages.use340LowercaseLettersNumbersOrHyphensSome') }}
- </p>
<p
v-if="error"
role="alert"
diff --git a/apps/cloud/app/components/CloudSiteSettings.vue b/apps/cloud/app/components/CloudSiteSettings.vue
index 2ede7645..30fc1a7b 100644
--- a/apps/cloud/app/components/CloudSiteSettings.vue
+++ b/apps/cloud/app/components/CloudSiteSettings.vue
@@ -325,20 +325,9 @@ async function save() {
<p class="cf-field-hint">
{{ $t('cloud.presentation.layoutHelp') }}
</p>
- <URadioGroup
+ <CloudHeaderLayoutChoice
v-model="homeHeaderLayout"
:disabled="busy"
- :aria-label="$t('cloud.presentation.layout')"
- orientation="horizontal"
- variant="card"
- size="sm"
- :ui="presentationChoiceUi"
- :items="
- (['embedded', 'fixed'] as const).map((value) => ({
- value,
- label: $t('cloud.presentation.' + value),
- }))
- "
/>
</section>
<section class="cf-gallery-presentation">
diff --git a/apps/cloud/i18n/locales/en.json b/apps/cloud/i18n/locales/en.json
index bd2b6362..689b5c7f 100644
--- a/apps/cloud/i18n/locales/en.json
+++ b/apps/cloud/i18n/locales/en.json
@@ -132,6 +132,7 @@
"createASite": "Create a site",
"startWithAPrivateDraftYourAddressIsReserved": "Your site is published immediately after creation. No photographs or storage setup are required.",
"siteName": "Site name",
+ "siteNamePlaceholder": "My photo gallery",
"siteAddress": "Site address",
"use340LowercaseLettersNumbersOrHyphensSome": "Use 3–40 lowercase letters, numbers or hyphens. Some addresses are reserved. The address cannot be changed here.",
"viewSite": "View site",
diff --git a/apps/cloud/i18n/locales/zh-Hans.json b/apps/cloud/i18n/locales/zh-Hans.json
index c5a1f023..651c6b2d 100644
--- a/apps/cloud/i18n/locales/zh-Hans.json
+++ b/apps/cloud/i18n/locales/zh-Hans.json
@@ -132,6 +132,7 @@
"createASite": "创建站点",
"startWithAPrivateDraftYourAddressIsReserved": "创建后站点会立即发布,无需先上传照片或配置存储。",
"siteName": "站点名称",
+ "siteNamePlaceholder": "例如:我的摄影集",
"siteAddress": "站点地址",
"use340LowercaseLettersNumbersOrHyphensSome": "使用 3–40 个小写字母、数字或连字符。部分地址已被保留,此处暂不支持修改地址。",
"viewSite": "访问站点",