Skip to content

Commit

Permalink
Improve server addition sheet styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-128 committed Jan 27, 2025
1 parent 42e5aeb commit cdb1257
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions qBitControl/ViewModels/ServersView/ServerAddViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class ServerAddViewModel: ObservableObject {

@Published var isCheckingConnection = false;

public var addButtonColor: Color { self.isCheckingConnection ? Color.gray : Color.blue }

private var alertQueue: [String] = [];

init() { }
Expand All @@ -46,7 +48,7 @@ class ServerAddViewModel: ObservableObject {

func validateIsConnecting() -> Bool {
if (self.isCheckingConnection) {
showAlert(message: "Adding, Please wait")
//showAlert(message: "Adding, Please wait")
return false;
}

Expand Down Expand Up @@ -74,7 +76,6 @@ class ServerAddViewModel: ObservableObject {
}

func addServer(server: Server) {
showAlert(message: "Add server success!")
serversHelper.addServer(server: server)
}

Expand Down
7 changes: 5 additions & 2 deletions qBitControl/Views/ServersViews/ServerAddView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ struct ServerAddView: View {
} label: {
Spacer()
if(viewModel.isCheckingConnection) {
Text("ADDING")
Text("ADDING" + "...")
.fontWeight(.bold)
} else {
Text("ADD")
.fontWeight(.bold)
}
Spacer()
}.buttonStyle(.borderedProminent)
}.listRowBackground(Color.blue)
.tint(viewModel.addButtonColor)
}.listRowBackground(viewModel.addButtonColor)
}
.alert(isPresented: $viewModel.isInvalidAlert) {
Alert(title: Text("Invalid server information"), message: Text(viewModel.invalidAlertMessage), dismissButton: .default(Text("OK"), action: {
Expand Down

0 comments on commit cdb1257

Please sign in to comment.