@@ -11,11 +11,7 @@ import type {
1111 PreparedCopyItemOptions ,
1212 ReactGridLayoutProps ,
1313} from '@gravity-ui/dashkit' ;
14- import {
15- DashKitDnDWrapper ,
16- ActionPanel as DashkitActionPanel ,
17- DashKit as GravityDashkit ,
18- } from '@gravity-ui/dashkit' ;
14+ import { DashKit as GravityDashkit } from '@gravity-ui/dashkit' ;
1915import { DEFAULT_GROUP , MenuItems } from '@gravity-ui/dashkit/helpers' ;
2016import {
2117 ChevronsDown ,
@@ -46,15 +42,11 @@ import type {DashTab, DashTabItem, DashTabLayout} from 'shared';
4642import {
4743 ControlQA ,
4844 DASH_INFO_HEADER ,
49- DashBodyQa ,
50- DashEntryQa ,
5145 DashKitOverlayMenuQa ,
5246 DashTabItemType ,
53- EntryScope ,
5447 FOCUSED_WIDGET_PARAM_NAME ,
5548 Feature ,
5649 FixedHeaderQa ,
57- LOADED_DASH_CLASS ,
5850 SCROLL_TITLE_DEBOUNCE_TIME ,
5951 UPDATE_STATE_DEBOUNCE_TIME ,
6052} from 'shared' ;
@@ -68,18 +60,13 @@ import {WidgetContextProvider} from 'ui/components/DashKit/context/WidgetContext
6860import { getDashKitMenu } from 'ui/components/DashKit/helpers' ;
6961import { registry } from 'ui/registry' ;
7062import { showToast } from 'ui/store/actions/toaster' ;
71- import { selectAsideHeaderIsCompact } from 'ui/store/selectors/asideHeader' ;
72- import { selectUserSettings } from 'ui/store/selectors/user' ;
7363import { isEmbeddedMode } from 'ui/utils/embedded' ;
7464import { isEnabledFeature } from 'ui/utils/isEnabledFeature' ;
7565
76- import { getIsAsideHeaderEnabled } from '../../../../components/AsideHeaderAdapter' ;
7766import { getConfiguredDashKit } from '../../../../components/DashKit/DashKit' ;
7867import { DL } from '../../../../constants' ;
79- import Utils from '../../../../utils' ;
80- import { TYPES_TO_DIALOGS_MAP , getActionPanelItems } from '../../../../utils/getActionPanelItems' ;
68+ import { TYPES_TO_DIALOGS_MAP } from '../../../../utils/getActionPanelItems' ;
8169import { EmptyState } from '../../components/EmptyState/EmptyState' ;
82- import Loader from '../../components/Loader/Loader' ;
8370import { Mode } from '../../modules/constants' ;
8471import type { CopiedConfigContext , CopiedConfigData } from '../../modules/helpers' ;
8572import {
@@ -88,7 +75,6 @@ import {
8875 getLayoutParentId ,
8976 getPastedWidgetData ,
9077 getPreparedCopyItemOptions ,
91- memoizedGetLocalTabs ,
9278} from '../../modules/helpers' ;
9379import type { TabsHashStates } from '../../store/actions/dashTyped' ;
9480import {
@@ -108,28 +94,24 @@ import {
10894 selectCurrentTab ,
10995 selectCurrentTabId ,
11096 selectDashDescription ,
111- selectDashError ,
11297 selectDashShowOpenedDescription ,
11398 selectDashWorkbookId ,
11499 selectEntryId ,
115100 selectLastModifiedItemId ,
116101 selectSettings ,
117- selectShowTableOfContent ,
118102 selectSkipReload ,
119103 selectTabHashState ,
120104 selectTabs ,
121105} from '../../store/selectors/dashTypedSelectors' ;
122106import { getCustomizedProperties } from '../../utils/dashkitProps' ;
123107import { scrollIntoView } from '../../utils/scrollUtils' ;
124- import { DashError } from '../DashError/DashError' ;
125108import {
126109 FixedHeaderContainer ,
127110 FixedHeaderControls ,
128111 FixedHeaderWrapper ,
129112} from '../FixedHeader/FixedHeader' ;
130- import TableOfContent from '../TableOfContent/TableOfContent' ;
131- import { Tabs } from '../Tabs/Tabs' ;
132113
114+ import Content from './components/Content/Content' ;
133115import {
134116 FixedContainerWrapperWithContext ,
135117 FixedControlsWrapperWithContext ,
@@ -426,7 +408,24 @@ class Body extends React.PureComponent<BodyProps, DashBodyState> {
426408
427409 return (
428410 < div className = { b ( ) } ref = { this . _dashBodyRef } >
429- { this . renderBody ( ) }
411+ < Content
412+ copiedData = { this . state . hasCopyInBuffer }
413+ dashEntryKey = { this . props . entry ?. key }
414+ disableHashNavigation = { this . props . disableHashNavigation }
415+ hideErrorDetails = { this . props . hideErrorDetails }
416+ isCondensed = { this . isCondensed ( ) }
417+ loaded = { this . state . loaded }
418+ mode = { this . props . mode }
419+ showEditActionPanel = { this . isEditMode ( ) }
420+ renderDashkit = { this . renderDashkit }
421+ onDragEnd = { this . handleDragEnd }
422+ onDragStart = { this . handleDragStart }
423+ onItemClick = { this . handleTocItemClick }
424+ onRetry = { this . props . onRetry }
425+ { ...( this . props . onlyView
426+ ? { onlyView : this . props . onlyView }
427+ : { onlyView : this . props . onlyView , onPasteItem : this . props . onPasteItem } ) }
428+ />
430429 < PaletteEditor />
431430 < EntryDialogues ref = { this . entryDialoguesRef } />
432431 < DashBodyAdditionalControls />
@@ -1304,124 +1303,22 @@ class Body extends React.PureComponent<BodyProps, DashBodyState> {
13041303 } ) ;
13051304 }
13061305 } ;
1307-
1308- private renderBody ( ) {
1309- const {
1310- mode,
1311- settings,
1312- tabs,
1313- showTableOfContent,
1314- isSidebarOpened,
1315- hideErrorDetails,
1316- onRetry,
1317- error,
1318- disableHashNavigation,
1319- } = this . props ;
1320-
1321- const { loaded, hasCopyInBuffer} = this . state ;
1322-
1323- switch ( mode ) {
1324- case Mode . Loading :
1325- case Mode . Updating :
1326- return < Loader size = "l" /> ;
1327- case Mode . Error :
1328- return < DashError error = { error } hideDetails = { hideErrorDetails } onRetry = { onRetry } /> ;
1329- }
1330-
1331- const localTabs = memoizedGetLocalTabs ( tabs ) ;
1332-
1333- const hasTableOfContentForTab = ! ( localTabs . length === 1 && ! localTabs [ 0 ] . items . length ) ;
1334-
1335- const showEditActionPanel = this . isEditMode ( ) ;
1336-
1337- const loadedMixin = loaded ? LOADED_DASH_CLASS : undefined ;
1338-
1339- const hideDashTitle =
1340- settings . hideDashTitle || ( DL . IS_MOBILE && ! isMobileFixedHeaderEnabled ) ;
1341-
1342- const content = (
1343- < div
1344- data-qa = { DashBodyQa . ContentWrapper }
1345- className = { b ( 'content-wrapper' , { mobile : DL . IS_MOBILE , mode} , loadedMixin ) }
1346- >
1347- < div
1348- className = { b ( 'content-container' , {
1349- mobile : DL . IS_MOBILE ,
1350- 'no-title' :
1351- settings . hideDashTitle && ( settings . hideTabs || tabs . length === 1 ) ,
1352- 'no-title-with-tabs' :
1353- settings . hideDashTitle && ! settings . hideTabs && tabs . length > 1 ,
1354- } ) }
1355- >
1356- < TableOfContent
1357- disableHashNavigation = { disableHashNavigation }
1358- onItemClick = { this . handleTocItemClick }
1359- />
1360- < div
1361- className = { b ( 'content' , {
1362- condensed : this . isCondensed ( ) ,
1363- 'with-table-of-content' : showTableOfContent && hasTableOfContentForTab ,
1364- mobile : DL . IS_MOBILE ,
1365- aside : getIsAsideHeaderEnabled ( ) ,
1366- 'with-edit-panel' : showEditActionPanel ,
1367- 'with-footer' : isEnabledFeature ( Feature . EnableFooter ) ,
1368- } ) }
1369- >
1370- { ! hideDashTitle && this . props . entry ?. key && (
1371- < div className = { b ( 'entry-name' ) } data-qa = { DashEntryQa . EntryName } >
1372- { Utils . getEntryNameFromKey ( this . props . entry ?. key ) }
1373- </ div >
1374- ) }
1375- { ! settings . hideTabs && < Tabs className = { b ( 'tabs' ) } /> }
1376- { this . renderDashkit ( ) }
1377- { ! this . props . onlyView && (
1378- < DashkitActionPanel
1379- toggleAnimation = { true }
1380- disable = { ! showEditActionPanel }
1381- items = { getActionPanelItems ( {
1382- copiedData : hasCopyInBuffer ,
1383- onPasteItem : this . props . onPasteItem ,
1384- openDialog : this . props . openDialog ,
1385- filterItem : ( item ) => item . id === DashTabItemType . Image ,
1386- userSettings : this . props . userSettings ,
1387- scope : EntryScope . Dash ,
1388- } ) }
1389- className = { b ( 'edit-panel' , {
1390- 'aside-opened' : isSidebarOpened ,
1391- } ) }
1392- />
1393- ) }
1394- </ div >
1395- </ div >
1396- </ div >
1397- ) ;
1398-
1399- return (
1400- < DashKitDnDWrapper onDragStart = { this . handleDragStart } onDragEnd = { this . handleDragEnd } >
1401- { content }
1402- </ DashKitDnDWrapper >
1403- ) ;
1404- }
14051306}
14061307
14071308const mapStateToProps = ( state : DatalensGlobalState ) => ( {
14081309 entryId : selectEntryId ( state ) ,
14091310 lastModifiedItem : selectLastModifiedItemId ( state ) ,
14101311 entry : state . dash . entry ,
14111312 mode : state . dash . mode ,
1412- showTableOfContent : selectShowTableOfContent ( state ) ,
14131313 hashStates : selectTabHashState ( state ) ,
14141314 settings : selectSettings ( state ) ,
14151315 tabData : selectCurrentTab ( state ) ,
14161316 dashKitRef : state . dash . dashKitRef ,
14171317 canEdit : canEdit ( state ) ,
14181318 tabs : selectTabs ( state ) ,
14191319 tabId : selectCurrentTabId ( state ) ,
1420- isSidebarOpened : ! selectAsideHeaderIsCompact ( state ) ,
14211320 workbookId : selectDashWorkbookId ( state ) ,
1422- error : selectDashError ( state ) ,
14231321 skipReload : selectSkipReload ( state ) ,
1424- userSettings : selectUserSettings ( state ) ,
14251322 dashDescription : selectDashDescription ( state ) ,
14261323 showOpenedDescription : selectDashShowOpenedDescription ( state ) ,
14271324 hasTableOfContent : hasTableOfContent ( state ) ,
0 commit comments