Show live swap status, explorer links, and full kyc.rip route details

This commit is contained in:
2026-10-26 21:31:41 +08:00
parent 2f70931cba
commit 3ff5385a9b
13 changed files with 759 additions and 150 deletions
+36 -36
View File
@@ -31,6 +31,7 @@ struct RootView: View {
return .home
}
@State private var seedBox: SeedBox?
@StateObject private var drawers = DrawerCoordinator()
var body: some View {
ZStack {
@@ -63,6 +64,33 @@ struct RootView: View {
.scrollDismissesKeyboard(.interactively)
}
.preferredColorScheme(.dark)
.task { await model.bootstrap() }
.sheet(item: $seedBox) { box in
SeedRevealView(seed: box.seed, symbol: box.symbol) { seedBox = nil }
}
.bottomDrawer(isPresented: Binding(
get: { drawers.transaction != nil },
set: { if !$0 { drawers.transaction = nil } }
)) {
if let record = drawers.transaction {
TransactionDetailView(record: record,
symbol: model.symbol,
chain: model.chain) { drawers.transaction = nil }
}
}
.bottomDrawer(isPresented: Binding(
get: { drawers.qr != nil },
set: { if !$0 { drawers.qr = nil } }
)) {
if let item = drawers.qr {
AddressQRSheet(title: item.title, address: item.address) { drawers.qr = nil }
}
}
.bottomDrawer(isPresented: $drawers.settings) {
SettingsView()
}
.environmentObject(drawers)
// Above the drawers so a lock always hides whatever was on screen.
.overlay {
if model.locked, model.faceIDEnabled {
LockScreen {
@@ -70,10 +98,6 @@ struct RootView: View {
}
}
}
.task { await model.bootstrap() }
.sheet(item: $seedBox) { box in
SeedRevealView(seed: box.seed, symbol: box.symbol) { seedBox = nil }
}
.onChange(of: model.chain) { _ in
if route == .dashboard { route = .home }
}
@@ -90,10 +114,8 @@ struct RootView: View {
struct HomeView: View {
@EnvironmentObject private var model: AppModel
@EnvironmentObject private var drawers: DrawerCoordinator
@Binding var route: Route
@State private var selectedTransaction: TransactionRecord?
@State private var showSettings = false
@State private var qrAddress: AddressQR?
var body: some View {
VStack(spacing: 18) {
@@ -114,28 +136,6 @@ struct HomeView: View {
MessageBanner(message: message, isError: false)
}
}
.bottomDrawer(isPresented: Binding(
get: { selectedTransaction != nil },
set: { if !$0 { selectedTransaction = nil } }
)) {
if let record = selectedTransaction {
TransactionDetailView(record: record,
symbol: model.symbol,
chain: model.chain) { selectedTransaction = nil }
}
}
.bottomDrawer(isPresented: Binding(
get: { qrAddress != nil },
set: { if !$0 { qrAddress = nil } }
)) {
if let item = qrAddress {
AddressQRSheet(title: item.title, address: item.address) { qrAddress = nil }
}
}
.bottomDrawer(isPresented: $showSettings) {
SettingsView()
.environmentObject(model)
}
}
private var header: some View {
@@ -150,7 +150,7 @@ struct HomeView: View {
}
Spacer()
Button {
showSettings = true
drawers.settings = true
} label: {
Image(systemName: "gearshape")
.font(.system(size: 17, weight: .medium))
@@ -209,7 +209,7 @@ struct HomeView: View {
// the front card away to bring the next one up.
AccountStack(accounts: model.moneroAccounts,
fiat: { model.fiatValue(of: $0, chain: .xmr) },
onQR: { qrAddress = AddressQR(title: $0.title, address: $0.address) })
onQR: { drawers.qr = AddressQR(title: $0.title, address: $0.address) })
}
if model.chain == .xmr {
@@ -257,14 +257,16 @@ struct HomeView: View {
Text("Activity")
.font(.system(size: 13, weight: .semibold))
.foregroundStyle(Theme.muted)
ForEach(model.transactions) { record in
// A Monero transaction can produce several transfer entries with the
// same hash, so index-based identities keep the rows stable.
ForEach(Array(model.transactions.enumerated()), id: \.offset) { index, record in
Button {
selectedTransaction = record
drawers.transaction = record
} label: {
TransactionRow(record: record, symbol: model.symbol)
}
.buttonStyle(.plain)
if record.id != model.transactions.last?.id {
if index < model.transactions.count - 1 {
Divider().overlay(Theme.border)
}
}
@@ -281,8 +283,6 @@ struct HomeView: View {
private var moneroUnavailableCard: some View {
VStack(spacing: 14) {
ChainPicker(selection: Binding(get: { model.chain },
set: { newValue in Task { await model.select(newValue) } }))
Card {
VStack(alignment: .leading, spacing: 10) {
Text("Monero wallet")