1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-07 21:20:07 +01:00

🏗 WIP: Warning manager

This commit is contained in:
2022-08-09 21:55:59 +02:00
parent f90925ee17
commit c1c7561361
9 changed files with 62 additions and 11 deletions

View File

@@ -94,7 +94,6 @@ extension MainMenu {
Log.info("Should present the first launch screen!")
DispatchQueue.main.async {
// OnboardingWindowController.show()
WarningsWindowController.show()
}
}

View File

@@ -174,6 +174,10 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
PreferencesWindowController.show()
}
@objc func openWarnings() {
WarningsWindowController.show()
}
@objc func openDomainList() {
DomainListVC.show()
}

View File

@@ -76,6 +76,10 @@ class StatusMenu: NSMenu {
func addCoreMenuItems() {
self.addItem(NSMenuItem.separator())
if (WarningManager.hasWarnings()) {
self.addItem(NSMenuItem(title: "mi_warnings".localized(2),
action: #selector(MainMenu.openWarnings), keyEquivalent: ""))
}
self.addItem(NSMenuItem(title: "mi_preferences".localized,
action: #selector(MainMenu.openPrefs), keyEquivalent: ","))
self.addItem(NSMenuItem(title: "mi_check_for_updates".localized,

View File

@@ -13,12 +13,17 @@ struct WarningListView: View {
List {
VStack(alignment: .leading) {
WarningView(
title: "warnings.arm_compatibility_title".localized,
description: "warnings.arm_compatibility.description".localized,
title: "warnings.arm_compatibility_title",
description: "warnings.arm_compatibility.description",
documentationUrl: "https://phpmon.app/documentation/apple-silicon-transition"
)
Divider()
}.frame(height: 90)
WarningView(
title: "warnings.helper_permissions_title",
description: "warnings.helper_permissions.description"
)
Divider()
}
}
.navigationTitle("Warnings")

View File

@@ -15,24 +15,24 @@ struct WarningView: View {
var body: some View {
VStack(alignment: .leading) {
HStack(spacing: 5) {
HStack(spacing: 10) {
Image(systemName: "exclamationmark.triangle.fill")
.resizable()
.frame(width: 25, height: 25)
.padding()
.frame(width: 18, height: 18)
.foregroundColor(Color.orange)
.padding()
VStack(alignment: .leading, spacing: 5) {
Text(title.localizedForSwiftUI)
.fontWeight(.bold)
Text(description.localizedForSwiftUI)
.font(.body)
.font(.system(size: 12))
}
if documentationUrl != nil {
Button("Learn More") {
NSWorkspace.shared.open(URL(string: documentationUrl!)!)
}
}.padding()
}
}.padding()
}.padding(5)
}
}
}
@@ -41,7 +41,8 @@ struct WarningView_Previews: PreviewProvider {
static var previews: some View {
WarningView(
title: "warnings.helper_permissions_title",
description: "warnings.helper_permissions.description"
description: "warnings.helper_permissions.description",
documentationUrl: "https://nicoverbruggen.be"
)
WarningView(
title: "warnings.helper_permissions_title",

View File

@@ -0,0 +1,13 @@
//
// Warning.swift
// PHP Monitor
//
// Created by Nico Verbruggen on 09/08/2022.
// Copyright © 2022 Nico Verbruggen. All rights reserved.
//
import Foundation
struct Warning {
}

View File

@@ -0,0 +1,15 @@
//
// WarningManager.swift
// PHP Monitor
//
// Created by Nico Verbruggen on 09/08/2022.
// Copyright © 2022 Nico Verbruggen. All rights reserved.
//
import Foundation
class WarningManager {
// TODO: Singleton initialization at launch
}

View File

@@ -55,6 +55,8 @@
"mi_detected_extensions" = "Detected Extensions";
"mi_no_extensions_detected" = "No additional extensions detected.";
"mi_warnings" = "⚠️ %i Warnings...";
"mi_valet" = "Laravel Valet";
"mi_domain_list" = "View Domains List...";