diff --git a/PHP Monitor.xcodeproj/project.pbxproj b/PHP Monitor.xcodeproj/project.pbxproj index 12c5d46..3d356f6 100644 --- a/PHP Monitor.xcodeproj/project.pbxproj +++ b/PHP Monitor.xcodeproj/project.pbxproj @@ -163,7 +163,6 @@ C493084B279F331F009C240B /* AddSiteVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4930849279F331F009C240B /* AddSiteVC.swift */; }; C4998F0A2617633900B2526E /* PrefsWC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4998F092617633900B2526E /* PrefsWC.swift */; }; C4998F0B2617633900B2526E /* PrefsWC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4998F092617633900B2526E /* PrefsWC.swift */; }; - C49E171F27A5736E00787921 /* PMServicesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C49E171E27A5736E00787921 /* PMServicesView.swift */; }; C4AC51FC27E27F47008528CA /* DomainListKindCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4AC51FB27E27F47008528CA /* DomainListKindCell.swift */; }; C4ACA38F25C754C100060C66 /* PhpExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4ACA38E25C754C100060C66 /* PhpExtension.swift */; }; C4AF9F71275445FF00D44ED0 /* valet-config.json in Resources */ = {isa = PBXBuildFile; fileRef = C4AF9F70275445FF00D44ED0 /* valet-config.json */; }; @@ -232,11 +231,6 @@ C4EC1E68279DE0540010F296 /* ServicesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EC1E67279DE0540010F296 /* ServicesView.swift */; }; C4EC1E73279DFCF40010F296 /* Events.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EC1E72279DFCF40010F296 /* Events.swift */; }; C4EE188422D3386B00E126E5 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EE188322D3386B00E126E5 /* Constants.swift */; }; - C4EE55A927708B9E001DF387 /* PMHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EE55A627708B9E001DF387 /* PMHeaderView.swift */; }; - C4EE55AA27708B9E001DF387 /* PMHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EE55A627708B9E001DF387 /* PMHeaderView.swift */; }; - C4EE55AB27708B9E001DF387 /* Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EE55A727708B9E001DF387 /* Preview.swift */; }; - C4EE55AD27708B9E001DF387 /* PMStatsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EE55A827708B9E001DF387 /* PMStatsView.swift */; }; - C4EE55AE27708B9E001DF387 /* PMStatsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EE55A827708B9E001DF387 /* PMStatsView.swift */; }; C4EED88927A48778006D7272 /* InterAppHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EED88827A48778006D7272 /* InterAppHandler.swift */; }; C4EED88A27A48778006D7272 /* InterAppHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4EED88827A48778006D7272 /* InterAppHandler.swift */; }; C4F2E4372752F0870020E974 /* HomebrewDiagnostics.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4F2E4362752F0870020E974 /* HomebrewDiagnostics.swift */; }; @@ -392,7 +386,6 @@ C4927F0A27B2DFC200C55AFD /* Errors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = ""; }; C4930849279F331F009C240B /* AddSiteVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddSiteVC.swift; sourceTree = ""; }; C4998F092617633900B2526E /* PrefsWC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrefsWC.swift; sourceTree = ""; }; - C49E171E27A5736E00787921 /* PMServicesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PMServicesView.swift; sourceTree = ""; }; C4AC51FB27E27F47008528CA /* DomainListKindCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DomainListKindCell.swift; sourceTree = ""; }; C4ACA38E25C754C100060C66 /* PhpExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpExtension.swift; sourceTree = ""; }; C4AF9F70275445FF00D44ED0 /* valet-config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "valet-config.json"; sourceTree = ""; }; @@ -435,9 +428,6 @@ C4EC1E67279DE0540010F296 /* ServicesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServicesView.swift; sourceTree = ""; }; C4EC1E72279DFCF40010F296 /* Events.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Events.swift; sourceTree = ""; }; C4EE188322D3386B00E126E5 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; - C4EE55A627708B9E001DF387 /* PMHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PMHeaderView.swift; sourceTree = ""; }; - C4EE55A727708B9E001DF387 /* Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Preview.swift; sourceTree = ""; }; - C4EE55A827708B9E001DF387 /* PMStatsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PMStatsView.swift; sourceTree = ""; }; C4EED88827A48778006D7272 /* InterAppHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterAppHandler.swift; sourceTree = ""; }; C4F2E4362752F0870020E974 /* HomebrewDiagnostics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomebrewDiagnostics.swift; sourceTree = ""; }; C4F2E4392752F7D00020E974 /* PhpInstallation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpInstallation.swift; sourceTree = ""; }; @@ -1001,10 +991,6 @@ isa = PBXGroup; children = ( C44264BF2850BD2A007400F1 /* VersionPopoverView.swift */, - C49E171E27A5736E00787921 /* PMServicesView.swift */, - C4EE55A627708B9E001DF387 /* PMHeaderView.swift */, - C4EE55A827708B9E001DF387 /* PMStatsView.swift */, - C4EE55A727708B9E001DF387 /* Preview.swift */, C44264BD2850B86C007400F1 /* SwiftUIHelper.swift */, ); path = SwiftUI; @@ -1214,8 +1200,6 @@ C4068CA727B07A1300544CD5 /* SelectPreferenceView.swift in Sources */, C4080FF627BD8C6400BF2C6B /* BetterAlert.swift in Sources */, C4E0F7ED27BEBDA9007475F2 /* NSWindowExtension.swift in Sources */, - C49E171F27A5736E00787921 /* PMServicesView.swift in Sources */, - C4EE55AD27708B9E001DF387 /* PMStatsView.swift in Sources */, C4205A7E27F4D21800191A39 /* ValetProxy.swift in Sources */, C4C8E818276F54D8003AC782 /* App+ConfigWatch.swift in Sources */, 54FCFD30276C8DA4004CE748 /* HotkeyPreferenceView.swift in Sources */, @@ -1227,7 +1211,6 @@ C48D0CA325CC992000CC7490 /* StatsView.swift in Sources */, C40C7F2827721FF600DDDCDC /* ActivePhpInstallation+Checks.swift in Sources */, C463E380284930EE00422731 /* PresetHelper.swift in Sources */, - C4EE55A927708B9E001DF387 /* PMHeaderView.swift in Sources */, C41C02A927E61A65009F26CB /* ValetSite+Fake.swift in Sources */, C4C0E8DF27F88AEB002D32A9 /* FakeSiteScanner.swift in Sources */, C44264BE2850B86C007400F1 /* SwiftUIHelper.swift in Sources */, @@ -1238,7 +1221,6 @@ C44067F527E2582B0045BD4E /* DomainListNameCell.swift in Sources */, C40C5C9C2846A40600E28255 /* Preset.swift in Sources */, C41CD0292628D8EE0065BBED /* GlobalKeybindPreference.swift in Sources */, - C4EE55AB27708B9E001DF387 /* Preview.swift in Sources */, C44067F727E258410045BD4E /* DomainListPhpCell.swift in Sources */, C42800AA28452AA10099C999 /* StatusMenu+Items.swift in Sources */, C415D3B72770F294005EF286 /* Actions.swift in Sources */, @@ -1323,7 +1305,6 @@ files = ( C449B4F427EE7FC800C47E8A /* DomainListKindCell.swift in Sources */, 54EAC806262F212B0092D14E /* GlobalKeybindPreference.swift in Sources */, - C4EE55AE27708B9E001DF387 /* PMStatsView.swift in Sources */, C41CA5EE2774F8EE00A2C80E /* DomainListVC+Actions.swift in Sources */, 54D9E0B727E4F51E003B9AD9 /* HotKey.swift in Sources */, C4205A7F27F4D21800191A39 /* ValetProxy.swift in Sources */, @@ -1444,7 +1425,6 @@ C418898A275FE8CB001EF227 /* Filesystem.swift in Sources */, C40FE73B282ABB2E00A302C2 /* AppVersionTest.swift in Sources */, C4F780C625D80B75000DBC97 /* XibLoadable.swift in Sources */, - C4EE55AA27708B9E001DF387 /* PMHeaderView.swift in Sources */, C46E206E28299B3800D909D6 /* AppUpdateChecker.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/phpmon/Domain/SwiftUI/PMHeaderView.swift b/phpmon/Domain/SwiftUI/PMHeaderView.swift deleted file mode 100644 index 26526db..0000000 --- a/phpmon/Domain/SwiftUI/PMHeaderView.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// PMHeaderView.swift -// PHP Monitor -// -// Created by Nico Verbruggen on 15/04/2021. -// Copyright © 2022 Nico Verbruggen. All rights reserved. -// - -import SwiftUI - -@available(OSX 11.0, *) -struct PMHeaderView: View { - @State var content: String = "Your Title Here" - - var body: some View { - PMHeader(labelText: $content).frame(minWidth: 0, maxWidth: 450, minHeight: 0, maxHeight: 50) - } -} - -@available(OSX 11.0, *) -struct PMHeader: NSViewRepresentable { - @Binding var labelText: String - - func makeNSView(context: Context) -> some NSView { - return HeaderView.asMenuItem(text: labelText).view! - } - - func updateNSView(_ nsView: NSViewType, context: Context) {} -} diff --git a/phpmon/Domain/SwiftUI/PMServicesView.swift b/phpmon/Domain/SwiftUI/PMServicesView.swift deleted file mode 100644 index ead38a4..0000000 --- a/phpmon/Domain/SwiftUI/PMServicesView.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// PMHeaderView.swift -// PHP Monitor -// -// Created by Nico Verbruggen on 15/04/2021. -// Copyright © 2022 Nico Verbruggen. All rights reserved. -// - -import SwiftUI - -@available(OSX 11.0, *) -struct PMServicesView: View { - var body: some View { - PMServices().frame(minWidth: 0, maxWidth: 450, minHeight: 0, maxHeight: 50) - } -} - -@available(OSX 11.0, *) -struct PMServices: NSViewRepresentable { - func makeNSView(context: Context) -> some NSView { - return ServicesView.asMenuItem().view! - } - - func updateNSView(_ nsView: NSViewType, context: Context) {} -} diff --git a/phpmon/Domain/SwiftUI/PMStatsView.swift b/phpmon/Domain/SwiftUI/PMStatsView.swift deleted file mode 100644 index 95b3c72..0000000 --- a/phpmon/Domain/SwiftUI/PMStatsView.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// PMStatsView.swift -// PHP Monitor -// -// Created by Nico Verbruggen on 15/04/2021. -// Copyright © 2022 Nico Verbruggen. All rights reserved. -// - -import SwiftUI - -@available(OSX 11.0, *) -struct PMStats: NSViewRepresentable { - @Binding var labelText: String - - func makeNSView(context: Context) -> some NSView { - return StatsView.asMenuItem(memory: labelText, post: labelText, upload: labelText).view! - } - - func updateNSView(_ nsView: NSViewType, context: Context) {} -} - -@available(OSX 11.0, *) -struct PMStatsView: View { - @State var content: String = "5 MB" - - var body: some View { - PMStats(labelText: $content).frame(minWidth: 0, maxWidth: 450, minHeight: 0, maxHeight: 80) - } -} diff --git a/phpmon/Domain/SwiftUI/Preview.swift b/phpmon/Domain/SwiftUI/Preview.swift deleted file mode 100644 index a0b673a..0000000 --- a/phpmon/Domain/SwiftUI/Preview.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// Preview.swift -// PHP Monitor -// -// Created by Nico Verbruggen on 15/04/2021. -// Copyright © 2022 Nico Verbruggen. All rights reserved. -// - -import SwiftUI -import Cocoa - -@available(OSX 11.0, *) -struct Preview_Previews: PreviewProvider { - static var previews: some View { - PMHeaderView(content: "You are running PHP 8.1") - PMStatsView(content: "15 MB") - PMStatsView(content: "2 GB") - PMServicesView() // uses live services data! - } -} diff --git a/phpmon/Domain/SwiftUI/VersionPopoverView.swift b/phpmon/Domain/SwiftUI/VersionPopoverView.swift index 3994e39..e977aa8 100644 --- a/phpmon/Domain/SwiftUI/VersionPopoverView.swift +++ b/phpmon/Domain/SwiftUI/VersionPopoverView.swift @@ -55,15 +55,11 @@ struct VersionPopoverView: View { if !validPhpVersions.isEmpty { // Suggestions for alternative PHP versions VStack(alignment: .leading, spacing: 10) { - HStack(alignment: .center, spacing: 5) { - Image(systemName: "info.circle.fill") - .renderingMode(.template) - .foregroundColor(Color("AppColor")) - Text("alert.php_suggestions".localized) - .font(.subheadline) - .foregroundColor(Color("AppColor")) - - }.padding(EdgeInsets(top: 5, leading: 0, bottom: 0, trailing: 0)) + DisclaimerView( + iconName: "info.circle", + message: "alert.php_suggestions".localized, + color: Color("AppColor") + ) HStack { ForEach(validPhpVersions, id: \.self) { version in Button("site_link.switch_to_php".localized(version.homebrewVersion), action: { @@ -75,23 +71,16 @@ struct VersionPopoverView: View { } } else { if site.composerPhpSource != .unknown { - HStack(alignment: .center, spacing: 5) { - Image(systemName: "checkmark.seal.fill") - .renderingMode(.template) - .foregroundColor(Color("IconColorGreen")) - Text("alert.php_version_ideal".localized) - .font(.subheadline) - .foregroundColor(Color("IconColorGreen")) - }.padding(EdgeInsets(top: 5, leading: 0, bottom: 0, trailing: 0)) + DisclaimerView( + iconName: "checkmark.seal.fill", + message: "alert.php_version_ideal".localized, + color: Color("IconColorGreen") + ) } else { - HStack(alignment: .firstTextBaseline, spacing: 5) { - Image(systemName: "questionmark.circle.fill") - .renderingMode(.template) - .foregroundColor(Color.secondary) - Text("alert.unable_to_determine_is_fine".localized) - .font(.subheadline) - .foregroundColor(Color.secondary) - }.padding(EdgeInsets(top: 5, leading: 0, bottom: 0, trailing: 0)) + DisclaimerView( + iconName: "questionmark.circle", + message: "alert.unable_to_determine_is_fine".localized + ) } } }.frame(width: 400, height: nil, alignment: .center) @@ -102,6 +91,23 @@ struct VersionPopoverView: View { } } +struct DisclaimerView: View { + @State var iconName: String + @State var message: String + @State var color: Color = Color.secondary + + var body: some View { + HStack(alignment: .firstTextBaseline, spacing: 5) { + Image(systemName: iconName) + .renderingMode(.template) + .foregroundColor(color) + Text(message) + .font(.subheadline) + .foregroundColor(color) + }.padding(EdgeInsets(top: 5, leading: 0, bottom: 0, trailing: 0)) + } +} + struct VersionPopoverView_Previews: PreviewProvider { static var previews: some View { VersionPopoverView(