Files
2026-03-15 04:25:45 -05:00

71 lines
2.4 KiB
TypeScript

"use client";
import Link from "next/link";
import { useEffect, useState } from "react";
import { CommunityTimeline } from "../components/CommunityTimeline";
import { CommunityPageHero } from "../components/CommunityPageHero";
import styles from "../components/memos.module.css";
function getStorage(key: string): string | null {
if (typeof window === "undefined") {
return null;
}
return localStorage.getItem(key);
}
export default function ArchivedPage() {
const [userId, setUserId] = useState<string | null>(null);
const [isVip, setIsVip] = useState(false);
const [showLoginPrompt, setShowLoginPrompt] = useState(false);
useEffect(() => {
const uid = getStorage("userId") || getStorage("memosAccount");
const type = getStorage("paidType");
setUserId(uid || null);
setIsVip(type === "vip");
}, []);
return (
<div className={styles.pageStack}>
<CommunityPageHero
eyebrow="Archive"
title="归档但不丢失"
description="把已经沉淀完成的内容移入归档,保持首页干净,同时保留随时可查的历史记录。"
chips={["历史沉淀", "仍可检索", "适合经验总结"]}
actions={[{ href: "/community", label: "返回首页", secondary: true }]}
/>
{showLoginPrompt ? (
<section className={styles.vipBanner}>
<p></p>
<Link href="/" className={styles.ctaLink}>
</Link>
</section>
) : null}
{isVip && userId ? (
<CommunityTimeline
userId={userId}
onVipRequired={() => setShowLoginPrompt(true)}
state="ARCHIVED"
emptyText="目前还没有归档内容。"
/>
) : (
<section className={styles.lockedPanel}>
<div className={styles.lockedPanelCopy}>
<span className={styles.lockedPanelEyebrow}>Members Only</span>
<h2 className={styles.lockedPanelTitle}></h2>
<p className={styles.lockedPanelDesc}></p>
</div>
<div className={styles.lockedPanelActions}>
<Link href="/" className={styles.heroPrimaryAction}>
</Link>
</div>
</section>
)}
</div>
);
}