Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 8 additions & 9 deletions src/components/Fullscreen/Fullscreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {cn} from '../../utils/cn';
import {useTypedDispatch, useTypedSelector} from '../../utils/hooks';
import {Portal} from '../Portal/Portal';

import {useFullscreenContext} from './FullscreenContext';

import disableFullscreenIcon from '../../assets/icons/disableFullscreen.svg';

import './Fullscreen.scss';
Expand All @@ -18,11 +20,10 @@ 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 fullscreenRootRef = useFullscreenContext();

const onDisableFullScreen = React.useCallback(() => {
dispatch(disableFullscreen());
Expand All @@ -44,25 +45,25 @@ function Fullscreen({children, className}: FullscreenProps) {
const [container, setContainer] = React.useState<HTMLDivElement | null>(null);
React.useEffect(() => {
const div = document.createElement('div');
fullscreenRoot?.appendChild(div);
fullscreenRootRef.current?.appendChild(div);
div.style.display = 'contents';
setContainer(div);
return () => {
setContainer(null);
div.remove();
};
}, []);
}, [fullscreenRootRef]);

const ref = React.useRef<HTMLDivElement>(null);
React.useLayoutEffect(() => {
if (container) {
if (isFullscreen) {
fullscreenRoot?.appendChild(container);
fullscreenRootRef.current?.appendChild(container);
} else {
ref.current?.appendChild(container);
}
}
}, [container, isFullscreen]);
}, [container, fullscreenRootRef, isFullscreen]);

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

export default Fullscreen;
25 changes: 25 additions & 0 deletions src/components/Fullscreen/FullscreenContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';

const FullscreenContext = React.createContext<React.RefObject<HTMLDivElement> | null>(null);

export function useFullscreenContext() {
const context = React.useContext(FullscreenContext);
if (!context) {
throw new Error('useFullscreenContext must be used within a FullscreenProvider');
}
return context;
}

export function FullscreenProvider({
children,
fullscreenRootRef,
}: {
children: React.ReactNode;
fullscreenRootRef: React.RefObject<HTMLDivElement>;
}) {
return (
<FullscreenContext.Provider value={fullscreenRootRef}>
{children}
</FullscreenContext.Provider>
);
}
22 changes: 13 additions & 9 deletions src/containers/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {History} from 'history';
import {Helmet} from 'react-helmet-async';

import {componentsRegistry} from '../../components/ComponentsProvider/componentsRegistry';
import {FullscreenProvider} from '../../components/Fullscreen/FullscreenContext';
import {useTypedSelector} from '../../utils/hooks';
import ReduxTooltip from '../ReduxTooltip/ReduxTooltip';
import type {YDBEmbeddedUISettings} from '../UserSettings/settings';
Expand Down Expand Up @@ -47,19 +48,22 @@ function AppContent({
}) {
const {appTitle} = useAppTitle();
const singleClusterMode = useTypedSelector((state) => state.singleClusterMode);
const fullscreenRootRef = React.useRef<HTMLDivElement>(null);

return (
<React.Fragment>
<Helmet defaultTitle={appTitle} titleTemplate={`%s — ${appTitle}`} />
<ContentWrapper>
<NavigationWrapper
singleClusterMode={singleClusterMode}
userSettings={userSettings}
>
<Content singleClusterMode={singleClusterMode}>{children}</Content>
<div id="fullscreen-root"></div>
</NavigationWrapper>
</ContentWrapper>
<FullscreenProvider fullscreenRootRef={fullscreenRootRef}>
<ContentWrapper>
<NavigationWrapper
singleClusterMode={singleClusterMode}
userSettings={userSettings}
>
<Content singleClusterMode={singleClusterMode}>{children}</Content>
<div ref={fullscreenRootRef}></div>
</NavigationWrapper>
</ContentWrapper>
</FullscreenProvider>
</React.Fragment>
);
}
Expand Down
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