style: format files and update about page content
- Update about page content - Format code in admin pages, tags, and theme modules
This commit is contained in:
parent
d1b5b8ee4e
commit
fbd706b198
@ -17,26 +17,7 @@ pub fn About() -> Element {
|
|||||||
h1 { class: "text-4xl font-bold text-paper-primary tracking-tight", "关于" }
|
h1 { class: "text-4xl font-bold text-paper-primary tracking-tight", "关于" }
|
||||||
}
|
}
|
||||||
article { class: "prose dark:prose-invert max-w-none text-paper-content leading-relaxed",
|
article { class: "prose dark:prose-invert max-w-none text-paper-content leading-relaxed",
|
||||||
p { "Yggdrasil 是一个以文字为主的简约博客系统。" }
|
p { "世界……遗忘我……" }
|
||||||
p {
|
|
||||||
"它使用 Rust + Dioxus 构建,采用 PostgreSQL 作为数据库,支持 Markdown 写作、标签管理和暗色模式。"
|
|
||||||
}
|
|
||||||
h2 { class: "text-xl font-bold text-paper-primary mt-8 mb-4", "技术栈" }
|
|
||||||
ul { class: "list-disc pl-5 space-y-1",
|
|
||||||
li { "Rust + Dioxus 0.7 (全栈 Web 框架)" }
|
|
||||||
li { "PostgreSQL + tokio-postgres (数据库)" }
|
|
||||||
li { "Tailwind CSS (样式)" }
|
|
||||||
li { "Tiptap Editor (富文本编辑器)" }
|
|
||||||
li { "pulldown-cmark (Markdown 渲染)" }
|
|
||||||
}
|
|
||||||
h2 { class: "text-xl font-bold text-paper-primary mt-8 mb-4", "特性" }
|
|
||||||
ul { class: "list-disc pl-5 space-y-1",
|
|
||||||
li { "Markdown 写作与实时预览" }
|
|
||||||
li { "文章标签与归档" }
|
|
||||||
li { "暗色/亮色主题切换" }
|
|
||||||
li { "响应式设计" }
|
|
||||||
li { "文章搜索" }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,7 @@ pub fn PostsPage(page: i32) -> Element {
|
|||||||
action: EmptyStateAction {
|
action: EmptyStateAction {
|
||||||
label: "写文章".to_string(),
|
label: "写文章".to_string(),
|
||||||
to: Route::Write {},
|
to: Route::Write {},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
div { class: "{ADMIN_TABLE_CLASS}",
|
div { class: "{ADMIN_TABLE_CLASS}",
|
||||||
|
|||||||
@ -106,7 +106,6 @@ pub fn TrashPage(page: i32) -> Element {
|
|||||||
// 自动清理配置卡片(抽取为子组件 AutoPurgeSettings,见文件末尾)。
|
// 自动清理配置卡片(抽取为子组件 AutoPurgeSettings,见文件末尾)。
|
||||||
AutoPurgeSettings { settings }
|
AutoPurgeSettings { settings }
|
||||||
|
|
||||||
|
|
||||||
// 批量操作栏(选中时显示)
|
// 批量操作栏(选中时显示)
|
||||||
if !selected_ids().is_empty() {
|
if !selected_ids().is_empty() {
|
||||||
div { class: "flex items-center gap-3 p-3 bg-paper-theme rounded-lg",
|
div { class: "flex items-center gap-3 p-3 bg-paper-theme rounded-lg",
|
||||||
@ -214,7 +213,7 @@ pub fn TrashPage(page: i32) -> Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
th { class: "px-4 py-3 font-medium", "标题" }
|
th { class: "px-4 py-3 font-medium", "标题" }
|
||||||
th { class: "px-4 py-3 font-medium", "原状态" } // 底部:清空回收站 + 分页
|
th { class: "px-4 py-3 font-medium", "原状态" }
|
||||||
th { class: "px-4 py-3 font-medium w-28", "删除时间" }
|
th { class: "px-4 py-3 font-medium w-28", "删除时间" }
|
||||||
th { class: "px-4 py-3 font-medium w-24 text-center", "剩余" }
|
th { class: "px-4 py-3 font-medium w-24 text-center", "剩余" }
|
||||||
th { class: "px-4 py-3 font-medium w-32 text-right", "操作" }
|
th { class: "px-4 py-3 font-medium w-32 text-right", "操作" }
|
||||||
@ -425,11 +424,7 @@ fn AutoPurgeSettings(settings: Signal<TrashSettings>) -> Element {
|
|||||||
// 设置面板(可折叠带平滑动画)
|
// 设置面板(可折叠带平滑动画)
|
||||||
div {
|
div {
|
||||||
class: "grid transition-all duration-300 ease-in-out",
|
class: "grid transition-all duration-300 ease-in-out",
|
||||||
style: if settings_panel_open() {
|
style: if settings_panel_open() { "grid-template-rows: 1fr; opacity: 1; pointer-events: auto;" } else { "grid-template-rows: 0fr; opacity: 0; pointer-events: none;" },
|
||||||
"grid-template-rows: 1fr; opacity: 1; pointer-events: auto;"
|
|
||||||
} else {
|
|
||||||
"grid-template-rows: 0fr; opacity: 0; pointer-events: none;"
|
|
||||||
},
|
|
||||||
div { class: "overflow-hidden min-h-0",
|
div { class: "overflow-hidden min-h-0",
|
||||||
div { class: "border-t border-paper-border p-5 space-y-6",
|
div { class: "border-t border-paper-border p-5 space-y-6",
|
||||||
// 开关行:启用自动清理
|
// 开关行:启用自动清理
|
||||||
|
|||||||
@ -656,9 +656,7 @@ fn CoverUploader(cover_image: Signal<String>, cover_uploading: Signal<bool>) ->
|
|||||||
// —— 上传中:骨架占位 + 文案 ——
|
// —— 上传中:骨架占位 + 文案 ——
|
||||||
if cover_uploading() {
|
if cover_uploading() {
|
||||||
div { class: "absolute inset-0 flex flex-col items-center justify-center gap-3 bg-[var(--color-paper-tertiary)]/30 animate-pulse",
|
div { class: "absolute inset-0 flex flex-col items-center justify-center gap-3 bg-[var(--color-paper-tertiary)]/30 animate-pulse",
|
||||||
span { class: "text-sm text-[var(--color-paper-secondary)]",
|
span { class: "text-sm text-[var(--color-paper-secondary)]", "上传中..." }
|
||||||
"上传中..."
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,9 +710,7 @@ fn CoverUploader(cover_image: Signal<String>, cover_uploading: Signal<bool>) ->
|
|||||||
}
|
}
|
||||||
// 底部渐变遮罩 + "更换封面"提示(hover 出现)。
|
// 底部渐变遮罩 + "更换封面"提示(hover 出现)。
|
||||||
div { class: "absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-black/50 to-transparent opacity-0 group-hover/cover:opacity-100 transition-opacity flex items-end justify-center pb-2 pointer-events-none",
|
div { class: "absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-black/50 to-transparent opacity-0 group-hover/cover:opacity-100 transition-opacity flex items-end justify-center pb-2 pointer-events-none",
|
||||||
span { class: "text-xs text-white/90",
|
span { class: "text-xs text-white/90", "点击下方区域可重新上传" }
|
||||||
"点击下方区域可重新上传"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ fn TagsContent() -> Element {
|
|||||||
rsx! {
|
rsx! {
|
||||||
EmptyState {
|
EmptyState {
|
||||||
title: "暂无标签",
|
title: "暂无标签",
|
||||||
description: "当前还没有任何标签。"
|
description: "当前还没有任何标签。",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -76,7 +76,9 @@ fn TagsContent() -> Element {
|
|||||||
tag: tag.name.clone(),
|
tag: tag.name.clone(),
|
||||||
},
|
},
|
||||||
"{tag.name}"
|
"{tag.name}"
|
||||||
sup { class: "ml-1 text-sm text-paper-secondary", "{tag.post_count}" }
|
sup { class: "ml-1 text-sm text-paper-secondary",
|
||||||
|
"{tag.post_count}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +132,7 @@ fn TagDetailContent(tag: String) -> Element {
|
|||||||
rsx! {
|
rsx! {
|
||||||
EmptyState {
|
EmptyState {
|
||||||
title: "暂无文章",
|
title: "暂无文章",
|
||||||
description: "该标签下还没有发布任何文章。"
|
description: "该标签下还没有发布任何文章。",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
11
src/theme.rs
11
src/theme.rs
@ -181,15 +181,14 @@ pub fn ThemeToggle() -> Element {
|
|||||||
let x = coords.x;
|
let x = coords.x;
|
||||||
let y = coords.y;
|
let y = coords.y;
|
||||||
// JS 从 DOM 现状推导目标主题(不传 isDark),避免与 Signal 状态不同步。
|
// JS 从 DOM 现状推导目标主题(不传 isDark),避免与 Signal 状态不同步。
|
||||||
let _ = js_sys::eval(&format!(
|
let _ = js_sys::eval(
|
||||||
|
&format!(
|
||||||
"if (window.__startThemeTransition) \
|
"if (window.__startThemeTransition) \
|
||||||
window.__startThemeTransition({x}, {y});",
|
window.__startThemeTransition({x}, {y});", // theme.set 推迟到动画结束:其触发的 Dioxus 微任务重渲染会打断 VT。
|
||||||
x = x,
|
x = x,
|
||||||
y = y,
|
y = y,
|
||||||
));
|
),
|
||||||
// theme.set 推迟到动画结束:其触发的 Dioxus 微任务重渲染会打断 VT。
|
);
|
||||||
// gen 确保连续点击只有最新回调 set。JS 已自治切换 dark class,
|
|
||||||
// 动画完成后再更新 Dioxus 状态,避免组件重渲染可能带来的干扰
|
|
||||||
let gen = click_gen() + 1;
|
let gen = click_gen() + 1;
|
||||||
click_gen.set(gen);
|
click_gen.set(gen);
|
||||||
let mut theme_clone = theme;
|
let mut theme_clone = theme;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user