From 59fca4580bafabf4e44fb34dc354baa7a3321971 Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Mon, 1 May 2023 14:52:54 +0200 Subject: [PATCH] Add 'Need help?' dialog with restart option (#7671) --- assets/css/app.css | 7 +- assets/js/components/HelpModal.vue | 157 +++++++++++++++++++++++++ assets/js/components/TopNavigation.vue | 46 ++------ assets/js/i18n.js | 1 + i18n/de.toml | 19 +++ i18n/en.toml | 19 +++ 6 files changed, 211 insertions(+), 38 deletions(-) create mode 100644 assets/js/components/HelpModal.vue diff --git a/assets/css/app.css b/assets/css/app.css index e7a6cffe8..3db33ddd8 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -145,6 +145,10 @@ a:hover { border-radius: 10px !important; } +.btn { + --bs-btn-border-width: 2px; +} + .btn-primary, .btn-primary:focus { background-color: var(--bs-primary); @@ -174,19 +178,16 @@ a:hover { .btn-outline-primary:focus { color: var(--bs-primary); background-color: transparent; - border-width: 2px; border-color: var(--bs-primary); } .btn-outline-primary:hover { color: var(--evcc-accent3) !important; background-color: transparent !important; - border-width: 2px; border-color: var(--evcc-accent3) !important; } .btn-outline-primary:active { color: var(--evcc-default-text) !important; background-color: var(--evcc-accent3) !important; - border-width: 2px; border-color: var(--evcc-accent3) !important; } diff --git a/assets/js/components/HelpModal.vue b/assets/js/components/HelpModal.vue new file mode 100644 index 000000000..1e27d262d --- /dev/null +++ b/assets/js/components/HelpModal.vue @@ -0,0 +1,157 @@ + + + diff --git a/assets/js/components/TopNavigation.vue b/assets/js/components/TopNavigation.vue index ef05fea59..be1b8cebb 100644 --- a/assets/js/components/TopNavigation.vue +++ b/assets/js/components/TopNavigation.vue @@ -52,43 +52,13 @@
  • - - {{ $t("header.blog") }} - - -
  • -
  • - - {{ $t("header.docs") }} - - -
  • -
  • - - {{ $t("header.github") }} - - +
  • - {{ $t("header.about") }} + evcc.io + @@ -108,13 +79,14 @@ import "@h2d2/shopicons/es/regular/moonstars"; import "@h2d2/shopicons/es/regular/menu"; import "@h2d2/shopicons/es/regular/newtab"; import GlobalSettingsModal from "./GlobalSettingsModal.vue"; +import HelpModal from "./HelpModal.vue"; import collector from "../mixins/collector"; import baseAPI from "../baseapi"; export default { name: "TopNavigation", - components: { GlobalSettingsModal }, + components: { GlobalSettingsModal, HelpModal }, mixins: [collector], props: { vehicleLogins: { @@ -168,6 +140,10 @@ export default { const modal = Modal.getOrCreateInstance(document.getElementById("globalSettingsModal")); modal.show(); }, + openHelpModal() { + const modal = Modal.getOrCreateInstance(document.getElementById("helpModal")); + modal.show(); + }, }, }; diff --git a/assets/js/i18n.js b/assets/js/i18n.js index 9108a1fb8..d2d3541cd 100644 --- a/assets/js/i18n.js +++ b/assets/js/i18n.js @@ -44,6 +44,7 @@ export function getLocalePreference() { export function removeLocalePreference(i18n) { settings.locale = null; setI18nLanguage(i18n, getBrowserLocale()); + ensureCurrentLocaleMessages(i18n); } export function setLocalePreference(i18n, locale) { diff --git a/i18n/de.toml b/i18n/de.toml index 7807b0526..285207961 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -73,9 +73,28 @@ blog = "Blog" docs = "Dokumentation" github = "GitHub" login = "Fahrzeug Logins" +needHelp = "Hilfe benötigt?" sessions = "Ladevorgänge" settings = "Einstellungen" +[help] +discussionsButton = "GitHub Discussions" +documentationButton = "Dokumentation" +issueButton = "Bug melden" +issueDescription = "Komisches Verhalten gefunden?" +modalTitle = "Hilfe benötigt?" +primaryActions = "Funktioniert etwas nicht so, wie es soll? Dies sind gute Anlaufstellen, um Hilfe zu erhalten." +restartButton = "Neu starten" +restartDescription = "Tried turning it off and on again?" +secondaryActions = "Noch keine Lösung gefunden? Hier noch ein paar weitere Möglichkeiten." + +[help.restart] +cancel = "Abbrechen" +confirm = "Ja, neu starten!" +description = "Unter normalen Umständen sollte ein Neustart nicht notwendig sein. Melde einen Bug, wenn du evcc regelmäßig neu starten musst." +disclaimer = "Hinweis: evcc beendet sich und verlässt sich darauf, vom Betriebssystem neu gestartet zu werden." +modalTitle = "Sicher, dass du neu starten möchtest?" + [main] vehicles = "Parkplatz" diff --git a/i18n/en.toml b/i18n/en.toml index b557a78b5..4486bce05 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -73,9 +73,28 @@ blog = "Blog" docs = "Documentation" github = "GitHub" login = "Vehicle logins" +needHelp = "Need help?" sessions = "Charging sessions" settings = "Settings" +[help] +discussionsButton = "GitHub discussions" +documentationButton = "Documentation" +issueButton = "Report a bug" +issueDescription = "Found a strange or wrong behavior?" +modalTitle = "Need help?" +primaryActions = "Something does not work the way it supposed to do? These are good places to get help." +restartButton = "Restart" +restartDescription = "Tried turning it off and on again?" +secondaryActions = "Still not able to solve your problem? Here are some more heavy handed options." + +[help.restart] +cancel = "Cancel" +confirm = "Yes, restart!" +description = "Under normal circumsances restarting should not be necessary. Please consider filing a bug if you need to restart evcc on a regular basis." +disclaimer = "Note: evcc will terminate and rely on the operating system to restart the service." +modalTitle = "Are you sure you want to restart?" + [main] vehicles = "Parking"