Give Monero sync its own section and consolidate the wallet buttons

This commit is contained in:
2026-10-10 20:18:41 +08:00
parent 7e739e1b77
commit c9679e35c4
3 changed files with 95 additions and 31 deletions
+9 -30
View File
@@ -91,7 +91,6 @@ struct RootView: View {
struct HomeView: View {
@EnvironmentObject private var model: AppModel
@Binding var route: Route
@State private var showDeleteConfirm = false
@State private var selectedTransaction: TransactionRecord?
@State private var showSettings = false
@State private var qrAddress: AddressQR?
@@ -137,19 +136,6 @@ struct HomeView: View {
SettingsView()
.environmentObject(model)
}
.confirmationDialog("Delete this wallet?",
isPresented: $showDeleteConfirm,
titleVisibility: .visible) {
Button("Delete wallet", role: .destructive) {
Task {
await model.deleteWallet()
route = .home
}
}
Button("Cancel", role: .cancel) {}
} message: {
Text("The keys stored on this device are removed. Make sure your recovery seed is backed up.")
}
}
private var header: some View {
@@ -189,9 +175,6 @@ struct HomeView: View {
.font(.system(size: 16, weight: .semibold))
.foregroundStyle(Theme.text)
Spacer()
if model.chain == .xmr, let status = model.syncStatus {
SyncBadge(status: status)
}
}
if model.chain == .xmr, !model.moneroAccounts.isEmpty {
@@ -223,25 +206,25 @@ struct HomeView: View {
AddressRow(address: model.displayAddress)
}
if model.chain == .xmr, let status = model.syncStatus {
SyncProgress(status: status, eta: model.syncEta)
}
}
}
if model.chain == .xmr {
SyncCard()
}
HStack(spacing: 10) {
PrimaryButton(title: "Send") { route = .send }
SecondaryButton(title: "Receive") { route = .receive }
SecondaryButton(title: "Swap") { route = .swap }
}
if model.chain == .xmr {
HStack(spacing: 10) {
SecondaryButton(title: model.syncStatus?.syncing == true ? "Syncing…" : "Sync now") {
Task { await model.startMoneroSync() }
}
SecondaryButton(title: "Addresses") { route = .accounts }
HStack(spacing: 12) {
IconButton(systemName: "arrow.clockwise") { Task { await model.refresh(force: true) } }
if model.chain == .xmr {
IconButton(systemName: "person.2.fill") { route = .accounts }
}
Spacer()
}
if model.chain == .xrp, model.moneroReady, let status = model.syncStatus, status.syncing {
@@ -264,10 +247,6 @@ struct HomeView: View {
}
}
HStack(spacing: 10) {
SecondaryButton(title: "Refresh") { Task { await model.refresh(force: true) } }
SecondaryButton(title: "Delete") { showDeleteConfirm = true }
}
if !model.transactions.isEmpty {
Card {