@robotical/webapp-types 3.7.20 → 3.7.22
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 +2 -0
- package/dist-types/src/application/ApplicationManager/ApplicationManager.js +3 -0
- package/dist-types/src/components/modals/LEDLightsOrQRVerificationModal/index.js +3 -3
- package/dist-types/src/utils/CarouselNavigatorManager.d.ts +24 -0
- package/dist-types/src/utils/CarouselNavigatorManager.js +53 -0
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent, RaftWifiScanResults,
|
|
|
10
10
|
import { ConnectedRaftItem } from "../../store/SelectedRaftContext";
|
|
11
11
|
import Toaster from "../../utils/Toaster";
|
|
12
12
|
import AnalyticsFacade from "@robotical/appv2-analytics-gatherer";
|
|
13
|
+
import { CarouselNavigatorManager } from "../../utils/CarouselNavigatorManager";
|
|
13
14
|
export default class ApplicationManager {
|
|
14
15
|
AnalyticsFacade: typeof AnalyticsFacade;
|
|
15
16
|
analyticsSessionId: string | undefined;
|
|
@@ -20,6 +21,7 @@ export default class ApplicationManager {
|
|
|
20
21
|
};
|
|
21
22
|
connectedRaftsContext: ConnectedRaftItem[];
|
|
22
23
|
returnToMainApp: () => void;
|
|
24
|
+
carouselNavigatorManager: CarouselNavigatorManager;
|
|
23
25
|
private _router;
|
|
24
26
|
setRouter(router: any): void;
|
|
25
27
|
navigateTo(path: string): void;
|
|
@@ -55,6 +55,7 @@ import ConnectingLoadingSpinnerModal from "../../components/modals/ConnectingLoa
|
|
|
55
55
|
import draggableModalState from "../../state-observables/modal/DraggableModalState";
|
|
56
56
|
import SensorsDashboardModal from "../../components/modals/ SensorsDashboardModal";
|
|
57
57
|
import LEDLightsOrQRVerificationModal from "../../components/modals/LEDLightsOrQRVerificationModal";
|
|
58
|
+
import { CarouselNavigatorManager } from "../../utils/CarouselNavigatorManager";
|
|
58
59
|
var SHOW_LOGS = true;
|
|
59
60
|
var TAG = "ApplicationManager";
|
|
60
61
|
var ApplicationManager = /** @class */ (function () {
|
|
@@ -67,6 +68,8 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
67
68
|
this.connectedRafts = {};
|
|
68
69
|
this.connectedRaftsContext = [];
|
|
69
70
|
this.returnToMainApp = function () { };
|
|
71
|
+
// Carousel navigators
|
|
72
|
+
this.carouselNavigatorManager = new CarouselNavigatorManager();
|
|
70
73
|
// Callback to call when a RAFT is selected (Phone App only)
|
|
71
74
|
// We need that to make sure the connection button gets the selected RAFT once the user selects one
|
|
72
75
|
this.ricSelectedCb = null;
|
|
@@ -103,10 +103,10 @@ export default function LEDLightsOrQRVerificationModal() {
|
|
|
103
103
|
return [2 /*return*/];
|
|
104
104
|
});
|
|
105
105
|
}); };
|
|
106
|
-
return (_jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.cards }, { children: options.map(function (_a) {
|
|
106
|
+
return (_jsxs("div", __assign({ className: styles.container }, { children: [!isButtonToConnectVisible ? _jsx("div", __assign({ className: styles.cards }, { children: options.map(function (_a) {
|
|
107
107
|
var id = _a.id, title = _a.title, subtitle = _a.subtitle, icon = _a.icon;
|
|
108
108
|
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));
|
|
109
|
-
}) })), qrSelected && _jsx(QRContent, { setSerialNo: setSerialNoFromQR }), _jsxs("div", __assign({ className: styles.buttonsContainer }, { children: [_jsx("button", __assign({ className: styles.
|
|
109
|
+
}) })) : _jsx("div", { children: "\u2705" }), qrSelected && _jsx(QRContent, { setSerialNo: setSerialNoFromQR }), _jsxs("div", __assign({ className: styles.buttonsContainer }, { children: [isButtonToConnectVisible && _jsx("button", __assign({ className: styles.connectButton, onClick: handleConnect }, { children: "QR code scan - click to connect" })), _jsx("button", __assign({ className: styles.cancelButton, onClick: function () { return modalState.closeModal(false); } }, { children: "Cancel" }))] }))] })));
|
|
110
110
|
}
|
|
111
111
|
function QRContent(_a) {
|
|
112
112
|
var _this = this;
|
|
@@ -126,7 +126,7 @@ function QRContent(_a) {
|
|
|
126
126
|
return [2 /*return*/];
|
|
127
127
|
});
|
|
128
128
|
}); };
|
|
129
|
-
return (_jsx("div", __assign({ className: styles.QRcontainer }, { children: _jsx("div", __assign({ className: styles.QRscannerContainer }, { children: _jsx(Scanner, { onError: function (err) { return console.error(err); }, formats: [
|
|
129
|
+
return (_jsx("div", __assign({ className: styles.QRcontainer }, { children: _jsx("div", __assign({ className: styles.QRscannerContainer }, { children: _jsx(Scanner, { styles: { container: { transform: 'scaleX(-1)' } }, onError: function (err) { return console.error(err); }, formats: [
|
|
130
130
|
"qr_code",
|
|
131
131
|
"micro_qr_code",
|
|
132
132
|
"rm_qr_code",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type CarouselNavigatorNames = "games" | "activities" | "other";
|
|
2
|
+
export type CarouselImage = {
|
|
3
|
+
src: string;
|
|
4
|
+
link: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class CarouselNavigatorManager {
|
|
7
|
+
carouselNavigators: Map<CarouselNavigatorNames, CarouselNavigator>;
|
|
8
|
+
constructor();
|
|
9
|
+
addNavigator(name: CarouselNavigatorNames, setImages: (images: CarouselImage[]) => void, rerenderComponent: (rerenderState: boolean) => void, setHighlightedItem: (highlightedItem: any) => void, setIsVisible: (isVisible: boolean) => void): void;
|
|
10
|
+
_addGamesNavigator(name: CarouselNavigatorNames, setImages: (images: CarouselImage[]) => void, rerenderComponent: (rerenderState: boolean) => void, setHighlightedItem: (highlightedItem: any) => void, setIsVisible: (isVisible: boolean) => void): void;
|
|
11
|
+
removeNavigator(name: CarouselNavigatorNames): void;
|
|
12
|
+
getNavigator(name: CarouselNavigatorNames): CarouselNavigator | undefined;
|
|
13
|
+
}
|
|
14
|
+
declare class CarouselNavigator {
|
|
15
|
+
name: CarouselNavigatorNames;
|
|
16
|
+
images: CarouselImage[];
|
|
17
|
+
rerenderComponent: (rerenderState: boolean) => void;
|
|
18
|
+
setHighlightedItem: (highlightedItem: any) => void;
|
|
19
|
+
setIsVisible: (isVisible: boolean) => void;
|
|
20
|
+
currentIndex: number;
|
|
21
|
+
constructor(name: CarouselNavigatorNames, images: CarouselImage[], rerenderComponent: (rerenderState: boolean) => void, setHighlightedItem: (highlightedItem: any) => void, setIsVisible: (isVisible: boolean) => void);
|
|
22
|
+
highlightImage(index: number): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import CarouselCodewheelImg from "../assets/carousel-navigation/carousel-codewheel.png";
|
|
2
|
+
import CarouselJump from "../assets/carousel-navigation/carousel-jump.png";
|
|
3
|
+
import CarouselMaze from "../assets/carousel-navigation/carousel-maze.png";
|
|
4
|
+
import CarouselRobofly from "../assets/carousel-navigation/carousel-robofly.png";
|
|
5
|
+
import CarouselSki from "../assets/carousel-navigation/carousel-ski.png";
|
|
6
|
+
var CarouselNavigatorManager = /** @class */ (function () {
|
|
7
|
+
function CarouselNavigatorManager() {
|
|
8
|
+
this.carouselNavigators = new Map();
|
|
9
|
+
}
|
|
10
|
+
CarouselNavigatorManager.prototype.addNavigator = function (name, setImages, rerenderComponent, setHighlightedItem, setIsVisible) {
|
|
11
|
+
if (name === "games") {
|
|
12
|
+
this._addGamesNavigator(name, setImages, rerenderComponent, setHighlightedItem, setIsVisible);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
CarouselNavigatorManager.prototype._addGamesNavigator = function (name, setImages, rerenderComponent, setHighlightedItem, setIsVisible) {
|
|
16
|
+
var images = [
|
|
17
|
+
{ src: CarouselCodewheelImg, link: '/codewheel' },
|
|
18
|
+
{ src: CarouselJump, link: '/jumping-game' },
|
|
19
|
+
{ src: CarouselRobofly, link: '/robofly-game' },
|
|
20
|
+
{ src: CarouselSki, link: '/ski-game' },
|
|
21
|
+
{ src: CarouselMaze, link: '/component3' },
|
|
22
|
+
];
|
|
23
|
+
this.carouselNavigators.set("games", new CarouselNavigator(name, images, rerenderComponent, setHighlightedItem, setIsVisible));
|
|
24
|
+
setImages(images);
|
|
25
|
+
};
|
|
26
|
+
CarouselNavigatorManager.prototype.removeNavigator = function (name) {
|
|
27
|
+
if (this.carouselNavigators.has(name)) {
|
|
28
|
+
this.carouselNavigators.delete(name);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
CarouselNavigatorManager.prototype.getNavigator = function (name) {
|
|
32
|
+
return this.carouselNavigators.get(name);
|
|
33
|
+
};
|
|
34
|
+
return CarouselNavigatorManager;
|
|
35
|
+
}());
|
|
36
|
+
export { CarouselNavigatorManager };
|
|
37
|
+
var CarouselNavigator = /** @class */ (function () {
|
|
38
|
+
function CarouselNavigator(name, images, rerenderComponent, setHighlightedItem, setIsVisible) {
|
|
39
|
+
this.name = name;
|
|
40
|
+
this.images = images;
|
|
41
|
+
this.rerenderComponent = rerenderComponent;
|
|
42
|
+
this.setHighlightedItem = setHighlightedItem;
|
|
43
|
+
this.setIsVisible = setIsVisible;
|
|
44
|
+
this.currentIndex = 0;
|
|
45
|
+
this.images = images;
|
|
46
|
+
}
|
|
47
|
+
CarouselNavigator.prototype.highlightImage = function (index) {
|
|
48
|
+
this.currentIndex = index;
|
|
49
|
+
this.setHighlightedItem(this.images[index]);
|
|
50
|
+
this.rerenderComponent(true);
|
|
51
|
+
};
|
|
52
|
+
return CarouselNavigator;
|
|
53
|
+
}());
|