156 Commits

Author SHA1 Message Date
xfy
08bd69d64b feat(write): add onImageUpload callback to tiptap editor 2026-06-05 15:23:36 +08:00
xfy
c2c7b46958 fix(tiptap-editor): use insertContentAt with drop position in onDrop handler
Previously dropped images were inserted at the current cursor position
instead of the actual drop position. Now uses insertContentAt(pos, ...)
to place images at the correct location.
2026-06-05 15:21:38 +08:00
xfy
00c5a880f4 feat(editor): add FileHandler extension for image paste/drop upload 2026-06-05 15:19:31 +08:00
xfy
3d7dd5b5a5 deps(editor): add @tiptap/extension-file-handler 2026-06-05 15:17:39 +08:00
xfy
76797f1bc3 feat(server): register upload route and static file serving 2026-06-05 15:14:10 +08:00
xfy
371ebcf8f9 fix(upload): gate axum imports behind #[cfg(feature = "server")]
Wrap all axum imports and constants with #[cfg(feature = "server")]
to prevent WASM compilation failures. Provide a no-op stub for
non-server builds.

Fixes: error[E0433]: cannot find module or crate  in scope
2026-06-05 15:08:19 +08:00
xfy
93020a8e14 fix(upload): remove space in filename format and unused UploadResponse struct 2026-06-05 15:00:29 +08:00
xfy
1bae3446e6 feat(api): add image upload handler with admin auth 2026-06-05 14:56:29 +08:00
xfy
eaec6d5da7 deps: add fs feature to tower-http for static file serving 2026-06-05 14:51:35 +08:00
xfy
16248ca330 chore: create uploads directory for image storage 2026-06-05 14:49:22 +08:00
xfy
dd7022ec75 fix: replace select element with overlay pattern to fix dropdown arrow alignment in write page 2026-06-05 11:09:02 +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
58cfcc31bf fix: improve label and button text contrast in write page light mode 2026-06-05 10:33:41 +08:00
xfy
7866c53e36 feat: add dark mode toggle button to admin layout 2026-06-05 10:33:34 +08:00
xfy
a8704e199f feat(editor): add slash command, table, task list, image and link extensions
- Add @tiptap/suggestion-based slash command menu with 12 commands
- Add TableKit for table support (3x3 with header)
- Add Image extension with base64 support
- Add Link extension with autolink and paste detection
- Add TaskList/TaskItem extensions for checklists
- Upgrade all tiptap packages from 3.23.6 to 3.25.0
- Add CSS styles for all new features including dark theme
2026-06-05 10:20:47 +08:00
xfy
5321b8cf97 refactor: reorganize admin write page layout with card-based sections 2026-06-05 09:58:26 +08:00
xfy
5b481e801c feat: add custom .sublime-syntax loading for Swift and Kotlin, improve alias table
- Enable yaml-load feature in syntect to support loading .sublime-syntax files
- Load custom syntax definitions from syntaxes/ directory via SyntaxSet::into_builder
- Add Swift and Kotlin syntax definitions as .sublime-syntax files
- Fix alias table to properly resolve full language names (javascript,
  typescript, python, swift, kotlin, golang) via file extension lookup
- Redirect ts/typescript to JavaScript highlighting (syntect v5.3.0 does not
  support TypeScript's Sublime Text v2 syntax format)
- Add documentation comments to generate_highlight_css.rs binary
2026-06-05 09:27:21 +08:00
xfy
81d3d72a48 feat: enable extended markdown parsing with table support in post rendering 2026-06-04 18:06:46 +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
0dbd07198b fix: remove leftover --wasm-split flag from dx serve dev command
Amends the wasm-split rollback by also cleaning up the dev server
flag that was missed in the previous revert commit.
2026-06-04 17:46:44 +08:00
xfy
f81656bb18 revert: disable wasm-split due to fullstack SSR incompatibility
wasm-split is incompatible with Dioxus fullstack SSR/hydration.
The feature causes hydration failures because split WASM chunks
are not available during client-side hydration of server-rendered HTML.

Changes reverted:
- Remove wasm-split feature from dioxus and dioxus-router
- Remove --wasm-split flag from dx build in Makefile
2026-06-04 17:44:33 +08:00
xfy
73fd3c30e2 build: remove obsolete WASM path fix and tracked index.html 2026-06-04 17:34:12 +08:00
xfy
a282d1dd29 feat: enable wasm-split for route-based code splitting
Enable Dioxus 0.7 automatic WASM bundle splitting by route:

- Add wasm-split feature to dioxus and dioxus-router in Cargo.toml
- Add --wasm-split flag to dx build in Makefile
- Router definitions stay as plain #[route] — splitting is automatic

Dioxus 0.7.9 handles splitting automatically when the feature and
CLI flag are enabled. Per-route #[wasm_split] attributes are not
required (and not supported by this version's derive macro).
2026-06-04 17:32:00 +08:00
xfy
c44f37e9ec feat: enable wasm_split for non-core routes
Split low-frequency routes into separate WASM chunks:
- archives, tags, search, about
- admin/* (dashboard, write, posts)
- login, register

Core reading paths (home, post detail) remain in initial bundle.
2026-06-04 17:15:14 +08:00
xfy
9c38ca7a16 chore: stop tracking tiptap build artifacts (now gitignored) 2026-06-04 16:52:11 +08:00
xfy
675349a5b4 fix: add #[cfg(feature = server)] to server-only imports for WASM compatibility 2026-06-04 16:40:42 +08:00
xfy
0ce4924e06 chore: final verification after redundancy cleanup - all checks pass 2026-06-04 16:27:53 +08:00
xfy
cd45ab17de build: simplify tiptap build by setting fixed output filename in vite config 2026-06-04 16:26:25 +08:00
xfy
e5ce1580e2 fix: restore dead_code allow on CreatePostRequest to suppress warning 2026-06-04 16:25:05 +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
c26c62558e fix: add status_badge_class for badge styling, restore posts table backgrounds 2026-06-04 16:17:41 +08:00
xfy
58e9dbc5b7 refactor: add status_label/status_class/formatted_date helpers to Post model 2026-06-04 16:13:49 +08:00
xfy
c27b2d513e perf: pre-compile regex patterns and extract markdown stripping to utils/text.rs 2026-06-04 16:08:01 +08:00
xfy
28707d3c3a refactor: reuse session validation in get_current_admin_user via get_user_by_token 2026-06-04 16:02:47 +08:00
xfy
58f972aa17 fix: restore register success alert layout with login link 2026-06-04 15:59:17 +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
d3be04bcec refactor: extract session parsing to auth/session.rs and db error helpers to api/utils.rs 2026-06-04 15:16:40 +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
aebdcd6d99 fix(build): fix WASM 404 in production by creating symlinks in wasm/ directory 2026-06-04 11:34:13 +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
593666135c feat: add DB connection retry logic with get_conn() helper 2026-06-04 10: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
5d018864c2 refactor: remove PageLayout from all frontend pages, delegate to FrontendLayout
- Remove PageLayout wrapper from Home, HomePage, Archives, Tags,
  TagDetail, PostDetail, Search, and About components
- Remove unused imports: use_nav_items, use_route, PageLayout, Route
- Pages now render only their content; Header/Footer are provided by
  FrontendLayout via the router's #[layout] attribute
- Skeleton screens (DelayedSkeleton) remain in data-loading branches
- This eliminates redundant Header/Footer re-mounting on every route
  change, which was the primary source of page transition flicker

Files changed:
- src/pages/home.rs: remove PageLayout, keep HomeInfo + HomePosts
- src/pages/about.rs: remove PageLayout, render content directly
- src/pages/archives.rs: remove PageLayout, keep header + ArchivesContent
- src/pages/post_detail.rs: remove PageLayout, keep PostDetailContent
- src/pages/search.rs: remove PageLayout, keep search form + results
- src/pages/tags.rs: remove PageLayout from Tags and TagDetail
2026-06-03 18:38:11 +08:00
xfy
8845577958 feat: wrap frontend routes in FrontendLayout via router #[layout] attribute
- All public-facing pages (Home, Archives, Tags, PostDetail, Search,
  About, HomePage) are now wrapped in #[layout(FrontendLayout)]
- Header and Footer stay mounted during page transitions, only the
  <Outlet> content swaps — eliminates full-page flash/flicker
- Login and Register routes moved outside FrontendLayout since they
  are standalone pages without navigation header
- Route order restructured: FrontendLayout block → admin nest → auth pages
- Note: #[end_layout]/#[end_nest] must have a variant after them in the
  enum, otherwise the Routable derive macro fails with 'expected identifier'
2026-06-03 18:35:36 +08:00