diff options
| author | Christian Cleberg <[email protected]> | 2026-04-13 22:37:22 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-13 22:37:22 -0500 |
| commit | 5dcfe0f147c7871eaf5f3a88bd9e9fded38d4633 (patch) | |
| tree | 6bcbda4f02a131d3e3b870a3904ccd42f4af2f26 /Rune/Views/Settings/WalletTransactionsView.swift | |
| parent | fcf864a15b70e4ecb5bd789b1db3116221c34394 (diff) | |
| download | rune-5dcfe0f147c7871eaf5f3a88bd9e9fded38d4633.tar.gz rune-5dcfe0f147c7871eaf5f3a88bd9e9fded38d4633.tar.bz2 rune-5dcfe0f147c7871eaf5f3a88bd9e9fded38d4633.zip | |
v1.2.0 domain management and wallet expansionv1.2.0
Complete v1.1-aligned domain flows with forwards and glue CRUD, improve API payload resilience, and add wallet transaction/payment views.
Harden error handling and UX states across domain screens, remove out-of-scope DNSSEC/renewal record flows for now, and keep auth/session behavior aligned with token-based usage.
Diffstat (limited to 'Rune/Views/Settings/WalletTransactionsView.swift')
| -rw-r--r-- | Rune/Views/Settings/WalletTransactionsView.swift | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Rune/Views/Settings/WalletTransactionsView.swift b/Rune/Views/Settings/WalletTransactionsView.swift new file mode 100644 index 0000000..f0106de --- /dev/null +++ b/Rune/Views/Settings/WalletTransactionsView.swift @@ -0,0 +1,75 @@ +import SwiftUI + +struct WalletTransactionsView: View { + @ObservedObject var viewModel: WalletViewModel + let client: NjallaClient + + var body: some View { + List { + if let errorMessage = viewModel.transactionsErrorMessage { + Section { + InlineErrorView(message: errorMessage, retryTitle: "Retry Transactions") { + Task { + await viewModel.loadTransactions(client: client) + } + } + .listRowInsets(EdgeInsets(top: 8, leading: 16, bottom: 8, trailing: 16)) + } + } + + if viewModel.isLoadingTransactions && viewModel.transactions.isEmpty { + Section { + HStack { + Spacer() + ProgressView("Loading Transactions") + Spacer() + } + } + } else if viewModel.transactions.isEmpty { + Section { + ContentUnavailableView( + "No Transactions", + systemImage: "eurosign.circle", + description: Text("No wallet transactions were returned for this account.") + ) + } + } else { + ForEach(viewModel.transactions) { transaction in + NavigationLink { + WalletPaymentDetailView(transactionID: transaction.id, viewModel: viewModel, client: client) + } label: { + VStack(alignment: .leading, spacing: 4) { + Text(transaction.type ?? "Transaction") + .font(.headline) + Text(transactionDateText(transaction)) + .font(.subheadline) + .foregroundStyle(.secondary) + if let amount = transaction.amount { + Text("Amount: €\(amount)") + .font(.subheadline) + .foregroundStyle(.secondary) + } + } + .padding(.vertical, 4) + } + } + } + } + .listStyle(.insetGrouped) + .navigationTitle("Transactions") + .navigationBarTitleDisplayMode(.inline) + .task { + await viewModel.loadTransactions(client: client) + } + .refreshable { + await viewModel.loadTransactions(client: client) + } + } + + private func transactionDateText(_ transaction: WalletTransaction) -> String { + if let date = transaction.date, !date.isEmpty { + return date + } + return "ID: \(transaction.id)" + } +} |
