From f86a9ad0514c68f979c8844993a42d49c23c0399 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 15 Jul 2022 13:10:42 -0500 Subject: [PATCH] ble/alerts: move and improve no web bluetooth message --- src/alerts.ts | 2 ++ src/ble/alerts/NoWebBluetooth.tsx | 49 ++++++++++++++++++++++++++ src/ble/alerts/i18n.test.ts | 12 +++++++ src/ble/alerts/i18n.ts | 16 +++++++++ src/ble/alerts/index.ts | 7 ++++ src/ble/alerts/translations/en.json | 8 +++++ src/ble/sagas.test.ts | 4 +++ src/ble/sagas.ts | 2 ++ src/lwp3-bootloader/sagas-ble.ts | 2 ++ src/notifications/i18n.ts | 1 - src/notifications/sagas.test.ts | 8 ++--- src/notifications/sagas.ts | 20 ----------- src/notifications/translations/en.json | 1 - 13 files changed, 106 insertions(+), 26 deletions(-) create mode 100644 src/ble/alerts/NoWebBluetooth.tsx create mode 100644 src/ble/alerts/i18n.test.ts create mode 100644 src/ble/alerts/i18n.ts create mode 100644 src/ble/alerts/index.ts create mode 100644 src/ble/alerts/translations/en.json diff --git a/src/alerts.ts b/src/alerts.ts index f05a8134..4e372ef0 100644 --- a/src/alerts.ts +++ b/src/alerts.ts @@ -3,12 +3,14 @@ import { IToastProps } from '@blueprintjs/core'; import alerts from './alerts/alerts'; +import ble from './ble/alerts'; import explorer from './explorer/alerts'; import { CreateToast } from './i18nToaster'; /** This collects alerts from all of the subsystems of the app */ const alertDomains = { alerts, + ble, explorer, }; diff --git a/src/ble/alerts/NoWebBluetooth.tsx b/src/ble/alerts/NoWebBluetooth.tsx new file mode 100644 index 00000000..175cd784 --- /dev/null +++ b/src/ble/alerts/NoWebBluetooth.tsx @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2022 The Pybricks Authors + +import { Button, Intent } from '@blueprintjs/core'; +import React from 'react'; +import { CreateToast } from '../../i18nToaster'; +import { isIOS, isLinux } from '../../utils/os'; +import { I18nId, useI18n } from './i18n'; + +const NoWebBluetooth: React.VoidFunctionComponent = () => { + const i18n = useI18n(); + return ( + <> +

{i18n.translate(I18nId.NoWebBluetoothMessage)}

+ {!isLinux() && !isIOS() && ( +

{i18n.translate(I18nId.NoWebBluetoothSuggestion)}

+ )} + {isLinux() && ( + <> +

{i18n.translate(I18nId.NoWebBluetoothLinux)}

+

+ + chrome://flags/#enable-experimental-web-platform-features + +