Skip to content

Commit 13c0285

Browse files
committed
refactor: use inline LabeledContent for plugin install state in connection form
1 parent 3d6496a commit 13c0285

1 file changed

Lines changed: 30 additions & 23 deletions

File tree

TablePro/Views/Connection/ConnectionFormView.swift

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -269,30 +269,37 @@ struct ConnectionFormView: View { // swiftlint:disable:this type_body_length
269269
}
270270

271271
if type.isDownloadablePlugin && !PluginManager.shared.isDriverLoaded(for: type) {
272-
ContentUnavailableView {
273-
Label(type.rawValue, image: type.iconName)
274-
} description: {
275-
if isInstallingPlugin {
276-
Text("Installing plugin…")
277-
} else if let error = pluginInstallError {
278-
Text(error)
279-
} else {
280-
Text("This plugin is not installed yet.")
281-
}
282-
} actions: {
283-
if isInstallingPlugin {
284-
ProgressView()
285-
.controlSize(.small)
286-
} else if pluginInstallError != nil {
287-
Button("Retry") {
288-
pluginInstallError = nil
289-
installPlugin(for: type)
290-
}
291-
} else {
292-
Button("Install Plugin") {
293-
installPlugin(for: type)
272+
Section {
273+
LabeledContent(String(localized: "Plugin")) {
274+
if isInstallingPlugin {
275+
HStack(spacing: 6) {
276+
ProgressView()
277+
.controlSize(.small)
278+
Text("Installing…")
279+
.foregroundStyle(.secondary)
280+
}
281+
} else if let error = pluginInstallError {
282+
HStack(spacing: 6) {
283+
Text(error)
284+
.foregroundStyle(.red)
285+
.font(.caption)
286+
.lineLimit(2)
287+
Button("Retry") {
288+
pluginInstallError = nil
289+
installPlugin(for: type)
290+
}
291+
.controlSize(.small)
292+
}
293+
} else {
294+
HStack(spacing: 6) {
295+
Text("Not installed")
296+
.foregroundStyle(.secondary)
297+
Button("Install") {
298+
installPlugin(for: type)
299+
}
300+
.controlSize(.small)
301+
}
294302
}
295-
.buttonStyle(.borderedProminent)
296303
}
297304
}
298305
} else if PluginManager.shared.connectionMode(for: type) == .fileBased {

0 commit comments

Comments
 (0)