Merge pull request #611 from ONLYOFFICE/bugfix/new-empty-screen
Bugfix/new empty screen
This commit is contained in:
commit
eac40356c7
@ -62,10 +62,12 @@ export const getDescription = (
|
||||
isArchiveFolderRoot: boolean,
|
||||
isRootEmptyPage: boolean,
|
||||
rootFolderType: Nullable<FolderType>,
|
||||
): string => {
|
||||
isPublicRoom: boolean,
|
||||
): React.ReactNode => {
|
||||
const isNotAdmin = isUser(access);
|
||||
|
||||
if (isRootEmptyPage) return getRootDesctiption(t, access, rootFolderType);
|
||||
if (isRootEmptyPage)
|
||||
return getRootDesctiption(t, access, rootFolderType, isPublicRoom);
|
||||
|
||||
if (isFolder)
|
||||
return getFolderDescription(
|
||||
|
@ -40,6 +40,7 @@ export const useEmptyView = (
|
||||
isRootEmptyPage,
|
||||
isArchiveFolderRoot,
|
||||
rootFolderType,
|
||||
isPublicRoom,
|
||||
}: EmptyViewContainerProps,
|
||||
t: TTranslation,
|
||||
) => {
|
||||
@ -56,6 +57,7 @@ export const useEmptyView = (
|
||||
isArchiveFolderRoot,
|
||||
isRootEmptyPage,
|
||||
rootFolderType,
|
||||
isPublicRoom,
|
||||
);
|
||||
const title = getTitle(
|
||||
type,
|
||||
@ -91,6 +93,7 @@ export const useEmptyView = (
|
||||
isRootEmptyPage,
|
||||
isArchiveFolderRoot,
|
||||
rootFolderType,
|
||||
isPublicRoom,
|
||||
]);
|
||||
|
||||
return emptyViewOptions;
|
||||
@ -133,9 +136,9 @@ export const useOptions = (
|
||||
newFilter.searchArea = RoomSearchArea.Active;
|
||||
|
||||
const state = {
|
||||
title: roomsFolder.title,
|
||||
title: roomsFolder?.title,
|
||||
isRoot: true,
|
||||
rootFolderType: roomsFolder.rootFolderType,
|
||||
rootFolderType: roomsFolder?.rootFolderType,
|
||||
};
|
||||
|
||||
const path = getCategoryUrl(CategoryType.Shared);
|
||||
@ -146,7 +149,7 @@ export const useOptions = (
|
||||
},
|
||||
state,
|
||||
};
|
||||
}, [roomsFolder.rootFolderType, roomsFolder.title, userId]);
|
||||
}, [roomsFolder?.rootFolderType, roomsFolder?.title, userId]);
|
||||
|
||||
const onGoToPersonal = useCallback((): LinkProps => {
|
||||
const newFilter = FilesFilter.getDefault();
|
||||
@ -154,9 +157,9 @@ export const useOptions = (
|
||||
newFilter.folder = myFolderId?.toString() ?? "";
|
||||
|
||||
const state = {
|
||||
title: myFolder.title,
|
||||
title: myFolder?.title,
|
||||
isRoot: true,
|
||||
rootFolderType: myFolder.rootFolderType,
|
||||
rootFolderType: myFolder?.rootFolderType,
|
||||
};
|
||||
|
||||
const path = getCategoryUrl(CategoryType.Personal);
|
||||
@ -170,7 +173,7 @@ export const useOptions = (
|
||||
},
|
||||
state,
|
||||
};
|
||||
}, [myFolder.rootFolderType, myFolder.title, myFolderId]);
|
||||
}, [myFolder?.rootFolderType, myFolder?.title, myFolderId]);
|
||||
|
||||
const onCreateRoom = useCallback(() => {
|
||||
if (isWarningRoomsDialog) {
|
||||
|
@ -48,8 +48,10 @@ const InjectedEmptyViewContainer = inject<
|
||||
clientLoadingStore,
|
||||
userStore,
|
||||
currentQuotaStore,
|
||||
publicRoomStore,
|
||||
}): InjectedEmptyViewContainerProps => {
|
||||
const { isWarningRoomsDialog } = currentQuotaStore;
|
||||
const { isPublicRoom } = publicRoomStore;
|
||||
|
||||
const { myFolderId, myFolder, roomsFolder } = treeFoldersStore;
|
||||
|
||||
@ -83,6 +85,7 @@ const InjectedEmptyViewContainer = inject<
|
||||
myFolder,
|
||||
roomsFolder,
|
||||
userId,
|
||||
isPublicRoom,
|
||||
isWarningRoomsDialog,
|
||||
inviteUser,
|
||||
setViewInfoPanel,
|
||||
|
@ -64,6 +64,7 @@ export interface InjectedEmptyViewContainerProps
|
||||
isWarningRoomsDialog: boolean;
|
||||
setVisibleInfoPanel: (arg: boolean) => void;
|
||||
setViewInfoPanel: TStore["infoPanelStore"]["setView"];
|
||||
isPublicRoom: boolean;
|
||||
}
|
||||
|
||||
export type EmptyViewContainerProps = OutEmptyViewContainerProps &
|
||||
|
@ -171,6 +171,7 @@ export const getRootDesctiption = (
|
||||
t: TTranslation,
|
||||
access: AccessType,
|
||||
rootFolderType: Nullable<FolderType>,
|
||||
isPublicRoom: boolean,
|
||||
) => {
|
||||
return match([rootFolderType, access])
|
||||
.with([FolderType.Rooms, ShareAccessRights.None], () =>
|
||||
@ -179,6 +180,13 @@ export const getRootDesctiption = (
|
||||
.with([FolderType.Rooms, ShareAccessRights.DenyAccess], () =>
|
||||
t("EmptyView:EmptyRootRoomUserDescription"),
|
||||
)
|
||||
.with([FolderType.Rooms, P.when(() => isPublicRoom)], () => (
|
||||
<>
|
||||
<span>{t("Files:RoomEmptyAtTheMoment")}</span>
|
||||
<br />
|
||||
<span>{t("Files:FilesWillAppearHere")}</span>
|
||||
</>
|
||||
))
|
||||
.with([FolderType.USER, ShareAccessRights.None], () =>
|
||||
t("EmptyView:DefaultFolderDescription"),
|
||||
)
|
||||
@ -267,7 +275,12 @@ export const getRootTitle = (
|
||||
rootFolderType: Nullable<FolderType>,
|
||||
) => {
|
||||
return match([rootFolderType, access])
|
||||
.with([FolderType.Rooms, ShareAccessRights.None], () =>
|
||||
.with(
|
||||
[
|
||||
FolderType.Rooms,
|
||||
P.union(ShareAccessRights.None, ShareAccessRights.ReadOnly),
|
||||
],
|
||||
() =>
|
||||
t("Files:EmptyRootRoomHeader", {
|
||||
productName: t("Common:ProductName"),
|
||||
}),
|
||||
@ -401,7 +414,12 @@ export const getRootIcom = (
|
||||
.with([FolderType.Rooms, ShareAccessRights.None], () =>
|
||||
isBaseTheme ? <EmptyRoomsRootLightIcon /> : <EmptyRoomsRootDarkIcon />,
|
||||
)
|
||||
.with([FolderType.Rooms, ShareAccessRights.DenyAccess], () =>
|
||||
.with(
|
||||
[
|
||||
FolderType.Rooms,
|
||||
P.union(ShareAccessRights.DenyAccess, ShareAccessRights.ReadOnly),
|
||||
],
|
||||
() =>
|
||||
isBaseTheme ? (
|
||||
<EmptyRoomsRootUserLightIcon />
|
||||
) : (
|
||||
|
@ -179,6 +179,9 @@ class TreeFoldersStore {
|
||||
return this.rootFoldersTitles[FolderType.TRASH]?.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {import("@docspace/shared/api/files/types").TFolder=}
|
||||
*/
|
||||
get myFolder() {
|
||||
return this.treeFolders.find((x) => x.rootFolderType === FolderType.USER);
|
||||
}
|
||||
@ -196,7 +199,9 @@ class TreeFoldersStore {
|
||||
get recentFolder() {
|
||||
return this.treeFolders.find((x) => x.rootFolderType === FolderType.Recent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {import("@docspace/shared/api/rooms/types").TRoom=}
|
||||
*/
|
||||
get roomsFolder() {
|
||||
return this.treeFolders.find((x) => x.rootFolderType === FolderType.Rooms);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ export type EmptyViewLinkType = {
|
||||
export type EmptyViewItemType = {
|
||||
key: React.Key;
|
||||
title: string;
|
||||
description: string;
|
||||
description: React.ReactNode;
|
||||
icon: React.ReactElement;
|
||||
onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
||||
disabled?: boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user