47 Commits

Author SHA1 Message Date
xfy
0319c927c6 chore: format code 2026-06-09 13:43:10 +08:00
xfy
44c1358da5 refactor: extract post content JS into standalone script 2026-06-09 13:18:40 +08:00
xfy
0345fa70f2 fix: add click handler for code block copy button 2026-06-09 11:33:26 +08:00
xfy
42b39266a6 fix: preserve data URI in img src during markdown rendering
ammonia's default url_schemes whitelist excludes 'data', causing
data:image/* URLs to be stripped from img src attributes. Add 'data'
to allowed schemes. Also skip data: URIs in JS thumbnail logic.
2026-06-09 10:06:34 +08:00
xfy
185bcab9f9 cleanup(forms): remove unused BUTTON_SECONDARY_CLASS 2026-06-08 16:19:35 +08:00
xfy
717266db1e fix: resolve conditional compilation and dead code warnings 2026-06-08 16:11:24 +08:00
xfy
b6f41e74e7 feat: image thumbnail + lightbox viewer
- Add ImageViewer reusable component with thumbnail and click-to-zoom
- PostCover: load ?w=1200 thumbnail, click to view full-size
- PostCard: display cover thumbnail (?thumb=400x300) in list view
- PostContent: inline images load ?w=800 thumbnail, click to zoom
- Add lightbox overlay styles with fade-in animation
- Add zoom cursor and hover effect for zoomable images
- Extend web-sys features for DOM image/lightbox manipulation
2026-06-08 15:52:47 +08:00
xfy
c776536678 fix(write-skeleton): align skeleton layout with actual write page
- fix bottom button bar layout (justify-end -> items-center with flex-1 spacer)
- remove extra p-6 padding from editor container
- add p-4 padding to toolbar area to match Tiptap editor padding
2026-06-05 18:21:35 +08:00
xfy
077573af67 fix(layout): highlight write nav for both /write and /write/:id 2026-06-05 17:55:18 +08:00
xfy
6d621d9ec4 feat(admin): remove '前台' nav item from admin header 2026-06-05 17:07:22 +08:00
xfy
28d1ee0d52 fix: reset UserContext on login/logout to prevent admin page stuck on re-login
Root cause: UserContext.checked was never reset on logout, causing AdminLayout's use_effect to skip get_current_user() on subsequent mounts, leaving the page in (checked=true, user=None) limbo.

- Reset ctx.user and ctx.checked on logout in admin_layout.rs
- Reset ctx.checked on login success in login.rs so AdminLayout re-validates session on mount
2026-06-05 10:42:20 +08:00
xfy
7866c53e36 feat: add dark mode toggle button to admin layout 2026-06-05 10:33:34 +08:00
xfy
5321b8cf97 refactor: reorganize admin write page layout with card-based sections 2026-06-05 09:58:26 +08:00
xfy
245fd83ec8 feat: replace in-footer scroll-to-top link with fixed floating button 2026-06-04 17:55:26 +08:00
xfy
1830fc9f2e cleanup: remove dead code, debug prints, and unused dead_code allow attributes 2026-06-04 16:20:43 +08:00
xfy
4e33bd3ee6 refactor: extract form atoms (FormInput, FormLabel, AlertBox) and replace repeated input/button styles 2026-06-04 15:55:40 +08:00
xfy
71abff1b3e refactor: add style prop to SkeletonBox, migrate last tags_skeleton div 2026-06-04 15:49:30 +08:00
xfy
4fbc938422 refactor: migrate tags_skeleton and admin_skeleton to SkeletonBox 2026-06-04 15:47:21 +08:00
xfy
6ed12ff1cb refactor: fix skeleton atoms - remove unused components, use &str, migrate all skeletons 2026-06-04 15:43:40 +08:00
xfy
ebf0f84733 refactor: extract skeleton atoms (SkeletonLine, SkeletonBox, SkeletonCard) and refactor skeleton components 2026-06-04 15:35:36 +08:00
xfy
9da060ac32 refactor: extract sleep_ms to utils/time.rs, deduplicate in hooks and skeletons 2026-06-04 15:11:08 +08:00
xfy
ce14c476b5 refactor: replace string-based navigation with typed Route and Link components 2026-06-04 14:55:18 +08:00
xfy
88cd23f74f fix: show route-specific skeleton screens in SuspenseBoundary fallback 2026-06-04 11:06:42 +08:00
xfy
c2f68b9c2d fix: wrap Outlet in SuspenseBoundary to prevent full-page flash on route change 2026-06-04 11:03:56 +08:00
xfy
e09a0f4616 chore: remove unused PageLayout component
- Delete src/components/page_layout.rs — no longer used by any page
- Remove 'pub mod page_layout' from components/mod.rs
- All frontend pages now use FrontendLayout via the router instead
2026-06-03 18:38:57 +08:00
xfy
e861b8a5be feat: add FrontendLayout component with Header, Footer and Outlet
- New FrontendLayout component wraps all frontend pages with shared
  Header (with nav items and theme toggle) and Footer
- Uses Outlet::<Route> to render child route components
- Similar pattern to existing AdminLayout but without auth checks
- Registered in components/mod.rs

This is the first step toward eliminating page transition flicker by
keeping Header/Footer mounted while only the main content area swaps.
2026-06-03 18:32:43 +08:00
xfy
326108ab68 fix: delay skeleton pulse animation instead of hiding skeleton, prevent blank flash 2026-06-03 17:47:51 +08:00
xfy
73e30d6f89 feat: add DelayedSkeleton wrapper to prevent skeleton flicker on fast loads 2026-06-03 17:41:49 +08:00
xfy
068d13c69f refactor: remove obsolete SuspenseWrapper, all pages now use dedicated skeleton screens 2026-06-03 17:33:44 +08:00
xfy
62519d620d feat: add SearchSkeleton component and replace inline skeleton on search page 2026-06-03 17:30:47 +08:00
xfy
c2e1fbe3ac feat: add TagsSkeleton/TagDetailSkeleton and replace generic fallback on tags pages 2026-06-03 17:25:47 +08:00
xfy
5becd73ebc feat: add ArchiveSkeleton and replace generic fallback on archives page 2026-06-03 17:19:29 +08:00
xfy
372c701b07 feat: add PostDetailSkeleton and replace generic fallback on post detail page 2026-06-03 17:13:39 +08:00
xfy
076448d6ed feat: add HomeSkeleton and replace generic fallback on home page 2026-06-03 17:09:20 +08:00
xfy
db8e88e1fe feat: add skeleton screens module and PostCardSkeleton component 2026-06-03 17:01:39 +08:00
xfy
60a2cd49ab feat: add SuspenseWrapper component for SSR 2026-06-03 14:14:45 +08:00
xfy
6b1f2e27c9 feat(components): add post page components (header, toc, content, footer, nav) 2026-06-02 18:21:25 +08:00
xfy
f3c1718cd0 feat: add use_delayed_loading hook to prevent skeleton flash 2026-06-02 17:53:04 +08:00
xfy
1950646bef feat: add shared components, new pages, and pagination 2026-06-02 17:33:28 +08:00
xfy
b6cabe489f feat: migrate frontend to database-driven posts
- Replace hardcoded POSTS with API-driven data in home, archives, tags
- Add post detail page /post/:slug with HTML rendering
- Add admin posts management page with list and soft delete
- Update dashboard with real stats from database
- Add admin navigation for posts management
- Fix PartialEq derives for Post, Tag, PostStats models
- Use use_resource and use_memo for data fetching with proper loading states
2026-06-02 17:33:28 +08:00
xfy
a58e0f4e3b 修复 Footer 组件滚动监听器未正确清理的问题 2026-06-02 17:33:28 +08:00
xfy
c924b1e643 修复编译器警告并改进代码质量 2026-06-02 17:33:28 +08:00
李林军
4093178fc3 添加tracing日志并重构服务器启动逻辑 2026-05-27 11:39:09 +08:00
xfy
9c834ba1df 添加骨架屏组件,优化 admin 路由切换和编辑器初始化体验
- AdminLayout 使用骨架屏替代简单"加载中"文字,保持布局结构一致避免闪烁
- WritePage 添加编辑器初始化骨架屏和就绪状态轮询
- 新增 admin_skeleton.rs 和 write_skeleton.rs 组件

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 09:25:26 +08:00
xfy
61376f6ba9 修复 admin 路由切换闪烁,全局替换原生导航为客户端路由
- 新增全局 UserContext,将用户认证状态提升到 App 级别缓存
- 将 /admin 和 /admin/write 改为嵌套路由,AdminLayout 作为共享父布局
- AdminLayout 使用 Outlet 渲染子页面,避免路由切换时重复挂载
- 修复所有原生 <a> 标签导致的整页刷新问题:
  - Header 导航栏 Logo 和 NavItem
  - 首页文章卡片、分页按钮
  - 归档页文章条目
  - 标签页标签云、文章卡片、标签链接
  - 登录/注册页面链接
  - Dashboard 快捷操作按钮

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 00:18:15 +08:00
xfy
0be0719fdb 将 session cookie 改为后端 HttpOnly 设置
- login 通过 Set-Cookie 响应头设置 HttpOnly cookie
- get_current_user 从请求 Cookie header 读取 token,匹配具体 session
- logout 通过 Set-Cookie 清除 cookie,并删除对应 session
- 移除前端 document.cookie 操作代码

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 23:54:58 +08:00
xfy
8b9c6aa83d 重构 admin 模块,新增共享组件和文章撰写页面
- 将 monolithic admin.rs 拆分为 admin/ 目录模块(dashboard、write)
- 新增 components 模块:Header、Footer、AdminLayout
- 新增 /admin/write 文章撰写页面,支持 Markdown 实时预览
- 添加 pulldown-cmark 依赖用于 Markdown 渲染
- .env 移出版本控制,新增 .env.example 模板
- Home、Archives、Tags、Login、Register 等页面适配新组件

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 16:13:18 +08:00