commit 9ad68f9d96837a2578a53fdd64e1797c3f685d85
parent 9ffc27a82fbabf0537d579f47e0efe8ee5917363
Author: triesap <tyson@radroots.org>
Date: Sat, 18 Apr 2026 04:22:41 +0000
app: add setup create-account bootstrap
Diffstat:
4 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/crates/launchers/desktop/src/source_guards.rs b/crates/launchers/desktop/src/source_guards.rs
@@ -7,6 +7,7 @@ const ALLOWED_WINDOW_LITERALS: &[&str] = &[
"account-open-workspace",
"account-log-out",
"account-more",
+ "home-create-account",
"home-today-scroll",
"settings-allow-relay-connections",
"settings-launch-at-login",
diff --git a/crates/launchers/desktop/src/window.rs b/crates/launchers/desktop/src/window.rs
@@ -145,13 +145,31 @@ impl HomeView {
pub fn new(runtime: DesktopAppRuntime) -> Self {
Self { runtime }
}
+
+ fn generate_local_account(&mut self, cx: &mut Context<Self>) {
+ if self.runtime.generate_local_account(None).unwrap_or(false) {
+ cx.refresh_windows();
+ cx.notify();
+ }
+ }
}
impl Render for HomeView {
- fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let runtime_summary = self.runtime.summary();
match home_stage(&runtime_summary) {
HomeStage::FarmerWorkspace => farmer_home_shell(&runtime_summary).into_any_element(),
+ HomeStage::Setup
+ if runtime_summary.startup_issue.is_none()
+ && runtime_summary.startup_gate == AppStartupGate::SetupRequired =>
+ {
+ setup_home_shell(
+ &runtime_summary,
+ cx.listener(|this, _, _, cx| this.generate_local_account(cx)),
+ cx,
+ )
+ .into_any_element()
+ }
HomeStage::Setup | HomeStage::PersonalHolding => {
holding_home_shell(&runtime_summary).into_any_element()
}
@@ -1131,6 +1149,25 @@ fn holding_home_shell(runtime: &DesktopAppRuntimeSummary) -> impl IntoElement {
)
}
+fn setup_home_shell(
+ runtime: &DesktopAppRuntimeSummary,
+ on_create_account: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
+ cx: &App,
+) -> impl IntoElement {
+ home_shell_frame(
+ runtime,
+ div()
+ .size_full()
+ .child(app_center_stage(action_button(
+ "home-create-account",
+ app_shared_text(AppTextKey::HomeSetupCreateAccountAction),
+ on_create_account,
+ cx,
+ )))
+ .into_any_element(),
+ )
+}
+
fn home_shell_frame(
runtime: &DesktopAppRuntimeSummary,
main_content: AnyElement,
diff --git a/crates/shared/i18n/src/keys.rs b/crates/shared/i18n/src/keys.rs
@@ -38,6 +38,7 @@ define_app_text_keys! {
HomeTodayStockCountLabel => "home.today.stock_count.label",
HomeTodaySetupAddFulfillmentWindow => "home.today.setup.add_fulfillment_window",
HomeTodaySetupPublishProduct => "home.today.setup.publish_product",
+ HomeSetupCreateAccountAction => "home.setup.create_account",
HomeTodayEmptySetupTitle => "home.today.empty.setup.title",
HomeTodayEmptySetupBody => "home.today.empty.setup.body",
HomeTodayEmptyNoFarmTitle => "home.today.empty.no_farm.title",
diff --git a/i18n/locales/en/messages.json b/i18n/locales/en/messages.json
@@ -17,6 +17,7 @@
"home.today.stock_count.label": "Stock",
"home.today.setup.add_fulfillment_window": "Add a fulfillment window",
"home.today.setup.publish_product": "Publish a product",
+ "home.setup.create_account": "Create account",
"home.today.empty.setup.title": "Account setup required",
"home.today.empty.setup.body": "Add a local account to start using Radroots on this device.",
"home.today.empty.no_farm.title": "No farm yet",