mirror of
https://github.com/yattee/yattee.git
synced 2024-12-14 22:30:32 +05:30
Fix remove instance/account button on macOS
This commit is contained in:
parent
5c559928b9
commit
89839baddf
@ -9,9 +9,6 @@ struct InstancesSettings: View {
|
|||||||
@State private var presentingInstanceForm = false
|
@State private var presentingInstanceForm = false
|
||||||
@State private var savedFormInstanceID: Instance.ID?
|
@State private var savedFormInstanceID: Instance.ID?
|
||||||
|
|
||||||
@State private var presentingAccountRemovalConfirmation = false
|
|
||||||
@State private var presentingInstanceRemovalConfirmation = false
|
|
||||||
|
|
||||||
@State private var frontendURL = ""
|
@State private var frontendURL = ""
|
||||||
@State private var proxiesVideos = false
|
@State private var proxiesVideos = false
|
||||||
|
|
||||||
@ -53,7 +50,18 @@ struct InstancesSettings: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Button("Remove") {
|
Button("Remove") {
|
||||||
presentingAccountRemovalConfirmation = true
|
settings.presentAlert(
|
||||||
|
Alert(
|
||||||
|
title: Text(
|
||||||
|
"Are you sure you want to remove \(selectedAccount?.description ?? "") account?"
|
||||||
|
),
|
||||||
|
message: Text("This cannot be reverted"),
|
||||||
|
primaryButton: .destructive(Text("Remove")) {
|
||||||
|
AccountsModel.remove(selectedAccount!)
|
||||||
|
},
|
||||||
|
secondaryButton: .cancel()
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
.foregroundColor(colorScheme == .dark ? .white : .red)
|
.foregroundColor(colorScheme == .dark ? .white : .red)
|
||||||
.opacity(account == selectedAccount ? 1 : 0)
|
.opacity(account == selectedAccount ? 1 : 0)
|
||||||
@ -61,18 +69,6 @@ struct InstancesSettings: View {
|
|||||||
.tag(account)
|
.tag(account)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.alert(isPresented: $presentingAccountRemovalConfirmation) {
|
|
||||||
Alert(
|
|
||||||
title: Text(
|
|
||||||
"Are you sure you want to remove \(selectedAccount?.description ?? "") account?"
|
|
||||||
),
|
|
||||||
message: Text("This cannot be undone"),
|
|
||||||
primaryButton: .destructive(Text("Remove")) {
|
|
||||||
AccountsModel.remove(selectedAccount!)
|
|
||||||
},
|
|
||||||
secondaryButton: .cancel()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if #available(macOS 12.0, *) {
|
if #available(macOS 12.0, *) {
|
||||||
list
|
list
|
||||||
@ -127,12 +123,11 @@ struct InstancesSettings: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Button("Remove Location") {
|
Button("Remove Location") {
|
||||||
presentingInstanceRemovalConfirmation = true
|
|
||||||
settings.presentAlert(Alert(
|
settings.presentAlert(Alert(
|
||||||
title: Text(
|
title: Text(
|
||||||
"Are you sure you want to remove \(selectedInstance!.longDescription) location?"
|
"Are you sure you want to remove \(selectedInstance!.longDescription) location?"
|
||||||
),
|
),
|
||||||
message: Text("This cannot be undone"),
|
message: Text("This cannot be reverted"),
|
||||||
primaryButton: .destructive(Text("Remove")) {
|
primaryButton: .destructive(Text("Remove")) {
|
||||||
if accounts.current?.instance == selectedInstance {
|
if accounts.current?.instance == selectedInstance {
|
||||||
accounts.setCurrent(nil)
|
accounts.setCurrent(nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user