diff --git a/src/app.rs b/src/app.rs index 1b49dbf..0f0b070 100644 --- a/src/app.rs +++ b/src/app.rs @@ -904,6 +904,11 @@ impl App { } } } + // 開始使用: a new install, no bots yet. + Ok("welcome") => { + app.state.bots.clear(); + app.approvals.clear(); + } Ok("channels") => { app.show_settings = true; app.settings_tab = SettingsTab::Channels; diff --git a/src/app/kit.rs b/src/app/kit.rs index 1cacc53..ff95006 100644 --- a/src/app/kit.rs +++ b/src/app/kit.rs @@ -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)); } +/// 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, 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 /// 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)) { diff --git a/src/app/welcome_ui.rs b/src/app/welcome_ui.rs index d6052fb..dbfac2d 100644 --- a/src/app/welcome_ui.rs +++ b/src/app/welcome_ui.rs @@ -47,9 +47,9 @@ impl App { let mut go_account = false; step(ui, p, 1, "連上 AI 模型", ready.is_some(), |ui| { match ready { - Some(k) => hint(ui, format!("已經可以用 {}。", k.label()), p), + Some(k) => note(ui, format!("已經可以用 {}。", k.label()), p), None => { - hint(ui, "選一個 AI 服務(xAI、OpenAI、Claude、Gemini…),貼上它的 API 金鑰。也可以用自己電腦上的 Ollama,不用金鑰。", p); + note(ui, "選一個 AI 服務,貼上它的 API 金鑰。用自己電腦上的 Ollama 不用金鑰。", p); ui.add_space(6.0); if ui.add(primary_button("設定模型", p)).clicked() { go_keys = true; @@ -58,7 +58,7 @@ impl App { } }); step(ui, p, 2, "建立你的第一個 Bot", false, |ui| { - hint(ui, "幫它取名字、寫下它要做什麼。之後隨時可以再加更多 Bot。", p); + note(ui, "取個名字,寫下它要做什麼。", p); ui.add_space(6.0); let b = if ready.is_some() { primary_button("建立 Bot", p) } else { secondary_button("建立 Bot") }; if ui.add(b).clicked() { @@ -70,9 +70,10 @@ impl App { ui.label(RichText::new(t("在別台電腦用過 AnyBot?")).strong().family(crate::bold())); if signed_in { 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 { - hint(ui, "登入你的帳號,那邊的 Bot、聊天和設定會自動同步到這台;這台的也會同步上去。", p); + note(ui, "登入帳號,那邊的 Bot、聊天和設定會同步過來。", p); ui.add_space(6.0); if ui.add(secondary_button("登入帳號")).clicked() { go_account = true;