Files
tiku-saas-web/src/student/pages/HandbookPage.tsx

12 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { ArrowRight, FileText } from "lucide-react";
import { useQuery } from "@tanstack/react-query";
import { Link } from "react-router";
import { catalogApi, queryKeys } from "../../api";
import { useStudentSession } from "../StudentSession";
export default function HandbookPage() {
const { profile } = useStudentSession();
const query = useQuery({ queryKey: queryKeys.handbookSubjects(profile?.regionId), queryFn: () => catalogApi.handbookSubjects(profile?.regionId) });
return <div className="catalog-learning-page"><header className="page-heading"><div><p className="eyebrow">KNOWLEDGE HANDBOOK</p><h1></h1><p></p></div></header>{query.isLoading ? <div className="skeleton-grid"><i /><i /><i /></div> : query.isError ? <div className="error-panel"><p></p><button onClick={() => void query.refetch()}></button></div> : query.data?.items.length ? <section className="learning-catalog-grid">{query.data.items.map((item) => <Link to={`/handbook/subject/${item.id}`} key={item.id}><span><FileText /></span><div><small>HANDBOOK SUBJECT</small><h2>{item.name}</h2><p>{item.description || "查看章节和知识条目。"}</p></div><ArrowRight /></Link>)}</section> : <div className="empty-panel"></div>}</div>;
}