From 443e107cc474882f558e0783a2d9068b7692bd00 Mon Sep 17 00:00:00 2001 From: Pavel Denisjuk Date: Mon, 11 Dec 2023 14:45:09 +0100 Subject: [PATCH] fix(app-file-manager): render extensions next to the basic fields --- .../components/FileDetails/FileDetails.tsx | 50 ++++++++++++------- .../FileDetails/components/Content.tsx | 13 +++-- .../FileManagerView/FileManagerViewConfig.tsx | 1 + .../FileDetails/GroupFields.tsx | 14 ++++++ .../configComponents/FileDetails/index.ts | 3 ++ .../src/modules/FileManagerRenderer/index.tsx | 2 + 6 files changed, 61 insertions(+), 22 deletions(-) create mode 100644 packages/app-file-manager/src/modules/FileManagerRenderer/FileManagerView/configComponents/FileDetails/GroupFields.tsx diff --git a/packages/app-file-manager/src/components/FileDetails/FileDetails.tsx b/packages/app-file-manager/src/components/FileDetails/FileDetails.tsx index bb456b0752e..20a2f4c44c4 100644 --- a/packages/app-file-manager/src/components/FileDetails/FileDetails.tsx +++ b/packages/app-file-manager/src/components/FileDetails/FileDetails.tsx @@ -1,5 +1,5 @@ import React, { useMemo, useState } from "react"; -// @ts-ignore +// @ts-expect-error import { useHotkeys } from "react-hotkeyz"; import omit from "lodash/omit"; import styled from "@emotion/styled"; @@ -74,6 +74,8 @@ const FileDetailsInner: React.FC = ({ file }) => { const { close } = useFileDetails(); const { fileDetails } = useFileManagerViewConfig(); + const [, leftPanel = "1", rightPanel = "1"] = fileDetails.width.split(","); + const extensionFields = useMemo(() => { const fields = fileModel.fields.find(field => field.fieldId === "extensions"); if (!fields?.settings?.fields) { @@ -91,6 +93,19 @@ const FileDetailsInner: React.FC = ({ file }) => { close(); }; + const basicFieldsElement = ( + + {fileDetails.fields.map(field => ( + + {field.element} + + ))} + + ); + + const extensionFieldsElement = + extensionFields.length > 0 ? : null; + return (
{() => ( @@ -99,30 +114,27 @@ const FileDetailsInner: React.FC = ({ file }) => {
- + - - - - - {fileDetails.fields.map(field => ( - - {field.element} - - ))} - - - {extensionFields.length > 0 ? ( + + {fileDetails.groupFields ? ( + + {basicFieldsElement} - + {extensionFieldsElement} - ) : null} - + + ) : ( + <> + {basicFieldsElement} + {extensionFieldsElement} + + )}