@@ -25,31 +25,34 @@ struct AccountView: View {
2525 let providers = AuthProvider . allCases. filter { $0 != store. currentProvider }
2626 ForEach ( providers, id: \. self) { provider in
2727 let isConnected = store. connectedProviders. contains ( provider)
28+ let showProgressView = store. isLoading && store. activeLoadingProvider == provider
2829 HStack {
2930 providerContent ( provider)
3031 Spacer ( )
31- if store. isLoading && store. activeLoadingProvider == provider {
32- ProgressView ( )
33- . id ( UUID ( ) )
34- } else {
35- Button {
36- if isConnected {
37- store. send ( . unlinkFromProvider( provider) )
38- } else {
39- store. send ( . linkWithProvider( provider) )
40- }
41- } label: {
42- Text ( isConnected
43- ? String ( localized: " account_disconnect " )
44- : String ( localized: " account_connect " ) )
45- . font ( . caption. weight ( . semibold) )
46- . foregroundStyle ( . white)
47- . padding ( . horizontal, 12 )
48- . padding ( . vertical, 6 )
49- . background ( isConnected ? Color . red : . blue)
50- . clipShape ( . capsule)
32+ Button {
33+ if isConnected {
34+ store. send ( . unlinkFromProvider( provider) )
35+ } else {
36+ store. send ( . linkWithProvider( provider) )
37+ }
38+ } label: {
39+ Text ( isConnected
40+ ? String ( localized: " account_disconnect " )
41+ : String ( localized: " account_connect " ) )
42+ . font ( . caption. weight ( . semibold) )
43+ . foregroundStyle ( . white)
44+ . padding ( . horizontal, 12 )
45+ . padding ( . vertical, 6 )
46+ . background ( isConnected ? Color . red : . blue)
47+ . clipShape ( . capsule)
48+ }
49+ . buttonStyle ( . plain)
50+ . disabled ( store. isLoading)
51+ . opacity ( showProgressView ? 0 : 1 )
52+ . overlay {
53+ if showProgressView {
54+ ProgressView ( )
5155 }
52- . buttonStyle ( . plain)
5356 }
5457 }
5558 }
0 commit comments