@robotical/webapp-types 3.7.21 → 3.7.23

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.
@@ -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;
@@ -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: '/skiing-game' },
21
+ { src: CarouselMaze, link: '/maze' },
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
+ }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robotical/webapp-types",
3
- "version": "3.7.21",
3
+ "version": "3.7.23",
4
4
  "description": "Type definitions for the Application Manager",
5
5
  "main": "dist/application-manager.d.ts",
6
6
  "types": "dist/application-manager.d.ts",