mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
👌 Cleanup UI code
This commit is contained in:
@ -21,9 +21,7 @@ struct BrewPhpFormula: Equatable {
|
||||
/// The upgrade that is currently available, if it exists.
|
||||
let upgradeVersion: String?
|
||||
|
||||
#warning("The rebuild attribute should be checked, it can be used to check if a Tap update exists for a pre-release version.")
|
||||
/// A rebuild version, if applicable.
|
||||
// let rebuild: String?
|
||||
// TODO: A rebuild attribute could be checked, to check if a Tap update exists for a pre-release version
|
||||
|
||||
/// Whether this formula is a stable version of PHP.
|
||||
let prerelease: Bool
|
||||
|
@ -29,10 +29,11 @@ class BrewTapFormulae {
|
||||
let versionRange = Range(match.range(at: 2), in: file) {
|
||||
// Determine what the extension's name is
|
||||
let phpExtensionName = String(file[phpExtensionRange])
|
||||
|
||||
// Determine what PHP version this is for
|
||||
let phpVersion = String(file[versionRange])
|
||||
|
||||
// Create a new BrewPhpExtension object, which will determine whether this extension is installed or not
|
||||
// Create a new BrewPhpExtension object (determines if installed)
|
||||
let phpExtension = BrewPhpExtension(
|
||||
path: "\(Paths.tapPath)/\(tap)/Formula/\(file)",
|
||||
name: phpExtensionName,
|
||||
|
@ -98,30 +98,8 @@ struct PhpExtensionManagerView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func listContent(for ext: BrewPhpExtension) -> some View {
|
||||
HStack(alignment: .center, spacing: 7.0) {
|
||||
VStack(alignment: .center, spacing: 0) {
|
||||
HStack {
|
||||
HStack {
|
||||
Image(systemName: ext.isInstalled || ext.hasAlternativeInstall
|
||||
? "puzzlepiece.extension.fill"
|
||||
: "puzzlepiece.extension")
|
||||
.resizable()
|
||||
.frame(width: 24, height: 20)
|
||||
.foregroundColor(ext.hasAlternativeInstall ? Color.gray : Color.blue)
|
||||
}.frame(width: 36, height: 24)
|
||||
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
HStack {
|
||||
Text(ext.name).bold()
|
||||
}
|
||||
|
||||
if !ext.extensionDependencies.isEmpty {
|
||||
HStack(spacing: 3) {
|
||||
Text("Depends on:")
|
||||
.font(.system(size: 10))
|
||||
ForEach(ext.extensionDependencies, id: \.self) {
|
||||
Text($0)
|
||||
private func dependency(named name: String) -> some View {
|
||||
return Text(name)
|
||||
.font(.system(size: 9))
|
||||
.padding(.horizontal, 5)
|
||||
.padding(.vertical, 1)
|
||||
@ -130,9 +108,9 @@ struct PhpExtensionManagerView: View {
|
||||
.clipShape(Capsule())
|
||||
.fixedSize(horizontal: true, vertical: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func extensionLabel(for ext: BrewPhpExtension) -> some View {
|
||||
return Group {
|
||||
if ext.isInstalled {
|
||||
if let dependent = ext.firstDependent(in: self.manager.extensions) {
|
||||
Text("You cannot uninstall this before uninstalling **\(dependent.name)**.")
|
||||
@ -157,6 +135,38 @@ struct PhpExtensionManagerView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func listContent(for ext: BrewPhpExtension) -> some View {
|
||||
HStack(alignment: .center, spacing: 7.0) {
|
||||
VStack(alignment: .center, spacing: 0) {
|
||||
HStack {
|
||||
HStack {
|
||||
Image(systemName: ext.isInstalled || ext.hasAlternativeInstall
|
||||
? "puzzlepiece.extension.fill"
|
||||
: "puzzlepiece.extension")
|
||||
.resizable()
|
||||
.frame(width: 24, height: 20)
|
||||
.foregroundColor(ext.hasAlternativeInstall ? Color.gray : Color.blue)
|
||||
}.frame(width: 36, height: 24)
|
||||
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
HStack {
|
||||
Text(ext.name).bold()
|
||||
}
|
||||
|
||||
if !ext.extensionDependencies.isEmpty {
|
||||
HStack(spacing: 3) {
|
||||
Text("Depends on:")
|
||||
.font(.system(size: 10))
|
||||
ForEach(ext.extensionDependencies, id: \.self) {
|
||||
dependency(named: $0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extensionLabel(for: ext)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
|
Reference in New Issue
Block a user