Quellcode durchsuchen

Change wording in prefs based on setting

binwiederhier vor 2 Jahren
Ursprung
Commit
eb220544a3
2 geänderte Dateien mit 8 neuen und 7 gelöschten Zeilen
  1. 5 4
      web/public/static/langs/en.json
  2. 3 3
      web/src/components/Preferences.jsx

+ 5 - 4
web/public/static/langs/en.json

@@ -330,6 +330,11 @@
   "prefs_notifications_delete_after_one_day_description": "Notifications are auto-deleted after one day",
   "prefs_notifications_delete_after_one_week_description": "Notifications are auto-deleted after one week",
   "prefs_notifications_delete_after_one_month_description": "Notifications are auto-deleted after one month",
+  "prefs_notifications_web_push_title": "Background notifications",
+  "prefs_notifications_web_push_enabled_description": "Notifications are received when web app is not running via Web Push",
+  "prefs_notifications_web_push_disabled_description": "Notification are only received when web app is running",
+  "prefs_notifications_web_push_enabled": "Enabled",
+  "prefs_notifications_web_push_disabled": "Disabled",
   "prefs_users_title": "Manage users",
   "prefs_users_description": "Add/remove users for your protected topics here. Please note that username and password are stored in the browser's local storage.",
   "prefs_users_description_no_sync": "Users and passwords are not synchronized to your account.",
@@ -368,10 +373,6 @@
   "prefs_reservations_dialog_description": "Reserving a topic gives you ownership over the topic, and allows you to define access permissions for other users over the topic.",
   "prefs_reservations_dialog_topic_label": "Topic",
   "prefs_reservations_dialog_access_label": "Access",
-  "prefs_notifications_web_push_title": "Background notifications",
-  "prefs_notifications_web_push_description": "Receive notifications in the background via Web Push, even when app is not running",
-  "prefs_notifications_web_push_enabled": "Enabled",
-  "prefs_notifications_web_push_disabled": "Disabled",
   "reservation_delete_dialog_description": "Removing a reservation gives up ownership over the topic, and allows others to reserve it. You can keep, or delete existing messages and attachments.",
   "reservation_delete_dialog_action_keep_title": "Keep cached messages and attachments",
   "reservation_delete_dialog_action_keep_description": "Messages and attachments that are cached on the server will become publicly visible for people with knowledge of the topic name.",

+ 3 - 3
web/src/components/Preferences.jsx

@@ -237,7 +237,7 @@ const DeleteAfter = () => {
 const WebPushEnabled = () => {
   const { t } = useTranslation();
   const labelId = "prefWebPushEnabled";
-  const defaultEnabled = useLiveQuery(async () => prefs.webPushEnabled());
+  const enabled = useLiveQuery(async () => prefs.webPushEnabled());
   const handleChange = async (ev) => {
     await prefs.setWebPushEnabled(ev.target.value);
   };
@@ -247,9 +247,9 @@ const WebPushEnabled = () => {
   }
 
   return (
-    <Pref labelId={labelId} title={t("prefs_notifications_web_push_title")} description={t("prefs_notifications_web_push_description")}>
+    <Pref labelId={labelId} title={t("prefs_notifications_web_push_title")} description={enabled ? t("prefs_notifications_web_push_enabled_description") : t("prefs_notifications_web_push_disabled_description")}>
       <FormControl fullWidth variant="standard" sx={{ m: 1 }}>
-        <Select value={defaultEnabled ?? false} onChange={handleChange} aria-labelledby={labelId}>
+        <Select value={enabled ?? false} onChange={handleChange} aria-labelledby={labelId}>
           <MenuItem value>{t("prefs_notifications_web_push_enabled")}</MenuItem>
           <MenuItem value={false}>{t("prefs_notifications_web_push_disabled")}</MenuItem>
         </Select>