From eabb0e8470098f791a01b8775a6428f940c3504f Mon Sep 17 00:00:00 2001 From: DanSylvest Date: Sun, 13 Jul 2025 15:20:33 +0300 Subject: [PATCH] fix(Map): Trying to fix problem with fast forwarding after page are inactive some time. --- .../MapSettings/components/ImportExport.tsx | 3 - .../components/RightBar/DebugComponent.tsx | 49 ++++++++ .../components/RightBar/RightBar.tsx | 4 + .../hooks/Mapper/helpers/getFormattedTime.ts | 11 ++ .../hooks/Mapper/hooks/usePageVisibility.ts | 5 +- assets/js/hooks/Mapper/useMapperHandlers.ts | 106 +++++++++++++++++- 6 files changed, 167 insertions(+), 11 deletions(-) create mode 100644 assets/js/hooks/Mapper/components/mapRootContent/components/RightBar/DebugComponent.tsx create mode 100644 assets/js/hooks/Mapper/helpers/getFormattedTime.ts diff --git a/assets/js/hooks/Mapper/components/mapRootContent/components/MapSettings/components/ImportExport.tsx b/assets/js/hooks/Mapper/components/mapRootContent/components/MapSettings/components/ImportExport.tsx index 97365821..1a472815 100644 --- a/assets/js/hooks/Mapper/components/mapRootContent/components/MapSettings/components/ImportExport.tsx +++ b/assets/js/hooks/Mapper/components/mapRootContent/components/MapSettings/components/ImportExport.tsx @@ -76,9 +76,6 @@ export const ImportExport = () => { detail: 'Settings already imported. Or something went wrong.', life: 3000, }); - - // eslint-disable-next-line no-console - console.log('JOipP', `text`, text); } catch (error) { console.error(`Import from file Error: `, error); diff --git a/assets/js/hooks/Mapper/components/mapRootContent/components/RightBar/DebugComponent.tsx b/assets/js/hooks/Mapper/components/mapRootContent/components/RightBar/DebugComponent.tsx new file mode 100644 index 00000000..3211c901 --- /dev/null +++ b/assets/js/hooks/Mapper/components/mapRootContent/components/RightBar/DebugComponent.tsx @@ -0,0 +1,49 @@ +import { TooltipPosition, WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit'; +import useLocalStorageState from 'use-local-storage-state'; +import { useMapRootState } from '@/hooks/Mapper/mapRootProvider'; + +export const DebugComponent = () => { + const { outCommand } = useMapRootState(); + + const [record, setRecord] = useLocalStorageState('record', { + defaultValue: false, + }); + + // @ts-ignore + const [recordsList] = useLocalStorageState<{ type; data }[]>('recordsList', { + defaultValue: [], + }); + + const handleRunSavedEvents = () => { + recordsList.forEach(record => outCommand(record)); + }; + + return ( + <> + + + + + + + + + ); +}; diff --git a/assets/js/hooks/Mapper/components/mapRootContent/components/RightBar/RightBar.tsx b/assets/js/hooks/Mapper/components/mapRootContent/components/RightBar/RightBar.tsx index 221fba0a..623ecce8 100644 --- a/assets/js/hooks/Mapper/components/mapRootContent/components/RightBar/RightBar.tsx +++ b/assets/js/hooks/Mapper/components/mapRootContent/components/RightBar/RightBar.tsx @@ -7,6 +7,7 @@ import { TooltipPosition } from '@/hooks/Mapper/components/ui-kit'; import { useMapCheckPermissions } from '@/hooks/Mapper/mapRootProvider/hooks/api'; import { UserPermission } from '@/hooks/Mapper/types/permissions.ts'; +// import { DebugComponent } from '@/hooks/Mapper/components/mapRootContent/components/RightBar/DebugComponent.tsx'; interface RightBarProps { onShowOnTheMap?: () => void; @@ -79,6 +80,9 @@ export const RightBar = ({
+ {/* TODO - do not delete this code needs for debug */} + {/**/} +