feat(web): 用户工作台 - 产品化壳层、内容库布局与积分入口

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ddCat
2026-09-16 22:59:45 +08:00
parent f52702b70f
commit 969e2831b2
46 changed files with 5355 additions and 944 deletions

View File

@@ -17,8 +17,6 @@ const featureNames: Record<FeatureKey, string> = {
pluginCenterEnabled: "插件中心",
};
let featureAvailabilityCheckedOnce = false;
export function RequireFeature({ feature, children }: { feature: FeatureKey; children: ReactNode }) {
const navigate = useNavigate();
const user = useUserStore((state) => state.user);
@@ -28,8 +26,6 @@ export function RequireFeature({ feature, children }: { feature: FeatureKey; chi
const [error, setError] = useState("");
useEffect(() => {
if (featureAvailabilityCheckedOnce) return;
featureAvailabilityCheckedOnce = true;
let cancelled = false;
setError("");
refreshFeatureAvailability()
@@ -42,7 +38,7 @@ export function RequireFeature({ feature, children }: { feature: FeatureKey; chi
return () => {
cancelled = true;
};
}, []);
}, [feature, user?.id]);
if (checking) return <WorkspacePage><WorkspaceLoadingState label="正在确认功能状态" detail={featureNames[feature]} rows={3} /></WorkspacePage>;
if (error) return <WorkspacePage><WorkspaceErrorState title="无法确认功能状态" description={error} actionLabel="返回创作台" onRetry={() => navigate("/", { replace: true })} /></WorkspacePage>;