summaryrefslogtreecommitdiff
path: root/frontend/src/components/settings/pages/general/NotificationSettings.tsx
blob: 21c2fd8258c1d193dd7ab7264de88520872ca917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Field, Toggle } from 'decky-frontend-lib';
import { FC } from 'react';
import { useTranslation } from 'react-i18next';

import { useDeckyState } from '../../../DeckyState';

const NotificationSettings: FC = () => {
  const { notificationSettings } = useDeckyState();
  const notificationService = window.DeckyPluginLoader.notificationService;

  const { t } = useTranslation();

  return (
    <>
      <Field label={t('SettingsGeneralIndex.notifications.decky_updates_label')}>
        <Toggle
          value={notificationSettings.deckyUpdates}
          onChange={(deckyUpdates) => {
            notificationService.update({ ...notificationSettings, deckyUpdates });
          }}
        />
      </Field>
      <Field label={t('SettingsGeneralIndex.notifications.plugin_updates_label')}>
        <Toggle
          value={notificationSettings.pluginUpdates}
          onChange={(pluginUpdates) => {
            notificationService.update({ ...notificationSettings, pluginUpdates });
          }}
        />
      </Field>
    </>
  );
};

export default NotificationSettings;