"use client"; import Link from "next/link"; import { useEffect, useMemo, 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 ExplorePage() { const [userId, setUserId] = useState(null); const [isVip, setIsVip] = useState(false); const [showLoginPrompt, setShowLoginPrompt] = useState(false); const [query, setQuery] = useState(""); useEffect(() => { const uid = getStorage("userId") || getStorage("memosAccount"); const type = getStorage("paidType"); setUserId(uid || null); setIsVip(type === "vip"); }, []); useEffect(() => { if (typeof window === "undefined") { return; } const tag = new URLSearchParams(window.location.search).get("tag"); if (tag) { setQuery(`#${tag}`); } }, []); const normalizedQuery = useMemo(() => query.trim(), [query]); return (
setQuery(event.target.value)} placeholder="例如:AI 工具、远程工作、自动化" />
你可以直接输入 `#标签` 或普通关键词,结果会基于当前社群动态实时过滤。
{showLoginPrompt ? (

发现页仅对会员开放。

立即加入会员
) : null} {isVip && userId ? ( setShowLoginPrompt(true)} state="NORMAL" query={normalizedQuery} emptyText="没有匹配当前关键词的动态,换个标签试试。" /> ) : (
Members Only

发现页需要会员权限

开通后即可按标签、关键词和时间流探索全部动态。

立即加入
)}
); }