From c6dd338bb79774dc35b10f858149e6b125028f6b Mon Sep 17 00:00:00 2001 From: Vlada Gazizova <94864088+gazizova-vlada@users.noreply.github.com> Date: Thu, 8 Aug 2024 10:37:19 +0300 Subject: [PATCH] Client:TableRow:Refactoring. --- .../TableView/sub-components/RoomsRowData.js | 56 ++++--------------- .../Body/TableView/sub-components/RowData.js | 53 ++++-------------- 2 files changed, 22 insertions(+), 87 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RoomsRowData.js b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RoomsRowData.js index 6bd34d2727..c9ad73fa71 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RoomsRowData.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RoomsRowData.js @@ -41,7 +41,6 @@ const RoomsRowDataComponent = (props) => { const { roomColumnTypeIsEnabled, roomColumnOwnerIsEnabled, - roomColumnQuickButtonsIsEnabled, roomColumnTagsIsEnabled, roomColumnActivityIsEnabled, roomQuotaColumnIsEnable, @@ -63,6 +62,11 @@ const RoomsRowDataComponent = (props) => { } = props; const lastColumn = getLastColumn(tableStorageName); + const quickButtonsComponentNode = ( + + {quickButtonsComponent} + + ); return ( <> @@ -85,13 +89,7 @@ const RoomsRowDataComponent = (props) => { {badgesComponent} - {lastColumn === "Name" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Name" ? quickButtonsComponentNode : <>} {roomColumnTypeIsEnabled ? ( @@ -111,13 +109,7 @@ const RoomsRowDataComponent = (props) => { sideColor={theme.filesSection.tableView.row.sideColor} {...props} /> - {lastColumn === "Type" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Type" ? quickButtonsComponentNode : <>} ) : (
@@ -136,13 +128,7 @@ const RoomsRowDataComponent = (props) => { sideColor={theme.filesSection.tableView.row.sideColor} {...props} /> - {lastColumn === "Tags" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Tags" ? quickButtonsComponentNode : <>} ) : (
@@ -165,13 +151,7 @@ const RoomsRowDataComponent = (props) => { sideColor={theme.filesSection.tableView.row.sideColor} {...props} /> - {lastColumn === "Owner" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Owner" ? quickButtonsComponentNode : <>} ) : (
@@ -194,13 +174,7 @@ const RoomsRowDataComponent = (props) => { sideColor={theme.filesSection.tableView.row.sideColor} {...props} /> - {lastColumn === "Activity" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Activity" ? quickButtonsComponentNode : <>} ) : (
@@ -213,13 +187,7 @@ const RoomsRowDataComponent = (props) => { type="room" isReadOnly={!item?.security?.EditRoom} /> - {lastColumn === "Storage" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Storage" ? quickButtonsComponentNode : <>} ) : (
@@ -232,7 +200,6 @@ export default inject(({ currentQuotaStore, tableStore }) => { const { roomColumnTypeIsEnabled, roomColumnOwnerIsEnabled, - roomColumnQuickButtonsIsEnabled, roomColumnTagsIsEnabled, roomColumnActivityIsEnabled, roomQuotaColumnIsEnable, @@ -244,7 +211,6 @@ export default inject(({ currentQuotaStore, tableStore }) => { roomQuotaColumnIsEnable, roomColumnTypeIsEnabled, roomColumnOwnerIsEnabled, - roomColumnQuickButtonsIsEnabled, roomColumnTagsIsEnabled, roomColumnActivityIsEnabled, showStorageInfo, diff --git a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RowData.js b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RowData.js index 7862870d54..75cbfe1cee 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RowData.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RowData.js @@ -60,6 +60,11 @@ const RowDataComponent = (props) => { } = props; const lastColumn = getLastColumn(tableStorageName); + const quickButtonsComponentNode = ( + + {quickButtonsComponent} + + ); return ( <> @@ -82,13 +87,7 @@ const RowDataComponent = (props) => { {badgesComponent} - {lastColumn === "Name" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Name" ? quickButtonsComponentNode : <>} {authorColumnIsEnabled ? ( @@ -106,13 +105,7 @@ const RowDataComponent = (props) => { sideColor={theme.filesSection.tableView.row.sideColor} {...props} /> - {lastColumn === "Author" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Author" ? quickButtonsComponentNode : <>} ) : (
@@ -136,13 +129,7 @@ const RowDataComponent = (props) => { sideColor={theme.filesSection.tableView.row.sideColor} {...props} /> - {lastColumn === "Created" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Created" ? quickButtonsComponentNode : <>} ) : (
@@ -163,13 +150,7 @@ const RowDataComponent = (props) => { sideColor={theme.filesSection.tableView.row.sideColor} {...props} /> - {lastColumn === "Modified" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Modified" ? quickButtonsComponentNode : <>} ) : (
@@ -190,13 +171,7 @@ const RowDataComponent = (props) => { sideColor={theme.filesSection.tableView.row.sideColor} {...props} /> - {lastColumn === "Size" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Size" ? quickButtonsComponentNode : <>} ) : (
@@ -219,13 +194,7 @@ const RowDataComponent = (props) => { sideColor={theme.filesSection.tableView.row.sideColor} {...props} /> - {lastColumn === "Type" ? ( - - {quickButtonsComponent} - - ) : ( - <> - )} + {lastColumn === "Type" ? quickButtonsComponentNode : <>} ) : (