feat: init blog repo
@@ -0,0 +1,10 @@
|
||||
node_modules/
|
||||
.next/
|
||||
out/
|
||||
.DS_Store
|
||||
*.log
|
||||
.env*
|
||||
.pnp
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
tsconfig.tsbuildinfo
|
||||
|
After Width: | Height: | Size: 370 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 182 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 275 KiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 339 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 727 KiB |
|
After Width: | Height: | Size: 908 KiB |
|
After Width: | Height: | Size: 3.1 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 873 KiB |
@@ -0,0 +1,26 @@
|
||||
import { defineConfig, globalIgnores } from "eslint/config";
|
||||
import nextVitals from "eslint-config-next/core-web-vitals";
|
||||
import nextTs from "eslint-config-next/typescript";
|
||||
|
||||
const eslintConfig = defineConfig([
|
||||
...nextVitals,
|
||||
...nextTs,
|
||||
{
|
||||
rules: {
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"react-hooks/set-state-in-effect": "off",
|
||||
"react-hooks/exhaustive-deps": "off",
|
||||
"@typescript-eslint/no-unused-vars": "warn",
|
||||
}
|
||||
},
|
||||
// Override default ignores of eslint-config-next.
|
||||
globalIgnores([
|
||||
// Default ignores of eslint-config-next:
|
||||
".next/**",
|
||||
"out/**",
|
||||
"build/**",
|
||||
"next-env.d.ts",
|
||||
]),
|
||||
]);
|
||||
|
||||
export default eslintConfig;
|
||||
@@ -0,0 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
images: {
|
||||
unoptimized: true,
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: "https",
|
||||
hostname: "images.unsplash.com",
|
||||
},
|
||||
{
|
||||
protocol: "http",
|
||||
hostname: "localhost",
|
||||
port: "8080",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "my_house",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@phosphor-icons/react": "^2.1.10",
|
||||
"@types/leaflet": "^1.9.21",
|
||||
"axios": "^1.18.1",
|
||||
"framer-motion": "^12.40.0",
|
||||
"gsap": "^3.15.0",
|
||||
"highlight.js": "^11.11.1",
|
||||
"leaflet": "^1.9.4",
|
||||
"lenis": "^1.3.23",
|
||||
"lucide-react": "^1.21.0",
|
||||
"next": "16.2.9",
|
||||
"ogl": "^1.0.11",
|
||||
"react": "19.2.4",
|
||||
"react-dom": "19.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "16.2.9",
|
||||
"tailwindcss": "^4",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
const config = {
|
||||
plugins: {
|
||||
"@tailwindcss/postcss": {},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
After Width: | Height: | Size: 830 KiB |
|
After Width: | Height: | Size: 816 KiB |
|
After Width: | Height: | Size: 778 KiB |
|
After Width: | Height: | Size: 748 KiB |
|
After Width: | Height: | Size: 605 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 182 KiB |
|
After Width: | Height: | Size: 820 KiB |
|
After Width: | Height: | Size: 697 KiB |
|
After Width: | Height: | Size: 793 KiB |
|
After Width: | Height: | Size: 786 KiB |
|
After Width: | Height: | Size: 822 KiB |
|
After Width: | Height: | Size: 790 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 651 KiB |
|
After Width: | Height: | Size: 804 KiB |
|
After Width: | Height: | Size: 894 KiB |
|
After Width: | Height: | Size: 758 KiB |
|
After Width: | Height: | Size: 843 KiB |
|
After Width: | Height: | Size: 776 KiB |
|
After Width: | Height: | Size: 863 KiB |
|
After Width: | Height: | Size: 720 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 863 KiB |
|
After Width: | Height: | Size: 628 KiB |
|
After Width: | Height: | Size: 561 KiB |
|
After Width: | Height: | Size: 720 KiB |
|
After Width: | Height: | Size: 845 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 275 KiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 339 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 727 KiB |
|
After Width: | Height: | Size: 908 KiB |
|
After Width: | Height: | Size: 3.1 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 873 KiB |
|
After Width: | Height: | Size: 475 KiB |
|
After Width: | Height: | Size: 400 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
@@ -0,0 +1 @@
|
||||
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
||||
|
After Width: | Height: | Size: 391 B |
@@ -0,0 +1 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 992 KiB |
@@ -0,0 +1 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
||||
|
After Width: | Height: | Size: 128 B |
@@ -0,0 +1 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
||||
|
After Width: | Height: | Size: 385 B |
@@ -0,0 +1,9 @@
|
||||
import request from './request'
|
||||
|
||||
export function getAchievementsList() {
|
||||
return request.get('/achievements/list')
|
||||
}
|
||||
|
||||
export function getAchievementMetasList() {
|
||||
return request.get('/achievement-metas/list')
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import request from './request'
|
||||
|
||||
export function getBlogsList() {
|
||||
return request.get('/blogs/list')
|
||||
}
|
||||
|
||||
export function getBlogDetailBySlug(slug: string) {
|
||||
return request.get(`/blogs/detail/by-slug/${slug}`)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import request from './request'
|
||||
|
||||
export function getPublicConfig() {
|
||||
return request.get('/config/public')
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import request from './request'
|
||||
|
||||
export function getGalleryList() {
|
||||
return request.get('/gallery/list')
|
||||
}
|
||||
|
||||
export function getFootprintCategoryList() {
|
||||
return request.get('/footprint-category/list')
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import request from './request'
|
||||
|
||||
export function getTimeLetterList() {
|
||||
return request.get('/time-letter/list')
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import request from './request'
|
||||
|
||||
export function getLoveList() {
|
||||
return request.get('/love/list')
|
||||
}
|
||||
|
||||
export function getLoveBucketList() {
|
||||
return request.get('/love/bucket/list')
|
||||
}
|
||||
|
||||
export function getLoveCapsuleList() {
|
||||
return request.get('/love/capsule/list')
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import request from './request'
|
||||
|
||||
export function getNotesList() {
|
||||
return request.get('/notes/list')
|
||||
}
|
||||
|
||||
export function createNote(payload: any) {
|
||||
return request.post('/notes/create', payload)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import request from './request'
|
||||
|
||||
export function getFeedbackList(params: { page: number; pageSize: number; category: string }) {
|
||||
return request.get('/pond/feedback', { params })
|
||||
}
|
||||
|
||||
export function createFeedback(payload: any) {
|
||||
return request.post('/pond/feedback', payload)
|
||||
}
|
||||
|
||||
export function likeFeedback(id: number | string) {
|
||||
return request.post(`/pond/feedback/${id}/like`)
|
||||
}
|
||||
|
||||
export function getFeedbackTypes() {
|
||||
return request.get('/pond/feedback-type/list')
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import axios from 'axios'
|
||||
|
||||
const request = axios.create({
|
||||
baseURL: process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8080/api',
|
||||
timeout: 15000,
|
||||
})
|
||||
|
||||
export default request
|
||||
@@ -0,0 +1,75 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { connection } from "next/server";
|
||||
import { getPublicConfig } from "@/api/config";
|
||||
import AboutPageClient from "@/components/about/AboutPageClient";
|
||||
import { aboutProfile } from "@/mock/about";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
let title = "春风不解别离意,今日方知我是春。";
|
||||
try {
|
||||
const response = await getPublicConfig();
|
||||
const configs = response.data?.data;
|
||||
if (Array.isArray(configs)) {
|
||||
const titleConfig = configs.find(
|
||||
(item: { configKey?: string; configValue?: string }) =>
|
||||
item.configKey === "site.title.about"
|
||||
);
|
||||
if (titleConfig?.configValue) {
|
||||
title = titleConfig.configValue;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Failed to generate About page metadata:", error);
|
||||
}
|
||||
|
||||
return {
|
||||
title,
|
||||
description: "我在代码、文字和生活的缝隙里,慢慢搭建一个属于自己的小宇宙。关于 RRTiamo,此间主人。",
|
||||
};
|
||||
}
|
||||
|
||||
async function isAboutPageEnabled() {
|
||||
try {
|
||||
const response = await getPublicConfig();
|
||||
const configs = response.data?.data;
|
||||
|
||||
if (!Array.isArray(configs)) return true;
|
||||
|
||||
const aboutConfig = configs.find(
|
||||
(item: { configKey?: string; configValue?: string }) =>
|
||||
item.configKey === "page.about.enable"
|
||||
);
|
||||
|
||||
return aboutConfig?.configValue !== "false";
|
||||
} catch (error) {
|
||||
console.warn("About page: public config unavailable, keeping page enabled.", error);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export default async function AboutPage() {
|
||||
await connection();
|
||||
const enabled = await isAboutPageEnabled();
|
||||
|
||||
if (!enabled) notFound();
|
||||
|
||||
let profile = aboutProfile;
|
||||
try {
|
||||
const response = await getPublicConfig();
|
||||
const configs = response.data?.data;
|
||||
if (Array.isArray(configs)) {
|
||||
const profileConfig = configs.find(
|
||||
(item: { configKey?: string; configValue?: string }) =>
|
||||
item.configKey === "page.about.profile"
|
||||
);
|
||||
if (profileConfig?.configValue) {
|
||||
profile = JSON.parse(profileConfig.configValue);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Failed to load dynamic about profile, using default fallback.", error);
|
||||
}
|
||||
|
||||
return <AboutPageClient profile={profile} />;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import React from "react";
|
||||
import AchievementsPageClient from "@/components/achievements/AchievementsPageClient";
|
||||
import { Achievement } from "@/components/achievements/CertificateCard";
|
||||
import { getAchievementsList, getAchievementMetasList } from "@/api/achievements";
|
||||
import { getPublicConfig } from "@/api/config";
|
||||
|
||||
export interface AchievementMeta {
|
||||
id: number;
|
||||
type: string; // category or level
|
||||
name: string;
|
||||
code: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
async function getAchievements(): Promise<Achievement[]> {
|
||||
try {
|
||||
const res = await getAchievementsList();
|
||||
const data = res.data;
|
||||
if (data && data.code === 200 && Array.isArray(data.data)) {
|
||||
return data.data;
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("Achievements Page SSR: API offline, falling back to client-side initialization.", err);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
async function getAchievementMetas(): Promise<AchievementMeta[]> {
|
||||
try {
|
||||
const res = await getAchievementMetasList();
|
||||
const data = res.data;
|
||||
if (data && data.code === 200 && Array.isArray(data.data)) {
|
||||
return data.data;
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("Achievements Page SSR metas: API offline, using empty meta.", err);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
async function getPublicConfigs(): Promise<Record<string, string>> {
|
||||
try {
|
||||
const res = await getPublicConfig();
|
||||
const data = res.data;
|
||||
if (data && data.code === 200 && Array.isArray(data.data)) {
|
||||
const configMap: Record<string, string> = {};
|
||||
data.data.forEach((item: any) => {
|
||||
configMap[item.configKey] = item.configValue;
|
||||
});
|
||||
return configMap;
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("Achievements Page SSR configs: API offline, using empty configuration.", err);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
export default async function AchievementsPage() {
|
||||
const achievements = await getAchievements();
|
||||
const metas = await getAchievementMetas();
|
||||
const configs = await getPublicConfigs();
|
||||
|
||||
return (
|
||||
<AchievementsPageClient
|
||||
initialItems={achievements}
|
||||
initialMetas={metas}
|
||||
configs={configs}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,913 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState, useEffect, useRef } from "react";
|
||||
import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
import gsap from "gsap";
|
||||
import { ScrollTrigger } from "gsap/ScrollTrigger";
|
||||
import {
|
||||
BookOpen,
|
||||
Heart,
|
||||
Camera,
|
||||
Lock,
|
||||
EyeSlash,
|
||||
MapPin,
|
||||
Smiley,
|
||||
Funnel,
|
||||
CalendarBlank
|
||||
} from "@phosphor-icons/react";
|
||||
|
||||
import { writingData } from "@/data/writing";
|
||||
import { mockLoveNotes } from "@/mock/love";
|
||||
import { galleryData } from "@/data/gallery";
|
||||
import { useArticles } from "@/hooks/useArticles";
|
||||
import { useLove } from "@/hooks/useLove";
|
||||
import { useGallery } from "@/hooks/useGallery";
|
||||
import { useSysConfig } from "@/hooks/useSysConfig";
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
gsap.registerPlugin(ScrollTrigger);
|
||||
}
|
||||
|
||||
interface ArchiveItem {
|
||||
key: string;
|
||||
title: string;
|
||||
date: string;
|
||||
type: "Writing" | "Love Note" | "Photo";
|
||||
visibility: "public" | "hidden" | "private";
|
||||
link: string;
|
||||
category?: string;
|
||||
mood?: string;
|
||||
description?: string;
|
||||
cover?: string;
|
||||
location?: string;
|
||||
content?: string;
|
||||
camera?: string;
|
||||
lens?: string;
|
||||
filmStock?: string;
|
||||
settings?: string;
|
||||
photoType?: "image" | "video";
|
||||
}
|
||||
|
||||
// 情绪翻译
|
||||
const translateMood = (mood: string) => {
|
||||
const map: { [key: string]: string } = {
|
||||
quiet: "安静",
|
||||
thoughtful: "沉思",
|
||||
observant: "观察",
|
||||
inspired: "灵感",
|
||||
happy: "愉悦",
|
||||
joyful: "欣喜",
|
||||
energetic: "活力",
|
||||
romantic: "浪漫",
|
||||
playful: "淘气",
|
||||
peaceful: "宁静",
|
||||
};
|
||||
return map[mood] || mood;
|
||||
};
|
||||
|
||||
// 权限标签组件
|
||||
const VisibilityBadge = ({ visibility, isLove = false }: { visibility: "public" | "hidden" | "private"; isLove?: boolean }) => {
|
||||
if (visibility === "private") {
|
||||
return (
|
||||
<span className="inline-flex items-center text-[9px] font-semibold text-amber-900 bg-amber-50/80 dark:text-amber-300 dark:bg-amber-950/40 px-1.5 py-0.5 rounded border border-amber-200/50 dark:border-amber-900/30 whitespace-nowrap">
|
||||
<Lock className="w-2.5 h-2.5 mr-0.5" /> 密码锁定
|
||||
</span>
|
||||
);
|
||||
}
|
||||
if (visibility === "hidden") {
|
||||
return (
|
||||
<span className="inline-flex items-center text-[9px] font-semibold text-charcoal/60 bg-charcoal/5 dark:text-white/60 dark:bg-white/5 px-1.5 py-0.5 rounded border border-charcoal/10 dark:border-white/10 whitespace-nowrap">
|
||||
<EyeSlash className="w-2.5 h-2.5 mr-0.5" /> 隐秘链接
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span className={`text-[8px] font-mono font-semibold tracking-wider uppercase px-1.5 py-0.5 rounded ${
|
||||
isLove
|
||||
? "text-red-800 bg-red-50 dark:text-red-300 dark:bg-red-950/20"
|
||||
: "text-charcoal/30 bg-charcoal/5 dark:text-white/30 dark:bg-white/5"
|
||||
}`}>
|
||||
PUBLIC
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
// 单张归档卡片组件 - 结合高级 GSAP 3D Hover Tilt 物理摇摆
|
||||
const ArchiveCard = ({ item }: { item: ArchiveItem }) => {
|
||||
const cardRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const el = cardRef.current;
|
||||
if (!el) return;
|
||||
|
||||
let onMouseMove: (e: MouseEvent) => void;
|
||||
let onMouseLeave: () => void;
|
||||
|
||||
const ctx = gsap.context(() => {
|
||||
// 创建高频物理磁吸过渡
|
||||
const xTo = gsap.quickTo(el, "rotationY", { duration: 0.5, ease: "power2.out" });
|
||||
const yTo = gsap.quickTo(el, "rotationX", { duration: 0.5, ease: "power2.out" });
|
||||
|
||||
onMouseMove = (e: MouseEvent) => {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const mouseX = e.clientX - rect.left - rect.width / 2;
|
||||
const mouseY = e.clientY - rect.top - rect.height / 2;
|
||||
|
||||
// 限制倾斜角度在 3.5 度以内,保持低调奢华
|
||||
const rotateY = (mouseX / (rect.width / 2)) * 3.5;
|
||||
const rotateX = -(mouseY / (rect.height / 2)) * 3.5;
|
||||
|
||||
xTo(rotateY);
|
||||
yTo(rotateX);
|
||||
};
|
||||
|
||||
onMouseLeave = () => {
|
||||
xTo(0);
|
||||
yTo(0);
|
||||
};
|
||||
|
||||
el.addEventListener("mousemove", onMouseMove);
|
||||
el.addEventListener("mouseleave", onMouseLeave);
|
||||
}, cardRef);
|
||||
|
||||
return () => {
|
||||
if (onMouseMove && onMouseLeave) {
|
||||
el.removeEventListener("mousemove", onMouseMove);
|
||||
el.removeEventListener("mouseleave", onMouseLeave);
|
||||
}
|
||||
ctx.revert();
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (item.type === "Writing") {
|
||||
return (
|
||||
<div
|
||||
ref={cardRef}
|
||||
style={{ transformStyle: "preserve-3d", perspective: 1000 }}
|
||||
className="group relative bg-[#F9F9F6] dark:bg-[#1E2521] border border-charcoal/10 dark:border-white/10 rounded-2xl p-6 shadow-[0_4px_12px_rgba(0,0,0,0.02)] hover:shadow-[0_12px_32px_rgba(0,0,0,0.08)] transition-shadow duration-500 flex flex-col justify-between min-h-[220px] overflow-hidden"
|
||||
>
|
||||
{/* 曲别针效果 */}
|
||||
<div className="absolute top-0 left-6 w-8 h-4 bg-zinc-300/40 dark:bg-zinc-800/60 rounded-b-md border-x border-b border-charcoal/5 dark:border-white/5 shadow-inner" />
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="flex justify-between items-center text-[10px] font-mono text-charcoal/40 dark:text-white/40 uppercase tracking-wider">
|
||||
<span className="flex items-center gap-1">
|
||||
<BookOpen className="w-3.5 h-3.5 text-gold" /> {item.category || "Essay"}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<CalendarBlank className="w-3.5 h-3.5" /> {item.date}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 relative">
|
||||
<h3 className="font-serif text-lg md:text-xl font-medium text-charcoal dark:text-white group-hover:text-gold transition-colors duration-300 leading-snug">
|
||||
<Link href={item.link} className="after:absolute after:inset-0">
|
||||
{item.title}
|
||||
</Link>
|
||||
</h3>
|
||||
<p className="font-sans text-xs text-charcoal/60 dark:text-white/60 line-clamp-3 leading-relaxed">
|
||||
{item.description}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 pt-4 border-t border-charcoal/5 dark:border-white/5 flex justify-between items-center text-[10px] font-mono text-charcoal/40 dark:text-white/40">
|
||||
<span className="flex items-center gap-1">
|
||||
<Smiley className="w-3.5 h-3.5 text-gold" /> Mood: {item.mood ? translateMood(item.mood) : "未知"}
|
||||
</span>
|
||||
<VisibilityBadge visibility={item.visibility} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (item.type === "Love Note") {
|
||||
return (
|
||||
<div
|
||||
ref={cardRef}
|
||||
style={{ transformStyle: "preserve-3d", perspective: 1000 }}
|
||||
className="group relative bg-[#FCF5F2] dark:bg-[#25201E] border border-red-900/10 dark:border-red-900/20 rounded-2xl p-6 shadow-[0_4px_12px_rgba(0,0,0,0.02)] hover:shadow-[0_12px_32px_rgba(244,63,94,0.08)] transition-shadow duration-500 flex flex-col justify-between min-h-[220px] overflow-hidden"
|
||||
>
|
||||
{/* 心形火漆印记 */}
|
||||
<div className="absolute -top-3 -right-3 w-12 h-12 rounded-full bg-red-800/10 dark:bg-red-800/20 border border-red-800/15 flex items-center justify-center rotate-12 group-hover:rotate-45 transition-transform duration-500">
|
||||
<Heart className="w-5 h-5 text-red-800 dark:text-red-600 fill-red-800/20" />
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="flex justify-between items-center text-[10px] font-mono text-red-800/50 dark:text-red-400/50 uppercase tracking-wider">
|
||||
<span className="flex items-center gap-1 font-semibold">
|
||||
<Heart className="w-3.5 h-3.5" /> Love Memory
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<CalendarBlank className="w-3.5 h-3.5" /> {item.date}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 relative">
|
||||
<h3 className="font-serif text-lg md:text-xl font-medium text-red-950 dark:text-red-100 group-hover:text-gold transition-colors duration-300 leading-snug">
|
||||
<Link href={item.link} className="after:absolute after:inset-0">
|
||||
{item.title}
|
||||
</Link>
|
||||
</h3>
|
||||
<p className="font-sans text-xs text-red-950/60 dark:text-red-100/60 line-clamp-3 leading-relaxed">
|
||||
{item.content}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 pt-4 border-t border-red-900/5 dark:border-red-900/10 flex justify-between items-center text-[10px] font-mono text-red-800/50 dark:text-red-400/50">
|
||||
<span className="flex items-center gap-1">
|
||||
<MapPin className="w-3.5 h-3.5 text-red-800" /> {item.location || "我们的窝"}
|
||||
</span>
|
||||
<VisibilityBadge visibility={item.visibility} isLove />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Photo / Polaroid 相片卡片
|
||||
return (
|
||||
<div
|
||||
ref={cardRef}
|
||||
style={{ transformStyle: "preserve-3d", perspective: 1000 }}
|
||||
className="group relative bg-[#FCFAF2] dark:bg-[#25241E] border border-charcoal/10 dark:border-white/10 rounded-2xl p-4 pb-5 shadow-[0_4px_12px_rgba(0,0,0,0.02)] hover:shadow-[0_12px_32px_rgba(0,0,0,0.08)] transition-shadow duration-500 flex flex-col justify-between min-h-[300px] overflow-hidden"
|
||||
>
|
||||
{/* 拍立得相框区 */}
|
||||
<div className="relative aspect-square w-full rounded-lg overflow-hidden bg-zinc-100 dark:bg-zinc-950 border border-charcoal/5 dark:border-white/5">
|
||||
{item.visibility === "public" ? (
|
||||
<>
|
||||
{item.photoType === "video" ? (
|
||||
<video
|
||||
src={item.cover}
|
||||
className="w-full h-full object-cover brightness-[0.98] group-hover:brightness-100 group-hover:scale-[1.03] transition-all duration-500"
|
||||
muted
|
||||
loop
|
||||
playsInline
|
||||
onMouseOver={(e) => (e.target as HTMLVideoElement).play()}
|
||||
onMouseOut={(e) => (e.target as HTMLVideoElement).pause()}
|
||||
/>
|
||||
) : (
|
||||
<Image
|
||||
src={item.cover || ""}
|
||||
alt={item.title}
|
||||
fill
|
||||
sizes="(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 33vw"
|
||||
className="object-cover brightness-[0.98] group-hover:brightness-100 group-hover:scale-[1.03] transition-all duration-500"
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="absolute bottom-2 right-2 bg-black/40 backdrop-blur-[2px] text-[8px] font-mono text-white/80 px-1.5 py-0.5 rounded-sm pointer-events-none uppercase">
|
||||
{item.camera ? item.camera.split(" ")[0] : "SNAP"}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
/* 私密硫酸纸盖印效果 */
|
||||
<div className="w-full h-full bg-gradient-to-br from-amber-900/15 to-zinc-900/40 backdrop-blur-md flex flex-col items-center justify-center p-6 text-center select-none relative">
|
||||
<div className="absolute inset-0 bg-cream/10 dark:bg-black/10 mix-blend-overlay" />
|
||||
|
||||
<div className="space-y-2 z-10">
|
||||
<div className="w-10 h-10 rounded-full bg-red-950/20 dark:bg-red-900/30 border border-red-950/20 dark:border-red-900/30 flex items-center justify-center mx-auto shadow-inner">
|
||||
<Lock className="w-4 h-4 text-red-800 dark:text-red-500 fill-red-800/10" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-xs font-serif font-medium text-red-950 dark:text-red-100">
|
||||
{item.visibility === "private" ? "私密归档" : "隐藏档案"}
|
||||
</div>
|
||||
<div className="text-[9px] font-mono text-charcoal/50 dark:text-white/40 uppercase tracking-widest mt-0.5">
|
||||
{item.visibility === "private" ? "Passcode Secured" : "Direct Link Only"}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 -rotate-12 bg-red-800/90 dark:bg-red-700/90 text-white text-[9px] font-mono font-semibold tracking-[0.2em] px-4 py-1 shadow-md border border-red-700 pointer-events-none uppercase whitespace-nowrap">
|
||||
{item.visibility === "private" ? "CONFIDENTIAL" : "RESTRICTED"}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 拍立得白边底座手写区 */}
|
||||
<div className="mt-4 space-y-3 px-1">
|
||||
<div className="space-y-1">
|
||||
<h3 className="font-ma-shan-zheng text-xl text-charcoal dark:text-zinc-100 group-hover:text-gold transition-colors duration-300 leading-snug">
|
||||
<Link href={item.link} className="after:absolute after:inset-0">
|
||||
{item.title}
|
||||
</Link>
|
||||
</h3>
|
||||
{item.visibility === "public" && (
|
||||
<p className="font-sans text-[10px] text-charcoal/50 dark:text-white/40 line-clamp-1">
|
||||
{item.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="pt-2 border-t border-charcoal/5 dark:border-white/5 flex justify-between items-end">
|
||||
<div className="text-[8px] font-mono text-charcoal/40 dark:text-white/40 leading-normal">
|
||||
{item.visibility === "public" && item.camera ? (
|
||||
<>
|
||||
<div className="line-clamp-1">{item.camera} · {item.lens}</div>
|
||||
<div className="text-gold/70 dark:text-gold-light/60 font-semibold uppercase">{item.filmStock} · {item.settings}</div>
|
||||
</>
|
||||
) : (
|
||||
<div>SYSTEM INDEX: PHOTO-{item.key.toUpperCase()}</div>
|
||||
)}
|
||||
</div>
|
||||
<VisibilityBadge visibility={item.visibility} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
// 预先静态化提取初始年份以供延迟加载状态
|
||||
const getInitialYears = () => {
|
||||
const dates = [
|
||||
...writingData.map((post) => post.date),
|
||||
...mockLoveNotes.map((entry) => entry.date),
|
||||
...galleryData.map((photo) => photo.date),
|
||||
];
|
||||
dates.sort((a, b) => new Date(b).getTime() - new Date(a).getTime());
|
||||
const years = dates.map(d => d.split("-")[0]);
|
||||
return Array.from(new Set(years)).sort((a, b) => b.localeCompare(a));
|
||||
};
|
||||
|
||||
export default function ArchivePage() {
|
||||
const { isPageEnabled } = useSysConfig();
|
||||
const loveEnabled = isPageEnabled("page.love.enable", true);
|
||||
const { posts: dynamicPosts } = useArticles();
|
||||
const { loveNotes: dynamicLove } = useLove();
|
||||
const { photos: dynamicGallery } = useGallery();
|
||||
const [activeTab, setActiveTab] = useState<"all" | "Writing" | "Love Note" | "Photo">("all");
|
||||
const [activeYear, setActiveYear] = useState<string>(() => {
|
||||
const initialYears = getInitialYears();
|
||||
return initialYears.length > 0 ? initialYears[0] : "";
|
||||
});
|
||||
const pageRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// 动态年份同步更新
|
||||
useEffect(() => {
|
||||
const allItems = [
|
||||
...dynamicPosts.map((post) => post.date),
|
||||
...dynamicLove.map((entry) => entry.date),
|
||||
...dynamicGallery.map((photo) => photo.date),
|
||||
];
|
||||
if (allItems.length > 0) {
|
||||
allItems.sort((a, b) => new Date(b).getTime() - new Date(a).getTime());
|
||||
const years = Array.from(new Set(allItems.map(d => d.split("-")[0]))).sort((a, b) => b.localeCompare(a));
|
||||
if (years.length > 0 && !years.includes(activeYear)) {
|
||||
setActiveYear(years[0]);
|
||||
}
|
||||
}
|
||||
}, [dynamicPosts, dynamicLove, dynamicGallery]);
|
||||
const noteRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// 独立控制黄便签的高级 3D 悬挂物理摇摆与交互
|
||||
useEffect(() => {
|
||||
const el = noteRef.current;
|
||||
if (!el) return;
|
||||
|
||||
let onMouseEnter: () => void;
|
||||
let onMouseMove: (e: MouseEvent) => void;
|
||||
let onMouseLeave: () => void;
|
||||
|
||||
const ctx = gsap.context(() => {
|
||||
const xTo = gsap.quickTo(el, "rotationY", { duration: 0.6, ease: "power2.out" });
|
||||
const yTo = gsap.quickTo(el, "rotationX", { duration: 0.6, ease: "power2.out" });
|
||||
const rTo = gsap.quickTo(el, "rotation", { duration: 0.6, ease: "power2.out" });
|
||||
|
||||
onMouseEnter = () => {
|
||||
gsap.to(el, {
|
||||
y: -6,
|
||||
boxShadow: "0 15px 30px rgba(0,0,0,0.06)",
|
||||
duration: 0.4,
|
||||
ease: "power2.out"
|
||||
});
|
||||
};
|
||||
|
||||
onMouseMove = (e: MouseEvent) => {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const mouseX = e.clientX - rect.left - rect.width / 2;
|
||||
const mouseY = e.clientY - rect.top - rect.height / 2;
|
||||
|
||||
const rotateY = (mouseX / (rect.width / 2)) * 6;
|
||||
const rotateX = -(mouseY / (rect.height / 2)) * 6;
|
||||
const rot = -2.5 + (mouseX / (rect.width / 2)) * 4;
|
||||
|
||||
xTo(rotateY);
|
||||
yTo(rotateX);
|
||||
rTo(rot);
|
||||
};
|
||||
|
||||
onMouseLeave = () => {
|
||||
xTo(0);
|
||||
yTo(0);
|
||||
rTo(-2.5);
|
||||
|
||||
gsap.to(el, {
|
||||
y: 0,
|
||||
boxShadow: "5px 5px 15px rgba(0,0,0,0.03)",
|
||||
duration: 0.8,
|
||||
ease: "elastic.out(1.2, 0.5)" // 回弹时产生微微颤动的阻尼效果
|
||||
});
|
||||
};
|
||||
|
||||
el.addEventListener("mouseenter", onMouseEnter);
|
||||
el.addEventListener("mousemove", onMouseMove);
|
||||
el.addEventListener("mouseleave", onMouseLeave);
|
||||
}, noteRef);
|
||||
|
||||
return () => {
|
||||
if (onMouseEnter && onMouseMove && onMouseLeave) {
|
||||
el.removeEventListener("mouseenter", onMouseEnter);
|
||||
el.removeEventListener("mousemove", onMouseMove);
|
||||
el.removeEventListener("mouseleave", onMouseLeave);
|
||||
}
|
||||
ctx.revert();
|
||||
};
|
||||
}, []);
|
||||
|
||||
// 合载所有的静态/动态数据并按时间自新到旧排序
|
||||
const archives: ArchiveItem[] = [
|
||||
...dynamicPosts.map((post) => ({
|
||||
key: post.slug,
|
||||
title: post.title,
|
||||
date: post.date,
|
||||
type: "Writing" as const,
|
||||
visibility: post.visibility,
|
||||
link: `/writing/${post.slug}`,
|
||||
category: post.category,
|
||||
mood: post.mood,
|
||||
cover: post.cover,
|
||||
description: post.description,
|
||||
content: post.content,
|
||||
})),
|
||||
...(loveEnabled ? dynamicLove.map((entry) => ({
|
||||
key: entry.id,
|
||||
title: entry.title,
|
||||
date: entry.date,
|
||||
type: "Love Note" as const,
|
||||
visibility: entry.visibility,
|
||||
link: `/love`,
|
||||
location: entry.location,
|
||||
mood: entry.mood,
|
||||
cover: entry.cover,
|
||||
content: entry.content,
|
||||
})) : []),
|
||||
...dynamicGallery.map((photo) => {
|
||||
// 模拟一些私密/隐藏影像切片,增加物理档案馆的仪式感
|
||||
let vis: "public" | "hidden" | "private" = "public";
|
||||
if (photo.id === "anime-boy") vis = "private";
|
||||
if (photo.id === "flower-wall") vis = "hidden";
|
||||
return {
|
||||
key: photo.id,
|
||||
title: photo.title,
|
||||
date: photo.date,
|
||||
type: "Photo" as const,
|
||||
visibility: vis,
|
||||
link: `/gallery`,
|
||||
cover: photo.src,
|
||||
description: photo.description,
|
||||
camera: photo.camera,
|
||||
lens: photo.lens,
|
||||
filmStock: photo.filmStock,
|
||||
settings: photo.settings,
|
||||
location: photo.location,
|
||||
photoType: photo.type,
|
||||
};
|
||||
}),
|
||||
];
|
||||
|
||||
archives.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
|
||||
|
||||
// 数量统计
|
||||
const writingCount = archives.filter(i => i.type === "Writing").length;
|
||||
const loveCount = archives.filter(i => i.type === "Love Note").length;
|
||||
const photoCount = archives.filter(i => i.type === "Photo").length;
|
||||
|
||||
// 过滤后的数据
|
||||
const filteredArchives = archives.filter(
|
||||
(item) => activeTab === "all" || item.type === activeTab
|
||||
);
|
||||
|
||||
// 年份分组
|
||||
const groups: { [key: string]: ArchiveItem[] } = {};
|
||||
filteredArchives.forEach((item) => {
|
||||
const year = item.date.split("-")[0];
|
||||
if (!groups[year]) {
|
||||
groups[year] = [];
|
||||
}
|
||||
groups[year].push(item);
|
||||
});
|
||||
|
||||
const years = Object.keys(groups).sort((a, b) => b.localeCompare(a));
|
||||
|
||||
// 高端洗牌-发牌过滤动画逻辑 (通过 GSAP 物理动画接管 Tab 切换卡片排布)
|
||||
const changeTab = (tab: "all" | "Writing" | "Love Note" | "Photo") => {
|
||||
if (tab === activeTab) return;
|
||||
|
||||
// 提前在 pageRef 范围内获取所有卡片,如果不存在则不执行 GSAP 动画以防止报错
|
||||
const cards = pageRef.current?.querySelectorAll(".archive-card-anim");
|
||||
if (!cards || cards.length === 0) {
|
||||
setActiveTab(tab);
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. 发起“洗牌合拢淡出”动效
|
||||
gsap.to(cards, {
|
||||
opacity: 0,
|
||||
y: 25,
|
||||
scale: 0.95,
|
||||
rotation: 0,
|
||||
duration: 0.35,
|
||||
stagger: 0.015,
|
||||
ease: "power2.in",
|
||||
onComplete: () => {
|
||||
// 2. 动效完成后同步状态
|
||||
setActiveTab(tab);
|
||||
|
||||
const filtered = archives.filter(item => tab === "all" || item.type === tab);
|
||||
const tempGroups: { [key: string]: boolean } = {};
|
||||
filtered.forEach((item) => {
|
||||
const yr = item.date.split("-")[0];
|
||||
tempGroups[yr] = true;
|
||||
});
|
||||
const tempYears = Object.keys(tempGroups).sort((a, b) => b.localeCompare(a));
|
||||
if (tempYears.length > 0) {
|
||||
setActiveYear(tempYears[0]);
|
||||
} else {
|
||||
setActiveYear("");
|
||||
}
|
||||
|
||||
// 3. 在下一渲染帧中,完美发起 staggered“散开物理发牌”动效
|
||||
setTimeout(() => {
|
||||
const newCards = pageRef.current?.querySelectorAll(".archive-card-anim");
|
||||
if (newCards && newCards.length > 0) {
|
||||
gsap.fromTo(newCards,
|
||||
{
|
||||
opacity: 0,
|
||||
y: 45,
|
||||
scale: 0.96,
|
||||
rotation: () => (Math.random() - 0.5) * 2.5,
|
||||
},
|
||||
{
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: () => (Math.random() - 0.5) * 1.5,
|
||||
duration: 0.9,
|
||||
stagger: 0.04,
|
||||
ease: "power4.out" // 完美的减速物理阻尼曲线
|
||||
}
|
||||
);
|
||||
}
|
||||
}, 30);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// GSAP 首次加载动画及 ScrollTrigger 物理联动
|
||||
useEffect(() => {
|
||||
const ctx = gsap.context(() => {
|
||||
// 1. 顶部索引卡与便签滑入 (优雅的弹性入场)
|
||||
gsap.from(".archive-index-card", {
|
||||
opacity: 0,
|
||||
y: 40,
|
||||
duration: 1.0,
|
||||
ease: "power3.out"
|
||||
});
|
||||
|
||||
// 2. 黄便签的“飘落悬挂物理摇摆”进场动效
|
||||
gsap.fromTo(".archive-sticky-note",
|
||||
{
|
||||
opacity: 0,
|
||||
y: -80,
|
||||
rotation: -18,
|
||||
scale: 0.9
|
||||
},
|
||||
{
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: -2.5,
|
||||
duration: 1.6,
|
||||
delay: 0.2,
|
||||
ease: "elastic.out(1.1, 0.45)"
|
||||
}
|
||||
);
|
||||
// 2. 过滤栏滑入
|
||||
gsap.from(".archive-filter-bar", {
|
||||
opacity: 0,
|
||||
y: 25,
|
||||
duration: 1.0,
|
||||
delay: 0.15,
|
||||
ease: "power3.out"
|
||||
});
|
||||
// 3. 侧边栏时间轴滑入
|
||||
gsap.from(".archive-timeline-sidebar", {
|
||||
opacity: 0,
|
||||
x: -30,
|
||||
duration: 1.0,
|
||||
delay: 0.25,
|
||||
ease: "power3.out"
|
||||
});
|
||||
|
||||
// 4. 首次加载卡片 Stagger 物理发牌滑入
|
||||
const firstCards = pageRef.current?.querySelectorAll(".archive-card-anim");
|
||||
if (firstCards && firstCards.length > 0) {
|
||||
gsap.from(firstCards, {
|
||||
opacity: 0,
|
||||
y: 45,
|
||||
rotation: () => (Math.random() - 0.5) * 2.5,
|
||||
duration: 0.9,
|
||||
stagger: 0.05,
|
||||
delay: 0.35,
|
||||
ease: "power4.out"
|
||||
});
|
||||
}
|
||||
|
||||
// 5. 年份标题横线 ScrollTrigger 动态横向拉伸生长
|
||||
years.forEach((year) => {
|
||||
gsap.fromTo(`#divider-${year}`,
|
||||
{ scaleX: 0, opacity: 0 },
|
||||
{
|
||||
scaleX: 1,
|
||||
opacity: 1,
|
||||
ease: "power2.out",
|
||||
duration: 1.2,
|
||||
scrollTrigger: {
|
||||
trigger: `#year-${year}`,
|
||||
start: "top 85%", // 进入屏幕下方 85% 位置时触发
|
||||
once: true
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// 6. 滚动联动高亮左侧年份刻度
|
||||
years.forEach((year) => {
|
||||
ScrollTrigger.create({
|
||||
trigger: `#year-${year}`,
|
||||
start: "top 35%",
|
||||
end: "bottom 35%",
|
||||
onToggle: (self) => {
|
||||
if (self.isActive) {
|
||||
setActiveYear(year);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 7. 时光轴流逝线滚动比例拉伸 (只在桌面端 sticky sidebar 启用,避免移动端计算报错)
|
||||
if (window.innerWidth >= 1024) {
|
||||
gsap.to(".timeline-progress-fill", {
|
||||
scaleY: 1,
|
||||
ease: "none",
|
||||
scrollTrigger: {
|
||||
trigger: ".archive-timeline-sidebar",
|
||||
start: "top 32%",
|
||||
end: "bottom 70%",
|
||||
endTrigger: ".archive-cards-list-container", // 跟踪右侧网格底端
|
||||
scrub: true
|
||||
}
|
||||
});
|
||||
}
|
||||
}, pageRef);
|
||||
|
||||
return () => ctx.revert();
|
||||
}, [years, activeTab]); // 过滤引起 years 变动时,安全重建 ScrollTrigger 保证坐标绝对精准
|
||||
|
||||
// 锚点滚动
|
||||
const scrollToYear = (year: string) => {
|
||||
const lenis = (window as unknown as { lenis: { scrollTo: (target: string, options: { offset: number }) => void } }).lenis;
|
||||
if (lenis) {
|
||||
lenis.scrollTo(`#year-${year}`, { offset: -120 });
|
||||
} else {
|
||||
document.getElementById(`year-${year}`)?.scrollIntoView({ behavior: "smooth" });
|
||||
}
|
||||
};
|
||||
|
||||
const categories = [
|
||||
{ id: "all" as const, name: "全部归档", icon: null },
|
||||
{ id: "Writing" as const, name: "随笔散文", icon: <BookOpen className="w-3.5 h-3.5" /> },
|
||||
...(loveEnabled ? [{ id: "Love Note" as const, name: "恋爱纪实", icon: <Heart className="w-3.5 h-3.5" /> }] : []),
|
||||
{ id: "Photo" as const, name: "影像切片", icon: <Camera className="w-3.5 h-3.5" /> },
|
||||
];
|
||||
|
||||
return (
|
||||
<div ref={pageRef} className="max-w-6xl mx-auto w-full px-4 md:px-8 py-24 md:py-32">
|
||||
{/* 1. 档案馆索书卡(数字索引卡) */}
|
||||
<div className="archive-index-card bg-white/60 dark:bg-zinc-900/60 backdrop-blur-md border border-charcoal/10 dark:border-white/10 rounded-3xl p-6 md:p-10 shadow-[0_12px_40px_-12px_rgba(0,0,0,0.08)] relative overflow-hidden mb-10">
|
||||
<div className="absolute -top-12 -right-12 w-48 h-48 bg-gold/5 dark:bg-gold/10 rounded-full blur-3xl pointer-events-none" />
|
||||
|
||||
<div className="flex flex-col md:flex-row md:items-start md:justify-between gap-8 relative z-10">
|
||||
<div className="space-y-4 max-w-2xl">
|
||||
<div className="flex items-center space-x-3">
|
||||
<span className="text-[9px] font-mono tracking-[0.2em] text-gold bg-gold/10 px-2.5 py-1 rounded-md uppercase font-semibold">
|
||||
NO. ATLAS-260624-MYHOUSE
|
||||
</span>
|
||||
<span className="flex h-2 w-2 relative">
|
||||
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
|
||||
<span className="relative inline-flex rounded-full h-2 w-2 bg-emerald-500"></span>
|
||||
</span>
|
||||
<span className="text-[9px] font-mono text-charcoal/40 dark:text-white/40 uppercase">
|
||||
ONLINE INDEX
|
||||
</span>
|
||||
</div>
|
||||
<h1 className="font-serif text-4xl md:text-5xl font-light text-charcoal dark:text-white">
|
||||
Archive / 编目归档
|
||||
</h1>
|
||||
<p className="font-sans text-xs md:text-sm text-charcoal/60 dark:text-white/60 leading-relaxed">
|
||||
档案馆内所有收录文章、恋爱纪实与影像切片的索引总汇。
|
||||
我们用文字与胶片,在易逝的时间河流中,为日常编目,留存那些闪闪发光的细碎回忆。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* 手写黄便签 */}
|
||||
<div
|
||||
ref={noteRef}
|
||||
style={{ transformStyle: "preserve-3d", perspective: 1000 }}
|
||||
className="archive-sticky-note self-start md:self-center bg-[#FDF6E2] dark:bg-[#2C2921] border border-[#EBE3CD] dark:border-[#423C2F] p-4 rounded-xl shadow-[5px_5px_15px_rgba(0,0,0,0.03)] max-w-xs relative flex-shrink-0"
|
||||
>
|
||||
<div className="absolute -top-2 left-1/2 -translate-x-1/2 w-12 h-3 bg-white/40 dark:bg-black/20 backdrop-blur-[1px] rotate-1 pointer-events-none" />
|
||||
<p className="font-ma-shan-zheng text-lg text-amber-900/80 dark:text-amber-200/80 leading-relaxed pt-1.5 select-none">
|
||||
“时间的针脚密密麻麻,有些落在了纸上,有些藏在了心里。”
|
||||
</p>
|
||||
<div className="text-right mt-1.5 select-none font-sans text-[9px] text-amber-900/40 dark:text-amber-200/40">
|
||||
— 馆长编目印
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 统计指标卡 */}
|
||||
<div className="grid grid-cols-3 gap-4 mt-8 pt-8 border-t border-charcoal/10 dark:border-white/10">
|
||||
<div className="bg-cream/40 dark:bg-charcoal/30 p-4 rounded-2xl border border-charcoal/5 dark:border-white/5 flex flex-col justify-between">
|
||||
<span className="text-[11px] text-charcoal/50 dark:text-white/50 flex items-center gap-1.5 font-medium">
|
||||
<BookOpen className="w-4 h-4 text-gold" /> 随笔散文
|
||||
</span>
|
||||
<div className="mt-2 flex items-baseline gap-1">
|
||||
<span className="font-serif text-2xl md:text-3xl font-light text-charcoal dark:text-white">{writingCount}</span>
|
||||
<span className="text-[9px] text-charcoal/40 dark:text-white/40 font-mono">DOCS</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-cream/40 dark:bg-charcoal/30 p-4 rounded-2xl border border-charcoal/5 dark:border-white/5 flex flex-col justify-between">
|
||||
<span className="text-[11px] text-charcoal/50 dark:text-white/50 flex items-center gap-1.5 font-medium">
|
||||
<Heart className="w-4 h-4 text-red-500" /> 恋爱纪实
|
||||
</span>
|
||||
<div className="mt-2 flex items-baseline gap-1">
|
||||
<span className="font-serif text-2xl md:text-3xl font-light text-charcoal dark:text-white">{loveCount}</span>
|
||||
<span className="text-[9px] text-charcoal/40 dark:text-white/40 font-mono">NOTES</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-cream/40 dark:bg-charcoal/30 p-4 rounded-2xl border border-charcoal/5 dark:border-white/5 flex flex-col justify-between">
|
||||
<span className="text-[11px] text-charcoal/50 dark:text-white/50 flex items-center gap-1.5 font-medium">
|
||||
<Camera className="w-4 h-4 text-blue-500" /> 影像切片
|
||||
</span>
|
||||
<div className="mt-2 flex items-baseline gap-1">
|
||||
<span className="font-serif text-2xl md:text-3xl font-light text-charcoal dark:text-white">{photoCount}</span>
|
||||
<span className="text-[9px] text-charcoal/40 dark:text-white/40 font-mono">PHOTOS</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 2. 分类页签过滤器 */}
|
||||
<div className="archive-filter-bar flex flex-wrap items-center gap-3 mb-10 pb-4 border-b border-charcoal/5 dark:border-white/5">
|
||||
<span className="text-xs text-charcoal/40 dark:text-white/40 flex items-center gap-1 mr-2 font-mono">
|
||||
<Funnel className="w-3.5 h-3.5" /> FILTER / 检索 :
|
||||
</span>
|
||||
<div className="flex bg-cream/80 dark:bg-charcoal/50 p-1 rounded-full border border-charcoal/10 dark:border-white/10 relative">
|
||||
{categories.map((cat) => {
|
||||
const isActive = activeTab === cat.id;
|
||||
return (
|
||||
<button
|
||||
key={cat.id}
|
||||
onClick={() => changeTab(cat.id)}
|
||||
className={`px-3.5 py-1.5 rounded-full text-xs font-sans transition-all duration-300 relative z-10 flex items-center gap-1.5 ${
|
||||
isActive
|
||||
? "text-white dark:text-charcoal bg-gold dark:bg-gold shadow-[0_2px_8px_rgba(217,134,95,0.25)] font-medium"
|
||||
: "text-charcoal/60 dark:text-white/60 hover:text-charcoal dark:hover:text-white"
|
||||
}`}
|
||||
>
|
||||
{cat.icon}
|
||||
<span>{cat.name}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 3. 两栏式主体:时光刻度轴 + 归档网格 */}
|
||||
<div className="flex flex-col lg:flex-row gap-8 items-start">
|
||||
{/* 3.A 侧边年份刻度轴 (在大屏幕下粘性固定,在小屏幕下水平滑动) */}
|
||||
<div className="archive-timeline-sidebar w-full lg:w-1/4 lg:sticky lg:top-32 self-start space-y-6">
|
||||
{/* 桌面端时间线 */}
|
||||
<div className="hidden lg:block space-y-4 pr-6">
|
||||
<div className="text-[10px] font-mono tracking-widest text-charcoal/40 dark:text-white/40 uppercase">
|
||||
TIMELINE / 时光轴
|
||||
</div>
|
||||
<div className="relative pl-4 space-y-6">
|
||||
{/* 时间轴轨道(灰色底) */}
|
||||
<div className="absolute left-[4px] top-2 bottom-2 w-[1px] bg-charcoal/10 dark:bg-white/10" />
|
||||
{/* 时光流逝金色填充进度条 */}
|
||||
<div className="absolute left-[4px] top-2 bottom-2 w-[1px] bg-gold origin-top scale-y-0 timeline-progress-fill" />
|
||||
|
||||
{years.map((year) => {
|
||||
const count = groups[year]?.length || 0;
|
||||
const isActive = activeYear === year;
|
||||
return (
|
||||
<button
|
||||
key={year}
|
||||
onClick={() => scrollToYear(year)}
|
||||
className="group block text-left relative focus:outline-none py-1"
|
||||
>
|
||||
{/* 时光轴节点 */}
|
||||
<div className={`absolute -left-[21px] top-1/2 -translate-y-1/2 w-2.5 h-2.5 rounded-full bg-cream dark:bg-charcoal border-2 transition-all duration-300 ${
|
||||
isActive
|
||||
? "border-gold bg-gold scale-125 shadow-[0_0_8px_rgba(217,134,95,0.6)]"
|
||||
: "border-charcoal/30 dark:border-white/30 group-hover:border-gold"
|
||||
}`} />
|
||||
<div className={`font-serif text-3xl font-light transition-all duration-300 flex items-baseline gap-1.5 ${
|
||||
isActive
|
||||
? "text-gold translate-x-1"
|
||||
: "text-charcoal/40 dark:text-white/40 group-hover:text-gold"
|
||||
}`}>
|
||||
{year}
|
||||
<span className={`text-[10px] font-sans font-normal transition-all duration-300 ${
|
||||
isActive ? "text-gold/60" : "text-charcoal/30 dark:text-white/30"
|
||||
}`}>({count})</span>
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 移动端年份快捷导航 */}
|
||||
<div className="lg:hidden flex items-center gap-2 overflow-x-auto pb-4 scrollbar-none w-full border-b border-charcoal/5 dark:border-white/5">
|
||||
{years.map((year) => {
|
||||
const count = groups[year]?.length || 0;
|
||||
const isActive = activeYear === year;
|
||||
return (
|
||||
<button
|
||||
key={year}
|
||||
onClick={() => scrollToYear(year)}
|
||||
className={`flex-shrink-0 px-3.5 py-1.5 rounded-lg border text-xs font-serif transition-all duration-300 ${
|
||||
isActive
|
||||
? "text-gold border-gold bg-gold/5 font-medium"
|
||||
: "bg-cream/80 dark:bg-charcoal/50 border-charcoal/10 dark:border-white/10 text-charcoal/70 dark:text-white/70"
|
||||
}`}
|
||||
>
|
||||
{year} 年 <span className={`font-sans text-[9px] ${isActive ? "text-gold/60" : "text-charcoal/40 dark:text-white/40"}`}>({count})</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 3.B 归档卡片网格列表 */}
|
||||
<div className="archive-cards-list-container w-full lg:w-3/4 space-y-16">
|
||||
{years.length === 0 ? (
|
||||
<div className="py-20 text-center space-y-3 bg-white/40 dark:bg-zinc-900/40 rounded-3xl border border-charcoal/5 dark:border-white/5">
|
||||
<span className="text-3xl">📭</span>
|
||||
<p className="font-serif text-lg text-charcoal/40 dark:text-white/40">此分类下暂无已归档内容</p>
|
||||
</div>
|
||||
) : (
|
||||
years.map((year) => (
|
||||
<div key={year} id={`year-${year}`} className="space-y-6 scroll-mt-28">
|
||||
{/* 年份标题刻度线 */}
|
||||
<div className="flex items-center gap-4 border-b border-charcoal/10 dark:border-white/10 pb-3">
|
||||
<h2 className="font-serif text-4xl font-light text-charcoal dark:text-white tracking-wide">
|
||||
{year}
|
||||
</h2>
|
||||
<span className="text-xs font-sans text-charcoal/40 dark:text-white/40 font-normal uppercase tracking-widest bg-cream/80 dark:bg-charcoal/60 px-2.5 py-0.5 rounded border border-charcoal/5 dark:border-white/5">
|
||||
{groups[year].length} 档案
|
||||
</span>
|
||||
{/* origin-left 用于横线拉伸生长 */}
|
||||
<div
|
||||
id={`divider-${year}`}
|
||||
className="grow h-px bg-gradient-to-r from-charcoal/15 dark:from-white/15 to-transparent origin-left"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 卡片网格 */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 md:gap-8">
|
||||
{groups[year].map((item) => (
|
||||
<div
|
||||
key={item.key}
|
||||
className="archive-card-anim"
|
||||
>
|
||||
<ArchiveCard item={item} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
import FootprintsPageClient from "@/components/footprints/FootprintsPageClient";
|
||||
import { getPublicConfig } from "@/api/config";
|
||||
import { getGalleryList, getFootprintCategoryList } from "@/api/gallery";
|
||||
import { getLoveList } from "@/api/love";
|
||||
|
||||
interface PublicConfig {
|
||||
configKey: string;
|
||||
configValue: string;
|
||||
}
|
||||
|
||||
// 1. 获取公开系统配置以取得高德地图密钥
|
||||
async function getMapConfig() {
|
||||
try {
|
||||
const res = await getPublicConfig();
|
||||
const payload = res.data;
|
||||
if (payload?.code === 200 && Array.isArray(payload.data)) {
|
||||
const data = payload.data as PublicConfig[];
|
||||
const keyCfg = data.find((c) => c.configKey === "page.footprint.amap.key");
|
||||
const codeCfg = data.find((c) => c.configKey === "page.footprint.amap.securityJsCode");
|
||||
return {
|
||||
key: keyCfg?.configValue || "",
|
||||
code: codeCfg?.configValue || "",
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Footprints: API public configs unavailable, fallback to env keys.", error);
|
||||
}
|
||||
return { key: "", code: "" };
|
||||
}
|
||||
|
||||
// 2. 拉取照片墙列表
|
||||
async function getGalleryFootprints(): Promise<any[]> {
|
||||
try {
|
||||
const res = await getGalleryList();
|
||||
const payload = res.data;
|
||||
if (payload?.code === 200 && Array.isArray(payload.data)) {
|
||||
return payload.data
|
||||
.filter((item: any) => item.longitude && item.latitude) // 只要带坐标的
|
||||
.map((item: any) => ({
|
||||
id: `photo-${item.id}`,
|
||||
type: (item.footprintType || "photo") as "photo" | "love",
|
||||
slug: item.slug || `photo-${item.id}`,
|
||||
title: item.title,
|
||||
date: item.date ? item.date.split("T")[0] : new Date().toISOString().split("T")[0],
|
||||
location: item.location || "未知",
|
||||
longitude: Number(item.longitude),
|
||||
latitude: Number(item.latitude),
|
||||
cover: item.src || "/assets/writing-camera.png",
|
||||
content: item.description || "",
|
||||
camera: item.camera || "",
|
||||
lens: item.lens || "",
|
||||
filmStock: item.filmStock || "",
|
||||
settings: item.settings || "",
|
||||
mediaType: item.type || "image",
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Footprints page: Gallery API offline, falling back to static photo data.", error);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
// 3. 拉取恋爱日记列表
|
||||
async function getLoveFootprints(): Promise<any[]> {
|
||||
try {
|
||||
const res = await getLoveList();
|
||||
const payload = res.data;
|
||||
if (payload?.code === 200 && Array.isArray(payload.data)) {
|
||||
return payload.data
|
||||
.filter((item: any) => item.longitude && item.latitude) // 只要带坐标的
|
||||
.map((item: any) => ({
|
||||
id: `love-${item.id}`,
|
||||
type: (item.footprintType || "love") as "photo" | "love",
|
||||
slug: item.slug || `love-${item.id}`,
|
||||
title: item.title,
|
||||
date: item.date ? item.date.split("T")[0] : new Date().toISOString().split("T")[0],
|
||||
location: item.location || "未知",
|
||||
longitude: Number(item.longitude),
|
||||
latitude: Number(item.latitude),
|
||||
cover: item.cover || "/assets/love-anniversary.png",
|
||||
content: item.content || "",
|
||||
mood: item.mood || "",
|
||||
mediaType: "image",
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Footprints page: Love API offline, falling back to static love data.", error);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
// 4. 拉取足迹类别列表
|
||||
async function getFootprintCategories(): Promise<any[]> {
|
||||
try {
|
||||
const res = await getFootprintCategoryList();
|
||||
const payload = res.data;
|
||||
if (payload?.code === 200 && Array.isArray(payload.data)) {
|
||||
return payload.data;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Footprints page: Categories API offline, falling back to static categories.", error);
|
||||
}
|
||||
return [
|
||||
{ id: 1, name: "光影影像", code: "photo", icon: "Camera" },
|
||||
{ id: 2, name: "甜蜜瞬间", code: "love", icon: "Heart" },
|
||||
];
|
||||
}
|
||||
|
||||
export default async function FootprintsPage() {
|
||||
const mapConfig = await getMapConfig();
|
||||
const galleryItems = await getGalleryFootprints();
|
||||
const loveItems = await getLoveFootprints();
|
||||
const categories = await getFootprintCategories();
|
||||
|
||||
// 拼接与去重
|
||||
let combinedItems = [...galleryItems, ...loveItems];
|
||||
|
||||
// 4. 静态本地 fallback 兜底数据(在接口完全离线时保证前台完美可看)
|
||||
if (combinedItems.length === 0) {
|
||||
combinedItems = [
|
||||
{
|
||||
id: "static-photo-1",
|
||||
type: "photo",
|
||||
slug: "sidewalk-night",
|
||||
title: "深夜霓虹下的人行道",
|
||||
date: "2026-06-18",
|
||||
location: "上海 · 南京东路",
|
||||
longitude: 121.4883,
|
||||
latitude: 31.2369,
|
||||
cover: "/assets/【哲风壁纸】人行道-城市-夜晚.png",
|
||||
content: "城市的霓虹反射在微湿的人行道上。路灯把行人的影子拉得很长。深邃的蓝色调中透着都市的孤独感。胶片特有的银盐颗粒在暗部特别明显,配合 Zeiss 镜头的大光圈,散发出迷人的光圈散景。",
|
||||
camera: "Contax T2",
|
||||
lens: "Sonnar 38mm f/2.8",
|
||||
filmStock: "Fujifilm Superia 400",
|
||||
settings: "f/2.8, 1/30s",
|
||||
},
|
||||
{
|
||||
id: "static-photo-2",
|
||||
type: "photo",
|
||||
slug: "mountain-pavilion",
|
||||
title: "孤山亭子与破晓薄雾",
|
||||
date: "2026-03-05",
|
||||
location: "南京 · 紫金山巅",
|
||||
longitude: 118.8443,
|
||||
latitude: 32.0621,
|
||||
cover: "/assets/【哲风壁纸】亭子-励志文案-山石.png",
|
||||
content: "立于山巅乱石之中的古典凉亭,旁侧印刻着励志文字。朝霞初生,破晓的薄雾在树干之间弥漫,这是一场逃离都市的山野探索。在清晨五点爬上山顶,寒风料峭中按下这枚快门,定格物理意义上的光线碰撞。",
|
||||
camera: "Canon F-1",
|
||||
lens: "FD 50mm f/1.4",
|
||||
filmStock: "Kodak Portra 160",
|
||||
settings: "f/5.6, 1/125s",
|
||||
},
|
||||
{
|
||||
id: "static-photo-3",
|
||||
type: "photo",
|
||||
slug: "rabbit-sunset",
|
||||
title: "公路旁日落时分的小兔",
|
||||
date: "2026-02-14",
|
||||
location: "杭州 · 龙井山道",
|
||||
longitude: 120.1551,
|
||||
latitude: 30.2741,
|
||||
cover: "/assets/【哲风壁纸】兔子-公路-日落.png",
|
||||
content: "夕阳将公路渲染成温暖的金黄色,一只小兔在路边草丛里探出头。金色的逆光将兔毛边缘照亮成光晕。在落日前的最后十分钟,使用 Leica M6 的黄斑快速对焦,这是一张极其难得的生活切片。",
|
||||
camera: "Leica M6",
|
||||
lens: "Elmarit 90mm f/2.8",
|
||||
filmStock: "Kodak Gold 200",
|
||||
settings: "f/4.0, 1/250s",
|
||||
},
|
||||
{
|
||||
id: "static-love-1",
|
||||
type: "love",
|
||||
slug: "anniversary-3years",
|
||||
title: "三周年:从日落到星空",
|
||||
date: "2026-05-20",
|
||||
location: "秦皇岛 · 阿那亚孤独图书馆",
|
||||
longitude: 119.866068,
|
||||
latitude: 39.734289,
|
||||
cover: "/assets/love-anniversary.png",
|
||||
content: "海浪冲刷着沙滩,我们在阿那亚的孤独图书馆旁坐了很久。从天色微红一直坐到繁星点点,风很大,但因为你靠在身旁,一切都显得无比安详。谢谢你陪我走过的第三个四季。希望下一个三年、十年,我们依然能在世界各个海角仰望同一片星空。",
|
||||
mood: "romantic",
|
||||
},
|
||||
{
|
||||
id: "static-love-2",
|
||||
type: "love",
|
||||
slug: "first-cooking-disaster",
|
||||
title: "厨房里的“灾难”与大笑",
|
||||
date: "2026-02-14",
|
||||
location: "上海 · 卢湾旧租屋",
|
||||
longitude: 121.4737,
|
||||
latitude: 31.2304,
|
||||
cover: "/assets/love-cooking.png",
|
||||
content: "本来计划做一顿法式红酒炖牛肉,结果因为聊天太投入,红酒收汁过头,牛肉有些焦糊,烟雾报警器还响了起来。我们手忙脚乱地挥动抹布散热,最后只能叫了外卖披萨。但那晚我们开了一瓶好酒,坐在地板上笑了整整一个通宵。其实幸福并不是多么精致的晚宴,而是我们面对灾难时能一起大笑的默契。",
|
||||
mood: "playful",
|
||||
},
|
||||
{
|
||||
id: "static-love-3",
|
||||
type: "love",
|
||||
slug: "rainy-day-museum",
|
||||
title: "美术馆的无声漫步",
|
||||
date: "2025-11-18",
|
||||
location: "上海 · 徐汇西岸美术馆",
|
||||
longitude: 121.45524,
|
||||
latitude: 31.18123,
|
||||
cover: "/assets/love-museum.png",
|
||||
content: "窗外是阴冷潮湿的上海秋雨,展厅内是巨大而沉静的抽象画作。我们没有太多言语,只是安静地并肩走过一个又一个展厅。有时候,爱情不需要轰轰烈烈的对白,只要在沉默的艺术品前,余光里全是你,就足够温暖。",
|
||||
mood: "peaceful",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
// 按照日期倒序排列,让最新的足迹先展示在顶部
|
||||
combinedItems.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
|
||||
|
||||
return (
|
||||
<FootprintsPageClient
|
||||
initialItems={combinedItems}
|
||||
apiMapKey={mapConfig.key}
|
||||
apiMapCode={mapConfig.code}
|
||||
categories={categories}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { motion, AnimatePresence } from "framer-motion";
|
||||
import gsap from "gsap";
|
||||
import { ScrollTrigger } from "gsap/ScrollTrigger";
|
||||
import { galleryData, GalleryPhoto } from "@/data/gallery";
|
||||
import { useGallery } from "@/hooks/useGallery";
|
||||
import Lightbox from "@/components/gallery/Lightbox";
|
||||
import GalleryCard from "@/components/gallery/GalleryCard";
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
gsap.registerPlugin(ScrollTrigger);
|
||||
}
|
||||
|
||||
export default function GalleryPage() {
|
||||
const { photos, loading } = useGallery();
|
||||
const [selectedPhoto, setSelectedPhoto] = useState<GalleryPhoto | null>(null);
|
||||
const [columnsCount, setColumnsCount] = useState(3);
|
||||
const [mounted, setMounted] = useState(false);
|
||||
|
||||
const gridRef = useRef<HTMLDivElement>(null);
|
||||
const leftColRef = useRef<HTMLDivElement>(null);
|
||||
const rightColRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// 1. 客户端响应式自适应列数计算
|
||||
useEffect(() => {
|
||||
requestAnimationFrame(() => {
|
||||
setMounted(true);
|
||||
});
|
||||
const handleResize = () => {
|
||||
const width = window.innerWidth;
|
||||
if (width < 768) {
|
||||
setColumnsCount(1);
|
||||
} else if (width < 1024) {
|
||||
setColumnsCount(2);
|
||||
} else {
|
||||
setColumnsCount(3);
|
||||
}
|
||||
};
|
||||
|
||||
handleResize();
|
||||
window.addEventListener("resize", handleResize);
|
||||
return () => window.removeEventListener("resize", handleResize);
|
||||
}, []);
|
||||
|
||||
// 2. GSAP 左右列视差漂移动效 (仅在三列大屏下生效,防移动端重排)
|
||||
useEffect(() => {
|
||||
if (!mounted || columnsCount < 3) return;
|
||||
|
||||
const ctx = gsap.context(() => {
|
||||
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
if (reduceMotion) return;
|
||||
|
||||
// 左列视差滚动偏慢 (向上滑移偏少)
|
||||
if (leftColRef.current) {
|
||||
gsap.fromTo(
|
||||
leftColRef.current,
|
||||
{ y: 0 },
|
||||
{
|
||||
y: -40,
|
||||
ease: "none",
|
||||
scrollTrigger: {
|
||||
trigger: gridRef.current,
|
||||
start: "top bottom",
|
||||
end: "bottom top",
|
||||
scrub: 0.5,
|
||||
invalidateOnRefresh: true,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 右列视差滚动偏快 (向上滑移偏多)
|
||||
if (rightColRef.current) {
|
||||
gsap.fromTo(
|
||||
rightColRef.current,
|
||||
{ y: 0 },
|
||||
{
|
||||
y: 40,
|
||||
ease: "none",
|
||||
scrollTrigger: {
|
||||
trigger: gridRef.current,
|
||||
start: "top bottom",
|
||||
end: "bottom top",
|
||||
scrub: 0.5,
|
||||
invalidateOnRefresh: true,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
}, gridRef);
|
||||
|
||||
// 页面高度更新时刷新缓存
|
||||
const refreshTimer = setTimeout(() => ScrollTrigger.refresh(), 250);
|
||||
|
||||
return () => {
|
||||
ctx.revert();
|
||||
clearTimeout(refreshTimer);
|
||||
};
|
||||
}, [mounted, columnsCount]);
|
||||
|
||||
// 将数据按照列数分发给对应的子数组
|
||||
const getColumnsData = () => {
|
||||
const columns: GalleryPhoto[][] = Array.from({ length: columnsCount }, () => []);
|
||||
photos.forEach((photo, idx) => {
|
||||
columns[idx % columnsCount].push(photo);
|
||||
});
|
||||
return columns;
|
||||
};
|
||||
|
||||
const columns = getColumnsData();
|
||||
|
||||
return (
|
||||
<div className="max-w-7xl mx-auto w-full px-6 md:px-12 py-16 md:py-24">
|
||||
{/* 栏目头部 */}
|
||||
<div className="border-b border-charcoal/10 dark:border-white/10 pb-12 mb-20">
|
||||
<span className="text-[10px] font-sans font-semibold tracking-widest text-charcoal/40 dark:text-white/40 uppercase">
|
||||
05 / Gallery
|
||||
</span>
|
||||
<h1 className="font-serif text-4xl md:text-5xl font-light text-charcoal dark:text-cream mt-2">
|
||||
Gallery / 影像档案
|
||||
</h1>
|
||||
<p className="font-sans text-xs text-charcoal/50 dark:text-white/50 tracking-wider mt-2">
|
||||
用镜头与感光胶片物理定格的光影。已升级为极简无界艺术杂志排版,左右侧列辅以不对称顶部偏置与 GSAP 视差,实现顺畅呼吸的观看体验。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* 瀑布流网格 */}
|
||||
<div ref={gridRef} className="relative z-10 w-full overflow-visible">
|
||||
{/* 未挂载骨架屏 */}
|
||||
{!mounted || loading ? (
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-12">
|
||||
{(photos.length > 0 ? photos : galleryData).map((photo) => (
|
||||
<div
|
||||
key={photo.id}
|
||||
className="bg-stone-100 dark:bg-zinc-950 border border-charcoal/5 dark:border-white/5 h-96 rounded-none animate-pulse"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex gap-12 items-start w-full">
|
||||
{columns.map((columnItems, colIdx) => {
|
||||
// 决定分配视差 Ref 绑定
|
||||
let colRef = undefined;
|
||||
if (columnsCount === 3) {
|
||||
if (colIdx === 0) colRef = leftColRef;
|
||||
if (colIdx === 2) colRef = rightColRef;
|
||||
}
|
||||
|
||||
// 决定不对称顶部偏置,增加版面韵律感 (仅在多列且挂载后应用)
|
||||
let colOffsetClass = "";
|
||||
if (columnsCount === 3) {
|
||||
if (colIdx === 1) colOffsetClass = "pt-20";
|
||||
if (colIdx === 2) colOffsetClass = "pt-10";
|
||||
} else if (columnsCount === 2) {
|
||||
if (colIdx === 1) colOffsetClass = "pt-12";
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
key={colIdx}
|
||||
ref={colRef}
|
||||
className={`flex-1 flex flex-col gap-12 will-change-transform ${colOffsetClass}`}
|
||||
>
|
||||
<AnimatePresence mode="popLayout">
|
||||
{columnItems.map((photo) => {
|
||||
const globalIdx = photos.indexOf(photo);
|
||||
return (
|
||||
<motion.div
|
||||
key={photo.id}
|
||||
initial={{ opacity: 0, y: 35 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, amount: 0.15 }}
|
||||
transition={{
|
||||
duration: 0.7,
|
||||
ease: [0.16, 1, 0.3, 1], // easeOutQuart
|
||||
}}
|
||||
>
|
||||
<GalleryCard
|
||||
photo={photo}
|
||||
index={globalIdx}
|
||||
onClick={() => setSelectedPhoto(photo)}
|
||||
/>
|
||||
</motion.div>
|
||||
);
|
||||
})}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 大图查看灯箱 */}
|
||||
<Lightbox photo={selectedPhoto} onClose={() => setSelectedPhoto(null)} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,583 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
:root {
|
||||
--bg-color: #F7F8F1;
|
||||
--bg-dark-color: #EAF0E5;
|
||||
--fg-color: #223326;
|
||||
--border-line-color: rgba(34, 51, 38, 0.1);
|
||||
--font-heading: var(--font-jost);
|
||||
--font-body: var(--font-inter);
|
||||
--accent-color: #D9865F;
|
||||
--accent-light-color: #F1B894;
|
||||
|
||||
/* Section-specific font variables (Personal archive defaults) */
|
||||
--font-hero-heading: var(--font-jost);
|
||||
--font-hero-body: var(--font-inter);
|
||||
|
||||
--font-writing-heading: var(--font-jost);
|
||||
--font-writing-body: var(--font-inter);
|
||||
|
||||
--font-bento-heading: var(--font-space-grotesk);
|
||||
--font-bento-body: var(--font-inter);
|
||||
|
||||
--font-gallery-heading: var(--font-jost);
|
||||
--font-gallery-body: var(--font-inter);
|
||||
|
||||
--font-quote-heading: var(--font-jost);
|
||||
|
||||
/* Font fallback mapping values (Sans-first personal blog system) */
|
||||
--font-hero-h-val: var(--font-hero-heading), var(--font-noto-serif-sc), system-ui, sans-serif;
|
||||
--font-hero-b-val: var(--font-hero-body), var(--font-body), sans-serif;
|
||||
--font-writing-h-val: var(--font-writing-heading), var(--font-noto-serif-sc), system-ui, sans-serif;
|
||||
--font-writing-b-val: var(--font-writing-body), var(--font-body), sans-serif;
|
||||
--font-bento-h-val: var(--font-bento-heading), var(--font-body), sans-serif;
|
||||
--font-bento-b-val: var(--font-bento-body), var(--font-body), sans-serif;
|
||||
--font-gallery-h-val: var(--font-gallery-heading), var(--font-noto-serif-sc), system-ui, sans-serif;
|
||||
--font-gallery-b-val: var(--font-gallery-body), var(--font-body), sans-serif;
|
||||
--font-quote-h-val: var(--font-quote-heading), var(--font-noto-serif-sc), system-ui, sans-serif;
|
||||
}
|
||||
|
||||
/* 暗黑模式变量配置 */
|
||||
.dark {
|
||||
--bg-color: #17211B;
|
||||
--bg-dark-color: #203027;
|
||||
--fg-color: #F1F4EA;
|
||||
--border-line-color: rgba(241, 244, 234, 0.12);
|
||||
--font-heading: var(--font-jost);
|
||||
--font-body: var(--font-inter);
|
||||
--accent-color: #F1A77C;
|
||||
--accent-light-color: #F5C6A8;
|
||||
}
|
||||
|
||||
@theme {
|
||||
--color-cream: var(--bg-color);
|
||||
--color-cream-dark: var(--bg-dark-color);
|
||||
--color-charcoal: var(--fg-color);
|
||||
--color-gold: var(--accent-color);
|
||||
--color-gold-light: var(--accent-light-color);
|
||||
--color-border-line: var(--border-line-color);
|
||||
|
||||
--font-sans: var(--font-body), system-ui, sans-serif;
|
||||
--font-serif: var(--font-heading), var(--font-noto-serif-sc), Georgia, serif;
|
||||
|
||||
/* Module specific font theme mappings using fallback variables */
|
||||
--font-hero-h: var(--font-hero-h-val);
|
||||
--font-hero-b: var(--font-hero-b-val);
|
||||
--font-writing-h: var(--font-writing-h-val);
|
||||
--font-writing-b: var(--font-writing-b-val);
|
||||
--font-bento-h: var(--font-bento-h-val);
|
||||
--font-bento-b: var(--font-bento-b-val);
|
||||
--font-gallery-h: var(--font-gallery-h-val);
|
||||
--font-gallery-b: var(--font-gallery-b-val);
|
||||
--font-quote-h: var(--font-quote-h-val);
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
UI/UX Pro Max 风格系统定义
|
||||
========================================================================== */
|
||||
|
||||
@import "./styles/themes/life.css";
|
||||
@import "./styles/themes/swiss.css";
|
||||
@import "./styles/themes/minimalist.css";
|
||||
@import "./styles/themes/glass.css";
|
||||
@import "./styles/themes/brutalist.css";
|
||||
|
||||
body {
|
||||
background-color: var(--bg-color);
|
||||
color: var(--fg-color);
|
||||
font-family: var(--font-sans);
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
transition: background-color 0.6s cubic-bezier(0.25, 1, 0.5, 1), color 0.6s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
|
||||
html {
|
||||
scrollbar-color:
|
||||
color-mix(in srgb, var(--accent-color) 72%, var(--fg-color) 28%)
|
||||
color-mix(in srgb, var(--bg-dark-color) 82%, transparent);
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
html::-webkit-scrollbar {
|
||||
width: 12px;
|
||||
}
|
||||
|
||||
html::-webkit-scrollbar-track {
|
||||
background:
|
||||
linear-gradient(
|
||||
180deg,
|
||||
color-mix(in srgb, var(--bg-color) 86%, white 14%),
|
||||
color-mix(in srgb, var(--bg-dark-color) 88%, var(--accent-light-color) 12%)
|
||||
);
|
||||
border-left: 1px solid color-mix(in srgb, var(--fg-color) 10%, transparent);
|
||||
}
|
||||
|
||||
html::-webkit-scrollbar-thumb {
|
||||
border: 3px solid color-mix(in srgb, var(--bg-color) 88%, white 12%);
|
||||
border-radius: 999px;
|
||||
background:
|
||||
linear-gradient(
|
||||
180deg,
|
||||
color-mix(in srgb, var(--accent-light-color) 82%, white 18%),
|
||||
color-mix(in srgb, var(--accent-color) 76%, var(--fg-color) 24%)
|
||||
);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgb(255 255 255 / 0.45),
|
||||
0 0 0 1px color-mix(in srgb, var(--fg-color) 8%, transparent);
|
||||
}
|
||||
|
||||
html::-webkit-scrollbar-thumb:hover {
|
||||
background:
|
||||
linear-gradient(
|
||||
180deg,
|
||||
color-mix(in srgb, var(--accent-light-color) 72%, white 28%),
|
||||
color-mix(in srgb, var(--accent-color) 88%, var(--fg-color) 12%)
|
||||
);
|
||||
}
|
||||
|
||||
/* 全局应用渐变过渡以配合明暗主题切换(限制选择器以避免通配符导致的性能崩溃) */
|
||||
body, header, footer, main, button, input, textarea, a,
|
||||
.writing-card, .bg-cream, .bg-charcoal, .border, .text-charcoal, .text-cream {
|
||||
transition: background-color 0.6s cubic-bezier(0.25, 1, 0.5, 1),
|
||||
border-color 0.6s cubic-bezier(0.25, 1, 0.5, 1),
|
||||
color 0.6s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
|
||||
/* 胶片颗粒感遮罩层 (使用高效静态 Base64 平铺 PNG 代替 CPU 密集型 SVG 动态噪点滤镜) */
|
||||
.film-grain {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAA5u7F8AAAADFBMVEUAAAAAAAAAAAAAAAA17ypIAAAABHRSTlMAr6+vp0hMSgAAAElJREFUeNqVzckNADAMwzD33/Q610uDQDwgCSpq7F2t965Gey2j5Y6WG8peKOcCOV/A+QPOD3B+gPMDnB/g/ADnBzg/wPkBzg/4/wA8xQEVO2D2OAAAAABJRU5ErkJggg==");
|
||||
background-repeat: repeat;
|
||||
opacity: 0.035;
|
||||
pointer-events: none;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.dark .film-grain {
|
||||
opacity: 0.02; /* 暗模式下略微减弱噪点强度 */
|
||||
}
|
||||
|
||||
/* 动态背景视频过渡 */
|
||||
.bg-video {
|
||||
transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
|
||||
/* 自定义文字选择 */
|
||||
::selection {
|
||||
background-color: var(--color-gold-light);
|
||||
color: #1A1A1A;
|
||||
}
|
||||
|
||||
/* 隐藏 Lenis 滚动条默认样式以配合高级排版 */
|
||||
html.lenis, html.lenis body {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.lenis-smooth {
|
||||
scroll-behavior: auto !important;
|
||||
}
|
||||
|
||||
.lenis-smooth [data-lenis-prevent] {
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.lenis-stopped {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.lenis-scrolling iframe {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 细线条风格 */
|
||||
.divider-h {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: var(--color-border-line);
|
||||
}
|
||||
|
||||
.divider-v {
|
||||
width: 1px;
|
||||
height: 100%;
|
||||
background-color: var(--color-border-line);
|
||||
}
|
||||
|
||||
/* 双边框细线样式 */
|
||||
.border-double-line {
|
||||
border-bottom: 3px double var(--color-border-line);
|
||||
}
|
||||
|
||||
/* 文字遮罩显示效果基础 */
|
||||
.char-mask {
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.char-inner {
|
||||
display: inline-block;
|
||||
transform: translateY(100%);
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
背景图片及卡片可读性优化(防止背景图片亮度过高遮挡文字)
|
||||
========================================================================== */
|
||||
.bg-image-layer {
|
||||
opacity: 0.1 !important;
|
||||
transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
.dark .bg-image-layer {
|
||||
opacity: 0.05 !important;
|
||||
}
|
||||
.style-glass .bg-image-layer {
|
||||
opacity: 0.22 !important;
|
||||
}
|
||||
.style-minimalist .bg-image-layer {
|
||||
opacity: 0.04 !important;
|
||||
}
|
||||
.style-brutalist .bg-image-layer {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
||||
/* 实色卡片高对比度类,用于防止卡片内容在强背景下看不清 */
|
||||
.high-contrast-card {
|
||||
background-color: var(--bg-color) !important;
|
||||
border: 1px solid var(--border-line-color) !important;
|
||||
}
|
||||
.style-glass .high-contrast-card {
|
||||
background-color: rgba(255, 255, 255, 0.08) !important;
|
||||
backdrop-filter: blur(20px) saturate(120%) !important;
|
||||
-webkit-backdrop-filter: blur(20px) saturate(120%) !important;
|
||||
border: 1px solid rgba(255, 255, 255, 0.15) !important;
|
||||
}
|
||||
.dark.style-glass .high-contrast-card {
|
||||
background-color: rgba(15, 12, 28, 0.5) !important;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12) !important;
|
||||
}
|
||||
.style-minimalist .high-contrast-card {
|
||||
background-color: var(--bg-dark-color) !important;
|
||||
border-color: transparent !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
.style-brutalist .high-contrast-card {
|
||||
background-color: var(--bg-color) !important;
|
||||
border: 2px solid var(--border-line-color) !important;
|
||||
box-shadow: 4px 4px 0px var(--border-line-color) !important;
|
||||
}
|
||||
|
||||
/* 隐藏默认横向滚动条 */
|
||||
.no-scrollbar::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.no-scrollbar,
|
||||
.scrollbar-none {
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.scrollbar-none::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 硬件加速以调优横滚流畅度 */
|
||||
.gpu-accelerated-track {
|
||||
will-change: transform;
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
|
||||
/* 自动跑马灯滑道双端半透明羽化遮罩 */
|
||||
.mask-image-horizontal {
|
||||
mask-image: linear-gradient(to right, transparent, white 15%, white 85%, transparent);
|
||||
-webkit-mask-image: linear-gradient(to right, transparent, white 15%, white 85%, transparent);
|
||||
}
|
||||
|
||||
/* 首页开屏底部的低矮动态波浪 */
|
||||
.home-hero-wave {
|
||||
height: clamp(5rem, 10vw, 8.5rem);
|
||||
transform: translateY(1px);
|
||||
}
|
||||
|
||||
.waves {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-bottom: -7px;
|
||||
}
|
||||
|
||||
.wave-parallax > use {
|
||||
animation: atlas-wave-drift 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.wave-layer-1 {
|
||||
fill: color-mix(in srgb, var(--bg-color) 70%, var(--accent-light-color) 30%);
|
||||
opacity: 0.7;
|
||||
animation-delay: -2s;
|
||||
animation-duration: 7s;
|
||||
}
|
||||
|
||||
.wave-layer-2 {
|
||||
fill: color-mix(in srgb, var(--bg-color) 82%, var(--accent-light-color) 18%);
|
||||
opacity: 0.55;
|
||||
animation-delay: -3s;
|
||||
animation-duration: 10s;
|
||||
}
|
||||
|
||||
.wave-layer-3 {
|
||||
fill: color-mix(in srgb, var(--bg-color) 90%, var(--accent-light-color) 10%);
|
||||
opacity: 0.4;
|
||||
animation-delay: -4s;
|
||||
animation-duration: 13s;
|
||||
}
|
||||
|
||||
.wave-layer-4 {
|
||||
fill: var(--bg-color);
|
||||
animation-delay: -5s;
|
||||
animation-duration: 20s;
|
||||
}
|
||||
|
||||
@keyframes atlas-wave-drift {
|
||||
0% {
|
||||
transform: translate3d(-90px, 0, 0);
|
||||
}
|
||||
100% {
|
||||
transform: translate3d(85px, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Footer window decoration, shown only when the document bottom is reached */
|
||||
.footer-peekers {
|
||||
position: absolute;
|
||||
inset-inline: 0;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
pointer-events: none;
|
||||
transform: translateY(calc(-100% + 8px));
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.footer-peekers-image {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: min(48rem, 74vw);
|
||||
filter: drop-shadow(0 16px 24px color-mix(in srgb, var(--fg-color) 12%, transparent));
|
||||
}
|
||||
|
||||
.footer-peekers-image img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.footer-peekers-floating {
|
||||
position: fixed;
|
||||
inset-inline: 0;
|
||||
bottom: 0;
|
||||
z-index: 30;
|
||||
pointer-events: none;
|
||||
opacity: 1;
|
||||
transform: translateY(8px);
|
||||
/* Visibility / fade is driven by GSAP (see FloatingFooterPeekers); no CSS
|
||||
transition here so the scroll-scrubbed cross-dissolve is not double-eased. */
|
||||
}
|
||||
|
||||
.footer-peekers-floating-image {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: min(48rem, 74vw);
|
||||
filter: drop-shadow(0 16px 24px color-mix(in srgb, var(--fg-color) 12%, transparent));
|
||||
}
|
||||
|
||||
.footer-peekers-floating-image img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 1023px) {
|
||||
.footer-peekers-image,
|
||||
.footer-peekers-floating-image {
|
||||
width: min(44rem, 86vw);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.footer-peekers-image,
|
||||
.footer-peekers-floating-image {
|
||||
width: 104vw;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.wave-parallax > use {
|
||||
animation: none;
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
|
||||
.ecg-flow-left,
|
||||
.ecg-flow-right,
|
||||
.outer-dashed-ring {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Alternating slanted clip paths for writing cards */
|
||||
.clip-even-img {
|
||||
clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
|
||||
}
|
||||
.clip-odd-img {
|
||||
clip-path: polygon(0 0, 100% 0, 100% 100%, 0 88%);
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.clip-even-img {
|
||||
clip-path: polygon(0 0, 45% 0, 37% 100%, 0 100%);
|
||||
}
|
||||
.clip-odd-img {
|
||||
clip-path: polygon(55% 0, 100% 0, 100% 100%, 63% 100%);
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
性能与硬件加速渲染优化系统
|
||||
========================================================================== */
|
||||
|
||||
/* 1. 硬件加速弹幕节点:将弹幕隔离为独立的 GPU 合成层,避免滚动或位移时与高清视频背景混合重绘 */
|
||||
.love-danmaku-node {
|
||||
will-change: transform;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
@keyframes ecgFlowLeft {
|
||||
0% {
|
||||
stroke-dashoffset: 80;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes ecgFlowRight {
|
||||
0% {
|
||||
stroke-dashoffset: -80;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.ecg-flow-left {
|
||||
stroke-dasharray: 20 60;
|
||||
animation: ecgFlowLeft 3.5s linear infinite;
|
||||
}
|
||||
|
||||
.ecg-flow-right {
|
||||
stroke-dasharray: 20 60;
|
||||
animation: ecgFlowRight 3.5s linear infinite;
|
||||
}
|
||||
|
||||
.outer-dashed-ring {
|
||||
animation: rotateRing 15s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes rotateRing {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.perspective {
|
||||
perspective: 1000px;
|
||||
}
|
||||
|
||||
.transform-style-3d {
|
||||
transform-style: preserve-3d;
|
||||
}
|
||||
|
||||
.backface-hidden {
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.rotate-y-180 {
|
||||
transform: rotateY(180deg);
|
||||
}
|
||||
|
||||
/* 2. 硬件加速大半径高斯模糊背景层:避免在滚动时造成全屏重排与掉帧 */
|
||||
.glass-glows {
|
||||
will-change: transform;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
/* 3. 硬件加速胶片噪点层:将其固定到 GPU 合成图层上,避免与滚动层发生图层拉扯 */
|
||||
.film-grain {
|
||||
will-change: transform;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
ListeningCard 音乐频谱跳动动画 (自定义)
|
||||
========================================================================== */
|
||||
@keyframes bar-jump-1 {
|
||||
0%, 100% { transform: scaleY(0.3); }
|
||||
50% { transform: scaleY(1); }
|
||||
}
|
||||
@keyframes bar-jump-2 {
|
||||
0%, 100% { transform: scaleY(0.4); }
|
||||
50% { transform: scaleY(1.2); }
|
||||
}
|
||||
@keyframes bar-jump-3 {
|
||||
0%, 100% { transform: scaleY(0.25); }
|
||||
50% { transform: scaleY(0.85); }
|
||||
}
|
||||
@keyframes bar-jump-4 {
|
||||
0%, 100% { transform: scaleY(0.5); }
|
||||
50% { transform: scaleY(1.1); }
|
||||
}
|
||||
@keyframes bar-jump-5 {
|
||||
0%, 100% { transform: scaleY(0.35); }
|
||||
50% { transform: scaleY(0.95); }
|
||||
}
|
||||
|
||||
.animate-bar-jump-1 {
|
||||
animation: bar-jump-1 1.2s ease-in-out infinite;
|
||||
transform-origin: bottom;
|
||||
}
|
||||
.animate-bar-jump-2 {
|
||||
animation: bar-jump-2 0.9s ease-in-out infinite;
|
||||
transform-origin: bottom;
|
||||
}
|
||||
.animate-bar-jump-3 {
|
||||
animation: bar-jump-3 1.4s ease-in-out infinite;
|
||||
transform-origin: bottom;
|
||||
}
|
||||
.animate-bar-jump-4 {
|
||||
animation: bar-jump-4 1.1s ease-in-out infinite;
|
||||
transform-origin: bottom;
|
||||
}
|
||||
.animate-bar-jump-5 {
|
||||
animation: bar-jump-5 1.3s ease-in-out infinite;
|
||||
transform-origin: bottom;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
GalleryCard 暗角纹理 (自定义)
|
||||
========================================================================== */
|
||||
.bg-radial-vignette {
|
||||
background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.75) 100%);
|
||||
}
|
||||
|
||||
/* 隐藏 Next.js 本地开发状态指示器 */
|
||||
nextjs-portal, #__next-prerender-indicator {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 362 KiB |
@@ -0,0 +1,148 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Inter, Cormorant_Garamond, Playfair_Display, Space_Grotesk, Space_Mono, Jost, Noto_Serif_SC, Ma_Shan_Zheng } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import Navbar from "@/components/Navbar";
|
||||
import Footer from "@/components/Footer";
|
||||
import FloatingFooterPeekers from "@/components/ui/FloatingFooterPeekers";
|
||||
import SmoothScroll from "@/components/ui/SmoothScroll";
|
||||
import StyleConsole from "@/components/ui/StyleConsole";
|
||||
import BackToTop from "@/components/ui/BackToTop";
|
||||
import TapeStation from "@/components/ui/TapeStation";
|
||||
import ThemeApplier from "@/components/ui/ThemeApplier";
|
||||
|
||||
const inter = Inter({
|
||||
variable: "--font-inter",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
const cormorant = Cormorant_Garamond({
|
||||
variable: "--font-cormorant",
|
||||
subsets: ["latin"],
|
||||
weight: ["300", "400", "500", "600", "700"],
|
||||
style: ["normal", "italic"],
|
||||
});
|
||||
|
||||
const playfair = Playfair_Display({
|
||||
variable: "--font-playfair",
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "500", "600", "700"],
|
||||
style: ["normal", "italic"],
|
||||
});
|
||||
|
||||
const spaceGrotesk = Space_Grotesk({
|
||||
variable: "--font-space-grotesk",
|
||||
subsets: ["latin"],
|
||||
weight: ["300", "400", "500", "600", "700"],
|
||||
});
|
||||
|
||||
const spaceMono = Space_Mono({
|
||||
variable: "--font-space-mono",
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "700"],
|
||||
});
|
||||
|
||||
const jost = Jost({
|
||||
variable: "--font-jost",
|
||||
subsets: ["latin"],
|
||||
weight: ["300", "400", "500", "600", "700"],
|
||||
});
|
||||
|
||||
const notoSerifSC = Noto_Serif_SC({
|
||||
variable: "--font-noto-serif-sc",
|
||||
preload: false,
|
||||
weight: ["300", "400", "500", "600", "700"],
|
||||
display: "swap",
|
||||
});
|
||||
|
||||
const maShanZheng = Ma_Shan_Zheng({
|
||||
variable: "--font-ma-shan-zheng",
|
||||
weight: "400",
|
||||
subsets: ["latin"],
|
||||
preload: false,
|
||||
});
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
let title = "春风不解别离 | 个人生活档案馆";
|
||||
let faviconUrl = "/icon.png";
|
||||
try {
|
||||
const res = await fetch("http://localhost:8080/api/config/public", { next: { revalidate: 10 } });
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
if (data.code === 200 && Array.isArray(data.data)) {
|
||||
const titleItem = data.data.find((c: any) => c.configKey === "site.title.default");
|
||||
if (titleItem?.configValue) {
|
||||
title = titleItem.configValue;
|
||||
}
|
||||
const favItem = data.data.find((c: any) => c.configKey === "site.favicon.url");
|
||||
if (favItem?.configValue) {
|
||||
faviconUrl = favItem.configValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Failed to fetch root metadata:", e);
|
||||
}
|
||||
|
||||
return {
|
||||
title,
|
||||
description: "春风得意马蹄疾,不信人间有别离。承载思想随笔、时间胶囊、恋爱纪实与日常影像的私人电子展厅。",
|
||||
icons: {
|
||||
icon: faviconUrl,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html
|
||||
lang="zh"
|
||||
className={`${inter.variable} ${cormorant.variable} ${playfair.variable} ${spaceGrotesk.variable} ${spaceMono.variable} ${jost.variable} ${notoSerifSC.variable} ${maShanZheng.variable} h-full antialiased`}
|
||||
>
|
||||
<body className="min-h-full flex flex-col text-charcoal bg-transparent">
|
||||
<ThemeApplier />
|
||||
{/* 1. 全局底色层 (z-0) */}
|
||||
<div className="fixed inset-0 z-0 bg-cream pointer-events-none" />
|
||||
|
||||
{/* 2. 静态高定背景图片层 (z-1) */}
|
||||
<div
|
||||
className="fixed inset-0 z-1 pointer-events-none bg-cover bg-center bg-image-layer"
|
||||
style={{ backgroundImage: "url('/bg-image.png')" }}
|
||||
/>
|
||||
|
||||
{/* 2.5 霓虹发光灯效层 (仅在 Glassmorphic 风格下可见) */}
|
||||
<div className="fixed inset-0 z-[2] opacity-0 pointer-events-none transition-opacity duration-1000 glass-glows overflow-hidden">
|
||||
<div className="absolute top-[10%] left-[5%] w-[45vw] h-[45vw] rounded-full bg-pink-500/10 dark:bg-pink-500/15 blur-[120px]" />
|
||||
<div className="absolute bottom-[15%] right-[5%] w-[50vw] h-[50vw] rounded-full bg-blue-500/15 dark:bg-blue-500/20 blur-[150px]" />
|
||||
</div>
|
||||
|
||||
{/* 3. 电影胶片质感颗粒图层 (z-50, 保证极弱噪点铺在最上层) */}
|
||||
<div className="film-grain" />
|
||||
|
||||
{/* 4. 网页主内容容器 (z-10),拥有显式正值 z-index,保证所有文字、按钮绝对不被背景或视频遮挡 */}
|
||||
<div className="relative z-10 min-h-full flex flex-col">
|
||||
<SmoothScroll>
|
||||
<Navbar />
|
||||
<main className="grow flex flex-col">{children}</main>
|
||||
<Footer />
|
||||
</SmoothScroll>
|
||||
</div>
|
||||
|
||||
{/* 5. 全站底部趴窗装饰,接近 footer 时停靠到 footer 顶部 */}
|
||||
<FloatingFooterPeekers />
|
||||
|
||||
{/* 6. 悬浮的视觉控制中心 */}
|
||||
<StyleConsole />
|
||||
|
||||
{/* 7. 全局回到顶部按钮 */}
|
||||
<BackToTop />
|
||||
|
||||
{/* 8. 治愈系磁带播放器 */}
|
||||
<TapeStation />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { notFound } from "next/navigation";
|
||||
import { useSysConfig } from "@/hooks/useSysConfig";
|
||||
import EnvelopeCard from "@/components/letter/EnvelopeCard";
|
||||
import LetterModal from "@/components/letter/LetterModal";
|
||||
import { getTimeLetterList } from "@/api/letter";
|
||||
|
||||
interface CapsuleLetter {
|
||||
id: string;
|
||||
title: string;
|
||||
targetDate: string; // ISO 日期
|
||||
bypassCode: string; // 绕过密码
|
||||
prompt: string; // 胶囊预告
|
||||
content: string; // 信件内容
|
||||
images?: string;
|
||||
}
|
||||
|
||||
export default function LetterPage() {
|
||||
const { isPageEnabled, loading } = useSysConfig();
|
||||
const [letters, setLetters] = useState<CapsuleLetter[]>([]);
|
||||
const [activeLetter, setActiveLetter] = useState<CapsuleLetter | null>(null);
|
||||
const [unlockedIds, setUnlockedIds] = useState<string[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchLetters = async () => {
|
||||
try {
|
||||
const res = await getTimeLetterList();
|
||||
if (res.data?.code === 200) {
|
||||
const list = (res.data.data || []).map((item: any) => ({
|
||||
id: String(item.id),
|
||||
title: item.title,
|
||||
targetDate: item.targetDate,
|
||||
bypassCode: item.bypassCode || "",
|
||||
prompt: item.prompt || "",
|
||||
content: item.content || "",
|
||||
images: item.images || ""
|
||||
}));
|
||||
console.log("[岁月信箱] 动态加载的未来信札列表:", list);
|
||||
setLetters(list);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to fetch letters", err);
|
||||
}
|
||||
};
|
||||
fetchLetters();
|
||||
}, []);
|
||||
|
||||
if (!loading && !isPageEnabled("page.letter.enable", true)) {
|
||||
notFound();
|
||||
return null;
|
||||
}
|
||||
|
||||
const handleOpenLetter = (letter: CapsuleLetter) => {
|
||||
setActiveLetter(letter);
|
||||
};
|
||||
|
||||
const handleUnlockSuccess = (id: string) => {
|
||||
setUnlockedIds([...unlockedIds, id]);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="max-w-6xl mx-auto w-full px-4 md:px-8 py-24 md:py-32 relative">
|
||||
|
||||
{/* 3D 书桌皮质/木质档案垫板容器 */}
|
||||
<div className="relative bg-cream border border-charcoal/10 rounded-3xl p-8 md:p-12 shadow-[0_20px_50px_-20px_rgba(23,33,27,0.3)] overflow-hidden">
|
||||
|
||||
{/* 精致拟真黄铜回形针 (Paper Clip) - 别在信笺的左上角 */}
|
||||
<div className="absolute top-8 left-8 w-6 h-14 border-2 border-[#D4AF37]/50 rounded-full pointer-events-none rotate-[25deg] z-20 shadow-[2px_4px_6px_rgba(0,0,0,0.15)] flex justify-center">
|
||||
{/* 回形针内折叠金属环 */}
|
||||
<div className="absolute top-2 w-3.5 h-10 border border-[#D4AF37]/60 rounded-full" />
|
||||
{/* 回形针最内层回环 */}
|
||||
<div className="absolute top-4 w-2 h-7 border border-[#D4AF37]/50 rounded-full" />
|
||||
</div>
|
||||
|
||||
{/* 右上角精致信箱标签印花 */}
|
||||
<div className="absolute top-8 right-8 font-mono text-[8px] tracking-widest text-[#B5A891]/40 dark:text-white/20 uppercase pointer-events-none select-none text-right hidden sm:block">
|
||||
<span>SPRING TIME-BOX</span>
|
||||
<br />
|
||||
<span>EST. 2026.06</span>
|
||||
</div>
|
||||
|
||||
{/* 栏目头部 */}
|
||||
<div className="border-b border-charcoal/10 dark:border-white/10 pb-10 mb-12 relative pl-8">
|
||||
<span className="text-[10px] font-sans font-semibold tracking-widest text-charcoal/40 uppercase">
|
||||
08 / Time Capsule
|
||||
</span>
|
||||
<h1 className="font-serif text-4xl md:text-5xl font-light text-charcoal dark:text-cream mt-2 tracking-wide">
|
||||
Letter / 岁月信箱
|
||||
</h1>
|
||||
<p className="font-sans text-xs text-charcoal/50 tracking-wider mt-2.5 max-w-[60ch] leading-relaxed">
|
||||
投递给未来自己的时光胶囊。它们静静沉睡于「春风不解别离」逻辑舱中,将在倒计时归零时解封开启,亦可输入对应的时空秘钥提前唤醒阅读。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* 实体信卡列表 - 采用符合网格的 2 列排列 */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 md:gap-12 relative z-10 px-2">
|
||||
{letters.map((letter) => (
|
||||
<EnvelopeCard
|
||||
key={letter.id}
|
||||
letter={letter}
|
||||
unlockedIds={unlockedIds}
|
||||
onClick={() => handleOpenLetter(letter)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 模块化信件查看弹窗 */}
|
||||
<LetterModal
|
||||
letter={activeLetter}
|
||||
onClose={() => setActiveLetter(null)}
|
||||
unlockedIds={unlockedIds}
|
||||
onUnlockSuccess={handleUnlockSuccess}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import LovePageClient from "@/components/love/LovePageClient";
|
||||
import { getPublicConfig } from "@/api/config";
|
||||
|
||||
interface PublicConfig {
|
||||
configKey: string;
|
||||
configValue: string;
|
||||
}
|
||||
|
||||
async function getPublicConfigs(): Promise<Record<string, string>> {
|
||||
try {
|
||||
const response = await getPublicConfig();
|
||||
const payload = response.data;
|
||||
if (payload?.code === 200 && Array.isArray(payload.data)) {
|
||||
const configMap: Record<string, string> = {};
|
||||
payload.data.forEach((item: any) => {
|
||||
configMap[item.configKey] = item.configValue;
|
||||
});
|
||||
return configMap;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Love page config unavailable, using empty fallback.", error);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
export default async function LovePage() {
|
||||
const configs = await getPublicConfigs();
|
||||
const enabled = configs["page.love.enable"] !== "false";
|
||||
|
||||
if (!enabled) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return <LovePageClient configs={configs} />;
|
||||
}
|
||||