Web:EmptyContainer Added a empty screen for the filter

This commit is contained in:
Akmal Isomadinov 2024-08-15 16:24:22 +05:00
parent 0616b6d465
commit b6374f020d
5 changed files with 68 additions and 41 deletions

View File

@ -23,19 +23,24 @@
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing // All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
import EmptyScreenFilterAltSvgUrl from "PUBLIC_DIR/images/empty_screen_filter_alt.svg?url";
import EmptyScreenFilterAltDarkSvgUrl from "PUBLIC_DIR/images/empty_screen_filter_alt_dark.svg?url";
import ClearEmptyFilterSvgUrl from "PUBLIC_DIR/images/clear.empty.filter.svg?url";
import React from "react"; import React from "react";
import { useNavigate, useLocation } from "react-router-dom"; import { useNavigate, useLocation } from "react-router-dom";
import { withTranslation } from "react-i18next"; import { withTranslation } from "react-i18next";
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import EmptyContainer from "./EmptyContainer";
import FilesFilter from "@docspace/shared/api/files/filter"; import ClearEmptyFilterSvg from "PUBLIC_DIR/images/clear.empty.filter.svg";
import EmptyFilterRoomsLightIcon from "PUBLIC_DIR/images/emptyFilter/empty.filter.rooms.light.svg";
import EmptyFilterRoomsDarkIcon from "PUBLIC_DIR/images/emptyFilter/empty.filter.rooms.dark.svg";
import EmptyFilterFilesLightIcon from "PUBLIC_DIR/images/emptyFilter/empty.filter.files.light.svg";
import EmptyFilterFilesDarkIcon from "PUBLIC_DIR/images/emptyFilter/empty.filter.files.dark.svg";
import RoomsFilter from "@docspace/shared/api/rooms/filter"; import RoomsFilter from "@docspace/shared/api/rooms/filter";
import { IconButton } from "@docspace/shared/components/icon-button"; import FilesFilter from "@docspace/shared/api/files/filter";
import { Link } from "@docspace/shared/components/link"; import { EmptyView } from "@docspace/shared/components/empty-view";
// import EmptyContainer from "./EmptyContainer";
const EmptyFilterContainer = ({ const EmptyFilterContainer = ({
t, t,
@ -55,12 +60,32 @@ const EmptyFilterContainer = ({
const navigate = useNavigate(); const navigate = useNavigate();
const location = useLocation(); const location = useLocation();
const subheadingText = t("EmptyFilterSubheadingText");
const descriptionText = isRooms const descriptionText = isRooms
? t("Common:SearchEmptyRoomsDescription") ? t("Common:EmptyFilterRoomsDescription")
: t("Common:EmptyFilterDescriptionText"); : t("Common:EmptyFilterFilesDescription");
const getIconURL = () => {
if (isRooms)
return theme.isBase ? (
<EmptyFilterRoomsLightIcon />
) : (
<EmptyFilterRoomsDarkIcon />
);
return theme.isBase ? (
<EmptyFilterFilesLightIcon />
) : (
<EmptyFilterFilesDarkIcon />
);
};
/**
* @param {React.MouseEvent<HTMLAnchorElement, MouseEvent>} event
* @returns {void}
*/
const onResetFilter = (event) => {
event.preventDefault();
const onResetFilter = () => {
setIsLoading(true); setIsLoading(true);
if (isArchiveFolder) { if (isArchiveFolder) {
@ -86,31 +111,21 @@ const EmptyFilterContainer = ({
} }
}; };
const buttons = ( const options = {
<div className="empty-folder_container-links"> to: "",
<IconButton description: t("Common:ClearFilter"),
className="empty-folder_container-icon" icon: <ClearEmptyFilterSvg />,
size="12" onClick: onResetFilter,
onClick={onResetFilter} };
iconName={ClearEmptyFilterSvgUrl}
isFill
/>
<Link onClick={onResetFilter} {...linkStyles}>
{t("Common:ClearFilter")}
</Link>
</div>
);
const imageSrc = theme.isBase const imageSrc = getIconURL();
? EmptyScreenFilterAltSvgUrl
: EmptyScreenFilterAltDarkSvgUrl;
return ( return (
<EmptyContainer <EmptyView
headerText={t("Common:NotFoundTitle")} icon={imageSrc}
descriptionText={descriptionText} title={t("Common:NoFindingsFound")}
imageSrc={imageSrc} options={options}
buttons={buttons} description={descriptionText}
/> />
); );
}; };

View File

@ -67,6 +67,9 @@ export const EmptyViewBody = styled.div`
color: #4781d1; color: #4781d1;
svg { svg {
color: #4781d1; color: #4781d1;
g {
fill: currentColor;
}
flex-shrink: 0; flex-shrink: 0;
} }

View File

@ -46,7 +46,12 @@ export const EmptyView = ({
</EmptyViewHeader> </EmptyViewHeader>
<EmptyViewBody> <EmptyViewBody>
{isEmptyLinkOptions(options) ? ( {isEmptyLinkOptions(options) ? (
<Link className="ev-link" to={options.to} state={options.state}> <Link
className="ev-link"
to={options.to}
state={options.state}
onClick={options.onClick}
>
{options.icon} {options.icon}
<span>{options.description}</span> <span>{options.description}</span>
</Link> </Link>

View File

@ -5,6 +5,7 @@ export type EmptyViewLinkType = {
state?: unknown; state?: unknown;
icon: React.ReactElement; icon: React.ReactElement;
description: string; description: string;
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
}; };
export type EmptyViewItemType = { export type EmptyViewItemType = {

View File

@ -50,6 +50,7 @@
"Color": "Color", "Color": "Color",
"ComingSoon": "Coming soon", "ComingSoon": "Coming soon",
"Comment": "Comment", "Comment": "Comment",
"Commentator": "Commentator",
"Comments": "Comments", "Comments": "Comments",
"Common": "Common", "Common": "Common",
"CommonFiles": "Common files", "CommonFiles": "Common files",
@ -127,8 +128,8 @@
"Delete": "Delete", "Delete": "Delete",
"DenyAccess": "Deny access", "DenyAccess": "Deny access",
"Description": "Description", "Description": "Description",
"Disable": "Disable",
"DeveloperTools": "Developer Tools", "DeveloperTools": "Developer Tools",
"Disable": "Disable",
"Disabled": "Disabled", "Disabled": "Disabled",
"DisableQuota": "Disable quota", "DisableQuota": "Disable quota",
"DisableStorageQuota": "Disable storage quota", "DisableStorageQuota": "Disable storage quota",
@ -148,12 +149,13 @@
"EditButton": "Edit", "EditButton": "Edit",
"Editing": "Editing", "Editing": "Editing",
"Editor": "Editor", "Editor": "Editor",
"Commentator": "Commentator",
"Email": "Email", "Email": "Email",
"EmptyDescription": "The list of users previously invited to {{productName}} or separate rooms will appear here. You will be able to invite these users for collaboration at any time.", "EmptyDescription": "The list of users previously invited to {{productName}} or separate rooms will appear here. You will be able to invite these users for collaboration at any time.",
"EmptyEmail": "No email address parsed", "EmptyEmail": "No email address parsed",
"EmptyFieldError": "Empty field", "EmptyFieldError": "Empty field",
"EmptyFilterDescriptionText": "No files or folders match this filter. Try a different one or clear filter to view all files.", "EmptyFilterDescriptionText": "No files or folders match this filter. Try a different one or clear filter to view all files.",
"EmptyFilterFilesDescription": "No files or folders match this filter. Try another or remove the filter to view all files.",
"EmptyFilterRoomsDescription": "No room matches this filter. Try another or reset filter to view all rooms.",
"EmptyGroupsDescription": "Please create the first group.", "EmptyGroupsDescription": "Please create the first group.",
"EmptyGroupsHeader": "No groups here yet", "EmptyGroupsHeader": "No groups here yet",
"EmptyHeader": "No other accounts here yet", "EmptyHeader": "No other accounts here yet",
@ -252,6 +254,7 @@
"LinkExpireAfter": "The link will expire after <1>{{date}}</1>", "LinkExpireAfter": "The link will expire after <1>{{date}}</1>",
"LinkExpired": "The link has expired.", "LinkExpired": "The link has expired.",
"LinkIsValid": "The link is valid for <1>{{date}}</1>", "LinkIsValid": "The link is valid for <1>{{date}}</1>",
"LinkRemoved": "Link removed",
"LinkSuccessfullyCopied": "Link successfully copied to clipboard", "LinkSuccessfullyCopied": "Link successfully copied to clipboard",
"ListAccounts": "Account list", "ListAccounts": "Account list",
"LiveChat": "Live chat", "LiveChat": "Live chat",
@ -302,6 +305,7 @@
"NewVersionAvailable": "A new version of the website available", "NewVersionAvailable": "A new version of the website available",
"Next": "Next", "Next": "Next",
"No": "No", "No": "No",
"NoFindingsFound": "No findings found",
"NoRoomsFound": "No rooms found", "NoRoomsFound": "No rooms found",
"NotFoundGroups": "No groups found", "NotFoundGroups": "No groups found",
"NotFoundGroupsDescription": "No groups match your search. Please adjust your search parameters or clear the search field to view the full list of groups.", "NotFoundGroupsDescription": "No groups match your search. Please adjust your search parameters or clear the search field to view the full list of groups.",
@ -327,8 +331,8 @@
"OAuthRoomsWriteDescription": "View and manage all rooms", "OAuthRoomsWriteDescription": "View and manage all rooms",
"OCT": "OCT", "OCT": "OCT",
"OFORMsGallery": "Form Gallery", "OFORMsGallery": "Form Gallery",
"OkButton": "Ok",
"OKButton": "OK", "OKButton": "OK",
"OkButton": "Ok",
"Or": "or", "Or": "or",
"orContinueWith": "or continue with", "orContinueWith": "or continue with",
"OrganizationName": "ONLYOFFICE", "OrganizationName": "ONLYOFFICE",
@ -388,12 +392,11 @@
"RecoverDescribeYourProblemPlaceholder": "Describe your problem", "RecoverDescribeYourProblemPlaceholder": "Describe your problem",
"RecoverTitle": "Access recovery", "RecoverTitle": "Access recovery",
"Regenerate": "Regenerate", "Regenerate": "Regenerate",
"RemoveLink": "Remove link",
"LinkRemoved": "Link removed",
"RegistrationEmail": "Your registration email address", "RegistrationEmail": "Your registration email address",
"ReloadPage": "Reload page", "ReloadPage": "Reload page",
"Remember": "Remember me", "Remember": "Remember me",
"Remove": "Remove", "Remove": "Remove",
"RemoveLink": "Remove link",
"Rename": "Rename", "Rename": "Rename",
"RenewSubscription": "Renew subscription?", "RenewSubscription": "Renew subscription?",
"RepeatInvitation": "Repeat invitation", "RepeatInvitation": "Repeat invitation",