Client/Shared: Hide close button for Sdk.

This commit is contained in:
Tatiana Lopaeva 2024-08-23 20:14:14 +03:00
parent 7f7882f4ff
commit 3017d36a76
7 changed files with 27 additions and 7 deletions

View File

@ -29,12 +29,15 @@ import {
TFilesSettings, TFilesSettings,
TFolder, TFolder,
} from "@docspace/shared/api/files/types"; } from "@docspace/shared/api/files/types";
import { TBreadCrumb } from "@docspace/shared/components/selector/Selector.types"; import {
TBreadCrumb,
TSelectorHeader,
} from "@docspace/shared/components/selector/Selector.types";
import { DeviceType } from "@docspace/shared/enums"; import { DeviceType } from "@docspace/shared/enums";
import { TTheme } from "@docspace/shared/themes"; import { TTheme } from "@docspace/shared/themes";
import SocketIOHelper from "@docspace/shared/utils/socket"; import SocketIOHelper from "@docspace/shared/utils/socket";
export type FilesSelectorProps = { export type FilesSelectorProps = TSelectorHeader & {
isPanelVisible: boolean; isPanelVisible: boolean;
// withoutImmediatelyClose: boolean; // withoutImmediatelyClose: boolean;
isThirdParty: boolean; isThirdParty: boolean;

View File

@ -140,6 +140,7 @@ const FilesSelectorWrapper = ({
openRoot, openRoot,
filesSettings, filesSettings,
headerProps,
}: FilesSelectorProps) => { }: FilesSelectorProps) => {
const { t }: { t: TTranslation } = useTranslation([ const { t }: { t: TTranslation } = useTranslation([
"Files", "Files",
@ -392,6 +393,7 @@ const FilesSelectorWrapper = ({
getFilesArchiveError={getFilesArchiveError} getFilesArchiveError={getFilesArchiveError}
withCreate={(isMove || isCopy || isRestore || isRestoreAll) ?? false} withCreate={(isMove || isCopy || isRestore || isRestoreAll) ?? false}
filesSettings={filesSettings} filesSettings={filesSettings}
headerProps={headerProps}
/> />
); );
}; };

View File

@ -262,7 +262,10 @@ const Sdk = ({
: {}; : {};
const headerProps = frameConfig?.showSelectorHeader const headerProps = frameConfig?.showSelectorHeader
? { withHeader: true, headerProps: { headerLabel: "" } } ? {
withHeader: true,
headerProps: { headerLabel: "", isCloseable: false },
}
: {}; : {};
component = ( component = (
@ -301,6 +304,7 @@ const Sdk = ({
currentFolderId={frameConfig?.id} currentFolderId={frameConfig?.id}
openRoot={selectorOpenRoot} openRoot={selectorOpenRoot}
descriptionText={formatsDescription[frameConfig?.filterParam] || ""} descriptionText={formatsDescription[frameConfig?.filterParam] || ""}
headerProps={{ isCloseable: false }}
/> />
); );
break; break;

View File

@ -74,6 +74,7 @@ export type BreadCrumbsProps = {
export type HeaderProps = { export type HeaderProps = {
headerLabel: string; headerLabel: string;
onCloseClick: () => void; onCloseClick: () => void;
isCloseable?: boolean;
} & THeaderBackButton; } & THeaderBackButton;
export type TSelectorHeader = export type TSelectorHeader =

View File

@ -36,7 +36,9 @@ const Header = React.memo(
withoutBackButton, withoutBackButton,
headerLabel, headerLabel,
withoutBorder, withoutBorder,
isCloseable,
}: HeaderProps) => { }: HeaderProps) => {
console.log("isCloseable", isCloseable);
return ( return (
<AsideHeader <AsideHeader
header={headerLabel} header={headerLabel}
@ -46,6 +48,7 @@ const Header = React.memo(
onBackClick={onBackClick} onBackClick={onBackClick}
onCloseClick={onCloseClick} onCloseClick={onCloseClick}
withoutBorder={withoutBorder} withoutBorder={withoutBorder}
isCloseable={isCloseable}
/> />
); );
}, },

View File

@ -28,6 +28,7 @@ import { TSelectorItem } from "../../components/selector";
import { import {
TBreadCrumb, TBreadCrumb,
TInfoBar, TInfoBar,
TSelectorHeader,
} from "../../components/selector/Selector.types"; } from "../../components/selector/Selector.types";
import { import {
TFileSecurity, TFileSecurity,
@ -143,7 +144,8 @@ export type TSelectedFileInfo = {
export type TGetIcon = (size: number, fileExst: string) => string; export type TGetIcon = (size: number, fileExst: string) => string;
export type FilesSelectorProps = TInfoBar & export type FilesSelectorProps = TSelectorHeader &
TInfoBar &
( (
| { | {
getIcon: TGetIcon; getIcon: TGetIcon;

View File

@ -114,6 +114,7 @@ const FilesSelectorComponent = ({
createDefineRoomType, createDefineRoomType,
withInfoBar, withInfoBar,
infoBarData, infoBarData,
headerProps,
}: FilesSelectorProps) => { }: FilesSelectorProps) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(["Common"]); const { t } = useTranslation(["Common"]);
@ -475,10 +476,14 @@ const FilesSelectorComponent = ({
openRoot, openRoot,
]); ]);
const headerProps: TSelectorHeader = withHeader const headerSelectorProps: TSelectorHeader = withHeader
? { ? {
withHeader, withHeader,
headerProps: { headerLabel, onCloseClick: onCancel }, headerProps: {
...headerProps,
headerLabel,
onCloseClick: onCancel,
},
} }
: {}; : {};
@ -556,7 +561,7 @@ const FilesSelectorComponent = ({
const SelectorBody = ( const SelectorBody = (
<Selector <Selector
{...headerProps} {...headerSelectorProps}
{...searchProps} {...searchProps}
{...submitButtonProps} {...submitButtonProps}
{...cancelButtonProps} {...cancelButtonProps}