From c96dbec86e0006b77e3b0939e63cddece9fecccd Mon Sep 17 00:00:00 2001 From: JiPai Date: Sun, 8 Feb 2026 18:01:18 +0800 Subject: [PATCH 1/2] chore: update README --- README.md | 2 +- README.zh.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4059fed..a73b954 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@
[![Better Stack Badge](https://uptime.betterstack.com/status-badges/v1/monitor/vz4h.svg)](https://uptime.betterstack.com/?utm_source=status_badge) -[![Build CN Image](https://github.com/FurryConsChina/website/actions/workflows/build-cn-image.yml/badge.svg)](https://github.com/FurryConsChina/website/actions/workflows/build-cn-image.yml) +[![Deploy to CN Production](https://github.com/FurryConsChina/website/actions/workflows/deploy-prod-cn.yml/badge.svg)](https://github.com/FurryConsChina/website/actions/workflows/deploy-prod-cn.yml) [![RelativeCI](https://badges.relative-ci.com/badges/tUU1QJHvaWj6oY0ysuih?branch=main&style=flat)](https://app.relative-ci.com/projects/tUU1QJHvaWj6oY0ysuih)
diff --git a/README.zh.md b/README.zh.md index b22f0c0..b1fe564 100644 --- a/README.zh.md +++ b/README.zh.md @@ -3,7 +3,7 @@
[![Better Stack Badge](https://uptime.betterstack.com/status-badges/v1/monitor/vz4h.svg)](https://uptime.betterstack.com/?utm_source=status_badge) -[![Build CN Image](https://github.com/FurryConsChina/website/actions/workflows/build-cn-image.yml/badge.svg)](https://github.com/FurryConsChina/website/actions/workflows/build-cn-image.yml) +[![Deploy to CN Production](https://github.com/FurryConsChina/website/actions/workflows/deploy-prod-cn.yml/badge.svg)](https://github.com/FurryConsChina/website/actions/workflows/deploy-prod-cn.yml) [![RelativeCI](https://badges.relative-ci.com/badges/tUU1QJHvaWj6oY0ysuih?branch=main&style=flat)](https://app.relative-ci.com/projects/tUU1QJHvaWj6oY0ysuih)
From d0a22ed00f85c6174f839cd3b43890c16a4f7202 Mon Sep 17 00:00:00 2001 From: JiPai Date: Sun, 8 Feb 2026 18:01:36 +0800 Subject: [PATCH 2/2] feat: reduce init payload --- src/components/SimpleEventCard/index.tsx | 4 ++-- src/pages/[organization]/index.tsx | 30 ++++++++++++++++++------ src/pages/organization.tsx | 14 +++++++---- src/pages/years.tsx | 16 ++++++++++--- src/types/event.ts | 11 +++++++++ src/types/organization.ts | 8 +++++++ 6 files changed, 67 insertions(+), 16 deletions(-) diff --git a/src/components/SimpleEventCard/index.tsx b/src/components/SimpleEventCard/index.tsx index 7587d82..4a89d97 100644 --- a/src/components/SimpleEventCard/index.tsx +++ b/src/components/SimpleEventCard/index.tsx @@ -3,11 +3,11 @@ import Link from "next/link"; import dayjs from "dayjs"; import "dayjs/locale/zh-cn"; import "dayjs/locale/zh-tw"; -import { EventItem } from "@/types/event"; +import { SimpleEventItem } from "@/types/event"; import { useTranslation } from "next-i18next"; import { getDayjsLocale } from "@/utils/locale"; -function SimpleEventCard({ event }: { event: EventItem }) { +function SimpleEventCard({ event }: { event: SimpleEventItem }) { const { t, i18n } = useTranslation(); const dateFormat = t("date.monthDay") || "MM月DD日"; const dayjsLocale = getDayjsLocale(i18n.language); diff --git a/src/pages/[organization]/index.tsx b/src/pages/[organization]/index.tsx index b2e2b81..0bc77ee 100644 --- a/src/pages/[organization]/index.tsx +++ b/src/pages/[organization]/index.tsx @@ -17,7 +17,7 @@ import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import { useTranslation } from "next-i18next"; import { OrganizationsAPI } from "@/api/organizations"; import * as z from "zod/v4"; -import { EventItem } from "@/types/event"; +import { EventCardItem } from "@/types/event"; import { OrganizationSchema, Organization } from "@/types/organization"; import { FeatureSchema } from "@/types/feature"; import { keywordGenerator, organizationDetailDescriptionGenerator, OrganizationPageMeta } from "@/utils/meta"; @@ -36,7 +36,7 @@ import axios, { AxiosError } from "axios"; dayjs.extend(relativeTime); -export default function OrganizationDetail(props: { events: EventItem[]; organization: Organization }) { +export default function OrganizationDetail(props: { events: EventCardItem[]; organization: Organization }) { const { t, i18n } = useTranslation(); const { organization, events } = props; const dayjsLocale = getDayjsLocale(i18n.language); @@ -302,15 +302,31 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { const data = await OrganizationsAPI.getOrganizationDetail(reqParamsParseResult.organization); const validOrganization = data.organization; - const validEvents = + const validEvents: EventCardItem[] = data.events ?.map((e) => ({ - ...e, + id: e.id, + slug: e.slug, + name: e.name, + startAt: e.startAt, + endAt: e.endAt, + scale: e.scale, + type: e.type, + locationType: e.locationType, + address: e.address, + region: e.region ? { localName: e.region.localName } : null, organization: { - name: validOrganization?.name, - slug: validOrganization?.slug, - logoUrl: validOrganization?.logoUrl, + slug: validOrganization?.slug || "", + name: validOrganization?.name || "", }, + features: e.features ? { self: e.features.self ?? null } : null, + commonFeatures: e.commonFeatures + ? e.commonFeatures.map((f) => ({ name: f.name })) + : null, + thumbnail: e.thumbnail ?? null, + media: e.media?.images + ? { images: e.media.images.map((img) => ({ url: img.url })) } + : null, })) .sort((a, b) => { if (a.startAt && b.startAt) { diff --git a/src/pages/organization.tsx b/src/pages/organization.tsx index 9bc2967..cd4a384 100644 --- a/src/pages/organization.tsx +++ b/src/pages/organization.tsx @@ -6,12 +6,12 @@ import { sendTrack } from "@/utils/track"; import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import { useTranslation } from "next-i18next"; import { OrganizationsAPI } from "@/api/organizations"; -import { Organization } from "@/types/organization"; +import { OrganizationListItem } from "@/types/organization"; import { OrganizationPageMeta } from "@/utils/meta"; import { currentSupportLocale } from "@/utils/locale"; import { breadcrumbGenerator } from "@/utils/structuredData"; -export default function OrganizationPage({ organizations }: { organizations: Organization[] }) { +export default function OrganizationPage({ organizations }: { organizations: OrganizationListItem[] }) { const groupByStatusOrganizations = groupBy(organizations, (o) => o.status); const { t } = useTranslation(); @@ -37,7 +37,7 @@ export default function OrganizationPage({ organizations }: { organizations: Org ); } -function OrganizationItem({ organization }: { organization: Organization }) { +function OrganizationItem({ organization }: { organization: OrganizationListItem }) { const { t } = useTranslation(); return ( @@ -95,7 +95,13 @@ export async function getStaticProps({ locale }: { locale: string }) { return { props: { - organizations: organizations.records, + organizations: organizations.records.map((organization) => ({ + id: organization.id, + slug: organization.slug, + name: organization.name, + status: organization.status, + logoUrl: organization.logoUrl, + })), headMetas: { title: OrganizationPageMeta[locale as currentSupportLocale].title, des: OrganizationPageMeta[locale as currentSupportLocale].description(organizations.total), diff --git a/src/pages/years.tsx b/src/pages/years.tsx index b0c879c..6764179 100644 --- a/src/pages/years.tsx +++ b/src/pages/years.tsx @@ -3,13 +3,13 @@ import SimpleEventCard from "@/components/SimpleEventCard"; import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import { useTranslation } from "next-i18next"; import { EventsAPI } from "@/api/events"; -import { EventItem } from "@/types/event"; +import { SimpleEventItem } from "@/types/event"; import { monthNumberFormatter } from "@/utils/locale"; import { YearPageMeta } from "@/utils/meta"; import { currentSupportLocale } from "@/utils/locale"; import { breadcrumbGenerator } from "@/utils/structuredData"; -export default function Years({ events }: { events: EventItem[] }) { +export default function Years({ events }: { events: SimpleEventItem[] }) { const groupByYearEvents = eventGroupByYear(events, "asc"); const { t, i18n } = useTranslation(); @@ -76,10 +76,20 @@ export async function getStaticProps({ locale }: { locale: string }) { current: "1", pageSize: "999", }); + const slimEvents: SimpleEventItem[] = events.records.map((event) => ({ + id: event.id, + slug: event.slug, + name: event.name, + startAt: event.startAt, + endAt: event.endAt, + scale: event.scale, + region: event.region ? { localName: event.region.localName } : null, + organization: event.organization ? { slug: event.organization.slug, name: event.organization.name } : null, + })); return { props: { - events: events.records, + events: slimEvents, headMetas: { title: YearPageMeta[locale as currentSupportLocale].title, des: YearPageMeta[locale as currentSupportLocale].description(12, events.total || 0), diff --git a/src/types/event.ts b/src/types/event.ts index 76b7da7..0e4cf32 100644 --- a/src/types/event.ts +++ b/src/types/event.ts @@ -182,3 +182,14 @@ export type EventCardItem = { thumbnail?: string | null; media?: { images?: { url: string }[] } | null; }; + +export type SimpleEventItem = { + id: string; + slug: string; + name: string; + startAt: string | null; + endAt: string | null; + scale: string; + region: { localName: string | null } | null; + organization: { slug: string; name: string } | null; +}; diff --git a/src/types/organization.ts b/src/types/organization.ts index ca0f437..626bdf9 100644 --- a/src/types/organization.ts +++ b/src/types/organization.ts @@ -28,3 +28,11 @@ export const OrganizationSchema = z.object({ }); export type Organization = z.infer; + +export type OrganizationListItem = { + id: string; + slug: string; + name: string; + status: string; + logoUrl: string | null; +};