@24i/bigscreen-sdk 1.0.54-alpha.2836 → 2.1.1-alpha.2133
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/README.md +3 -2
- package/package.json +34 -53
- package/packages/adobe-heartbeat/src/AdobeHeartbeat.ts +9 -9
- package/packages/async-image/src/AsyncImage.tsx +10 -15
- package/packages/developer-tools/PlayerDebugWindow/README.md +1 -1
- package/packages/developer-tools/src/DeveloperToolsService/DeveloperToolsList.tsx +0 -11
- package/packages/developer-tools/src/PlayerDebugWindow/PlayerDebugWindow.tsx +5 -5
- package/packages/developer-tools/src/PlayerDebugWindow/constants.ts +0 -15
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoDetail.tsx +1 -2
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoProvider.ts +5 -57
- package/packages/developer-tools/src/TechnicalInfo/__mocks__/Device.ts +0 -12
- package/packages/developer-tools/src/TechnicalInfo/translations.ts +0 -8
- package/packages/device/src/getKeyDigit.ts +2 -2
- package/packages/device/src/resolver/resolver.ts +5 -18
- package/packages/digital-clock/src/DigitalClock.tsx +4 -15
- package/packages/driver-androidtv/src/DeviceAndroidTV.ts +9 -92
- package/packages/driver-androidtv/src/__mocks__/javaScriptBridge.ts +5 -38
- package/packages/driver-androidtv/src/index.ts +0 -1
- package/packages/driver-androidtv/src/keymap.ts +0 -18
- package/packages/driver-androidtv/src/types.ts +16 -144
- package/packages/driver-base/src/DeviceBase.ts +2 -80
- package/packages/driver-base/src/KeyMap/Key.ts +1 -8
- package/packages/driver-base/src/KeyMap/KeyMap.ts +0 -4
- package/packages/driver-base/src/KeyMap/interface.ts +0 -1
- package/packages/driver-base/src/KeyMap/overrideValues.ts +1 -2
- package/packages/driver-base/src/__mocks__/DeviceBase.ts +0 -24
- package/packages/driver-base/src/__mocks__/keyMap.ts +0 -1
- package/packages/driver-base/src/index.ts +0 -3
- package/packages/driver-base/src/types/DeviceEvent.ts +0 -2
- package/packages/driver-base/src/types/KeycodeKeyMap.ts +0 -1
- package/packages/driver-browser/src/DeviceBrowser.ts +0 -26
- package/packages/driver-browser/src/keymap.ts +0 -8
- package/packages/driver-entone/src/DeviceEntone.ts +1 -31
- package/packages/driver-entone/src/keymap.ts +0 -1
- package/packages/driver-hbbtv/src/DeviceHbbTV.ts +0 -26
- package/packages/driver-kreatv/src/DeviceKreaTV.ts +0 -26
- package/packages/driver-saphi/src/DeviceSaphi.ts +0 -26
- package/packages/driver-tizen/src/DeviceTizen.ts +7 -126
- package/packages/driver-tizen/src/ITizen.ts +202 -15116
- package/packages/driver-tizen/src/IWebapis.ts +87 -8643
- package/packages/driver-tizen/src/TizenKeys.ts +2 -4
- package/packages/driver-tizen/src/__mocks__/tizen.ts +8 -7
- package/packages/driver-tizen/src/constants.ts +195 -1
- package/packages/driver-tizen/src/types.ts +14 -0
- package/packages/driver-vidaa/src/DeviceVidaa.ts +2 -29
- package/packages/driver-vidaa/src/__mocks__/vidaa.ts +1 -1
- package/packages/driver-vidaa/src/keymap.ts +0 -2
- package/packages/driver-webos/src/DeviceWebos.ts +0 -55
- package/packages/driver-webos/src/__mocks__/webos.ts +0 -33
- package/packages/driver-webos/src/constants.ts +0 -1
- package/packages/driver-webos/src/keymap.ts +1 -2
- package/packages/driver-webos/src/types.ts +0 -30
- package/packages/driver-xbox/src/DeviceXbox.ts +1 -30
- package/packages/driver-xbox/src/keymap.ts +1 -1
- package/packages/epg/README.md +1 -3
- package/packages/epg/src/v2/Cell.tsx +2 -16
- package/packages/epg/src/v2/DataManager.ts +41 -112
- package/packages/epg/src/v2/DatePicker.tsx +3 -9
- package/packages/epg/src/v2/DateToast/DateToast.tsx +9 -12
- package/packages/epg/src/v2/Day.tsx +3 -6
- package/packages/epg/src/v2/Epg.tsx +5 -5
- package/packages/epg/src/v2/MockGenerator/generator.ts +2 -3
- package/packages/epg/src/v2/ProgramInfo/utils.ts +3 -4
- package/packages/epg/src/v2/Row.tsx +1 -3
- package/packages/epg/src/v2/TimelineSection.tsx +1 -4
- package/packages/epg/src/v2/basic/CellsManager.tsx +2 -7
- package/packages/epg/src/v2/basic/RowsManager.tsx +1 -3
- package/packages/epg/src/v2/interface.ts +0 -13
- package/packages/events-manager/src/EventsManager.ts +56 -1
- package/packages/focus/README.md +0 -33
- package/packages/focus/src/IFocusable.ts +0 -1
- package/packages/focus/src/Layout/Base.tsx +6 -41
- package/packages/focus/src/Layout/Matrix.tsx +19 -51
- package/packages/focus/src/Layout/__test__/Base.spec.ts +180 -0
- package/packages/focus/src/Layout/__test__/Horizontal.spec.ts +94 -0
- package/packages/focus/src/Layout/__test__/Matrix.spec.ts +261 -0
- package/packages/focus/src/Layout/__test__/Vertical.spec.ts +46 -0
- package/packages/focus/src/Layout/__test__/isRtl.spec.ts +23 -0
- package/packages/focus/src/Layout/__test__/shared.ts +19 -0
- package/packages/focus/src/focusFirstExisting.ts +1 -7
- package/packages/focus/src/index.ts +1 -2
- package/packages/gallup/src/Gallup.ts +3 -3
- package/packages/grid/src/Base/Base.tsx +10 -15
- package/packages/grid/src/FirstOnlyGrid/FirstOnlyGrid.tsx +2 -4
- package/packages/grid/src/UnifiedGridController/UnifiedGridController.ts +6 -6
- package/packages/icon/src/Icon.tsx +5 -27
- package/packages/input/README.md +1 -1
- package/packages/input/src/Input.tsx +10 -16
- package/packages/interactable/README.md +1 -2
- package/packages/interactable/src/Interactable.tsx +3 -9
- package/packages/interactable/src/interface.ts +0 -1
- package/packages/jsx/src/index.ts +1 -1
- package/packages/jsx/src/test-utils/index.ts +0 -1
- package/packages/keyboard/src/Backdrop/Backdrop.scss +0 -2
- package/packages/keyboard/src/KeyboardBase.tsx +4 -16
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.scss +0 -4
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.tsx +20 -28
- package/packages/keyboard/src/WhitelabelKeyboard/_sizes.1080.scss +0 -1
- package/packages/keyboard/src/WhitelabelKeyboard/_sizes.scss +0 -1
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/index.ts +0 -12
- package/packages/keyboard/src/WhitelabelKeyboard/types.ts +0 -1
- package/packages/keyboard/src/utils/caret.ts +8 -5
- package/packages/keyboard/src/utils/input.ts +6 -5
- package/packages/l10n/README.md +0 -18
- package/packages/l10n/src/date/common.ts +6 -18
- package/packages/l10n/src/date/cs.ts +8 -2
- package/packages/l10n/src/date/en-001.ts +3 -3
- package/packages/l10n/src/date/en-common.ts +4 -5
- package/packages/l10n/src/date/en-us.ts +3 -3
- package/packages/l10n/src/date/iso.ts +13 -12
- package/packages/l10n/src/date/types.ts +0 -9
- package/packages/l10n/src/l10n.ts +3 -61
- package/packages/list/src/Base/Base.tsx +9 -19
- package/packages/list/src/Base/interface.ts +2 -2
- package/packages/list/src/BasicList/BasicList.tsx +7 -7
- package/packages/list/src/CenteredList/CenteredList.tsx +2 -2
- package/packages/list/src/CenteredList/controller.ts +1 -0
- package/packages/list/src/EdgeOffsetList/EdgeOffsetList.tsx +10 -10
- package/packages/list/src/FirstOnlyList/FirstOnlyList.tsx +2 -2
- package/packages/list/src/FirstOnlyVariedList/FirstOnlyVariedList.tsx +2 -2
- package/packages/list/src/FixedToEndList/FixedToEndList.tsx +2 -2
- package/packages/list/src/UnifiedListController/UnifiedListController.ts +2 -6
- package/packages/list/src/interface.ts +2 -2
- package/packages/logger/src/loggers/ConsoleLogger/ConsoleLogger.ts +1 -7
- package/packages/logger/src/loggers/SentryLogger/Sentry.ts +0 -1
- package/packages/logger/src/loggers/SentryLogger/SentryLogger.ts +3 -5
- package/packages/menu/src/MenuAndContentContainer/MenuAndContentContainer.tsx +3 -31
- package/packages/menu/src/MenuAndContentContainer/interface.ts +0 -8
- package/packages/modal-service/README.md +1 -4
- package/packages/modal-service/src/ModalService.tsx +5 -29
- package/packages/perf-utils/README.md +120 -1
- package/packages/perf-utils/src/array/filter.ts +54 -1
- package/packages/perf-utils/src/array/find.ts +43 -1
- package/packages/perf-utils/src/array/findIndex.ts +43 -1
- package/packages/perf-utils/src/array/forEach.ts +48 -1
- package/packages/perf-utils/src/array/includes.ts +41 -1
- package/packages/perf-utils/src/array/includesNaN.ts +32 -1
- package/packages/perf-utils/src/array/index.ts +7 -1
- package/packages/perf-utils/src/array/map.ts +52 -1
- package/packages/player-ui/README.md +1 -1
- package/packages/player-ui/src/CurrentTime.tsx +2 -2
- package/packages/player-ui/src/Duration.tsx +2 -2
- package/packages/player-ui/src/PauseButton.tsx +0 -8
- package/packages/player-ui/src/PlayerInteractable.tsx +0 -1
- package/packages/player-ui/src/PlayerTime.tsx +1 -3
- package/packages/player-ui/src/PlayerUI.tsx +35 -68
- package/packages/player-ui/src/RemainingTime.tsx +2 -2
- package/packages/player-ui/src/Seekbar.tsx +18 -110
- package/packages/player-ui/src/Seeking.ts +16 -57
- package/packages/player-ui/src/Subtitles.tsx +2 -2
- package/packages/player-ui/src/index.ts +0 -1
- package/packages/player-ui/src/mocks.ts +8 -32
- package/packages/player-ui/src/timeUtils.ts +3 -3
- package/packages/player-ui/src/types.ts +3 -9
- package/packages/router/README.md +0 -1
- package/packages/router/src/Route.tsx +27 -61
- package/packages/router/src/Router.tsx +14 -63
- package/packages/router/src/history.ts +1 -8
- package/packages/router/src/index.ts +1 -1
- package/packages/router/src/utils.ts +4 -9
- package/packages/sass-utils/src/linear-gradient.scss +4 -9
- package/packages/sass-utils/src/scale.1080.scss +1 -3
- package/packages/sass-utils/src/scale.720.scss +1 -1
- package/packages/time/README.md +1 -4
- package/packages/time/src/Time.ts +13 -35
- package/packages/time/src/constants.ts +0 -1
- package/packages/toast/src/ToastService.tsx +5 -16
- package/packages/types-bigscreen-jsx/README.md +4 -5
- package/packages/types-bigscreen-jsx/index.d.ts +67 -72
- package/packages/utils/README.md +0 -27
- package/packages/utils/src/elementUtils.ts +0 -25
- package/packages/utils/src/index.ts +0 -8
- package/packages/utils/src/scaledImage.ts +3 -6
- package/packages/utils/src/textUtils.ts +14 -46
- package/packages/utils/src/wait.ts +1 -3
- package/packages/utils/src/xhr/xhrSend.ts +1 -3
- package/packages/utils/src/xhr/xhrSendRetry.ts +1 -3
- package/packages/zapping/src/ChannelZapping.ts +0 -9
- package/packages/zapping/src/Zapping.tsx +0 -10
- package/ci/is_ci_job_skippable.sh +0 -153
- package/packages/analytics/README.md +0 -8
- package/packages/analytics/src/A.ts +0 -1
- package/packages/analytics/src/Analytics.ts +0 -1
- package/packages/analytics/src/analyticsOnScroll.ts +0 -1
- package/packages/analytics/src/clients/ConsoleAnalytics/ConsoleAnalytics.ts +0 -1
- package/packages/analytics/src/clients/ConsoleAnalytics/index.ts +0 -1
- package/packages/analytics/src/clients/GoogleAnalytics/GoogleAnalytics.ts +0 -196
- package/packages/analytics/src/clients/GoogleAnalytics/constants.ts +0 -126
- package/packages/analytics/src/clients/GoogleAnalytics/getUrl.ts +0 -17
- package/packages/analytics/src/clients/GoogleAnalytics/index.ts +0 -2
- package/packages/analytics/src/clients/GoogleAnalytics/interface.ts +0 -82
- package/packages/analytics/src/clients/GoogleAnalytics/mapPayload.ts +0 -51
- package/packages/analytics/src/clients/GoogleAnalytics/prepareBody.ts +0 -14
- package/packages/analytics/src/clients/TealiumAnalytics/TealiumAnalytics.ts +0 -181
- package/packages/analytics/src/clients/TealiumAnalytics/constants.ts +0 -106
- package/packages/analytics/src/clients/TealiumAnalytics/findForLanguage.ts +0 -9
- package/packages/analytics/src/clients/TealiumAnalytics/index.ts +0 -4
- package/packages/analytics/src/clients/TealiumAnalytics/interface.ts +0 -35
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/__mocks__/mediaPayload.ts +0 -72
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/helper.ts +0 -36
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppError.ts +0 -13
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppOpen.ts +0 -13
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteAdd.ts +0 -11
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteRemove.ts +0 -11
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerClose.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerOpen.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSceneView.ts +0 -18
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearch.ts +0 -18
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchFailed.ts +0 -8
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchSuccess.ts +0 -8
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoPause.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoProgress.ts +0 -18
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoResume.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStart.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStop.ts +0 -15
- package/packages/analytics/src/clients/TealiumAnalytics/types.ts +0 -161
- package/packages/analytics/src/clients/TwentyFourIQ/TwentyFourIQClient.ts +0 -107
- package/packages/analytics/src/clients/TwentyFourIQ/constants.ts +0 -111
- package/packages/analytics/src/clients/TwentyFourIQ/helper.ts +0 -34
- package/packages/analytics/src/clients/TwentyFourIQ/index.ts +0 -2
- package/packages/analytics/src/clients/TwentyFourIQ/interface.ts +0 -34
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdEvent.ts +0 -20
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBase.ts +0 -24
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBuffering.ts +0 -15
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerClose.ts +0 -25
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerOpen.ts +0 -17
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapSceneView.ts +0 -15
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapScroll.ts +0 -17
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoComplete.ts +0 -22
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoPause.ts +0 -25
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoProgress.ts +0 -25
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStart.ts +0 -34
- package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStop.ts +0 -32
- package/packages/analytics/src/clients/TwentyFourIQ/types.ts +0 -132
- package/packages/analytics/src/constants.ts +0 -1
- package/packages/analytics/src/index.ts +0 -3
- package/packages/analytics/src/interface.ts +0 -1
- package/packages/analytics/src/utils/generateSessionId.ts +0 -8
- package/packages/device/src/driver/index.firetv.ts +0 -1
- package/packages/device/src/driver/index.smartcast.tv.ts +0 -1
- package/packages/driver-base/src/types/AdInfo.ts +0 -5
- package/packages/driver-base/src/types/InAppPurchase.ts +0 -25
- package/packages/driver-firetv/src/DeviceFireTV.ts +0 -91
- package/packages/driver-firetv/src/__mocks__/javaScriptBridge.ts +0 -45
- package/packages/driver-firetv/src/index.ts +0 -1
- package/packages/driver-firetv/src/types.ts +0 -1
- package/packages/driver-smartcast/src/DeviceSmartCast.ts +0 -394
- package/packages/driver-smartcast/src/__mocks__/api.ts +0 -79
- package/packages/driver-smartcast/src/index.ts +0 -1
- package/packages/driver-smartcast/src/keymap.ts +0 -9
- package/packages/driver-smartcast/src/types.ts +0 -111
- package/packages/focus/src/hasFocus.ts +0 -36
- package/packages/jsx/src/test-utils/keyup.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/arabic.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/burmese.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/dari.ts +0 -28
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/korean.ts +0 -26
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/pashto.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/persian.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/russian.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/spanish.ts +0 -26
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/tibetan.ts +0 -26
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/turkish.ts +0 -26
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/ukrainian.ts +0 -27
- package/packages/keyboard/src/WhitelabelKeyboard/layouts/urdu.ts +0 -26
- package/packages/keyboard/src/utils/setInputSelectionRange.ts +0 -10
- package/packages/l10n/src/date/de.ts +0 -97
- package/packages/l10n/src/date/es.ts +0 -71
- package/packages/l10n/src/date/fr.ts +0 -94
- package/packages/l10n/src/date/he.ts +0 -101
- package/packages/time/src/adapters/24iMediaTimeApi.ts +0 -47
- package/packages/time/src/services/24iMediaTimeApi/24iMediaTimeApi.ts +0 -43
- package/packages/time/src/services/24iMediaTimeApi/index.ts +0 -6
- package/packages/utils/src/forceReflow.ts +0 -14
- package/packages/utils/src/keyPress/index.ts +0 -6
- package/packages/utils/src/keyPress/keyPressSimulator.ts +0 -74
- package/packages/utils/src/keyPress/simulateKeyPress.ts +0 -25
- package/utils/release/release.ts +0 -156
|
@@ -63,9 +63,9 @@ export const formatTime = (duration: number, pattern: string) => {
|
|
|
63
63
|
const unitValues = calculateUnitValues(duration, units);
|
|
64
64
|
let result: string = pattern;
|
|
65
65
|
forEach(matches, (match) => {
|
|
66
|
-
const formatedValue = Number.isNaN(unitValues[match.unit])
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
const formatedValue = Number.isNaN(unitValues[match.unit]) ?
|
|
67
|
+
'--' :
|
|
68
|
+
unitValues[match.unit]!.toString().padStart(match.count, '0');
|
|
69
69
|
result = result.replace(
|
|
70
70
|
match.completeMatch,
|
|
71
71
|
formatedValue,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlayerBase } from '@24i/
|
|
1
|
+
import { PlayerBase } from '@24i/player-base';
|
|
2
2
|
import { Seeking } from './Seeking';
|
|
3
3
|
|
|
4
4
|
export enum PlayerAction {
|
|
@@ -20,12 +20,8 @@ export interface ActionsWithPayloadMap {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export interface IPlayerUI {
|
|
23
|
-
seeking
|
|
24
|
-
getPlayer: () => PlayerBase
|
|
25
|
-
disableHiding: () => void,
|
|
26
|
-
enableHiding: () => void,
|
|
27
|
-
disableSeeking: () => void,
|
|
28
|
-
enableSeeking: () => void,
|
|
23
|
+
seeking: Seeking;
|
|
24
|
+
getPlayer: () => PlayerBase<any>,
|
|
29
25
|
heartbeat: () => void,
|
|
30
26
|
trigger<K extends keyof ActionsWithoutPayloadMap>(action: K): void,
|
|
31
27
|
trigger<K extends keyof ActionsWithPayloadMap>(
|
|
@@ -34,8 +30,6 @@ export interface IPlayerUI {
|
|
|
34
30
|
isPlaying: () => boolean,
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
export type IPlayerUIWithSeeking = Required<IPlayerUI>;
|
|
38
|
-
|
|
39
33
|
export type PlayerUICommonProps = {
|
|
40
34
|
ui: IPlayerUI,
|
|
41
35
|
className?: string,
|
|
@@ -16,7 +16,6 @@ It will take care of route switching based on hash changes. It also supports par
|
|
|
16
16
|
- `children` - Routes
|
|
17
17
|
- `defaultPath` - optional path to which go after Router is mounted (default: `/`)
|
|
18
18
|
- `detachInactiveRoutes` - optional flag if routes should detach from DOM entirely during route switching (default: `true`)
|
|
19
|
-
- `canBack` - optional function whether the router can route back
|
|
20
19
|
|
|
21
20
|
### Interface
|
|
22
21
|
- `getActiveRoute()`*: Route | null* - Returns active route component
|
|
@@ -3,38 +3,36 @@ import {
|
|
|
3
3
|
Component,
|
|
4
4
|
createRef,
|
|
5
5
|
detachNode,
|
|
6
|
-
Reference,
|
|
7
6
|
replaceNode,
|
|
8
7
|
} from '@24i/bigscreen-sdk/jsx';
|
|
9
8
|
import { filter, forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
10
|
-
import { addClass, removeClass } from '@24i/bigscreen-sdk/utils';
|
|
11
|
-
import { ModalService } from '@24i/bigscreen-sdk/modal-service';
|
|
12
|
-
import { menuService } from '@24i/bigscreen-sdk/menu';
|
|
13
9
|
import { getCurrentHash } from './utils';
|
|
14
10
|
import { IRoute, RouteParams } from './types';
|
|
15
11
|
|
|
16
12
|
type Props = {
|
|
17
13
|
path: string,
|
|
18
|
-
domParent?: Reference<HTMLElement>;
|
|
19
14
|
regexpPath?: RegExp,
|
|
20
15
|
paramNames?: string[],
|
|
16
|
+
isDetachable?: boolean;
|
|
21
17
|
Component: Function,
|
|
22
18
|
};
|
|
23
19
|
|
|
24
|
-
const MRCU_DISABLED = 'mrcu-disabled';
|
|
25
|
-
|
|
26
20
|
export class Route extends Component<Props> {
|
|
27
21
|
wasCreated = false;
|
|
28
22
|
|
|
29
23
|
isDetached = false;
|
|
30
24
|
|
|
25
|
+
domParent: HTMLElement | null = null;
|
|
26
|
+
|
|
31
27
|
domRef = createRef<HTMLDivElement>();
|
|
32
28
|
|
|
33
29
|
component = createRef<IRoute | null>();
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
componentDidMount() {
|
|
32
|
+
const { isDetachable } = this.props;
|
|
33
|
+
this.domParent = this.domRef.current?.parentElement!;
|
|
34
|
+
if (isDetachable) this.detach();
|
|
35
|
+
}
|
|
38
36
|
|
|
39
37
|
getParams(): RouteParams {
|
|
40
38
|
const { regexpPath, paramNames } = this.props;
|
|
@@ -51,50 +49,21 @@ export class Route extends Component<Props> {
|
|
|
51
49
|
return {};
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
onMenuVisibilityChange = (isVisible: boolean) => {
|
|
55
|
-
if (isVisible) {
|
|
56
|
-
addClass(this.domRef, MRCU_DISABLED);
|
|
57
|
-
} else {
|
|
58
|
-
removeClass(this.domRef, MRCU_DISABLED);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
onCloseModalService = () => {
|
|
63
|
-
if (this.shouldCallReactivateOnCloseModal) {
|
|
64
|
-
this.component.current?.reactivate(this.getParams());
|
|
65
|
-
}
|
|
66
|
-
this.shouldCallReactivateOnCloseModal = false;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
getModalService() {
|
|
70
|
-
if (!this.modalService.current) {
|
|
71
|
-
this.appendMount(
|
|
72
|
-
<ModalService
|
|
73
|
-
ref={this.modalService}
|
|
74
|
-
onCloseLastModal={this.onCloseModalService}
|
|
75
|
-
/>,
|
|
76
|
-
this.domRef,
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
return this.modalService;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
52
|
show() {
|
|
83
|
-
|
|
53
|
+
this.showRoute();
|
|
84
54
|
if (!this.wasCreated) {
|
|
85
55
|
this.mountRoute();
|
|
86
56
|
this.component.current?.activate(this.getParams());
|
|
87
|
-
} else if (this.modalService.current?.isOpen()) {
|
|
88
|
-
this.focusModal();
|
|
89
|
-
this.shouldCallReactivateOnCloseModal = true;
|
|
90
57
|
} else {
|
|
91
58
|
this.component.current?.reactivate(this.getParams());
|
|
92
59
|
}
|
|
93
60
|
}
|
|
94
61
|
|
|
95
62
|
hide() {
|
|
96
|
-
|
|
97
|
-
|
|
63
|
+
if (this.wasCreated) {
|
|
64
|
+
this.component.current?.deactivate();
|
|
65
|
+
this.hideRoute();
|
|
66
|
+
}
|
|
98
67
|
}
|
|
99
68
|
|
|
100
69
|
replace(newRoute: Route) {
|
|
@@ -106,9 +75,8 @@ export class Route extends Component<Props> {
|
|
|
106
75
|
}
|
|
107
76
|
|
|
108
77
|
attach() {
|
|
109
|
-
const { domParent } = this.props;
|
|
110
78
|
if (this.isDetached) {
|
|
111
|
-
attachNode(this.domRef, domParent!);
|
|
79
|
+
attachNode(this.domRef, this.domParent!);
|
|
112
80
|
this.isDetached = false;
|
|
113
81
|
}
|
|
114
82
|
}
|
|
@@ -126,27 +94,20 @@ export class Route extends Component<Props> {
|
|
|
126
94
|
}
|
|
127
95
|
}
|
|
128
96
|
|
|
129
|
-
private focusModal() {
|
|
130
|
-
const mountedComponent = this.modalService.current!.getMountedComponent();
|
|
131
|
-
mountedComponent.current?.focus();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
97
|
focus() {
|
|
135
98
|
if (this.wasCreated) {
|
|
136
|
-
|
|
137
|
-
this.focusModal();
|
|
138
|
-
} else {
|
|
139
|
-
this.component.current?.focus();
|
|
140
|
-
}
|
|
99
|
+
this.component.current?.focus();
|
|
141
100
|
}
|
|
142
101
|
}
|
|
143
102
|
|
|
144
|
-
showRoute() {
|
|
145
|
-
|
|
103
|
+
private showRoute() {
|
|
104
|
+
const { isDetachable } = this.props;
|
|
105
|
+
if (!isDetachable) this.domRef.current!.style.display = 'block';
|
|
146
106
|
}
|
|
147
107
|
|
|
148
|
-
hideRoute() {
|
|
149
|
-
|
|
108
|
+
private hideRoute() {
|
|
109
|
+
const { isDetachable } = this.props;
|
|
110
|
+
if (!isDetachable) this.domRef.current!.style.display = 'none';
|
|
150
111
|
}
|
|
151
112
|
|
|
152
113
|
private mountRoute() {
|
|
@@ -159,8 +120,13 @@ export class Route extends Component<Props> {
|
|
|
159
120
|
}
|
|
160
121
|
|
|
161
122
|
render() {
|
|
123
|
+
const { isDetachable } = this.props;
|
|
162
124
|
return (
|
|
163
|
-
<div
|
|
125
|
+
<div
|
|
126
|
+
className="route"
|
|
127
|
+
style={!isDetachable ? { display: 'none' } : {}}
|
|
128
|
+
ref={this.domRef}
|
|
129
|
+
/>
|
|
164
130
|
);
|
|
165
131
|
}
|
|
166
132
|
}
|
|
@@ -10,7 +10,6 @@ type Props = {
|
|
|
10
10
|
children: JSX.Element[],
|
|
11
11
|
defaultPath?: string,
|
|
12
12
|
detachInactiveRoutes?: boolean,
|
|
13
|
-
canBack?: (event: KeyboardEvent) => boolean,
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
type RoutePath = {
|
|
@@ -29,12 +28,9 @@ const filterNulls = (allChildren: (JSX.Element | null)[]) => (
|
|
|
29
28
|
export class Router extends Component<Props> {
|
|
30
29
|
paths: { [key: string]: RoutePath } = {};
|
|
31
30
|
|
|
32
|
-
routerDomRef = createRef<HTMLDivElement>();
|
|
33
|
-
|
|
34
31
|
static defaultProps = {
|
|
35
32
|
defaultPath: '/',
|
|
36
33
|
detachInactiveRoutes: true,
|
|
37
|
-
canBack: () => true,
|
|
38
34
|
};
|
|
39
35
|
|
|
40
36
|
declare props: DeclareProps<Props, typeof Router.defaultProps>;
|
|
@@ -42,14 +38,12 @@ export class Router extends Component<Props> {
|
|
|
42
38
|
constructor(props: Props) {
|
|
43
39
|
super(props);
|
|
44
40
|
routerRef.current = this;
|
|
45
|
-
|
|
46
|
-
this.createRefs(children);
|
|
41
|
+
this.createRefs();
|
|
47
42
|
}
|
|
48
43
|
|
|
49
44
|
componentDidMount() {
|
|
50
45
|
window.document.addEventListener('keydown', this.onKeyDown, false);
|
|
51
46
|
window.addEventListener('hashchange', this.onHashChange, false);
|
|
52
|
-
this.hideAllRoutes();
|
|
53
47
|
this.goToDefaultPath();
|
|
54
48
|
}
|
|
55
49
|
|
|
@@ -63,8 +57,7 @@ export class Router extends Component<Props> {
|
|
|
63
57
|
};
|
|
64
58
|
|
|
65
59
|
onKeyDown = (event: KeyboardEvent) => {
|
|
66
|
-
|
|
67
|
-
if (history.length > 1 && device.isBackOrEscape(event) && canBack(event)) {
|
|
60
|
+
if (history.length > 1 && device.isBackOrEscape(event)) {
|
|
68
61
|
back();
|
|
69
62
|
stopEventImmediately(event);
|
|
70
63
|
}
|
|
@@ -98,8 +91,6 @@ export class Router extends Component<Props> {
|
|
|
98
91
|
return activeRoutePath?.ref.current || null;
|
|
99
92
|
}
|
|
100
93
|
|
|
101
|
-
// TODO: refactor to reduce complexity
|
|
102
|
-
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
103
94
|
switchRoutes(
|
|
104
95
|
routePathToHide: RoutePath | null,
|
|
105
96
|
routePathToShow: RoutePath | null,
|
|
@@ -113,31 +104,18 @@ export class Router extends Component<Props> {
|
|
|
113
104
|
} else if (routePathToShow) {
|
|
114
105
|
routeToHide!.hide();
|
|
115
106
|
routePathToHide.isVisible = false;
|
|
116
|
-
if (detachInactiveRoutes)
|
|
117
|
-
routeToHide!.replace(routeToShow!);
|
|
118
|
-
} else {
|
|
119
|
-
routeToHide!.hideRoute();
|
|
120
|
-
routeToShow!.showRoute();
|
|
121
|
-
}
|
|
107
|
+
if (detachInactiveRoutes) routeToHide!.replace(routeToShow!);
|
|
122
108
|
routeToShow!.show();
|
|
123
109
|
routePathToShow.isVisible = true;
|
|
124
110
|
return;
|
|
125
111
|
} else {
|
|
126
112
|
routeToHide!.hide();
|
|
127
113
|
routePathToHide.isVisible = false;
|
|
128
|
-
if (detachInactiveRoutes)
|
|
129
|
-
routeToHide!.detach();
|
|
130
|
-
} else {
|
|
131
|
-
routeToHide!.hideRoute();
|
|
132
|
-
}
|
|
114
|
+
if (detachInactiveRoutes) routeToHide!.detach();
|
|
133
115
|
}
|
|
134
116
|
}
|
|
135
117
|
if (routePathToShow) {
|
|
136
|
-
if (detachInactiveRoutes)
|
|
137
|
-
routeToShow!.attach();
|
|
138
|
-
} else {
|
|
139
|
-
routeToShow!.showRoute();
|
|
140
|
-
}
|
|
118
|
+
if (detachInactiveRoutes) routeToShow!.attach();
|
|
141
119
|
routeToShow!.show();
|
|
142
120
|
routePathToShow.isVisible = true;
|
|
143
121
|
}
|
|
@@ -147,10 +125,11 @@ export class Router extends Component<Props> {
|
|
|
147
125
|
this.getActiveRoute()?.focus();
|
|
148
126
|
}
|
|
149
127
|
|
|
150
|
-
createRefs(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
128
|
+
createRefs() {
|
|
129
|
+
const { children } = this.props;
|
|
130
|
+
forEach(children, (child: JSX.Element) => {
|
|
131
|
+
if (child.type === Route) {
|
|
132
|
+
const { path } = child.props;
|
|
154
133
|
const { regexpPath, paramNames } = pathToRegExp(path);
|
|
155
134
|
this.paths[path] = {
|
|
156
135
|
ref: createRef<Route>(),
|
|
@@ -172,28 +151,9 @@ export class Router extends Component<Props> {
|
|
|
172
151
|
}
|
|
173
152
|
}
|
|
174
153
|
|
|
175
|
-
|
|
176
|
-
const { detachInactiveRoutes } = this.props;
|
|
177
|
-
|
|
178
|
-
const route = this.paths[key];
|
|
179
|
-
if (!route.isVisible) {
|
|
180
|
-
if (detachInactiveRoutes) {
|
|
181
|
-
route.ref.current!.detach();
|
|
182
|
-
} else {
|
|
183
|
-
route.ref.current!.hideRoute();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
appendRoutes(routes: JSX.Element[]) {
|
|
190
|
-
this.createRefs(routes);
|
|
191
|
-
this.appendMount(this.renderRoutes(routes), this.routerDomRef);
|
|
192
|
-
this.hideAllRoutes();
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
renderRoutes(routes: JSX.Element[]) {
|
|
196
|
-
return filterNulls(map(routes, (child: JSX.Element) => {
|
|
154
|
+
render() {
|
|
155
|
+
const { children, detachInactiveRoutes } = this.props;
|
|
156
|
+
return filterNulls(map(children, (child: JSX.Element) => {
|
|
197
157
|
if (child.type === Route) {
|
|
198
158
|
const { path, Component: RouteComponent } = child.props;
|
|
199
159
|
const route = this.paths[path];
|
|
@@ -201,23 +161,14 @@ export class Router extends Component<Props> {
|
|
|
201
161
|
<Route
|
|
202
162
|
ref={route.ref}
|
|
203
163
|
path={path}
|
|
204
|
-
domParent={this.routerDomRef}
|
|
205
164
|
regexpPath={route.regexpPath}
|
|
206
165
|
Component={RouteComponent}
|
|
207
166
|
paramNames={route.paramNames}
|
|
167
|
+
isDetachable={detachInactiveRoutes}
|
|
208
168
|
/>
|
|
209
169
|
);
|
|
210
170
|
}
|
|
211
171
|
return null;
|
|
212
172
|
}));
|
|
213
173
|
}
|
|
214
|
-
|
|
215
|
-
render() {
|
|
216
|
-
const { children } = this.props;
|
|
217
|
-
return (
|
|
218
|
-
<div ref={this.routerDomRef} className="router">
|
|
219
|
-
{this.renderRoutes(children)}
|
|
220
|
-
</div>
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
174
|
}
|
|
@@ -2,10 +2,8 @@ import { NavigationConfig } from './types';
|
|
|
2
2
|
|
|
3
3
|
export const history: string[] = [];
|
|
4
4
|
|
|
5
|
-
const pathWithHash = (path:string) => `#${path}`;
|
|
6
|
-
|
|
7
5
|
const navigate = (path: string) => {
|
|
8
|
-
window.location.href =
|
|
6
|
+
window.location.href = `#${path}`;
|
|
9
7
|
};
|
|
10
8
|
|
|
11
9
|
export const go = (path: string, { skipHistory, replaceHistory }: NavigationConfig = {}) => {
|
|
@@ -24,8 +22,3 @@ export const back = () => {
|
|
|
24
22
|
export const clearHistory = () => {
|
|
25
23
|
history.length = 0;
|
|
26
24
|
};
|
|
27
|
-
|
|
28
|
-
export const replaceState = (path: string) => {
|
|
29
|
-
history[history.length - 1] = path;
|
|
30
|
-
window.history.replaceState(null, '', pathWithHash(path));
|
|
31
|
-
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Router } from './Router';
|
|
2
2
|
export { Route } from './Route';
|
|
3
3
|
export type { IRoute } from './types';
|
|
4
|
-
export { history, go, back, clearHistory
|
|
4
|
+
export { history, go, back, clearHistory } from './history';
|
|
5
5
|
export { focusActiveRoute } from './focusActiveRoute';
|
|
6
6
|
export { fromSafeUrl, toSafeUrl } from './utils';
|
|
@@ -6,16 +6,14 @@ export const isPathVisible = (hash: string, regexpPath?: RegExp) => (
|
|
|
6
6
|
|
|
7
7
|
export const getCurrentHash = () => window.location.href.split('#')[1] || '';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
const PARAM_REGEX = /([^/]+)/;
|
|
11
|
-
export const PARAM_REGEX_STR = PARAM_REGEX.source;
|
|
9
|
+
const PARAM = '([a-zA-Z0-9-=.:%_()\\[\\]{}]+)';
|
|
12
10
|
|
|
13
11
|
export const pathToRegExp = (path: string) => {
|
|
14
12
|
const regexpParts: string[] = [];
|
|
15
13
|
const paramNames: string[] = [];
|
|
16
14
|
forEach(path.split('/'), (pathPart) => {
|
|
17
15
|
if (pathPart.indexOf(':') === 0) {
|
|
18
|
-
regexpParts.push(
|
|
16
|
+
regexpParts.push(PARAM);
|
|
19
17
|
paramNames.push(pathPart.replace(':', ''));
|
|
20
18
|
} else regexpParts.push(pathPart);
|
|
21
19
|
});
|
|
@@ -25,13 +23,10 @@ export const pathToRegExp = (path: string) => {
|
|
|
25
23
|
};
|
|
26
24
|
};
|
|
27
25
|
|
|
28
|
-
const toUrlSafeBase64 = (param: string) => btoa(param).replace('/', '_');
|
|
29
|
-
const fromUrlSafeBase64 = (base64: string) => atob(base64.replace('_', '/'));
|
|
30
|
-
|
|
31
26
|
export const toSafeUrl = (param: string) => (
|
|
32
|
-
|
|
27
|
+
btoa(unescape(encodeURIComponent(param)))
|
|
33
28
|
);
|
|
34
29
|
|
|
35
30
|
export const fromSafeUrl = (base64: string) => (
|
|
36
|
-
decodeURIComponent(escape(
|
|
31
|
+
decodeURIComponent(escape(atob(base64)))
|
|
37
32
|
);
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
@use 'sass:list';
|
|
2
|
-
@use 'sass:math';
|
|
3
|
-
@use 'sass:meta';
|
|
4
|
-
@use 'sass:map';
|
|
5
|
-
|
|
6
1
|
@function legacy-direction($value) {
|
|
7
2
|
@if is-direction($value) == false {
|
|
8
3
|
@error "Cannot convert `#{$value}` to legacy syntax because it doesn't seem to be a direction.";
|
|
@@ -21,18 +16,18 @@
|
|
|
21
16
|
to left top : right bottom,
|
|
22
17
|
to top left : bottom right
|
|
23
18
|
);
|
|
24
|
-
@if map
|
|
25
|
-
@return map
|
|
19
|
+
@if map-has-key($conversion-map, $value) {
|
|
20
|
+
@return map-get($conversion-map, $value);
|
|
26
21
|
}
|
|
27
22
|
@return 90deg - $value;
|
|
28
23
|
}
|
|
29
24
|
|
|
30
25
|
@function is-direction($value) {
|
|
31
|
-
$is-keyword:
|
|
26
|
+
$is-keyword: index((
|
|
32
27
|
to top, to top right, to right top, to right, to bottom right, to right bottom,
|
|
33
28
|
to bottom, to bottom left, to left bottom, to left, to left top, to top left,
|
|
34
29
|
), $value);
|
|
35
|
-
$is-angle:
|
|
30
|
+
$is-angle: type-of($value) == 'number' and index('deg' 'grad' 'turn' 'rad', unit($value));
|
|
36
31
|
|
|
37
32
|
@return $is-keyword or $is-angle;
|
|
38
33
|
}
|
package/packages/time/README.md
CHANGED
|
@@ -52,7 +52,7 @@ await time.init({
|
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
### `getCurrentTime(): Date`
|
|
55
|
-
It returns date object having
|
|
55
|
+
It returns date object having local time set to server current time.
|
|
56
56
|
|
|
57
57
|
### `getCurrentUnixTime(): number`
|
|
58
58
|
It returns UNIX time in milliseconds of server UTC time.
|
|
@@ -60,9 +60,6 @@ It returns UNIX time in milliseconds of server UTC time.
|
|
|
60
60
|
### `getTimezoneOffset(): number`
|
|
61
61
|
It returns timezone offset in minutes, for UTC+1 (Germany) is 60.
|
|
62
62
|
|
|
63
|
-
### `getTimezoneOffsetMs(): number`
|
|
64
|
-
It returns timezone offset in milliseconds, for UTC+1 (Germany) is 3600000.
|
|
65
|
-
|
|
66
63
|
### `initStatus: InitStatus`
|
|
67
64
|
To check what time you are using, just check the `initStatus` property.
|
|
68
65
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createInterval } from '@24i/bigscreen-sdk/utils/timers';
|
|
2
2
|
import { parseIsoDate, getDayStart, getDayEnd } from './utils';
|
|
3
|
-
import { InitStatus, ErrorCode
|
|
3
|
+
import { InitStatus, ErrorCode } from './constants';
|
|
4
4
|
import { Config, TimeServiceResp } from './types';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -22,9 +22,6 @@ class Time {
|
|
|
22
22
|
/** The difference in milliseconds between System Date and Server Date */
|
|
23
23
|
offsetMs = 0;
|
|
24
24
|
|
|
25
|
-
/** The difference Date object internally adds to timestamp if not asking for UTC time. */
|
|
26
|
-
deviceOffset = new Date().getTimezoneOffset() * MS_PER_MINUTE;
|
|
27
|
-
|
|
28
25
|
/** Timer for periodical time update */
|
|
29
26
|
syncInterval = createInterval();
|
|
30
27
|
|
|
@@ -116,7 +113,7 @@ class Time {
|
|
|
116
113
|
this.currentTime = currentTime;
|
|
117
114
|
this.serverTime = date;
|
|
118
115
|
this.serverUnixTime = unixTime;
|
|
119
|
-
this.offsetMs = this.currentTime.getTime() - this.serverTime.getTime()
|
|
116
|
+
this.offsetMs = this.currentTime.getTime() - this.serverTime.getTime();
|
|
120
117
|
this.timezoneOffset = timezoneOffset;
|
|
121
118
|
}
|
|
122
119
|
|
|
@@ -171,15 +168,6 @@ class Time {
|
|
|
171
168
|
return this.timezoneOffset;
|
|
172
169
|
}
|
|
173
170
|
|
|
174
|
-
/**
|
|
175
|
-
* Returns the timezone offset in milliseconds.
|
|
176
|
-
*
|
|
177
|
-
* @returns Timezone offset in milliseconds, e.g. for UTC+1 (Germany) is 3600000.
|
|
178
|
-
*/
|
|
179
|
-
getTimezoneOffsetMs() {
|
|
180
|
-
return this.timezoneOffset * MS_PER_MINUTE;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
171
|
/**
|
|
184
172
|
* Returns offset (milliseconds) between System and Server Date object.
|
|
185
173
|
*
|
|
@@ -204,34 +192,24 @@ class Time {
|
|
|
204
192
|
}
|
|
205
193
|
|
|
206
194
|
/**
|
|
207
|
-
* Returns time
|
|
195
|
+
* Returns current time.
|
|
208
196
|
*
|
|
209
|
-
* @returns Current time
|
|
197
|
+
* @returns Current time.
|
|
210
198
|
*/
|
|
211
199
|
getCurrentTime() {
|
|
212
200
|
const now = new Date().getTime();
|
|
213
201
|
return new Date(now - this.offsetMs);
|
|
214
202
|
}
|
|
215
203
|
|
|
216
|
-
/**
|
|
217
|
-
* Returns current time.
|
|
218
|
-
*
|
|
219
|
-
* @returns Current time.
|
|
220
|
-
*/
|
|
221
|
-
getCurrentTimeReal() {
|
|
222
|
-
const nowShifted = this.getCurrentTime().getTime();
|
|
223
|
-
return new Date(nowShifted + this.deviceOffset);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
204
|
/**
|
|
227
205
|
* Returns whether the timestamp belongs to today
|
|
228
206
|
* @param timestamp to check
|
|
229
207
|
* @returns true if the timestamp falls between start and end of today
|
|
230
208
|
*/
|
|
231
209
|
isToday(timestamp: number) {
|
|
232
|
-
const
|
|
233
|
-
const startOfToday = getDayStart(
|
|
234
|
-
const endOfToday = getDayEnd(
|
|
210
|
+
const currentTime = this.getCurrentTime();
|
|
211
|
+
const startOfToday = getDayStart(currentTime);
|
|
212
|
+
const endOfToday = getDayEnd(currentTime);
|
|
235
213
|
return startOfToday <= timestamp && timestamp < endOfToday;
|
|
236
214
|
}
|
|
237
215
|
|
|
@@ -241,10 +219,10 @@ class Time {
|
|
|
241
219
|
* @returns true if the timestamp falls between start and end of tomorrow
|
|
242
220
|
*/
|
|
243
221
|
isTomorrow(timestamp: number) {
|
|
244
|
-
const
|
|
245
|
-
const startOfTomorrow = getDayEnd(
|
|
222
|
+
const currentTime = this.getCurrentTime();
|
|
223
|
+
const startOfTomorrow = getDayEnd(currentTime);
|
|
246
224
|
const tommorow = new Date(startOfTomorrow + 1);
|
|
247
|
-
const endOfTomorrow = getDayEnd(tommorow)
|
|
225
|
+
const endOfTomorrow = getDayEnd(tommorow);
|
|
248
226
|
return startOfTomorrow <= timestamp && timestamp < endOfTomorrow;
|
|
249
227
|
}
|
|
250
228
|
|
|
@@ -254,10 +232,10 @@ class Time {
|
|
|
254
232
|
* @returns true if the timestamp falls between start and end of yesterday
|
|
255
233
|
*/
|
|
256
234
|
isYesterday(timestamp: number) {
|
|
257
|
-
const
|
|
258
|
-
const endOfYesterday = getDayStart(
|
|
235
|
+
const currentTime = this.getCurrentTime();
|
|
236
|
+
const endOfYesterday = getDayStart(currentTime);
|
|
259
237
|
const yesterday = new Date(endOfYesterday - 1);
|
|
260
|
-
const startOfYesterday = getDayStart(yesterday)
|
|
238
|
+
const startOfYesterday = getDayStart(yesterday);
|
|
261
239
|
return startOfYesterday <= timestamp && timestamp < endOfYesterday;
|
|
262
240
|
}
|
|
263
241
|
}
|
|
@@ -34,22 +34,11 @@ export class ToastService<T extends MinimalToastProps> extends Component<Props<T
|
|
|
34
34
|
this.serviceContinue();
|
|
35
35
|
},
|
|
36
36
|
} as T);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return message === newMessage;
|
|
44
|
-
}) !== undefined;
|
|
45
|
-
|
|
46
|
-
if (!elementExists) {
|
|
47
|
-
if (!this.isShowingToast) {
|
|
48
|
-
this.appendMount(toastElement, this.rootDivRef);
|
|
49
|
-
this.isShowingToast = true;
|
|
50
|
-
} else {
|
|
51
|
-
this.toastElementBuffer.push(toastElement);
|
|
52
|
-
}
|
|
37
|
+
if (!this.isShowingToast) {
|
|
38
|
+
this.appendMount(toastElement, this.rootDivRef);
|
|
39
|
+
this.isShowingToast = true;
|
|
40
|
+
} else {
|
|
41
|
+
this.toastElementBuffer.push(toastElement);
|
|
53
42
|
}
|
|
54
43
|
}
|
|
55
44
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# BIGscreen JSX Types
|
|
2
2
|
BIGscreen JSX is a set of tools that allow you to write JSX and converts it to JS Dom API.
|
|
3
|
-
This package contains types originally from @types/react, modified for bigscreen-jsx needs.
|
|
3
|
+
This package contains types originally from @types/react, modified for smartapps-bigscreen-jsx needs.
|
|
4
4
|
|
|
5
5
|
# Contributing
|
|
6
|
-
Navigate to `<root>/node_modules/@types/react/`.
|
|
7
|
-
All react types are inside files `index.d.ts` and `global.d.ts`. Modify them to suit your needs and afterwards run this
|
|
6
|
+
Navigate to `<root>/packages/types-smartapps-bigscreen-jsx/node_modules/@types/react/`.
|
|
7
|
+
All react types are inside files `index.d.ts` and `global.d.ts`. Modify them to suit your needs and afterwards run this command in the `packages/types-smartapps-bigscreen-jsx/` directory:
|
|
8
8
|
|
|
9
9
|
`npx patch-package @types/react`
|
|
10
|
-
`npm install`
|
|
11
10
|
|
|
12
|
-
You can confirm everything worked by looking into
|
|
11
|
+
You can confirm everything worked by looking into `packages/types-smartapps-bigscreen-jsx/patches/`. You should see a file named `@types+react+<version-etc>.patch` that includes diff of your changes.
|