Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ interface EnableFullscreenButtonProps {
view?: ButtonView;
}

function EnableFullscreenButton({disabled, view = 'flat-secondary'}: EnableFullscreenButtonProps) {
export function EnableFullscreenButton({
disabled,
view = 'flat-secondary',
}: EnableFullscreenButtonProps) {
const dispatch = useTypedDispatch();
const onEnableFullscreen = () => {
dispatch(enableFullscreen());
Expand All @@ -25,5 +28,3 @@ function EnableFullscreenButton({disabled, view = 'flat-secondary'}: EnableFulls
</ActionTooltip>
);
}

export default EnableFullscreenButton;
6 changes: 4 additions & 2 deletions src/components/Fullscreen/Fullscreen.scss
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
.ydb-fullscreen {
--ydb-fullscreen-z-index: 1000;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed a bug with overlay - drawer is above fullscreen
Screenshot 2025-09-03 at 09 18 13


overflow: hidden;
flex-grow: 1;

&_fullscreen {
// should expand to fill the content area, keeping aside navigation visible
// counts on .gn-aside-header__content to have position: relative, it is set in App.scss
position: absolute;
z-index: 10;
z-index: var(--ydb-fullscreen-z-index);
inset: 0;

background-color: var(--g-color-base-background);
}

&__close-button {
position: fixed;
z-index: 11;
z-index: calc(var(--ydb-fullscreen-z-index) + 1);
top: 8px;
right: 20px;

Expand Down
15 changes: 8 additions & 7 deletions src/components/Fullscreen/Fullscreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ interface FullscreenProps {
className?: string;
}

const fullscreenRoot = document.getElementById('fullscreen-root') ?? undefined;

function Fullscreen({children, className}: FullscreenProps) {
export function Fullscreen({children, className}: FullscreenProps) {
const isFullscreen = useTypedSelector((state) => state.fullscreen);
const dispatch = useTypedDispatch();

const fullscreenRoot = React.useMemo(
Copy link
Collaborator

@astandrik astandrik Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use ref instead of low-level dom manipulations?
Cursor suggests two options for this

Image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added ref and context

() => document.getElementById('fullscreen-root') ?? undefined,
[],
);
Copy link
Member Author

@artemmufazalov artemmufazalov Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In dev mode root sometimes was not found - it's undefined, fullscreen doesn't work. Now it should always be present
Screenshot 2025-09-03 at 09 23 41


const onDisableFullScreen = React.useCallback(() => {
dispatch(disableFullscreen());
}, [dispatch]);
Expand Down Expand Up @@ -51,7 +54,7 @@ function Fullscreen({children, className}: FullscreenProps) {
setContainer(null);
div.remove();
};
}, []);
}, [fullscreenRoot]);

const ref = React.useRef<HTMLDivElement>(null);
React.useLayoutEffect(() => {
Expand All @@ -62,7 +65,7 @@ function Fullscreen({children, className}: FullscreenProps) {
ref.current?.appendChild(container);
}
}
}, [container, isFullscreen]);
}, [container, fullscreenRoot, isFullscreen]);

if (!container) {
return null;
Expand All @@ -85,5 +88,3 @@ function Fullscreen({children, className}: FullscreenProps) {
</div>
);
}

export default Fullscreen;
4 changes: 2 additions & 2 deletions src/containers/Tenant/Diagnostics/TopicData/TopicData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {isNil} from 'lodash';

import {DrawerWrapper} from '../../../../components/Drawer';
import {EmptyFilter} from '../../../../components/EmptyFilter/EmptyFilter';
import EnableFullscreenButton from '../../../../components/EnableFullscreenButton/EnableFullscreenButton';
import {EnableFullscreenButton} from '../../../../components/EnableFullscreenButton/EnableFullscreenButton';
import {PageError} from '../../../../components/Errors/PageError/PageError';
import Fullscreen from '../../../../components/Fullscreen/Fullscreen';
import {Fullscreen} from '../../../../components/Fullscreen/Fullscreen';
import {
DEFAULT_TABLE_ROW_HEIGHT,
ResizeablePaginatedTable,
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Tenant/Healthcheck/Healthcheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import {Flex, Icon} from '@gravity-ui/uikit';

import {ResponseError} from '../../../components/Errors/ResponseError';
import Fullscreen from '../../../components/Fullscreen/Fullscreen';
import {Fullscreen} from '../../../components/Fullscreen/Fullscreen';
import {HealthcheckStatus} from '../../../components/HealthcheckStatus/HealthcheckStatus';
import {Illustration} from '../../../components/Illustration';
import {Loader} from '../../../components/Loader';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React from 'react';
import {Xmark} from '@gravity-ui/icons';
import {Button, Flex, Icon, Text} from '@gravity-ui/uikit';

import EnableFullscreenButton from '../../../../../components/EnableFullscreenButton/EnableFullscreenButton';
import Fullscreen from '../../../../../components/Fullscreen/Fullscreen';
import {EnableFullscreenButton} from '../../../../../components/EnableFullscreenButton/EnableFullscreenButton';
import {Fullscreen} from '../../../../../components/Fullscreen/Fullscreen';
import {LoaderWrapper} from '../../../../../components/LoaderWrapper/LoaderWrapper';
import {setShowPreview} from '../../../../../store/reducers/schema/schema';
import {useTypedDispatch} from '../../../../../utils/hooks';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type {Settings} from '@gravity-ui/react-data-table';
import type {ControlGroupOption} from '@gravity-ui/uikit';
import {ClipboardButton, Flex, SegmentedRadioGroup, Text} from '@gravity-ui/uikit';

import EnableFullscreenButton from '../../../../components/EnableFullscreenButton/EnableFullscreenButton';
import Fullscreen from '../../../../components/Fullscreen/Fullscreen';
import {EnableFullscreenButton} from '../../../../components/EnableFullscreenButton/EnableFullscreenButton';
import {Fullscreen} from '../../../../components/Fullscreen/Fullscreen';
import {Illustration} from '../../../../components/Illustration';
import {LoaderWrapper} from '../../../../components/LoaderWrapper/LoaderWrapper';
import {QueryExecutionStatus} from '../../../../components/QueryExecutionStatus';
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Tenant/TenantDrawerHealthcheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {ArrowDownToLine} from '@gravity-ui/icons';
import {ActionTooltip, Button, Flex, Icon, Text} from '@gravity-ui/uikit';

import {DrawerWrapper} from '../../components/Drawer';
import EnableFullscreenButton from '../../components/EnableFullscreenButton/EnableFullscreenButton';
import {EnableFullscreenButton} from '../../components/EnableFullscreenButton/EnableFullscreenButton';
import {
selectAllHealthcheckInfo,
selectCheckStatus,
Expand Down
Loading