design: 開始使用的說明不再被截成一行,字也縮短;新增 kit::note(流程裡會換行的說明)

設定頁的 hint 是一行(長的滑過看全文),但開始使用這種流程裡,說明本身就是重點,不能截掉:
新增 kit::note(13 px 灰字、會換行),開始使用改用它,三段說明各縮成一句。
截圖模式多一個 welcome 畫面(還沒有 Bot 的新安裝)。

已驗證: cargo test 全過、截圖目視
This commit is contained in:
王性驊 2026-11-16 22:58:52 +08:00
parent 22c070fe72
commit 91da02a33f
3 changed files with 17 additions and 5 deletions

View File

@ -904,6 +904,11 @@ impl App {
} }
} }
} }
// 開始使用: a new install, no bots yet.
Ok("welcome") => {
app.state.bots.clear();
app.approvals.clear();
}
Ok("channels") => { Ok("channels") => {
app.show_settings = true; app.show_settings = true;
app.settings_tab = SettingsTab::Channels; app.settings_tab = SettingsTab::Channels;

View File

@ -193,6 +193,12 @@ pub(super) fn form_row(ui: &mut egui::Ui, label: &str, p: Palette, body: impl Fn
ui.horizontal(|ui| body(ui)); ui.horizontal(|ui| body(ui));
} }
/// Guidance in a flow (開始使用, a form's how-to): 13 px grey that wraps — unlike `hint`, which is
/// one line on a settings page. For the few places where the explanation is the point.
pub(super) fn note(ui: &mut egui::Ui, text: impl Into<String>, p: Palette) {
ui.add(egui::Label::new(RichText::new(t(&text.into())).size(FONT_SM).color(p.text2)).wrap());
}
/// A form field whose name has a 「?」 beside it (what the field does, on hover) instead of a /// A form field whose name has a 「?」 beside it (what the field does, on hover) instead of a
/// sentence under the box. /// sentence under the box.
pub(super) fn form_row_help(ui: &mut egui::Ui, label: &str, help: &str, p: Palette, body: impl FnOnce(&mut egui::Ui)) { pub(super) fn form_row_help(ui: &mut egui::Ui, label: &str, help: &str, p: Palette, body: impl FnOnce(&mut egui::Ui)) {

View File

@ -47,9 +47,9 @@ impl App {
let mut go_account = false; let mut go_account = false;
step(ui, p, 1, "連上 AI 模型", ready.is_some(), |ui| { step(ui, p, 1, "連上 AI 模型", ready.is_some(), |ui| {
match ready { match ready {
Some(k) => hint(ui, format!("已經可以用 {}。", k.label()), p), Some(k) => note(ui, format!("已經可以用 {}。", k.label()), p),
None => { None => {
hint(ui, "選一個 AI 服務(xAI、OpenAI、Claude、Gemini…),貼上它的 API 金鑰。也可以用自己電腦上的 Ollama,不用金鑰。", p); note(ui, "選一個 AI 服務,貼上它的 API 金鑰。用自己電腦上的 Ollama 不用金鑰。", p);
ui.add_space(6.0); ui.add_space(6.0);
if ui.add(primary_button("設定模型", p)).clicked() { if ui.add(primary_button("設定模型", p)).clicked() {
go_keys = true; go_keys = true;
@ -58,7 +58,7 @@ impl App {
} }
}); });
step(ui, p, 2, "建立你的第一個 Bot", false, |ui| { step(ui, p, 2, "建立你的第一個 Bot", false, |ui| {
hint(ui, "幫它取名字、寫下它要做什麼。之後隨時可以再加更多 Bot。", p); note(ui, "取個名字,寫下它要做什麼。", p);
ui.add_space(6.0); ui.add_space(6.0);
let b = if ready.is_some() { primary_button("建立 Bot", p) } else { secondary_button("建立 Bot") }; let b = if ready.is_some() { primary_button("建立 Bot", p) } else { secondary_button("建立 Bot") };
if ui.add(b).clicked() { if ui.add(b).clicked() {
@ -70,9 +70,10 @@ impl App {
ui.label(RichText::new(t("在別台電腦用過 AnyBot?")).strong().family(crate::bold())); ui.label(RichText::new(t("在別台電腦用過 AnyBot?")).strong().family(crate::bold()));
if signed_in { if signed_in {
let note = self.rm.note.lock().unwrap().clone(); let note = self.rm.note.lock().unwrap().clone();
hint(ui, if note.is_empty() { "已登入帳號。帳號裡沒有別的 Bot,從上面建立第一個吧。".to_string() } else { note }, p); let says = if note.is_empty() { "已登入帳號。帳號裡沒有別的 Bot,從上面建立第一個吧。".to_string() } else { note };
self::note(ui, says, p);
} else { } else {
hint(ui, "登入你的帳號,那邊的 Bot、聊天和設定會自動同步到這台;這台的也會同步上去。", p); note(ui, "登入帳號,那邊的 Bot、聊天和設定會同步過來。", p);
ui.add_space(6.0); ui.add_space(6.0);
if ui.add(secondary_button("登入帳號")).clicked() { if ui.add(secondary_button("登入帳號")).clicked() {
go_account = true; go_account = true;