Client:EmptyView Added empty screen for public room

This commit is contained in:
Akmal Isomadinov 2024-08-30 13:43:28 +05:00
parent f3c183b800
commit 839492dd27
6 changed files with 40 additions and 13 deletions

View File

@ -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(

View File

@ -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;

View File

@ -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,

View File

@ -64,6 +64,7 @@ export interface InjectedEmptyViewContainerProps
isWarningRoomsDialog: boolean;
setVisibleInfoPanel: (arg: boolean) => void;
setViewInfoPanel: TStore["infoPanelStore"]["setView"];
isPublicRoom: boolean;
}
export type EmptyViewContainerProps = OutEmptyViewContainerProps &

View File

@ -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,10 +275,15 @@ export const getRootTitle = (
rootFolderType: Nullable<FolderType>,
) => {
return match([rootFolderType, access])
.with([FolderType.Rooms, ShareAccessRights.None], () =>
t("Files:EmptyRootRoomHeader", {
productName: t("Common:ProductName"),
}),
.with(
[
FolderType.Rooms,
P.union(ShareAccessRights.None, ShareAccessRights.ReadOnly),
],
() =>
t("Files:EmptyRootRoomHeader", {
productName: t("Common:ProductName"),
}),
)
.with([FolderType.Rooms, ShareAccessRights.DenyAccess], () =>
t("EmptyView:EmptyRootRoomUserTitle"),
@ -401,12 +414,17 @@ export const getRootIcom = (
.with([FolderType.Rooms, ShareAccessRights.None], () =>
isBaseTheme ? <EmptyRoomsRootLightIcon /> : <EmptyRoomsRootDarkIcon />,
)
.with([FolderType.Rooms, ShareAccessRights.DenyAccess], () =>
isBaseTheme ? (
<EmptyRoomsRootUserLightIcon />
) : (
<EmptyRoomsRootUserDarkIcon />
),
.with(
[
FolderType.Rooms,
P.union(ShareAccessRights.DenyAccess, ShareAccessRights.ReadOnly),
],
() =>
isBaseTheme ? (
<EmptyRoomsRootUserLightIcon />
) : (
<EmptyRoomsRootUserDarkIcon />
),
)
.with([FolderType.USER, ShareAccessRights.None], () =>
isBaseTheme ? <DefaultFolderLight /> : <DefaultFolderDark />,

View File

@ -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;