Client:EmptyView Fixed share option

This commit is contained in:
Akmal Isomadinov 2024-08-01 19:31:51 +05:00
parent 9572d260f6
commit e2c09fc062
4 changed files with 35 additions and 2 deletions

View File

@ -419,7 +419,7 @@ export const getOptions = (
description: t("EmptyView:SharePublicRoomOptionDescription"),
icon: <SharedIcon />,
key: "share-public-room",
onClick: actions.createAndCopySharedLink,
onClick: actions.openInfoPanel,
disabled: false,
};

View File

@ -34,8 +34,11 @@ const EmptyViewContainer = observer(
folderType,
selectedFolder,
parentRoomType,
isVisibleInfoPanel,
isArchiveFolderRoot,
setViewInfoPanel,
onClickInviteUsers,
setVisibleInfoPanel,
onCreateAndCopySharedLink,
setSelectFileFormRoomDialogVisible,
}: EmptyViewContainerProps) => {
@ -48,6 +51,12 @@ const EmptyViewContainer = observer(
const theme = useTheme();
const openInfoPanel = useCallback(() => {
if (!isVisibleInfoPanel) setVisibleInfoPanel?.(true);
setViewInfoPanel?.("info_members");
}, [setViewInfoPanel, setVisibleInfoPanel, isVisibleInfoPanel]);
const onUploadAction = useCallback((uploadType: UploadType) => {
const element =
uploadType === "file"
@ -152,6 +161,7 @@ const EmptyViewContainer = observer(
uploadFromDocspace,
onUploadAction,
createAndCopySharedLink,
openInfoPanel,
},
),
[
@ -168,6 +178,7 @@ const EmptyViewContainer = observer(
onUploadAction,
createAndCopySharedLink,
onCreate,
openInfoPanel,
],
);
@ -185,10 +196,21 @@ const EmptyViewContainer = observer(
);
const InjectedEmptyViewContainer = inject<TStore>(
({ contextOptionsStore, selectedFolderStore, dialogsStore }) => {
({
contextOptionsStore,
selectedFolderStore,
dialogsStore,
infoPanelStore,
}) => {
const { onClickInviteUsers, onCreateAndCopySharedLink } =
contextOptionsStore;
const {
setIsVisible: setVisibleInfoPanel,
isVisible: isVisibleInfoPanel,
setView: setViewInfoPanel,
} = infoPanelStore;
const { setSelectFileFormRoomDialogVisible } = dialogsStore;
const { security, access } = selectedFolderStore;
@ -199,9 +221,12 @@ const InjectedEmptyViewContainer = inject<TStore>(
access,
security,
selectedFolder,
isVisibleInfoPanel,
onClickInviteUsers,
onCreateAndCopySharedLink,
setSelectFileFormRoomDialogVisible,
setVisibleInfoPanel,
setViewInfoPanel,
};
},
)(EmptyViewContainer);

View File

@ -36,6 +36,9 @@ export interface EmptyViewContainerProps {
selectedFolder?: ReturnType<
TStore["selectedFolderStore"]["getSelectedFolder"]
>;
setVisibleInfoPanel?: (arg: boolean) => void;
isVisibleInfoPanel: boolean;
setViewInfoPanel?: TStore["infoPanelStore"]["setView"];
}
export type OptionActions = {
@ -47,4 +50,5 @@ export type OptionActions = {
) => void;
onUploadAction: (type: UploadType) => void;
createAndCopySharedLink: VoidFunction;
openInfoPanel: VoidFunction;
};

View File

@ -161,6 +161,10 @@ class InfoPanelStore {
this.fileView = infoHistory;
};
/**
* @param {infoMembers | infoHistory | infoDetails} view
* @returns {void}
*/
setView = (view) => {
this.roomsView = view;
this.fileView = view === infoMembers ? infoDetails : view;