From 662b12c612f51e33d23daf34c4d73c2d0a4952dc Mon Sep 17 00:00:00 2001 From: toom1996 Date: Sun, 30 Aug 2026 22:49:56 +0800 Subject: [PATCH] update --- .workbuddy/memory/2026-08-30.md | 43 +++++++++++++++++++++++ .workbuddy/memory/MEMORY.md | 15 ++++++-- _tmp_build.log | 48 +++++++++++++------------- src/components/Index.astro | 38 +++----------------- src/components/RunwayLooks.astro | 4 +++ src/components/StreetSnaps.astro | 59 ++++++++++++++++++++++++++++++-- src/i18n/dictionary.ts | 37 +++++++++++++++----- src/layouts/Layout.astro | 49 ++++++++++++++++++-------- src/lib/api.ts | 4 ++- src/lib/routes.ts | 3 -- 10 files changed, 210 insertions(+), 90 deletions(-) create mode 100644 .workbuddy/memory/2026-08-30.md diff --git a/.workbuddy/memory/2026-08-30.md b/.workbuddy/memory/2026-08-30.md new file mode 100644 index 0000000..b816ca7 --- /dev/null +++ b/.workbuddy/memory/2026-08-30.md @@ -0,0 +1,43 @@ +# 2026-08-30 工作日志 + +## 首页 Street Style 图片过大调整(11:33) +- 用户反馈首页 Street Style 区块图片太大。定位到 `src/components/Index.astro` 的 ` + @@ -193,11 +233,13 @@ const sortOptions: { value: string; label: string }[] = [ SPIN_SVG, yearOptions: opts.yearOptions || [], sortOptions: opts.sortOptions || [], + cityOptions: opts.cityOptions || [], selectedYear: '' as string, selectedSort: DEFAULT_SORT as string, + selectedCity: '' as string, // 侧栏分组折叠状态:默认全部收起(不做持久化,每次进页都是关着的) - collapsedGroups: { year: true, sort: true } as Record, + collapsedGroups: { year: true, sort: true, city: true } as Record, items: [] as (StreetSnapItem & { _imgLoaded?: boolean })[], loading: false, @@ -207,6 +249,10 @@ const sortOptions: { value: string; label: string }[] = [ init() { this.locale = this.$el.dataset.locale || 'en' + // 支持从 header 下拉深链 ?city=xxx 直接进入对应地区(与侧栏 City 筛选一致) + const city = new URLSearchParams(window.location.search).get('city') + const allowed = (this.cityOptions || []).map((c: any) => c.value) + if (city && allowed.includes(city)) this.selectedCity = city this.loadPage(1) }, @@ -217,6 +263,7 @@ const sortOptions: { value: string; label: string }[] = [ clearAll() { this.selectedYear = '' this.selectedSort = DEFAULT_SORT + this.selectedCity = '' this.loadPage(1) }, @@ -237,6 +284,13 @@ const sortOptions: { value: string; label: string }[] = [ clear: () => { this.selectedSort = DEFAULT_SORT; this.loadPage(1) }, }) } + if (this.selectedCity) { + const hit = this.cityOptions.find((o: any) => o.value === this.selectedCity) + out.push({ + label: "CITY · " + (hit ? hit.label : this.selectedCity), + clear: () => { this.selectedCity = ''; this.loadPage(1) }, + }) + } return out }, @@ -255,6 +309,7 @@ const sortOptions: { value: string; label: string }[] = [ const json = await getStreetSnaps({ page, year: this.selectedYear || undefined, + city: this.selectedCity || undefined, sort: this.selectedSort, }) if (myToken !== this.reqToken) return diff --git a/src/i18n/dictionary.ts b/src/i18n/dictionary.ts index 6e712d5..a2b6cc0 100644 --- a/src/i18n/dictionary.ts +++ b/src/i18n/dictionary.ts @@ -21,24 +21,23 @@ export const dict: Record = { // ── 导航 / Navigation ── - 'about': { cn: '关于' }, - '全部的 runway': { cn: '全部的 runway' }, - 'contact': { cn: '联系' }, - - 'contact us': { cn: '联系我们' }, - 'home': { cn: '首页' }, - 'latest projects': { cn: '最新项目' }, - 'login': { cn: '登录' }, 'portfolio': { cn: '作品集' }, 'runway archive': { cn: '走秀档案' }, + // ── Runway 子分类(header 下拉,与列表页 COLLECTION 筛选一致)── + 'ready-to-wear': { cn: '女装成衣' }, + 'menswear': { cn: '男装' }, + 'couture': { cn: '高级定制' }, + 'resort': { cn: '度假系列' }, + 'pre-fall': { cn: '早秋系列' }, + 'signup': { cn: '注册' }, // ── 控件 / Controls ── @@ -108,8 +107,28 @@ export const dict: Record = { 'no street snap id specified': { cn: '未指定街拍 ID' }, - 'failed to load street snap. please refresh or try later.': { cn: '加载街拍失败,请刷新或稍后再试' } + 'failed to load street snap. please refresh or try later.': { cn: '加载街拍失败,请刷新或稍后再试' }, + // ── 地区 / Cities(街拍按城市分类,值对齐后端 street_snap.city 列;translate 会小写化 key)── + 'city': { cn: '地区' }, + 'paris': { cn: '巴黎' }, + 'new york': { cn: '纽约' }, + 'milan': { cn: '米兰' }, + 'london': { cn: '伦敦' }, + 'copenhagen': { cn: '哥本哈根' }, + 'florence': { cn: '佛罗伦萨' }, + 'berlin': { cn: '柏林' }, + 'tokyo': { cn: '东京' }, + 'seoul': { cn: '首尔' }, + 'shanghai': { cn: '上海' }, + 'beijing': { cn: '北京' }, + 'rome': { cn: '罗马' }, + 'madrid': { cn: '马德里' }, + 'amsterdam': { cn: '阿姆斯特丹' }, + 'antwerp': { cn: '安特卫普' }, + 'los angeles': { cn: '洛杉矶' }, + 'moscow': { cn: '莫斯科' }, + 'mumbai': { cn: '孟买' }, }; /** 把 {name} 形式的占位符替换成参数值。 */ diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 5a77e7b..96e78c6 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -30,16 +30,23 @@ const pathWithoutLocale = locales.includes(pathName.split('/')[1]) // 顶部导航数据模型(替代原 Alpine x-data 的 menu/state)。 // 下拉菜单与语言列表均由此驱动渲染,逻辑用 Astro 原生