🎉 init: 小龙的工作空间
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Metadata } from "next";
|
||||
import "./globals.css";
|
||||
import { Sidebar } from "@/components/layout/Sidebar";
|
||||
import { BottomNav } from "@/components/layout/BottomNav";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "BookShelf",
|
||||
description: "一款支持多端同步、Markdown 编辑和标签管理的笔记应用。",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="zh-CN">
|
||||
<body className="bg-gray-50 min-h-screen">
|
||||
<div className="flex">
|
||||
{/* Desktop Sidebar */}
|
||||
<Sidebar items={[{"name":"首页","href":"/home","icon":"🏠"},{"name":"统计仪表盘","href":"/统计仪表盘","icon":"📋"},{"name":"搜索和筛选","href":"/搜索和筛选","icon":"📅"},{"name":"书籍库","href":"/书籍库","icon":"✏️"},{"name":"阅读状态","href":"/阅读状态","icon":"📸"}] } projectName="BookShelf" />
|
||||
{/* Main Content */}
|
||||
<main className="flex-1 lg:pl-64 pb-20 lg:pb-0">
|
||||
<div className="max-w-2xl mx-auto px-4 py-6">
|
||||
{children}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
{/* Mobile Bottom Nav */}
|
||||
<BottomNav items={[{"name":"首页","href":"/home","icon":"🏠"},{"name":"统计仪表盘","href":"/统计仪表盘","icon":"📋"},{"name":"搜索和筛选","href":"/搜索和筛选","icon":"📅"},{"name":"书籍库","href":"/书籍库","icon":"✏️"}] } />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import Link from "next/link";
|
||||
|
||||
export default function HomePage() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Hero Section */}
|
||||
<section className="bg-gradient-to-br from-blue-500 to-blue-700 rounded-2xl p-6 text-white">
|
||||
<h1 className="text-2xl font-bold">BookShelf</h1>
|
||||
<p className="mt-2 text-blue-100 text-sm">应用首页</p>
|
||||
</section>
|
||||
|
||||
{/* Quick Actions */}
|
||||
<section>
|
||||
<h2 className="text-lg font-semibold text-gray-800 mb-3">快捷入口</h2>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<Link key="0" href="/home" className="bg-white rounded-xl border border-gray-100 p-4 text-center hover:shadow-md transition-shadow">
|
||||
<span className="text-2xl block mb-1">📋</span>
|
||||
<span className="text-sm text-gray-600">书籍库</span>
|
||||
</Link>
|
||||
<Link key="1" href="/home" className="bg-white rounded-xl border border-gray-100 p-4 text-center hover:shadow-md transition-shadow">
|
||||
<span className="text-2xl block mb-1">📅</span>
|
||||
<span className="text-sm text-gray-600">阅读状态</span>
|
||||
</Link>
|
||||
<Link key="2" href="/home" className="bg-white rounded-xl border border-gray-100 p-4 text-center hover:shadow-md transition-shadow">
|
||||
<span className="text-2xl block mb-1">📝</span>
|
||||
<span className="text-sm text-gray-600">阅读进度</span>
|
||||
</Link>
|
||||
<Link key="3" href="/home" className="bg-white rounded-xl border border-gray-100 p-4 text-center hover:shadow-md transition-shadow">
|
||||
<span className="text-2xl block mb-1">📸</span>
|
||||
<span className="text-sm text-gray-600">笔记和标注</span>
|
||||
</Link>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Recent Activity / Stats */}
|
||||
<section>
|
||||
<h2 className="text-lg font-semibold text-gray-800 mb-3">今日概览</h2>
|
||||
<div className="bg-white rounded-xl border border-gray-100 p-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-sm text-gray-500">欢迎使用 BookShelf</p>
|
||||
<p className="text-xs text-gray-400 mt-1">开始探索功能吧</p>
|
||||
</div>
|
||||
<span className="text-3xl">👋</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Card } from "@/components/ui/Card";
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import { EmptyState } from "@/components/ui/EmptyState";
|
||||
import { use书籍库 } from "@/hooks/use书籍库";
|
||||
|
||||
export default function PagePage() {
|
||||
const { data, loading, error, refetch } = use书籍库();
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-gray-800">书籍库</h1>
|
||||
<p className="text-sm text-gray-500 mt-1">添加书籍(书名</p>
|
||||
</div>
|
||||
<Button onClick={() => setOpen(true)} variant="primary" size="sm">新增</Button>
|
||||
</div>
|
||||
|
||||
{loading ? (
|
||||
<div className="flex justify-center py-12">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" />
|
||||
</div>
|
||||
) : error ? (
|
||||
<Card className="text-center py-8">
|
||||
<p className="text-red-500 text-sm">{error}</p>
|
||||
<Button onClick={refetch} variant="secondary" size="sm" className="mt-2">重试</Button>
|
||||
</Card>
|
||||
) : data.length === 0 ? (
|
||||
<EmptyState
|
||||
icon="📭"
|
||||
title="暂无数据"
|
||||
description="还没有任何记录,点击上方按钮开始"
|
||||
action={<Button onClick={() => setOpen(true)} variant="primary" size="sm">创建第一条</Button>}
|
||||
/>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
{data.map((item: any) => (
|
||||
<Card key={item.id}>
|
||||
<h3 className="font-medium text-gray-800">{item.title || item.name || `Item ${item.id.slice(0, 8)}`}</h3>
|
||||
<p className="text-xs text-gray-400 mt-1">{item.createdAt || ""}</p>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Card } from "@/components/ui/Card";
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import { EmptyState } from "@/components/ui/EmptyState";
|
||||
|
||||
|
||||
export default function PagePage() {
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-gray-800">书评</h1>
|
||||
<p className="text-sm text-gray-500 mt-1">读完后写书评,打分(</p>
|
||||
</div>
|
||||
<Button onClick={() => setOpen(true)} variant="primary" size="sm">新增</Button>
|
||||
</div>
|
||||
|
||||
{<Card>
|
||||
<p className="text-gray-500 text-sm">书评 页面内容</p>
|
||||
<p className="text-xs text-gray-400 mt-1">路由: /书评</p>
|
||||
</Card>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Card } from "@/components/ui/Card";
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import { EmptyState } from "@/components/ui/EmptyState";
|
||||
|
||||
|
||||
export default function PagePage() {
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-gray-800">搜索和筛选</h1>
|
||||
<p className="text-sm text-gray-500 mt-1">按状态/分类/作者/评分筛选。技术要求</p>
|
||||
</div>
|
||||
<Button onClick={() => setOpen(true)} variant="primary" size="sm">新增</Button>
|
||||
</div>
|
||||
|
||||
{<Card>
|
||||
<p className="text-gray-500 text-sm">搜索和筛选 页面内容</p>
|
||||
<p className="text-xs text-gray-400 mt-1">路由: /搜索和筛选</p>
|
||||
</Card>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Card } from "@/components/ui/Card";
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import { EmptyState } from "@/components/ui/EmptyState";
|
||||
import { use笔记和标注 } from "@/hooks/use笔记和标注";
|
||||
|
||||
export default function PagePage() {
|
||||
const { data, loading, error, refetch } = use笔记和标注();
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-gray-800">笔记和标注</h1>
|
||||
<p className="text-sm text-gray-500 mt-1">对某一页写笔记,支持高亮段落摘抄。</p>
|
||||
</div>
|
||||
<Button onClick={() => setOpen(true)} variant="primary" size="sm">新增</Button>
|
||||
</div>
|
||||
|
||||
{loading ? (
|
||||
<div className="flex justify-center py-12">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" />
|
||||
</div>
|
||||
) : error ? (
|
||||
<Card className="text-center py-8">
|
||||
<p className="text-red-500 text-sm">{error}</p>
|
||||
<Button onClick={refetch} variant="secondary" size="sm" className="mt-2">重试</Button>
|
||||
</Card>
|
||||
) : data.length === 0 ? (
|
||||
<EmptyState
|
||||
icon="📭"
|
||||
title="暂无数据"
|
||||
description="还没有任何记录,点击上方按钮开始"
|
||||
action={<Button onClick={() => setOpen(true)} variant="primary" size="sm">创建第一条</Button>}
|
||||
/>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
{data.map((item: any) => (
|
||||
<Card key={item.id}>
|
||||
<h3 className="font-medium text-gray-800">{item.title || item.name || `Item ${item.id.slice(0, 8)}`}</h3>
|
||||
<p className="text-xs text-gray-400 mt-1">{item.createdAt || ""}</p>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Card } from "@/components/ui/Card";
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import { EmptyState } from "@/components/ui/EmptyState";
|
||||
|
||||
|
||||
export default function PagePage() {
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-gray-800">统计仪表盘</h1>
|
||||
<p className="text-sm text-gray-500 mt-1">年度阅读量</p>
|
||||
</div>
|
||||
<Button onClick={() => setOpen(true)} variant="primary" size="sm">新增</Button>
|
||||
</div>
|
||||
|
||||
{<Card>
|
||||
<p className="text-gray-500 text-sm">统计仪表盘 页面内容</p>
|
||||
<p className="text-xs text-gray-400 mt-1">路由: /统计仪表盘</p>
|
||||
</Card>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Card } from "@/components/ui/Card";
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import { EmptyState } from "@/components/ui/EmptyState";
|
||||
import { use阅读状态 } from "@/hooks/use阅读状态";
|
||||
|
||||
export default function PagePage() {
|
||||
const { data, loading, error, refetch } = use阅读状态();
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-gray-800">阅读状态</h1>
|
||||
<p className="text-sm text-gray-500 mt-1">想读/在读/已读,记录开始日期和完成日期。</p>
|
||||
</div>
|
||||
<Button onClick={() => setOpen(true)} variant="primary" size="sm">新增</Button>
|
||||
</div>
|
||||
|
||||
{loading ? (
|
||||
<div className="flex justify-center py-12">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" />
|
||||
</div>
|
||||
) : error ? (
|
||||
<Card className="text-center py-8">
|
||||
<p className="text-red-500 text-sm">{error}</p>
|
||||
<Button onClick={refetch} variant="secondary" size="sm" className="mt-2">重试</Button>
|
||||
</Card>
|
||||
) : data.length === 0 ? (
|
||||
<EmptyState
|
||||
icon="📭"
|
||||
title="暂无数据"
|
||||
description="还没有任何记录,点击上方按钮开始"
|
||||
action={<Button onClick={() => setOpen(true)} variant="primary" size="sm">创建第一条</Button>}
|
||||
/>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
{data.map((item: any) => (
|
||||
<Card key={item.id}>
|
||||
<h3 className="font-medium text-gray-800">{item.title || item.name || `Item ${item.id.slice(0, 8)}`}</h3>
|
||||
<p className="text-xs text-gray-400 mt-1">{item.createdAt || ""}</p>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Card } from "@/components/ui/Card";
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import { EmptyState } from "@/components/ui/EmptyState";
|
||||
import { use阅读进度 } from "@/hooks/use阅读进度";
|
||||
|
||||
export default function PagePage() {
|
||||
const { data, loading, error, refetch } = use阅读进度();
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-gray-800">阅读进度</h1>
|
||||
<p className="text-sm text-gray-500 mt-1">更新当前页数,自动计算完成百分比。</p>
|
||||
</div>
|
||||
<Button onClick={() => setOpen(true)} variant="primary" size="sm">新增</Button>
|
||||
</div>
|
||||
|
||||
{loading ? (
|
||||
<div className="flex justify-center py-12">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" />
|
||||
</div>
|
||||
) : error ? (
|
||||
<Card className="text-center py-8">
|
||||
<p className="text-red-500 text-sm">{error}</p>
|
||||
<Button onClick={refetch} variant="secondary" size="sm" className="mt-2">重试</Button>
|
||||
</Card>
|
||||
) : data.length === 0 ? (
|
||||
<EmptyState
|
||||
icon="📭"
|
||||
title="暂无数据"
|
||||
description="还没有任何记录,点击上方按钮开始"
|
||||
action={<Button onClick={() => setOpen(true)} variant="primary" size="sm">创建第一条</Button>}
|
||||
/>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
{data.map((item: any) => (
|
||||
<Card key={item.id}>
|
||||
<h3 className="font-medium text-gray-800">{item.title || item.name || `Item ${item.id.slice(0, 8)}`}</h3>
|
||||
<p className="text-xs text-gray-400 mt-1">{item.createdAt || ""}</p>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user