diff --git a/package.json b/package.json index ebe1cac8a..99ca461ac 100644 --- a/package.json +++ b/package.json @@ -132,6 +132,7 @@ }, "resolutions": { "@types/react": "^18.2.0", - "esbuild": "^0.18.20" + "esbuild": "^0.18.20", + "**/gl": "^6.0.2" } } diff --git a/src/bundles/ar/AR.ts b/src/bundles/ar/AR.ts index 3f15a5857..ba41fdcdc 100644 --- a/src/bundles/ar/AR.ts +++ b/src/bundles/ar/AR.ts @@ -1,6 +1,6 @@ +import { Vector3 } from 'saar/libraries/misc'; import { ARObject } from 'saar/libraries/object_state_library/ARObject'; import { OverlayHelper, Toggle } from './OverlayHelper'; -import { Vector3 } from 'saar/libraries/misc'; export class ARState { arObjects: ARObject[] = []; diff --git a/src/bundles/ar/ObjectsHelper.ts b/src/bundles/ar/ObjectsHelper.ts index 36466c47d..c9a46768b 100644 --- a/src/bundles/ar/ObjectsHelper.ts +++ b/src/bundles/ar/ObjectsHelper.ts @@ -1,3 +1,4 @@ +import { type Vector3 } from 'saar/libraries/misc'; import { type ARObject, CubeObject, @@ -18,19 +19,18 @@ import { RotateToUser, SpringMovement, } from 'saar/libraries/object_state_library/Behaviour'; -import uniqid from 'uniqid'; +import UIBase64ImageComponent from 'saar/libraries/object_state_library/ui_component/UIBase64ImageItem'; +import UIColumnItem, { + type HorizontalAlignment, +} from 'saar/libraries/object_state_library/ui_component/UIColumnItem'; +import UIImageItem from 'saar/libraries/object_state_library/ui_component/UIImageItem'; import type { UIBasicItem } from 'saar/libraries/object_state_library/ui_component/UIItem'; import UIRowItem, { type VerticalAlignment, } from 'saar/libraries/object_state_library/ui_component/UIRowItem'; -import UIColumnItem, { - type HorizontalAlignment, -} from 'saar/libraries/object_state_library/ui_component/UIColumnItem'; import UITextItem from 'saar/libraries/object_state_library/ui_component/UITextItem'; -import UIImageItem from 'saar/libraries/object_state_library/ui_component/UIImageItem'; +import uniqid from 'uniqid'; import { callARCallback } from './AR'; -import UIBase64ImageComponent from 'saar/libraries/object_state_library/ui_component/UIBase64ImageItem'; -import { type Vector3 } from 'saar/libraries/misc'; // Objects diff --git a/src/tabs/AugmentedReality/AugmentedContent.tsx b/src/tabs/AugmentedReality/AugmentedContent.tsx index 4fb36ad21..8893a21d5 100644 --- a/src/tabs/AugmentedReality/AugmentedContent.tsx +++ b/src/tabs/AugmentedReality/AugmentedContent.tsx @@ -1,14 +1,14 @@ import { useState, type RefObject, useRef, useEffect } from 'react'; +import { usePlayArea } from 'saar/libraries/calibration_library/PlayAreaContext'; +import { useControls } from 'saar/libraries/controls_library/ControlsContext'; +import { ARObject } from 'saar/libraries/object_state_library/ARObject'; +import { useScreenState } from 'saar/libraries/screen_state_library/ScreenStateContext'; import { getModuleState, type ARState, setFrontObject, } from '../../bundles/ar/AR'; import type { OverlayHelper } from '../../bundles/ar/OverlayHelper'; -import { useScreenState } from 'saar/libraries/screen_state_library/ScreenStateContext'; -import { usePlayArea } from 'saar/libraries/calibration_library/PlayAreaContext'; -import { useControls } from 'saar/libraries/controls_library/ControlsContext'; -import { ARObject } from 'saar/libraries/object_state_library/ARObject'; /** * Content to be shown on screen. @@ -160,15 +160,16 @@ export function AugmentedContent(props: ARState) { fetch('https://worldtimeapi.org/api/timezone/Asia/Singapore') .then((response) => response.json()) .then((data) => { - let time = new Date(data.datetime).getTime(); - let offset = time - new Date().getTime(); + const time = new Date(data.datetime).getTime(); + const offset = time - new Date().getTime(); setTimeOffset(offset); - console.log('Time offset', offset); }) .catch((error) => { console.log(error); }); - } catch {} + } catch { + setTimeOffset(0); + } }, []); /** diff --git a/src/tabs/AugmentedReality/AugmentedLayer.tsx b/src/tabs/AugmentedReality/AugmentedLayer.tsx index 144de2fc2..72fe2625e 100644 --- a/src/tabs/AugmentedReality/AugmentedLayer.tsx +++ b/src/tabs/AugmentedReality/AugmentedLayer.tsx @@ -1,6 +1,6 @@ -import type { ARState } from '../../bundles/ar/AR'; import { PlayAreaContext } from 'saar/libraries/calibration_library/PlayAreaContext'; import { ControlsContext } from 'saar/libraries/controls_library/ControlsContext'; +import type { ARState } from '../../bundles/ar/AR'; import { AugmentedContent } from './AugmentedContent'; /** diff --git a/src/tabs/AugmentedReality/StartButton.tsx b/src/tabs/AugmentedReality/StartButton.tsx index 78d6ce2d8..a902f31a3 100644 --- a/src/tabs/AugmentedReality/StartButton.tsx +++ b/src/tabs/AugmentedReality/StartButton.tsx @@ -1,9 +1,9 @@ import { useEffect } from 'react'; -import type { ARState } from '../../bundles/ar/AR'; -import { useScreenState } from 'saar/libraries/screen_state_library/ScreenStateContext'; import { ARButton } from 'saar/libraries/misc'; -import { Overlay } from './Overlay'; +import { useScreenState } from 'saar/libraries/screen_state_library/ScreenStateContext'; +import type { ARState } from '../../bundles/ar/AR'; import { AugmentedLayer } from './AugmentedLayer'; +import { Overlay } from './Overlay'; /** * Toggle to start AR context, for tab. diff --git a/src/tabs/AugmentedReality/index.tsx b/src/tabs/AugmentedReality/index.tsx index fbfe3ab89..e699e4f11 100644 --- a/src/tabs/AugmentedReality/index.tsx +++ b/src/tabs/AugmentedReality/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { getModuleState } from '../../bundles/ar/AR'; import { ScreenStateContext } from 'saar/libraries/screen_state_library/ScreenStateContext'; +import { getModuleState } from '../../bundles/ar/AR'; import { StartButton } from './StartButton'; /**