diff --git a/src/api/comments/mod.rs b/src/api/comments/mod.rs index 1a2d93f..442ff8d 100644 --- a/src/api/comments/mod.rs +++ b/src/api/comments/mod.rs @@ -36,8 +36,3 @@ pub use update::batch_update_comment_status; pub use update::spam_comment; /// 将指定评论移入回收站。 pub use update::trash_comment; - -#[cfg(feature = "server")] -/// 将评论 Markdown 渲染为安全的 HTML。 -#[allow(unused_imports)] -pub use markdown::render_comment_markdown; diff --git a/src/api/posts/mod.rs b/src/api/posts/mod.rs index 6afe2e5..eb56d8a 100644 --- a/src/api/posts/mod.rs +++ b/src/api/posts/mod.rs @@ -54,12 +54,3 @@ pub use types::*; #[allow(unused_imports)] pub use update::update_post; -/// 将 Markdown 渲染为增强 HTML(含目录)。 -#[cfg(feature = "server")] -#[allow(unused_imports)] -pub use crate::api::markdown::render_markdown_enhanced; - -/// slug 生成与唯一性校验工具函数。 -#[cfg(feature = "server")] -#[allow(unused_imports)] -pub use crate::api::slug::{ensure_unique_slug, is_valid_slug, slugify}; diff --git a/src/components/ui.rs b/src/components/ui.rs index da1e2b5..53c8ac6 100644 --- a/src/components/ui.rs +++ b/src/components/ui.rs @@ -202,24 +202,6 @@ pub fn StatusBadge(color_class: &'static str, label: String) -> Element { } } -/// 空状态 / 错误状态组件。 -/// -/// 用于列表页无数据或加载失败时的居中占位提示。 -/// -/// Props: -/// - `message`:提示文本 -/// - `variant`:`"default"`(灰色,空状态)或 `"error"`(红色,加载失败) -#[component] -pub fn EmptyState(message: &'static str, variant: &'static str) -> Element { - let class = match variant { - "error" => "text-center text-red-500 dark:text-red-400 py-20", - _ => "text-center py-20 text-paper-secondary", - }; - rsx! { - div { class: "{class}", "{message}" } - } -} - /// Tooltip 定位样式(胶囊:黑底白字,hover 显现)。 const TOOLTIP_STYLE: &str = "pointer-events-none absolute left-1/2 -translate-x-1/2 px-3 py-1.5 text-xs font-medium whitespace-nowrap rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-200 bg-paper-primary text-paper-theme shadow-lg z-50"; diff --git a/src/hooks/delayed_loading.rs b/src/hooks/delayed_loading.rs deleted file mode 100644 index 5ca9890..0000000 --- a/src/hooks/delayed_loading.rs +++ /dev/null @@ -1,42 +0,0 @@ -//! 骨架屏延迟加载状态 Hook。 -//! -//! 通过延迟显示骨架屏,避免数据加载很快时出现闪烁。 - -use crate::utils::time::sleep_ms; -use dioxus::prelude::*; - -/// 骨架屏最小显示延迟(毫秒)。加载时间低于此值时不会显示骨架屏,避免闪烁。 -pub const MIN_SKELETON_DELAY_MS: u32 = 200; - -/// 延迟加载状态 Hook。 -/// -/// 当 `is_loading` 返回 true 时,延迟 `MIN_SKELETON_DELAY_MS` 毫秒后才返回 true; -/// 当 `is_loading` 返回 false 时,立即返回 false。 -/// -/// 用于骨架屏:避免数据加载很快时出现骨架屏一闪而过的问题。 -pub fn use_delayed_loading(is_loading: F) -> Signal -where - F: Fn() -> bool + Clone + 'static, -{ - let mut should_show = use_signal(|| false); - - use_effect(move || { - let loading = is_loading(); - - if loading { - if !should_show() { - let is_loading_clone = is_loading.clone(); - spawn(async move { - sleep_ms(MIN_SKELETON_DELAY_MS).await; - if is_loading_clone() { - should_show.set(true); - } - }); - } - } else { - should_show.set(false); - } - }); - - should_show -}