update
Some checks failed
deploy / deploy (push) Has been cancelled

This commit is contained in:
toom1996
2026-08-22 20:47:03 +08:00
parent 0df14036cf
commit c8d9735751
20 changed files with 228 additions and 125 deletions

View File

@ -1,27 +1,15 @@
---
import Layout from "@/layouts/Layout.astro"
import Article from "@/components/pages/article.astro"
import { fetchArticleById } from "@/lib/data"
import { getSsrArticle } from "@/lib/ssr"
// 按需 SSR:服务端按 ?id= 取数并渲染(保留既有 /cn/article?id= 链接,无需改动其他页面)
export const prerender = false
const API = (import.meta.env.API_SSR || import.meta.env.PUBLIC_API_BASE || "http://localhost:8090").replace(/\/$/, "")
const id = Astro.url.searchParams.get("id")
let article: import("@/lib/data").RawArticle | null = null
let error: "missing" | "failed" | null = null
if (!id) {
error = "missing"
} else {
try {
article = await fetchArticleById(id, API)
} catch {
article = null
}
error = article ? null : "failed"
}
const { article, error } = await getSsrArticle(id)
---
<Layout>
<Article article={article} locale="cn" apiBase={API} error={error} />
<Article article={article} locale="cn" error={error} />
</Layout>

View File

@ -2,7 +2,10 @@
import Layout from "@/layouts/Layout.astro"
import Breadcrumb from "@/components/Breadcrumb.astro"
import { getBrands, getYears, type BrandEntry } from "@/lib/api"
import { getI18n } from '@/i18n/utils'
import { clientHref, PATH, href } from '@/lib/routes'
const { locale } = getI18n(Astro)
let sidebarBrands: BrandEntry[] = []
let yearChips: number[] = []
@ -21,14 +24,14 @@ if (!yearChips.length) yearChips = yearSeed
---
<Layout title="All Shows — Portfolio Studio">
<div class="showsroot w-full" x-data="showsPage()">
<div class="showsroot w-full" x-data="showsPage()" data-locale={locale}>
<!-- 顶部:极简眉头 -->
<header class="showshead">
<div>
<Breadcrumb
items={[
{ label: 'Home', href: '/' },
{ label: 'Runway Archive', href: '/shows' },
{ label: 'Home', href: href(locale, PATH.home) },
{ label: 'Runway Archive', href: href(locale, PATH.shows) },
]}
>
<span slot="current" x-text="crumbYear">2026 Edition</span>
@ -187,7 +190,7 @@ if (!yearChips.length) yearChips = yearSeed
<!-- Card List -->
<template x-for="it in items" :key="it.id">
<a class="showscard" :href="`/article?id=${it.id}`" :aria-label="`${it.brand_name} ${it.title}`">
<a class="showscard" :href="articleHref(it)" :aria-label="`${it.brand_name} ${it.title}`">
<div class="showscard-left">
<div class="showscard-img" :class="{ 'is-loaded': it._imgLoaded }">
<span class="showsspin" aria-hidden="true" x-html="SPIN_SVG"></span>
@ -557,6 +560,7 @@ if (!yearChips.length) yearChips = yearSeed
return {
allBrands,
locale: '',
ICON_USER,
ICON_DATE,
SPIN_SVG,
@ -594,6 +598,7 @@ if (!yearChips.length) yearChips = yearSeed
reqToken: 0,
init() {
this.locale = this.$el.dataset.locale || 'en'
this.loadPage(1, false)
},
@ -826,6 +831,7 @@ if (!yearChips.length) yearChips = yearSeed
// 辅助辅助工具函数
toAbsUrl(url: string) { return toAbs(url) },
articleHref(it: { id: string | number }) { return clientHref(this.locale, PATH.article(it.id)) },
isNewAdded(pubAt?: number) { return Date.now() / 1000 - Number(pubAt || 0) < 60 * 60 * 24 * 14 },
fmtDate(ts: number) {
if (!ts) return ""

View File

@ -1,27 +1,15 @@
---
import Layout from "@/layouts/Layout.astro"
import Article from "@/components/pages/article.astro"
import { fetchArticleById } from "@/lib/data"
import { getSsrArticle } from "@/lib/ssr"
// 按需 SSR:服务端按 ?id= 取数并渲染(保留既有 /en/article?id= 链接,无需改动其他页面)
export const prerender = false
const API = (import.meta.env.API_SSR || import.meta.env.PUBLIC_API_BASE || "http://localhost:8090").replace(/\/$/, "")
const id = Astro.url.searchParams.get("id")
let article: import("@/lib/data").RawArticle | null = null
let error: "missing" | "failed" | null = null
if (!id) {
error = "missing"
} else {
try {
article = await fetchArticleById(id, API)
} catch {
article = null
}
error = article ? null : "failed"
}
const { article, error } = await getSsrArticle(id)
---
<Layout>
<Article article={article} locale="en" apiBase={API} error={error} />
<Article article={article} locale="en" error={error} />
</Layout>

View File

@ -1,29 +1,15 @@
---
import Layout from "@/layouts/Layout.astro"
import RunwayLookDetail from "@/components/RunwayLooksDetail.astro"
import { fetchArticleById } from "@/lib/data"
import { getSsrArticle } from "@/lib/ssr"
// 按需 SSR:服务端按 ?id= 取数并渲染(保留既有 /en/article?id= 链接,无需改动其他页面)
// 按需 SSR:服务端按 ?id= 取数并渲染(保留既有 /en/items/:id 链接,无需改动其他页面)
export const prerender = false
const API = ("http://localhost:8090").replace(/\/$/, "")
const {id} = Astro.params
let article: import("@/lib/data").RawArticle | null = null
let error: "missing" | "failed" | null = null
console.log(id)
if (!id) {
error = "missing"
} else {
try {
article = await fetchArticleById(id, API)
console.log(article)
} catch {
article = null
}
error = article ? null : "failed"
}
const { id } = Astro.params
const { article, error } = await getSsrArticle(id)
---
<Layout>
<RunwayLookDetail article={article} apiBase={API} error={error} />
<RunwayLookDetail article={article} error={error} />
</Layout>

View File

@ -2,7 +2,10 @@
import Layout from "@/layouts/Layout.astro"
import Breadcrumb from "@/components/Breadcrumb.astro"
import { getBrands, getYears, type BrandEntry } from "@/lib/api"
import { getI18n } from '@/i18n/utils'
import { clientHref, PATH, href } from '@/lib/routes'
const { locale } = getI18n(Astro)
let sidebarBrands: BrandEntry[] = []
let yearChips: number[] = []
@ -30,14 +33,14 @@ if (!yearChips.length) yearChips = yearSeed
} catch (e) {}
</script>
<div class="showsroot w-full" x-data="showsPage()">
<div class="showsroot w-full" x-data="showsPage()" data-locale={locale}>
<!-- 顶部:极简眉头 -->
<header class="showshead">
<div>
<Breadcrumb
items={[
{ label: 'Home', href: '/' },
{ label: 'Runway Archive', href: '/shows' },
{ label: 'Home', href: href(locale, PATH.home) },
{ label: 'Runway Archive', href: href(locale, PATH.shows) },
]}
>
<span slot="current" x-text="crumbYear">2026 Edition</span>
@ -201,7 +204,7 @@ if (!yearChips.length) yearChips = yearSeed
<!-- Card List -->
<template x-for="it in items" :key="it.id">
<a class="showscard" :href="`/article?id=${it.id}`" :aria-label="`${it.brand_name} ${it.title}`">
<a class="showscard" :href="articleHref(it)" :aria-label="`${it.brand_name} ${it.title}`">
<div class="showscard-left">
<div class="showscard-img" :class="{ 'is-loaded': it._imgLoaded }">
<span class="showsspin" aria-hidden="true" x-html="SPIN_SVG"></span>
@ -486,6 +489,7 @@ if (!yearChips.length) yearChips = yearSeed
return {
allBrands,
locale: '',
ICON_USER,
ICON_DATE,
SPIN_SVG,
@ -513,6 +517,7 @@ if (!yearChips.length) yearChips = yearSeed
reqToken: 0,
init() {
this.locale = this.$el.dataset.locale || 'en'
this.loadPage(1, false)
},
@ -684,6 +689,7 @@ if (!yearChips.length) yearChips = yearSeed
// 辅助辅助工具函数
toAbsUrl(url: string) { return toAbs(url) },
articleHref(it: { id: string | number }) { return clientHref(this.locale, PATH.article(it.id)) },
isNewAdded(pubAt?: number) { return Date.now() / 1000 - Number(pubAt || 0) < 60 * 60 * 24 * 14 },
fmtDate(ts: number) {
if (!ts) return ""