1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-06 03:20:09 +02:00

Add info button for PHP upgrades

This commit is contained in:
2024-11-25 16:43:19 +01:00
parent a22346ed35
commit 2b1c1c12f8
4 changed files with 35 additions and 19 deletions

View File

@ -3688,7 +3688,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1520;
CURRENT_PROJECT_VERSION = 1525;
DEAD_CODE_STRIPPING = YES;
DEBUG = YES;
DEVELOPMENT_TEAM = 8M54J5J787;
@ -3719,7 +3719,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1520;
CURRENT_PROJECT_VERSION = 1525;
DEAD_CODE_STRIPPING = YES;
DEBUG = NO;
DEVELOPMENT_TEAM = 8M54J5J787;
@ -3960,7 +3960,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1520;
CURRENT_PROJECT_VERSION = 1525;
DEAD_CODE_STRIPPING = YES;
DEBUG = NO;
DEVELOPMENT_TEAM = 8M54J5J787;
@ -4077,7 +4077,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1520;
CURRENT_PROJECT_VERSION = 1525;
DEAD_CODE_STRIPPING = YES;
DEBUG = YES;
DEVELOPMENT_TEAM = 8M54J5J787;
@ -4194,7 +4194,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1520;
CURRENT_PROJECT_VERSION = 1525;
DEAD_CODE_STRIPPING = YES;
DEBUG = YES;
DEVELOPMENT_TEAM = 8M54J5J787;
@ -4377,7 +4377,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1520;
CURRENT_PROJECT_VERSION = 1525;
DEAD_CODE_STRIPPING = YES;
DEBUG = NO;
DEVELOPMENT_TEAM = 8M54J5J787;

View File

@ -116,6 +116,10 @@ struct Constants {
string: "https://phpmon.app/php-unavailable"
)!
static let WikiPhpUpgrade = URL(
string: "https://phpmon.app/php-upgrade"
)!
static let DonationPayment = URL(
string: "https://phpmon.app/sponsor/now"
)!

View File

@ -10,6 +10,11 @@ import Foundation
import SwiftUI
struct HelpButton: View {
@State var frameSize: CGFloat = 14
@State var textSize: CGFloat = 12
@State var shadowOpacity: CGFloat = 0.3
@State var shadowRadius: CGFloat = 1
var action: () -> Void
var body: some View {
@ -18,9 +23,10 @@ struct HelpButton: View {
Circle()
.strokeBorder(Color(NSColor.separatorColor), lineWidth: 0.5)
.background(Circle().foregroundColor(Color(NSColor.controlColor)).opacity(0.7))
.shadow(color: Color(NSColor.separatorColor).opacity(0.3), radius: 1)
.frame(width: 14, height: 14)
Text("?").font(.system(size: 12, weight: .medium))
.shadow(color: Color(NSColor.separatorColor)
.opacity(shadowOpacity), radius: shadowRadius)
.frame(width: frameSize, height: frameSize)
Text("?").font(.system(size: textSize, weight: .medium))
.foregroundColor(Color(NSColor.labelColor))
}
})

View File

@ -9,6 +9,7 @@
import Foundation
import SwiftUI
// swiftlint:disable type_body_length
struct PhpVersionManagerView: View {
@ObservedObject var formulae: BrewFormulaeObservable
@ObservedObject var status: BusyStatus
@ -231,7 +232,11 @@ struct PhpVersionManagerView: View {
}
}
if formula.isInstalled {
if formula.hasUpgradedFormulaAlias {
HelpButton(frameSize: 18, textSize: 14, shadowOpacity: 1, shadowRadius: 2, action: {
NSWorkspace.shared.open(Constants.Urls.WikiPhpUpgrade)
})
} else if formula.isInstalled {
Button("phpman.buttons.uninstall".localizedForSwiftUI, role: .destructive) {
Task { await self.confirmUninstall(formula) }
}
@ -285,6 +290,15 @@ struct PhpVersionManagerView: View {
.frame(maxWidth: .infinity, alignment: .leading)
}
private func formulaIcon(for formula: BrewPhpFormula) -> some View {
Image(systemName: formula.icon)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 16, height: 16)
.foregroundColor(formula.iconColor)
.padding(.horizontal, 5)
}
private func unavailableFormula() -> some View {
HStack(spacing: 5) {
Text("phpman.version.unavailable".localizedForSwiftUI)
@ -295,16 +309,8 @@ struct PhpVersionManagerView: View {
})
}
}
private func formulaIcon(for formula: BrewPhpFormula) -> some View {
Image(systemName: formula.icon)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 16, height: 16)
.foregroundColor(formula.iconColor)
.padding(.horizontal, 5)
}
}
// swiftlint:enable type_body_length
#Preview {
PhpVersionManagerView(