2025-01-15 22:16:27 +03:00
|
|
|
'use client';
|
|
|
|
|
2025-02-20 14:45:52 +03:00
|
|
|
import React, { Suspense } from 'react';
|
2025-02-12 21:36:25 +03:00
|
|
|
|
2025-02-10 01:32:55 +03:00
|
|
|
import { Tooltip } from '@/components/Container';
|
|
|
|
import { Loader } from '@/components/Loader';
|
2025-01-15 22:16:27 +03:00
|
|
|
import { useTooltipsStore } from '@/stores/tooltips';
|
2025-02-20 18:10:53 +03:00
|
|
|
import { globalIDs } from '@/utils/constants';
|
2025-01-15 22:16:27 +03:00
|
|
|
|
2025-02-20 14:45:52 +03:00
|
|
|
const InfoConstituenta = React.lazy(() =>
|
|
|
|
import('@/features/rsform/components/InfoConstituenta').then(module => ({ default: module.InfoConstituenta }))
|
|
|
|
);
|
|
|
|
|
|
|
|
const InfoOperation = React.lazy(() =>
|
|
|
|
import('@/features/oss/components/InfoOperation').then(module => ({ default: module.InfoOperation }))
|
|
|
|
);
|
|
|
|
|
2025-01-15 22:16:27 +03:00
|
|
|
export const GlobalTooltips = () => {
|
|
|
|
const hoverCst = useTooltipsStore(state => state.activeCst);
|
2025-02-20 14:45:52 +03:00
|
|
|
const hoverOperation = useTooltipsStore(state => state.activeOperation);
|
2025-01-15 22:16:27 +03:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Tooltip
|
|
|
|
float
|
2025-02-20 18:10:53 +03:00
|
|
|
id={globalIDs.tooltip}
|
2025-01-15 22:16:27 +03:00
|
|
|
layer='z-topmost'
|
|
|
|
place='right-start'
|
|
|
|
className='mt-8 max-w-[20rem] break-words'
|
|
|
|
/>
|
|
|
|
<Tooltip
|
|
|
|
float
|
2025-02-20 18:10:53 +03:00
|
|
|
id={globalIDs.value_tooltip}
|
2025-01-15 22:16:27 +03:00
|
|
|
layer='z-topmost'
|
|
|
|
className='max-w-[calc(min(40rem,100dvw-2rem))] text-justify'
|
|
|
|
/>
|
2025-02-20 14:45:52 +03:00
|
|
|
<Tooltip
|
|
|
|
clickable
|
2025-02-20 18:10:53 +03:00
|
|
|
id={globalIDs.constituenta_tooltip}
|
2025-02-20 14:45:52 +03:00
|
|
|
layer='z-modalTooltip'
|
|
|
|
className='max-w-[30rem]'
|
|
|
|
hidden={!hoverCst}
|
|
|
|
>
|
|
|
|
<Suspense fallback={<Loader />}>
|
|
|
|
{hoverCst ? <InfoConstituenta data={hoverCst} onClick={event => event.stopPropagation()} /> : null}
|
|
|
|
</Suspense>
|
|
|
|
</Tooltip>
|
|
|
|
<Tooltip
|
2025-02-20 18:10:53 +03:00
|
|
|
id={globalIDs.operation_tooltip}
|
2025-02-20 14:45:52 +03:00
|
|
|
layer='z-modalTooltip'
|
|
|
|
className='max-w-[35rem] max-h-[40rem] dense'
|
|
|
|
hidden={!hoverOperation}
|
|
|
|
>
|
|
|
|
<Suspense fallback={<Loader />}>
|
|
|
|
{hoverOperation ? <InfoOperation operation={hoverOperation} /> : null}
|
|
|
|
</Suspense>
|
2025-01-15 22:16:27 +03:00
|
|
|
</Tooltip>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|