@robotical/webapp-types 3.11.7 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-types/src/application/ApplicationManager/ApplicationManager.d.ts +3 -0
- package/dist-types/src/application/ApplicationManager/ApplicationManager.js +13 -4
- package/dist-types/src/application/RAFTs/Cog/PublishedDataAnalyser.js +1 -1
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.d.ts +59 -88
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.js +78 -77
- package/dist-types/src/components/modals/ConnectingLoadingSpinnerModal/index.js +3 -1
- package/dist-types/src/components/modals/DetailedFeedbackModal/index.js +5 -3
- package/dist-types/src/components/modals/LEDLightsOrQRVerificationModal/index.js +17 -15
- package/dist-types/src/components/modals/VerificationModal/index.js +5 -3
- package/dist-types/src/components/modals/VerificationModalPhoneApp/index.js +9 -5
- package/dist-types/src/i18n.d.ts +2 -0
- package/dist-types/src/i18n.js +1119 -0
- package/package.json +1 -1
|
@@ -54,22 +54,10 @@ import { MdQrCode } from "react-icons/md";
|
|
|
54
54
|
//@ts-ignore
|
|
55
55
|
import { Scanner, centerText } from '@yudiel/react-qr-scanner';
|
|
56
56
|
import { ConnManager } from "@robotical/roboticaljs";
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
id: "qr",
|
|
60
|
-
title: "QR Code Verification",
|
|
61
|
-
subtitle: "Scan a QR code to verify.",
|
|
62
|
-
icon: _jsx(MdQrCode, { size: 32 }),
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: "led",
|
|
66
|
-
title: "LED Lights Verification",
|
|
67
|
-
subtitle: "Check LED signals for verification.",
|
|
68
|
-
icon: _jsx(HiOutlineLightBulb, { size: 32 }),
|
|
69
|
-
},
|
|
70
|
-
];
|
|
57
|
+
import { useTranslation } from "react-i18next";
|
|
71
58
|
export default function LEDLightsOrQRVerificationModal() {
|
|
72
59
|
var _this = this;
|
|
60
|
+
var t = useTranslation().t;
|
|
73
61
|
var _a = useState(true), qrSelected = _a[0], setQRSelected = _a[1];
|
|
74
62
|
var _b = useState(undefined), serialNoFromQR = _b[0], setSerialNoFromQR = _b[1];
|
|
75
63
|
var _c = useState(false), isButtonToConnectVisible = _c[0], setIsButtonToConnectVisible = _c[1];
|
|
@@ -85,6 +73,20 @@ export default function LEDLightsOrQRVerificationModal() {
|
|
|
85
73
|
setQRSelected(false);
|
|
86
74
|
}
|
|
87
75
|
}, [serialNoFromQR]);
|
|
76
|
+
var options = [
|
|
77
|
+
{
|
|
78
|
+
id: "qr",
|
|
79
|
+
title: t('connection.qr_title'),
|
|
80
|
+
subtitle: t('connection.qr_subtitle'),
|
|
81
|
+
icon: _jsx(MdQrCode, { size: 32 }),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "led",
|
|
85
|
+
title: t('connection.led_title'),
|
|
86
|
+
subtitle: t('connection.led_subtitle'),
|
|
87
|
+
icon: _jsx(HiOutlineLightBulb, { size: 32 }),
|
|
88
|
+
},
|
|
89
|
+
];
|
|
88
90
|
var handleSelect = function (id) {
|
|
89
91
|
if (id === 'qr') {
|
|
90
92
|
setSerialNoFromQR(undefined);
|
|
@@ -112,7 +114,7 @@ export default function LEDLightsOrQRVerificationModal() {
|
|
|
112
114
|
var id = _a.id, title = _a.title, subtitle = _a.subtitle, icon = _a.icon;
|
|
113
115
|
return (_jsxs("div", __assign({ className: qrSelected && id === 'qr' ? [styles.card, styles.qrselected].join(" ") : styles.card, onClick: function () { return handleSelect(id); } }, { children: [_jsx("div", __assign({ className: styles.icon }, { children: icon })), _jsx("h3", __assign({ className: styles.title }, { children: title })), _jsx("p", __assign({ className: styles.subtitle }, { children: subtitle }))] }), id));
|
|
114
116
|
}) })) :
|
|
115
|
-
_jsx("div", __assign({ className: styles.cogNote }, { children: _jsxs("strong", { children: ["Don't forget to ", _jsx("span", __assign({ className: styles.cogNoteHighlight }, { children: "turn on" })), " your Cog!"] }) })), qrSelected && _jsx(QRContent, { setSerialNo: setSerialNoFromQR }), _jsxs("div", __assign({ className: styles.buttonsContainer }, { children: [isButtonToConnectVisible && _jsx("button", __assign({ className: styles.connectButton, onClick: handleConnect }, { children:
|
|
117
|
+
_jsx("div", __assign({ className: styles.cogNote }, { children: _jsxs("strong", { children: ["Don't forget to ", _jsx("span", __assign({ className: styles.cogNoteHighlight }, { children: "turn on" })), " your Cog!"] }) })), qrSelected && _jsx(QRContent, { setSerialNo: setSerialNoFromQR }), _jsxs("div", __assign({ className: styles.buttonsContainer }, { children: [isButtonToConnectVisible && _jsx("button", __assign({ className: styles.connectButton, onClick: handleConnect }, { children: t('connection.qr_connect_button') })), _jsx("button", __assign({ className: styles.cancelButton, onClick: function () { return modalState.closeModal(false); } }, { children: t('connection.cancel') }))] }))] })));
|
|
116
118
|
}
|
|
117
119
|
function QRContent(_a) {
|
|
118
120
|
var _this = this;
|
|
@@ -56,6 +56,7 @@ import SimpleButton from "../../disposables/buttons/SimpleButton";
|
|
|
56
56
|
import LEDs from "../../oneoffs/LEDs";
|
|
57
57
|
import { raftConnectingSubscriptionHelper } from "../../../application/RAFTs/raft-subscription-helpers";
|
|
58
58
|
import { useConnectedRafts } from "../../../store/SelectedRaftContext";
|
|
59
|
+
import { useTranslation } from "react-i18next";
|
|
59
60
|
var SHOW_LOGS = true;
|
|
60
61
|
var TAG = "VerificationModal";
|
|
61
62
|
function VerificationModal(_a) {
|
|
@@ -65,6 +66,7 @@ function VerificationModal(_a) {
|
|
|
65
66
|
// const [connectedRaft, setConnectedRaft] = useState<RAFT | undefined>(connectedRAFT_);
|
|
66
67
|
var _c = useState(-200), RSSI = _c[0], setRSSI = _c[1];
|
|
67
68
|
var removeConnectedRaft = useConnectedRafts().removeConnectedRaft;
|
|
69
|
+
var t = useTranslation().t;
|
|
68
70
|
useEffect(function () {
|
|
69
71
|
/* Subscribe to the connectedRaft's SIGNAL strength */
|
|
70
72
|
if (!connectedRAFT_)
|
|
@@ -110,16 +112,16 @@ function VerificationModal(_a) {
|
|
|
110
112
|
if (!connectedRAFT_)
|
|
111
113
|
return;
|
|
112
114
|
var subHelper = raftConnectingSubscriptionHelper(connectedRAFT_);
|
|
113
|
-
subHelper.subscribe(setRandomColours);
|
|
115
|
+
subHelper === null || subHelper === void 0 ? void 0 : subHelper.subscribe(setRandomColours);
|
|
114
116
|
return function () {
|
|
115
|
-
subHelper.unsubscribe();
|
|
117
|
+
subHelper === null || subHelper === void 0 ? void 0 : subHelper.unsubscribe();
|
|
116
118
|
};
|
|
117
119
|
}, [connectedRAFT_]);
|
|
118
120
|
useEffect(function () {
|
|
119
121
|
/* Verify the connectedRaft once it's connected */
|
|
120
122
|
connectedRAFT_ === null || connectedRAFT_ === void 0 ? void 0 : connectedRAFT_.verifyRaft();
|
|
121
123
|
}, [connectedRAFT_]);
|
|
122
|
-
var contentJSX = _jsxs("div", __assign({ className: "verification-modal-container" }, { children: [_jsxs("div", __assign({ className: "verification-modal-martys-container" }, { children: [_jsxs("div", __assign({ className: "verification-modal-marty-name-row-container" }, { children: [_jsx("p", __assign({ className: "verification-modal-marty-name" }, { children: connectedRAFT_ === null || connectedRAFT_ === void 0 ? void 0 : connectedRAFT_.getFriendlyName() })), _jsx("div", __assign({ className: "verification-modal-marty-signal-container" }, { children: _jsx(RICSignal, { signalStrength: RSSI }) })), _jsx(BluetoothSVG, { fill: MAIN_BLUE })] })),
|
|
124
|
+
var contentJSX = _jsxs("div", __assign({ className: "verification-modal-container" }, { children: [_jsxs("div", __assign({ className: "verification-modal-martys-container" }, { children: [_jsxs("div", __assign({ className: "verification-modal-marty-name-row-container" }, { children: [_jsx("p", __assign({ className: "verification-modal-marty-name" }, { children: connectedRAFT_ === null || connectedRAFT_ === void 0 ? void 0 : connectedRAFT_.getFriendlyName() })), _jsx("div", __assign({ className: "verification-modal-marty-signal-container" }, { children: _jsx(RICSignal, { signalStrength: RSSI }) })), _jsx(BluetoothSVG, { fill: MAIN_BLUE })] })), _jsx("p", __assign({ className: "verification-modal-martys-back-hint" }, { children: t("verification_modal_phone.look_on_back", { raftType: connectedRAFT_ === null || connectedRAFT_ === void 0 ? void 0 : connectedRAFT_.type }) })), _jsxs("div", __assign({ className: "verification-modal-led-row-container" }, { children: [_jsx(LEDs, { coloursArr: randomColours, connectedRaft: connectedRAFT_ }), _jsx(SimpleButton, { onClick: onCancel, title: t("verification_modal_phone.no"), borderColour: "red", colour: "white", textColour: "red" }), _jsx(SimpleButton, { onClick: onYes, title: t("connection.yes") })] }))] })), _jsxs("div", __assign({ className: "verification-modal-bottom-btns-container" }, { children: [_jsx("div", { className: "dummy-gap" }), _jsx(SimpleButton, { onClick: onCancel, title: t("connection.cancel") })] }))] }));
|
|
123
125
|
return contentJSX;
|
|
124
126
|
}
|
|
125
127
|
export default VerificationModal;
|
|
@@ -71,11 +71,13 @@ import LoadingSpinner from "../../disposables/LoadingSpinner";
|
|
|
71
71
|
import { RaftConnectionMethod } from "../../../types/raft";
|
|
72
72
|
import { useConnectedRafts } from "../../../store/SelectedRaftContext";
|
|
73
73
|
import { ConnManager } from "@robotical/roboticaljs";
|
|
74
|
+
import { useTranslation } from "react-i18next";
|
|
74
75
|
var SHOW_LOGS = true;
|
|
75
76
|
var TAG = "VerificationModalPhone";
|
|
76
77
|
function VerificationModalPhoneApp(_a) {
|
|
77
78
|
var _this = this;
|
|
78
79
|
var foundRICs = _a.foundRICs;
|
|
80
|
+
var t = useTranslation().t;
|
|
79
81
|
var _b = useState([]), randomColours = _b[0], setRandomColours = _b[1];
|
|
80
82
|
var _c = useState(foundRICs), foundRICsState = _c[0], setFoundRICsState = _c[1];
|
|
81
83
|
var _d = useState(-1), selectedRICIdx = _d[0], setSelectedRICIdx = _d[1];
|
|
@@ -168,12 +170,14 @@ function VerificationModalPhoneApp(_a) {
|
|
|
168
170
|
});
|
|
169
171
|
}); };
|
|
170
172
|
useEffect(function () {
|
|
173
|
+
var _a;
|
|
171
174
|
if (!connectedRaft)
|
|
172
175
|
return;
|
|
173
|
-
raftConnectingSubscriptionHelper(connectedRaft).subscribe(setRandomColours);
|
|
176
|
+
(_a = raftConnectingSubscriptionHelper(connectedRaft)) === null || _a === void 0 ? void 0 : _a.subscribe(setRandomColours);
|
|
174
177
|
connectedRaft === null || connectedRaft === void 0 ? void 0 : connectedRaft.verifyRaftPhoneApp(foundRICsState[selectedRICIdx]);
|
|
175
178
|
return function () {
|
|
176
|
-
|
|
179
|
+
var _a;
|
|
180
|
+
(_a = raftConnectingSubscriptionHelper(connectedRaft)) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
177
181
|
};
|
|
178
182
|
}, [connectedRaft]);
|
|
179
183
|
var onSelectRaft = function (raftIdx) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -211,12 +215,12 @@ function VerificationModalPhoneApp(_a) {
|
|
|
211
215
|
}); };
|
|
212
216
|
var contentJSX = null;
|
|
213
217
|
if (foundRICsState.length === 0) {
|
|
214
|
-
contentJSX = _jsxs("div", __assign({ className: "verification-modal-container" }, { children: [!isScanning && _jsx("p", __assign({ style: { alignSelf: 'center' } }, { children: "No Robots Found" })), _jsx("div", __assign({ className: "verification-modal-martys-container" }, { children: isScanning && _jsxs("div", __assign({ style: { margin: "auto", width: "50px", height: "50px" } }, { children: [" ", _jsx(LoadingSpinner, {}), " "] })) })), _jsxs("div", __assign({ className: "verification-modal-bottom-btns-container" }, { children: [_jsx(SVGImageButton, { onClick: onScanAgain, title: "SCAN AGAIN", SVGImage: RefreshSVG, backgroundColour: MAIN_BLUE, titleColour: WHITE, SVGColour: WHITE }), _jsx("div", { className: "dummy-gap" }), _jsx(SimpleButton, { onClick: onCancel, title: "CANCEL" })] }))] }));
|
|
218
|
+
contentJSX = _jsxs("div", __assign({ className: "verification-modal-container" }, { children: [!isScanning && _jsx("p", __assign({ style: { alignSelf: 'center' } }, { children: t("verification_modal_phone.no_robots_found", "No Robots Found") })), _jsx("div", __assign({ className: "verification-modal-martys-container" }, { children: isScanning && _jsxs("div", __assign({ style: { margin: "auto", width: "50px", height: "50px" } }, { children: [" ", _jsx(LoadingSpinner, {}), " "] })) })), _jsxs("div", __assign({ className: "verification-modal-bottom-btns-container" }, { children: [_jsx(SVGImageButton, { onClick: onScanAgain, title: t("verification_modal_phone.scan_again", "SCAN AGAIN"), SVGImage: RefreshSVG, backgroundColour: MAIN_BLUE, titleColour: WHITE, SVGColour: WHITE }), _jsx("div", { className: "dummy-gap" }), _jsx(SimpleButton, { onClick: onCancel, title: t("verification_modal_phone.cancel", "CANCEL") })] }))] }));
|
|
215
219
|
}
|
|
216
220
|
else {
|
|
217
221
|
contentJSX = _jsxs("div", __assign({ className: "verification-modal-container" }, { children: [_jsxs("div", __assign({ className: "verification-modal-martys-container" }, { children: [isScanning && _jsxs("div", __assign({ style: { margin: "auto", width: "50px", height: "50px" } }, { children: [" ", _jsx(LoadingSpinner, {}), " "] })), foundRICsState.map(function (raftObj, raftIdx) {
|
|
218
|
-
return _jsxs(Fragment, { children: [_jsxs("div", __assign({ className: "verification-modal-marty-name-row-container", onClick: function () { return onSelectRaft(raftIdx); } }, { children: [_jsx("p", __assign({ className: "verification-modal-marty-name" }, { children: raftObj._localName })), _jsx("div", __assign({ className: "verification-modal-marty-signal-container" }, { children: _jsx(RICSignal, { signalStrength: raftObj._rssi }) })), _jsx(BluetoothSVG, { fill: MAIN_BLUE })] })), selectedRICIdx === raftIdx && _jsxs("div", { children: [_jsx("p", __assign({ className: "verification-modal-martys-back-hint" }, { children: isLoading ? "Loading..." : "
|
|
219
|
-
})] })), _jsxs("div", __assign({ className: "verification-modal-bottom-btns-container" }, { children: [_jsx(SVGImageButton, { onClick: onScanAgain, title: "
|
|
222
|
+
return _jsxs(Fragment, { children: [_jsxs("div", __assign({ className: "verification-modal-marty-name-row-container", onClick: function () { return onSelectRaft(raftIdx); } }, { children: [_jsx("p", __assign({ className: "verification-modal-marty-name" }, { children: raftObj._localName })), _jsx("div", __assign({ className: "verification-modal-marty-signal-container" }, { children: _jsx(RICSignal, { signalStrength: raftObj._rssi }) })), _jsx(BluetoothSVG, { fill: MAIN_BLUE })] })), selectedRICIdx === raftIdx && _jsxs("div", { children: [_jsx("p", __assign({ className: "verification-modal-martys-back-hint" }, { children: isLoading ? t("verification_modal_phone.loading", "Loading...") : t("verification_modal_phone.look_on_back", { raftType: connectedRaft === null || connectedRaft === void 0 ? void 0 : connectedRaft.type }) })), _jsxs("div", __assign({ className: "verification-modal-led-row-container" }, { children: [_jsx(LEDs, { coloursArr: randomColours, connectedRaft: connectedRaft }), !isLoading && _jsx(SimpleButton, { onClick: onCancel, title: t("verification_modal_phone.no", "No"), borderColour: "red", colour: "white", textColour: "red" }), !isLoading && _jsx(SimpleButton, { onClick: onYes, title: t("connection.yes") })] }))] })] }, raftIdx);
|
|
223
|
+
})] })), _jsxs("div", __assign({ className: "verification-modal-bottom-btns-container" }, { children: [_jsx(SVGImageButton, { onClick: onScanAgain, title: t("connection.scan_again"), SVGImage: RefreshSVG, backgroundColour: MAIN_BLUE, titleColour: WHITE, SVGColour: WHITE, disabled: isScanning }), _jsx("div", { className: "dummy-gap" }), _jsx(SimpleButton, { onClick: onCancel, title: t("connection.cancel") })] }))] }));
|
|
220
224
|
}
|
|
221
225
|
return contentJSX;
|
|
222
226
|
}
|