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

Finalized initial config UI without bindings

This commit is contained in:
2023-08-30 21:05:37 +02:00
parent f8e6aa988e
commit 528f213f17
4 changed files with 52 additions and 44 deletions

View File

@ -67,7 +67,6 @@
buildConfiguration = "Debug.Dev"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = "nl"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"

View File

@ -25,9 +25,9 @@ struct PreferenceContainer<ControlView: View>: View {
var body: some View {
VStack(alignment: .leading, spacing: 10) {
HStack(alignment: .top, spacing: 50) {
HStack(alignment: .top, spacing: 10) {
VStack(alignment: .leading) {
Text(self.name.localizedForSwiftUI)
Text(LocalizedStringKey(self.name))
.bold()
.multilineTextAlignment(.leading)
.frame(minWidth: 150, maxWidth: 150, alignment: .leading)
@ -35,11 +35,15 @@ struct PreferenceContainer<ControlView: View>: View {
VStack(alignment: .leading) {
controlView
Text(self.description.localizedForSwiftUI).font(.subheadline)
}.frame(maxWidth: .infinity, alignment: .leading)
Text(self.description.localizedForSwiftUI)
.font(.subheadline)
.fixedSize(horizontal: false, vertical: true)
}
.frame(maxWidth: .infinity, alignment: .topLeading)
}
}
.padding(10)
.padding(5)
}
}
@ -80,5 +84,9 @@ struct ByteLimitView_Previews: PreviewProvider {
PreferenceContainer(name: "Something\nStupid", description: "Description") {
ByteLimitView()
}
ConfigManagerView()
.frame(width: 600, height: .infinity)
.previewDisplayName("Config Manager")
}
}

View File

@ -18,7 +18,7 @@ class PhpPreference {
}
class BoolPhpPreference: PhpPreference {
@State var value: Bool = false
@State var value: Bool = true
}
class StringPhpPreference: PhpPreference {
@ -68,38 +68,40 @@ struct ConfigManagerView: View {
Divider()
VStack(spacing: 5) {
ForEach(preferences, id: \.key) { preference in
PreferenceContainer(
name: "php_ini.\(preference.key).title",
description: "php_ini.\(preference.key).description"
) {
if let preference = preference as? BytePhpPreference {
ByteLimitView()
}
if let preference = preference as? BoolPhpPreference {
Toggle("", isOn: preference.$value)
}
if let preference = preference as? StringPhpPreference {
TextField("Placeholder", text: preference.$value)
}
}.frame(maxWidth: .infinity)
}
VStack {
ForEach(preferences, id: \.key) { preference in
PreferenceContainer(
name: "php_ini.\(preference.key).title",
description: "php_ini.\(preference.key).description"
) {
if let preference = preference as? BytePhpPreference {
ByteLimitView()
}
if let preference = preference as? BoolPhpPreference {
Toggle("", isOn: preference.$value)
.toggleStyle(.switch)
.padding(.leading, -10)
}
if let preference = preference as? StringPhpPreference {
TextField("Placeholder", text: preference.$value)
}
}.frame(maxWidth: .infinity)
}
}.padding(10)
Divider()
HStack {
Button("Cancel", action: {
})
Spacer()
Button("Apply", action: {
VStack(alignment: .trailing) {
Button("Close", action: {
})
}
.padding(10)
.padding(.vertical, 10)
.padding(.horizontal, 15)
.frame(
minWidth: 0,
maxWidth: .infinity,
alignment: .topLeading
alignment: .topTrailing
)
}
}
@ -109,7 +111,7 @@ struct ConfigManagerView: View {
struct ConfigManagerView_Previews: PreviewProvider {
static var previews: some View {
ConfigManagerView()
// .frame(width: 600, height: 480)
.previewDisplayName("Config Manager")
.frame(width: 600)
.previewDisplayName("Live Preview")
}
}

View File

@ -83,8 +83,17 @@
// CONFMAN
"confman.title" = "PHP Config Editor";
"confman.description" = "This utility lets you customize your PHP installation with ease. Changes are automatically applied as you change your configuration values.";
"confman.title" = "PHP Configuration Editor";
"confman.description" = "This feature lets you customize your PHP installation with ease. Changes are automatically applied.";
"php_ini.memory_limit.title" = "Memory Limit";
"php_ini.memory_limit.description" = "This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server.";
"php_ini.post_max_size.title" = "POST Max Size";
"php_ini.post_max_size.description" = "Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than Upload Max Size. Generally speaking, Memory Limit should be larger than POST Max Size.";
"php_ini.file_uploads.title" = "File Uploads";
"php_ini.file_uploads.description" = "Enable or disable file uploads entirely. It is recommended to keep this on.";
"php_ini.upload_max_filesize.title" = "Upload Max Size";
"php_ini.upload_max_filesize.description" = "The maximum size of an uploaded file. POST Max Size must be larger than this value.";
// PHPMAN
@ -786,13 +795,3 @@ Please note that some features (greyed out below) are currently unavailable beca
"onboarding.tour.feature_unavailable" = "This feature is currently unavailable and requires Laravel Valet to be installed.";
"onboarding.tour.once" = "You will only see the Welcome Tour once. You can re-open the Welcome Tour later via the menu bar icon (available in the menu, under First Aid & Services).";
"onboarding.tour.close" = "Close Tour";
// CONFIGURATION MANAGER
"confman.title" = "Configuration Manager";
"confman.description" = "You can update configuration values for the currently active PHP version.";
"php_ini.memory_limit.title" = "Memory Limit";
"php_ini.post_max_size.title" = "POST Max Size";
"php_ini.file_uploads.title" = "File Uploads";
"php_ini.upload_max_filesize.title" = "Upload Max Size";