From d679c7e75cc02fae82b8f07d57c274db77d754b1 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Sun, 26 Feb 2023 22:50:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8C=20Tweak=20onboarding=20for=20Valet?= =?UTF-8?q?-less=20users?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SwiftUI/Onboarding/OnboardingView.swift | 68 +++++++++++-------- phpmon/Localizable.strings | 5 +- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/phpmon/Domain/SwiftUI/Onboarding/OnboardingView.swift b/phpmon/Domain/SwiftUI/Onboarding/OnboardingView.swift index 7cb5fe5..b1261be 100644 --- a/phpmon/Domain/SwiftUI/Onboarding/OnboardingView.swift +++ b/phpmon/Domain/SwiftUI/Onboarding/OnboardingView.swift @@ -12,30 +12,36 @@ struct OnboardingTextItem: View { @State var icon: String @State var title: String @State var description: String + @State var unavailable: Bool = false var body: some View { - HStack(alignment: .top, spacing: 5) { - Image(systemName: icon) - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: 24, height: 24) - .foregroundColor(Color.appPrimary) - .padding(.trailing, 10) - VStack(alignment: .leading, spacing: 4) { - Text(title.localizedForSwiftUI) - .font(.system(size: 14)) - .lineLimit(3) - Text(description.localizedForSwiftUI) - .foregroundColor(Color.secondary) - .font(.system(size: 13)) - .lineLimit(4) - .fixedSize(horizontal: false, vertical: true) - .frame(minWidth: 0, maxWidth: 800, alignment: .leading) + ZStack { + HStack(alignment: .top, spacing: 5) { + Image(systemName: icon) + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 24, height: 24) + .foregroundColor(unavailable ? .gray : Color.appPrimary) + .padding(.trailing, 10) + .opacity(self.unavailable ? 0.2 : 1) + VStack(alignment: .leading, spacing: 4) { + Text(title.localizedForSwiftUI) + .font(.system(size: 14)) + .lineLimit(3) + .opacity(self.unavailable ? 0.5 : 1) + Text(description.localizedForSwiftUI) + .foregroundColor(Color.secondary) + .font(.system(size: 13)) + .lineLimit(4) + .fixedSize(horizontal: false, vertical: true) + .frame(minWidth: 0, maxWidth: 800, alignment: .leading) + .opacity(self.unavailable ? 0.5 : 1) + } } + .padding() + .overlay(RoundedRectangle(cornerRadius: 5) + .stroke(Color.gray.opacity(self.unavailable ? 0.1 : 0.3), lineWidth: 1)) } - .padding() - .overlay(RoundedRectangle(cornerRadius: 5) - .stroke(Color.gray.opacity(0.3), lineWidth: 1)) } } @@ -53,9 +59,13 @@ struct OnboardingView: View { .font(.title) .bold() .padding(.bottom, 5) - Text("onboarding.explore".localized) - .padding(.bottom) - .padding(.trailing) + Text( + Valet.installed + ? "onboarding.explore".localized + : "onboarding.explore.lite".localized + ) + .padding(.bottom) + .padding(.trailing) } .padding(.top, 10) } @@ -72,17 +82,20 @@ struct OnboardingView: View { OnboardingTextItem( icon: "checkmark.circle.fill", title: "onboarding.tour.services.title", - description: "onboarding.tour.services" + description: "onboarding.tour.services", + unavailable: !Valet.installed ) OnboardingTextItem( icon: "list.bullet.circle.fill", title: "onboarding.tour.domains.title", - description: "onboarding.tour.domains" + description: "onboarding.tour.domains", + unavailable: !Valet.installed ) OnboardingTextItem( icon: "pin.circle.fill", title: "onboarding.tour.isolation.title", - description: "onboarding.tour.isolation" + description: "onboarding.tour.isolation", + unavailable: !Valet.installed ) } }.padding() @@ -111,6 +124,8 @@ struct OnboardingView: View { Button("onboarding.tour.close".localized) { App.shared.onboardingWindowController?.close() } + .padding(.bottom, 5) + .padding(.top, 10) } } .padding(.leading) @@ -123,7 +138,6 @@ struct OnboardingView_Previews: PreviewProvider { static var previews: some View { Group { OnboardingView() - OnboardingView().preferredColorScheme(.dark) } } } diff --git a/phpmon/Localizable.strings b/phpmon/Localizable.strings index 4fc0c11..bcb17ff 100644 --- a/phpmon/Localizable.strings +++ b/phpmon/Localizable.strings @@ -678,14 +678,17 @@ When files like these are missing, it's recommended to reinstall the appropriate "onboarding.title" = "Welcome Tour"; "onboarding.welcome" = "Welcome to PHP Monitor!"; "onboarding.explore" = "Congrats, you now have access to PHP Monitor's entire suite of functionality. You can learn more about some of the features that PHP Monitor has to offer on this screen."; +"onboarding.explore.lite" = "Congrats, you now have access to a subset of PHP Monitor's features. Please note that some features are currently disabled because Laravel Valet is not installed (or disabled.)"; "onboarding.tour.menu_bar.title" = "Power In Your Menu Bar"; "onboarding.tour.menu_bar" = "PHP Monitor lives in your menu bar. From this menu, you can access most of PHP Monitor's key functionality, including switching the globally linked PHP version, locating config files, and much more."; -"onboarding.tour.faq_hint" = "I recommend that you check out the [README](https://github.com/nicoverbruggen/phpmon/blob/main/README.md) on GitHub: it contains a comprehensive FAQ with various tips and common questions and answers."; +"onboarding.tour.faq_hint" = "**Questions? Unsure why features are unavailable?** +I recommend that you check out the [README](https://github.com/nicoverbruggen/phpmon/blob/main/README.md) on GitHub: it contains a comprehensive FAQ with various tips and common questions and answers."; "onboarding.tour.services.title" = "Manage Homebrew Services"; "onboarding.tour.services" = "Once you click on the menu bar item, you can see at a glance based on the checkmarks or crosses if all of the Homebrew services are up and running. You can also click on a service to quickly toggle it."; "onboarding.tour.domains.title" = "Manage Domains"; "onboarding.tour.domains" = "By opening the Domains window via the menu bar item, you can view which domains are linked and parked, as well as active nginx proxies."; "onboarding.tour.isolation.title" = "Isolate Domains"; "onboarding.tour.isolation" = "If you have Valet 3 installed, you can even use domain isolation by right-clicking on a given domain in the Domains window. This allows you to pick a specific version of PHP to use for that domain, and that domain only."; +"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";