oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1import RastrilloApple
2import SwiftUI
3
4/// The same account menu composition as Docs, using the kit's rows,
5/// identity replacement confirmation and sign-out words.
6struct EquipoOficinaAccountMenu: View {
7 let app: EquipoAppModel
8 @ObservedObject var model: OficinaIDModel
9 private var teams: [OficinaTeam] {
10 guard let identity = model.identity else { return [] }
11 return (model.store.teams(identity.id)?.teams ?? []).filter { $0.origin(for: "equipo") != nil }
12 }
13 var body: some View {
14 Section {
15 if let identity = model.identity { OficinaIdentityRow(identity: identity) }
16 ForEach(teams) { team in
17 Button {
18 Task { await model.choose(team); await app.oficina.synchronize() }
19 } label: {
20 HStack {
21 OficinaTeamRow(team: team)
22 if app.session?.account.oficinaTeam == team.sqid {
23 Image(systemName: "checkmark").accessibilityLabel(String(localized: "oficina.current_team", bundle: .module))
24 }
25 }
26 }.buttonStyle(.plain).disabled(model.busy)
27 }
28 if let error = app.oficina.error { Text(error).foregroundStyle(.secondary) }
29 if let error = model.error { OficinaErrorLine(error) }
30 Button(OficinaIDText.text("continue.another")) { model.useAnother() }
31 Button(OficinaIDText.text("otherWays")) { app.otherWays() }
32 Button(OficinaIDText.text("signOut", model.identity?.label ?? ""), role: .destructive) {
33 Task { await app.signOut() }
34 }
35 }
36 .task { await model.refreshTeams() }
37 .oficinaReplaceConfirmation(model)
38 }
39}
40