From 65e04b76c8a4c0eb6d5826d608d8d0390cfbdf78 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 17:34:17 +0300 Subject: [PATCH 01/23] Web:Common:Api: change withoutMe to excludeSubject at rooms filter --- packages/common/api/rooms/filter.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/common/api/rooms/filter.js b/packages/common/api/rooms/filter.js index 2dffd8ed7f..e996056197 100644 --- a/packages/common/api/rooms/filter.js +++ b/packages/common/api/rooms/filter.js @@ -34,8 +34,8 @@ const DEFAULT_SORT_BY = "DateAndTime"; const SORT_ORDER = "sortorder"; const DEFAULT_SORT_ORDER = "descending"; -const WITHOUT_ME = "withoutMe"; -const DEFAULT_WITHOUT_ME = false; +const EXCLUDE_SUBJECT = "excludeSubject"; +const DEFAULT_EXCLUDE_SUBJECT = false; const WITHOUT_TAGS = "withoutTags"; const DEFAULT_WITHOUT_TAGS = false; @@ -94,7 +94,8 @@ class RoomsFilter { const sortOrder = urlFilter[SORT_ORDER] || defaultFilter.sortOrder; - const withoutMe = urlFilter[WITHOUT_ME] || defaultFilter.withoutMe; + const excludeSubject = + urlFilter[EXCLUDE_SUBJECT] || defaultFilter.excludeSubject; const withoutTags = urlFilter[WITHOUT_TAGS] || defaultFilter.withoutTags; @@ -111,7 +112,7 @@ class RoomsFilter { tags, sortBy, sortOrder, - withoutMe, + excludeSubject, withoutTags ); @@ -131,7 +132,7 @@ class RoomsFilter { tags = DEFAULT_TAGS, sortBy = DEFAULT_SORT_BY, sortOrder = DEFAULT_SORT_ORDER, - withoutMe = DEFAULT_WITHOUT_ME, + excludeSubject = DEFAULT_EXCLUDE_SUBJECT, withoutTags = DEFAULT_WITHOUT_TAGS ) { this.page = page; @@ -146,7 +147,7 @@ class RoomsFilter { this.tags = tags; this.sortBy = sortBy; this.sortOrder = sortOrder; - this.withoutMe = withoutMe; + this.excludeSubject = excludeSubject; this.withoutTags = withoutTags; } @@ -175,7 +176,7 @@ class RoomsFilter { tags, sortBy, sortOrder, - withoutMe, + excludeSubject, withoutTags, } = this; @@ -192,7 +193,7 @@ class RoomsFilter { tags: tags, sortBy: sortBy, sortOrder: sortOrder, - withoutMe: withoutMe, + excludeSubject: excludeSubject, withoutTags: withoutTags, }; @@ -213,7 +214,7 @@ class RoomsFilter { tags, sortBy, sortOrder, - withoutMe, + excludeSubject, withoutTags, } = this; @@ -247,8 +248,8 @@ class RoomsFilter { dtoFilter[PAGE_COUNT] = pageCount; } - if (withoutMe) { - dtoFilter[WITHOUT_ME] = withoutMe; + if (excludeSubject) { + dtoFilter[EXCLUDE_SUBJECT] = excludeSubject; } if (withoutTags) { @@ -282,7 +283,7 @@ class RoomsFilter { this.tags, this.sortBy, this.sortOrder, - this.withoutMe, + this.excludeSubject, this.withoutTags ); } @@ -308,7 +309,7 @@ class RoomsFilter { tagsEqual && this.sortBy === filter.sortBy && this.sortOrder === filter.sortOrder && - this.withoutMe === filter.withoutMe && + this.excludeSubject === filter.excludeSubject && this.withoutTags === filter.withoutTags; return equals; From 0e5b27e8ad3e0c6b1c6368ec4de513d3a108d622 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 17:34:46 +0300 Subject: [PATCH 02/23] Web:Client:Home: update rooms filter with excludeSubject --- .../src/pages/Home/Section/Filter/index.js | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index f0054c1892..1cf23be4ae 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -147,9 +147,7 @@ const SectionFilterContent = ({ const owner = getOwner(data) || null; const subjectId = - owner === FilterKeys.other - ? null - : owner === FilterKeys.me + owner === FilterKeys.other || owner === FilterKeys.me ? userId : owner; @@ -182,7 +180,7 @@ const SectionFilterContent = ({ newFilter.withoutTags = false; } - newFilter.withoutMe = withoutMe; + newFilter.excludeSubject = withoutMe; // newFilter.withSubfolders = withSubfolders; // newFilter.searchInContent = withContent; @@ -369,7 +367,11 @@ const SectionFilterContent = ({ if (roomsFilter.subjectId) { const isMe = userId === roomsFilter.subjectId; - let label = isMe ? t("Common:MeLabel") : null; + let label = isMe + ? roomsFilter.excludeSubject + ? t("Common:OtherLabel") + : t("Common:MeLabel") + : null; if (!isMe) { const user = await getUser(roomsFilter.subjectId); @@ -384,14 +386,6 @@ const SectionFilterContent = ({ }); } - if (roomsFilter.withoutMe) { - filterValues.push({ - key: FilterKeys.other, - group: FilterGroups.roomFilterOwner, - label: t("Common:OtherLabel"), - }); - } - // if (roomsFilter.withoutTags) { // filterValues.push({ // key: [t("NoTag")], @@ -487,7 +481,7 @@ const SectionFilterContent = ({ roomsFilter.subjectId, roomsFilter.tags, roomsFilter.tags?.length, - roomsFilter.withoutMe, + roomsFilter.excludeSubject, roomsFilter.withoutTags, // roomsFilter.withSubfolders, // roomsFilter.searchInContent, @@ -934,7 +928,7 @@ const SectionFilterContent = ({ if (group === FilterGroups.roomFilterOwner) { newFilter.subjectId = null; - newFilter.withoutMe = false; + newFilter.excludeSubject = false; } if (group === FilterGroups.roomFilterTags) { From 45675c5dc1b7ec4458e56bed238b05e56cd0f873 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 18:27:28 +0300 Subject: [PATCH 03/23] Web:Common:Api: add excludeSubject at files filter --- packages/common/api/files/filter.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/common/api/files/filter.js b/packages/common/api/files/filter.js index e3f9d082a3..bf5cc315e0 100644 --- a/packages/common/api/files/filter.js +++ b/packages/common/api/files/filter.js @@ -14,6 +14,7 @@ const DEFAULT_AUTHOR_TYPE = null; const DEFAULT_SELECTED_ITEM = {}; const DEFAULT_FOLDER = "@my"; const DEFAULT_SEARCH_IN_CONTENT = null; +const DEFAULT_EXCLUDE_SUBJECT = null; const SEARCH_TYPE = "withSubfolders"; const AUTHOR_TYPE = "authorType"; @@ -27,6 +28,7 @@ const PAGE_COUNT = "count"; const FOLDER = "folder"; const PREVIEW = "preview"; const SEARCH_IN_CONTENT = "searchInContent"; +const EXCLUDE_SUBJECT = "excludeSubject"; // TODO: add next params // subjectGroup bool @@ -69,6 +71,8 @@ class FilesFilter { const folder = urlFilter[FOLDER] || defaultFilter.folder; const searchInContent = urlFilter[SEARCH_IN_CONTENT] || defaultFilter.searchInContent; + const excludeSubject = + urlFilter[EXCLUDE_SUBJECT] || defaultFilter.excludeSubject; const newFilter = new FilesFilter( page, @@ -83,7 +87,8 @@ class FilesFilter { authorType, defaultFilter.selectedItem, folder, - searchInContent + searchInContent, + excludeSubject ); return newFilter; @@ -102,7 +107,8 @@ class FilesFilter { authorType = DEFAULT_AUTHOR_TYPE, selectedItem = DEFAULT_SELECTED_ITEM, folder = DEFAULT_FOLDER, - searchInContent = DEFAULT_SEARCH_IN_CONTENT + searchInContent = DEFAULT_SEARCH_IN_CONTENT, + excludeSubject = DEFAULT_EXCLUDE_SUBJECT ) { this.page = page; this.pageCount = pageCount; @@ -117,6 +123,7 @@ class FilesFilter { this.selectedItem = selectedItem; this.folder = folder; this.searchInContent = searchInContent; + this.excludeSubject = excludeSubject; } getStartIndex = () => { @@ -143,6 +150,7 @@ class FilesFilter { withSubfolders, startIndex, searchInContent, + excludeSubject, } = this; const isFilterSet = @@ -165,6 +173,7 @@ class FilesFilter { withSubfolders: isFilterSet, userIdOrGroupId, searchInContent, + excludeSubject, }; const str = toUrlParams(dtoFilter, true); @@ -183,6 +192,7 @@ class FilesFilter { sortOrder, withSubfolders, searchInContent, + excludeSubject, } = this; const dtoFilter = {}; @@ -219,6 +229,10 @@ class FilesFilter { dtoFilter[SEARCH_IN_CONTENT] = searchInContent; } + if (excludeSubject) { + dtoFilter[EXCLUDE_SUBJECT] = excludeSubject; + } + dtoFilter[PAGE] = page + 1; dtoFilter[SORT_BY] = sortBy; dtoFilter[SORT_ORDER] = sortOrder; @@ -245,7 +259,8 @@ class FilesFilter { this.authorType, this.selectedItem, this.folder, - this.searchInContent + this.searchInContent, + this.excludeSubject ); } @@ -262,7 +277,8 @@ class FilesFilter { this.selectedItem.key === filter.selectedItem.key && this.folder === filter.folder && this.pageCount === filter.pageCount && - this.searchInContent === filter.searchInContent; + this.searchInContent === filter.searchInContent && + this.excludeSubject === filter.excludeSubject; return equals; } From 2d01924ea6106b5f02595e61c0493509202059ae Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 18:27:54 +0300 Subject: [PATCH 04/23] Web:Common:FilterInput: fix select option --- .../components/FilterInput/sub-components/FilterBlock.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/common/components/FilterInput/sub-components/FilterBlock.js b/packages/common/components/FilterInput/sub-components/FilterBlock.js index 70789425a1..81dc92c540 100644 --- a/packages/common/components/FilterInput/sub-components/FilterBlock.js +++ b/packages/common/components/FilterInput/sub-components/FilterBlock.js @@ -278,12 +278,7 @@ const FilterBlock = ({ show: false, })); - changeFilterValue( - showSelector.group, - items[0].key, - false, - items[0].label - ); + changeFilterValue(showSelector.group, items[0].id, false, items[0].label); }, [showSelector.group, changeFilterValue] ); From 007d25ce8eb07ac5c985e4af44a18784d967ef06 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Fri, 16 Sep 2022 18:28:49 +0300 Subject: [PATCH 05/23] Web:Client:Home: update files filter with 'Other' and 'Me' filter author --- .../src/pages/Home/Section/Filter/index.js | 63 +++++++++++++++---- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 1cf23be4ae..9d336a4a55 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -190,11 +190,8 @@ const SectionFilterContent = ({ } else { const filterType = getFilterType(data) || null; - const authorType = !!getAuthorType(data) - ? getAuthorType(data).includes("user_") - ? getAuthorType(data) - : `user_${getAuthorType(data)}` - : null; + const authorType = getAuthorType(data); + const withSubfolders = getSearchParams(data); const withContent = getFilterContent(data); @@ -203,7 +200,14 @@ const SectionFilterContent = ({ newFilter.filterType = filterType; - newFilter.authorType = authorType; + if (authorType === FilterKeys.me || authorType === FilterKeys.other) { + newFilter.authorType = `user_${userId}`; + newFilter.excludeSubject = authorType === FilterKeys.other; + } else { + newFilter.authorType = authorType ? `user_${authorType}` : null; + newFilter.excludeSubject = null; + } + newFilter.withSubfolders = withSubfolders === FilterKeys.excludeSubfolders ? "false" : "true"; newFilter.searchInContent = withContent === "true" ? "true" : null; @@ -462,11 +466,28 @@ const SectionFilterContent = ({ } if (filter.authorType) { - const user = await getUser(filter.authorType.replace("user_", "")); + const isMe = userId === filter.authorType.replace("user_", ""); + + let label = isMe + ? filter.excludeSubject + ? t("Common:OtherLabel") + : t("Common:MeLabel") + : null; + + if (!isMe) { + const user = await getUser(filter.authorType.replace("user_", "")); + + label = user.displayName; + } + filterValues.push({ - key: `${filter.authorType}`, + key: isMe + ? filter.excludeSubject + ? FilterKeys.other + : FilterKeys.me + : filter.authorType.replace("user_", ""), group: FilterGroups.filterAuthor, - label: user.displayName, + label: label, }); } } @@ -477,6 +498,7 @@ const SectionFilterContent = ({ filter.authorType, filter.filterType, filter.searchInContent, + filter.excludeSubject, roomsFilter.type, roomsFilter.subjectId, roomsFilter.tags, @@ -747,20 +769,33 @@ const SectionFilterContent = ({ } if (!isPersonalRoom) { - filterOptions.push( + const authorOption = [ { key: FilterGroups.filterAuthor, group: FilterGroups.filterAuthor, label: t("ByAuthor"), isHeader: true, + withMultiItems: true, }, { - key: "user", + key: FilterKeys.me, + group: FilterGroups.filterAuthor, + label: t("Common:MeLabel"), + }, + { + key: FilterKeys.other, + group: FilterGroups.filterAuthor, + label: t("Common:OtherLabel"), + }, + { + key: FilterKeys.user, group: FilterGroups.filterAuthor, label: t("Translations:AddAuthor"), isSelector: true, - } - ); + }, + ]; + + filterOptions.push(...authorOption); } filterOptions.push(...typeOptions); @@ -965,11 +1000,13 @@ const SectionFilterContent = ({ ); } else { const newFilter = filter.clone(); + if (group === FilterGroups.filterType) { newFilter.filterType = null; } if (group === FilterGroups.filterAuthor) { newFilter.authorType = null; + newFilter.excludeSubject = null; } if (group === FilterGroups.filterFolders) { newFilter.withSubfolders = "true"; From ab2fb1a8a04a96bf9cd68b336cc4a64ce6cdc91a Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 10:28:31 +0300 Subject: [PATCH 06/23] Web:Client:Home: fix onSearch, onFilter function for rooms --- packages/client/src/pages/Home/Section/Filter/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 9d336a4a55..a212422f55 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -220,6 +220,7 @@ const SectionFilterContent = ({ } }, [ + isRooms, fetchFiles, fetchRooms, setIsLoading, @@ -253,6 +254,7 @@ const SectionFilterContent = ({ } }, [ + isRooms, setIsLoading, fetchFiles, fetchRooms, @@ -285,6 +287,7 @@ const SectionFilterContent = ({ } }, [ + isRooms, setIsLoading, fetchFiles, fetchRooms, @@ -1025,6 +1028,7 @@ const SectionFilterContent = ({ } }, [ + isRooms, fetchFiles, fetchRooms, setIsLoading, From 5b2255d468b27d710d25be651f46e150fdaef863 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 10:47:27 +0300 Subject: [PATCH 07/23] Web:Client:Components: fix empty filter screen for rooms --- .../EmptyContainer/EmptyFilterContainer.js | 38 +++++++++++++----- .../src/components/EmptyContainer/index.js | 40 ++++++++++++++++--- 2 files changed, 64 insertions(+), 14 deletions(-) diff --git a/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js b/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js index c46a171a1b..cb69e5d5ff 100644 --- a/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js +++ b/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js @@ -3,6 +3,7 @@ import { withTranslation } from "react-i18next"; import { inject, observer } from "mobx-react"; import EmptyContainer from "./EmptyContainer"; import FilesFilter from "@docspace/common/api/files/filter"; +import RoomsFilter from "@docspace/common/api/rooms/filter"; import Link from "@docspace/components/link"; import IconButton from "@docspace/components/icon-button"; import toastr from "@docspace/components/toast/toastr"; @@ -12,17 +13,26 @@ const EmptyFilterContainer = ({ selectedFolderId, setIsLoading, fetchFiles, + fetchRooms, linkStyles, + isRooms, }) => { const subheadingText = t("EmptyFilterSubheadingText"); const descriptionText = t("EmptyFilterDescriptionText"); const onResetFilter = () => { setIsLoading(true); - const newFilter = FilesFilter.getDefault(); - fetchFiles(selectedFolderId, newFilter) - .catch((err) => toastr.error(err)) - .finally(() => setIsLoading(false)); + if (isRooms) { + const newFilter = RoomsFilter.getDefault(); + fetchRooms(selectedFolderId, newFilter) + .catch((err) => toastr.error(err)) + .finally(() => setIsLoading(false)); + } else { + const newFilter = FilesFilter.getDefault(); + fetchFiles(selectedFolderId, newFilter) + .catch((err) => toastr.error(err)) + .finally(() => setIsLoading(false)); + } }; const buttons = ( @@ -50,8 +60,18 @@ const EmptyFilterContainer = ({ ); }; -export default inject(({ filesStore, selectedFolderStore }) => ({ - fetchFiles: filesStore.fetchFiles, - selectedFolderId: selectedFolderStore.id, - setIsLoading: filesStore.setIsLoading, -}))(withTranslation(["Files", "Common"])(observer(EmptyFilterContainer))); +export default inject( + ({ filesStore, selectedFolderStore, treeFoldersStore }) => { + const { isRoomsFolder, isArchiveFolder } = treeFoldersStore; + + const isRooms = isRoomsFolder || isArchiveFolder; + + return { + fetchFiles: filesStore.fetchFiles, + fetchRooms: filesStore.fetchRooms, + selectedFolderId: selectedFolderStore.id, + setIsLoading: filesStore.setIsLoading, + isRooms, + }; + } +)(withTranslation(["Files", "Common"])(observer(EmptyFilterContainer))); diff --git a/packages/client/src/components/EmptyContainer/index.js b/packages/client/src/components/EmptyContainer/index.js index 406fc283c1..ebf9871ba9 100644 --- a/packages/client/src/components/EmptyContainer/index.js +++ b/packages/client/src/components/EmptyContainer/index.js @@ -63,19 +63,49 @@ export default inject( treeFoldersStore, selectedFolderStore, }) => { + const { filter, roomsFilter } = filesStore; + const { authorType, search, withSubfolders, filterType, - } = filesStore.filter; - const { isPrivacyFolder } = treeFoldersStore; + searchInContent, + } = filter; + const { + subjectId, + filterValue, + type, + withSubfolders: withRoomsSubfolders, + searchInContent: searchInContentRooms, + tags, + withoutTags, + } = roomsFilter; + + const { + isPrivacyFolder, + isRoomsFolder, + isArchiveFolder, + } = treeFoldersStore; + + const isRooms = isRoomsFolder || isArchiveFolder; const { setCreateRoomDialogVisible } = dialogsStore; - const isFiltered = - (authorType || search || !withSubfolders || filterType) && - !(isPrivacyFolder && isMobile); + const isFiltered = isRooms + ? filterValue || + type || + withRoomsSubfolders || + searchInContentRooms || + subjectId || + tags || + withoutTags + : (authorType || + search || + !withSubfolders || + filterType || + searchInContent) && + !(isPrivacyFolder && isMobile); return { theme: auth.settingsStore.theme, From 3c0bc5e500c50251172928f59c24885560a24cb1 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 11:19:15 +0300 Subject: [PATCH 08/23] Web:Common:API: fix filterValue at roomsFilter after page reload --- packages/common/api/rooms/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/api/rooms/filter.js b/packages/common/api/rooms/filter.js index e996056197..07a3f8b428 100644 --- a/packages/common/api/rooms/filter.js +++ b/packages/common/api/rooms/filter.js @@ -62,7 +62,7 @@ class RoomsFilter { defaultFilter.pageCount; const filterValue = - (urlFilter[FILTER_VALUE] && +urlFilter[FILTER_VALUE]) || + (urlFilter[FILTER_VALUE] && urlFilter[FILTER_VALUE]) || defaultFilter.filterValue; const type = (urlFilter[TYPE] && urlFilter[TYPE]) || defaultFilter.type; From 39366b49ab62a5c06505c95e836a2c5050d17f7e Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 11:23:32 +0300 Subject: [PATCH 09/23] Web:Client:Components: add new tranlsation key for rooms emptyFilterContainer --- packages/client/public/locales/en/Files.json | 1 + .../src/components/EmptyContainer/EmptyFilterContainer.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index 77d58b2666..1b2a72c086 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -19,6 +19,7 @@ "Document": "Document", "EmptyFile": "Empty file", "EmptyFilterDescriptionText": "No files or folders match this filter. Try a different one or clear filter to view all files. ", + "EmptyFilterDescriptionTextRooms": "No rooms match this filter. Try a different one or clear filter to view all rooms.", "EmptyFilterSubheadingText": "No files to be displayed for this filter here", "EmptyFolderDecription": "Drop files here or create new ones.", "EmptyFolderHeader": "No files in this folder", diff --git a/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js b/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js index cb69e5d5ff..fa1b3baab0 100644 --- a/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js +++ b/packages/client/src/components/EmptyContainer/EmptyFilterContainer.js @@ -18,7 +18,9 @@ const EmptyFilterContainer = ({ isRooms, }) => { const subheadingText = t("EmptyFilterSubheadingText"); - const descriptionText = t("EmptyFilterDescriptionText"); + const descriptionText = isRooms + ? t("EmptyFilterDescriptionTextRooms") + : t("EmptyFilterDescriptionText"); const onResetFilter = () => { setIsLoading(true); From 1c40c181eb80dab330ff1da7bd5d93928c80f99e Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 13:23:17 +0300 Subject: [PATCH 10/23] Web:Client: fix reload page for archived rooms --- .../src/components/Article/Body/index.js | 41 ++++++++++--------- packages/client/src/store/FilesStore.js | 10 ----- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/packages/client/src/components/Article/Body/index.js b/packages/client/src/components/Article/Body/index.js index b9c3796117..6ed3ba32df 100644 --- a/packages/client/src/components/Article/Body/index.js +++ b/packages/client/src/components/Article/Body/index.js @@ -4,7 +4,7 @@ import { inject, observer } from "mobx-react"; import { withRouter } from "react-router"; import { setDocumentTitle } from "@docspace/client/src/helpers/filesUtils"; import config from "PACKAGE_FILE"; -import { AppServerConfig } from "@docspace/common/constants"; +import { AppServerConfig, RoomSearchArea } from "@docspace/common/constants"; import Items from "./Items"; import { isMobile, tablet } from "@docspace/components/utils/device"; import FilesFilter from "@docspace/common/api/files/filter"; @@ -80,27 +80,30 @@ const ArticleBodyContent = (props) => { if (folderId === roomsFolderId || folderId === archiveFolderId) { setAlreadyFetchingRooms(true); - fetchRooms(folderId, null) + + const filter = RoomsFilter.getDefault(); + filter.searchArea = + folderId === archiveFolderId + ? RoomSearchArea.Archive + : RoomSearchArea.Active; + + fetchRooms(folderId, filter) .then(() => { - if (filesSection) { - const filter = RoomsFilter.getDefault(); + const url = getCategoryUrl( + folderId === archiveFolderId + ? CategoryType.Archive + : CategoryType.Shared + ); - const url = getCategoryUrl( - folderId === archiveFolderId - ? CategoryType.Archive - : CategoryType.Shared - ); + const filterParamsStr = filter.toUrlParams(); - const filterParamsStr = filter.toUrlParams(); - - history.push( - combineUrl( - AppServerConfig.proxyURL, - homepage, - `${url}?${filterParamsStr}` - ) - ); - } + history.push( + combineUrl( + AppServerConfig.proxyURL, + homepage, + `${url}?${filterParamsStr}` + ) + ); }) .finally(() => { if (isMobileOnly || isMobile()) { diff --git a/packages/client/src/store/FilesStore.js b/packages/client/src/store/FilesStore.js index fd10064e05..98e68a215c 100644 --- a/packages/client/src/store/FilesStore.js +++ b/packages/client/src/store/FilesStore.js @@ -846,16 +846,6 @@ class FilesStore { if (folderId) setSelectedNode([folderId + ""]); - const searchArea = folderId - ? folderId === roomsFolderId - ? RoomSearchArea.Active - : RoomSearchArea.Archive - : RoomSearchArea.Active; - - if (filterData.searchArea !== searchArea) { - filterData.searchArea = searchArea; - } - const request = () => api.rooms .getRooms(filterData) From 0b160d9a3f917958cceaddde9d1a2035060f936c Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Mon, 19 Sep 2022 13:41:47 +0300 Subject: [PATCH 11/23] Web: People: fixed accounts row styles --- .../AccountsHome/Section/Body/RowView/SimpleUserRow.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/client/src/pages/AccountsHome/Section/Body/RowView/SimpleUserRow.js b/packages/client/src/pages/AccountsHome/Section/Body/RowView/SimpleUserRow.js index a833a89b19..ce47c8ad42 100644 --- a/packages/client/src/pages/AccountsHome/Section/Body/RowView/SimpleUserRow.js +++ b/packages/client/src/pages/AccountsHome/Section/Body/RowView/SimpleUserRow.js @@ -82,7 +82,13 @@ const StyledSimpleUserRow = styled(Row)` .styled-element { height: 32px; - margin-right: 7px; + margin-right: 12px; + } + .checkbox { + padding-right: 5px !important; + :hover { + padding-right: 5px !important; + } } `; From a65517a9de2ed9af37ef9619f47e507888cd3748 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 17:09:06 +0300 Subject: [PATCH 12/23] Web: add new alert icon --- public/images/alert.react.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 public/images/alert.react.svg diff --git a/public/images/alert.react.svg b/public/images/alert.react.svg new file mode 100644 index 0000000000..0493065446 --- /dev/null +++ b/public/images/alert.react.svg @@ -0,0 +1,3 @@ + + + From cefb3fa6f0700cc2343ba94cdad1e8b853eac7a6 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 17:09:31 +0300 Subject: [PATCH 13/23] Web:Components:Snackbar: update styles --- packages/components/snackbar/index.js | 69 ++++++++++--------- .../snackbar/styled-snackbar-logo.js | 2 +- .../components/snackbar/styled-snackbar.js | 34 ++++++--- 3 files changed, 63 insertions(+), 42 deletions(-) diff --git a/packages/components/snackbar/index.js b/packages/components/snackbar/index.js index 5f040c563b..8641705ec5 100644 --- a/packages/components/snackbar/index.js +++ b/packages/components/snackbar/index.js @@ -124,13 +124,14 @@ class SnackBar extends React.Component { }} /> ) : ( - <> - {showIcon && ( - - - - )} - +
+
+ {showIcon && ( + + + + )} + {headerText} -
+
+
+ + {text} + + + {btnText && ( - {text} + {btnText} + )} - {btnText && ( - - {btnText} - - )} - - {countDownTime > -1 && ( - - )} -
- - + {countDownTime > -1 && ( + + )} +
+
)} {!btnText && ( )} diff --git a/packages/components/snackbar/styled-snackbar-logo.js b/packages/components/snackbar/styled-snackbar-logo.js index fdefa2b247..5de67ddfd3 100644 --- a/packages/components/snackbar/styled-snackbar-logo.js +++ b/packages/components/snackbar/styled-snackbar-logo.js @@ -1,5 +1,5 @@ import styled from "styled-components"; -import InfoIcon from "../../../public/images/info.react.svg"; +import InfoIcon from "../../../public/images/alert.react.svg"; import commonIconsStyles from "../utils/common-icons-style"; const StyledLogoIcon = styled(InfoIcon)` diff --git a/packages/components/snackbar/styled-snackbar.js b/packages/components/snackbar/styled-snackbar.js index af7f6ec0c2..5a92ea43b1 100644 --- a/packages/components/snackbar/styled-snackbar.js +++ b/packages/components/snackbar/styled-snackbar.js @@ -31,10 +31,6 @@ const StyledSnackBar = styled(Box)` background-color: ${(props) => props.backgroundColor}; background-image: url(${(props) => props.backgroundImg || ""}); - .logo { - padding-right: 10px; - } - .text-container { width: 100%; display: flex; @@ -42,8 +38,24 @@ const StyledSnackBar = styled(Box)` gap: 5px; text-align: ${(props) => props.textalign}; - .text-header { - margin: 0; + .header-body { + width: 100%; + height: 16px; + display: flex; + flex-direction: row; + align-items: center; + gap: 8px; + justify-content: start; + + .text-header { + font-size: 12px; + line-height: 16px; + font-weight: 600; + + text-align: center; + + margin: 0; + } } .text-body { @@ -52,6 +64,12 @@ const StyledSnackBar = styled(Box)` flex-direction: row; gap: 10px; justify-content: ${(props) => props.textalign}; + + .text { + font-size: 12px; + line-height: 16px; + font-weight: 400; + } } } @@ -61,12 +79,12 @@ const StyledSnackBar = styled(Box)` border: none; font-size: inherit; color: "#333"; - margin: 0 0 0 24px; + margin: -2px 4px 4px 24px; padding: 0; min-width: min-content; cursor: pointer; margin-left: auto; - padding-left: 8px; + text-decoration: underline; } From 853fa338ce0ab64a8210fdbb5098adb2ce49db09 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 18:00:08 +0300 Subject: [PATCH 14/23] Web:Client: move MainBar from section to global Layout and fix styles after this --- packages/client/src/Shell.jsx | 113 +++++++++--------- packages/client/src/components/Main/index.js | 11 +- packages/client/src/components/MainBar/Bar.js | 77 ++++++++++++ .../client/src/components/MainBar/index.js | 58 +++++++++ .../components/Article/styled-article.js | 3 +- .../sub-components/section-container.js | 1 - 6 files changed, 205 insertions(+), 58 deletions(-) create mode 100644 packages/client/src/components/MainBar/Bar.js create mode 100644 packages/client/src/components/MainBar/index.js diff --git a/packages/client/src/Shell.jsx b/packages/client/src/Shell.jsx index 6d8a47f972..efc72e78bd 100644 --- a/packages/client/src/Shell.jsx +++ b/packages/client/src/Shell.jsx @@ -29,6 +29,7 @@ import { useThemeDetector } from "SRC_DIR/helpers/utils"; import { isMobileOnly } from "react-device-detect"; import IndicatorLoader from "./components/IndicatorLoader"; import DialogsWrapper from "./components/dialogs/DialogsWrapper"; +import MainBar from "./components/MainBar"; // const { proxyURL } = AppServerConfig; // const homepage = config.homepage; @@ -404,73 +405,77 @@ const Shell = ({ items = [], page = "home", ...rest }) => { {isEditor || !isMobileOnly ? <> : } + {isMobileOnly && !isEditor && }
- - } +
+ + - - - - - - - - - - + "/settings", + "/settings/common", + "/settings/admin", + //"/settings/connected-clouds", + ]} + component={FilesRoute} + /> + + + + + + + + + + +
diff --git a/packages/client/src/components/Main/index.js b/packages/client/src/components/Main/index.js index f1d0f2ace5..e81d2629f8 100644 --- a/packages/client/src/components/Main/index.js +++ b/packages/client/src/components/Main/index.js @@ -7,9 +7,18 @@ const StyledMain = styled.main` width: 100vw; z-index: 0; display: flex; - flex-direction: row; + flex-direction: column; box-sizing: border-box; + .main-container { + width: 100%; + height: 100%; + + display: flex; + flex-direction: row; + box-sizing: border-box; + } + ${isMobileOnly && css` height: auto; diff --git a/packages/client/src/components/MainBar/Bar.js b/packages/client/src/components/MainBar/Bar.js new file mode 100644 index 0000000000..189deab9a3 --- /dev/null +++ b/packages/client/src/components/MainBar/Bar.js @@ -0,0 +1,77 @@ +import React, { useEffect, useState } from "react"; +import difference from "lodash/difference"; + +import { ADS_TIMEOUT } from "@docspace/client/src/helpers/filesConstants"; + +import { getBannerAttribute } from "@docspace/components/utils/banner"; + +import SnackBar from "@docspace/components/snackbar"; + +const bannerHOC = (props) => { + const { firstLoad, setMaintenanceExist } = props; + + const [htmlLink, setHtmlLink] = useState(); + const [campaigns, setCampaigns] = useState(); + + const { loadLanguagePath } = getBannerAttribute(); + + const bar = (localStorage.getItem("bar") || "") + .split(",") + .filter((bar) => bar.length > 0); + + const updateBanner = async () => { + const closed = JSON.parse(localStorage.getItem("barClose")); + const banner = difference(bar, closed); + let index = Number(localStorage.getItem("barIndex") || 0); + + if (banner.length < 1 || index + 1 >= banner.length) { + index = 0; + } else { + index++; + } + + try { + const [htmlUrl, campaigns] = await loadLanguagePath(); + setHtmlLink(htmlUrl); + setCampaigns(campaigns); + } catch (e) { + updateBanner(); + } + + localStorage.setItem("barIndex", index); + return; + }; + + useEffect(() => { + const updateTimeout = setTimeout(() => updateBanner(), 1000); + const updateInterval = setInterval(updateBanner, ADS_TIMEOUT); + return () => { + clearTimeout(updateTimeout); + clearInterval(updateInterval); + }; + }, []); + + const onClose = () => { + setMaintenanceExist(false); + const closeItems = JSON.parse(localStorage.getItem("barClose")) || []; + const closed = + closeItems.length > 0 ? [...closeItems, campaigns] : [campaigns]; + localStorage.setItem("barClose", JSON.stringify(closed)); + setHtmlLink(null); + }; + + const onLoad = () => { + setMaintenanceExist(true); + }; + + return htmlLink && !firstLoad ? ( + + ) : null; +}; + +export default bannerHOC; diff --git a/packages/client/src/components/MainBar/index.js b/packages/client/src/components/MainBar/index.js new file mode 100644 index 0000000000..652843cacb --- /dev/null +++ b/packages/client/src/components/MainBar/index.js @@ -0,0 +1,58 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import styled, { css } from "styled-components"; +import { isMobileOnly } from "react-device-detect"; + +import Bar from "./Bar"; + +import SnackBar from "@docspace/components/snackbar"; + +const StyledContainer = styled.div` + width: 100%; + max-width: 100%; + + ${isMobileOnly && + css` + width: calc(100% + 16px); + max-width: calc(100% + 16px); + + margin-right: -16px; + margin-top: 48px; + `} +`; + +const MainBar = ({ + firstLoad, + checkedMaintenance, + snackbarExist, + setMaintenanceExist, +}) => { + return ( + + {/* {checkedMaintenance && !snackbarExist && ( + + )} */} + console.log("load snackbar")} + /> + + ); +}; + +export default inject(({ auth, filesStore }) => { + const { + checkedMaintenance, + setMaintenanceExist, + snackbarExist, + } = auth.settingsStore; + + const { firstLoad } = filesStore; + + return { firstLoad, checkedMaintenance, snackbarExist, setMaintenanceExist }; +})(observer(MainBar)); diff --git a/packages/common/components/Article/styled-article.js b/packages/common/components/Article/styled-article.js index 33bcfba041..b9d94603ae 100644 --- a/packages/common/components/Article/styled-article.js +++ b/packages/common/components/Article/styled-article.js @@ -68,8 +68,7 @@ const StyledArticle = styled.article` position: fixed; margin: 0; padding: 0; - margin-top: ${(props) => - props.isBannerVisible ? "-16px" : "64px"} !important; + top: ${(props) => (props.isBannerVisible ? "-16px" : "64px")} !important; height: calc(100% - 64px) !important; `} diff --git a/packages/common/components/Section/sub-components/section-container.js b/packages/common/components/Section/sub-components/section-container.js index 6a10bbfb19..56a53263ab 100644 --- a/packages/common/components/Section/sub-components/section-container.js +++ b/packages/common/components/Section/sub-components/section-container.js @@ -71,7 +71,6 @@ const StyledSectionContainer = styled.section` css` width: 100vw !important; max-width: 100vw !important; - margin-top: 48px !important; `} .layout-progress-bar { From 2b17eb76284d8d2926478f89f1c6c647fc8cae80 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 18:03:18 +0300 Subject: [PATCH 15/23] Web:Client:Components: move styles from section to mainbar for html bars --- packages/client/src/components/MainBar/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/client/src/components/MainBar/index.js b/packages/client/src/components/MainBar/index.js index 652843cacb..656dc9991a 100644 --- a/packages/client/src/components/MainBar/index.js +++ b/packages/client/src/components/MainBar/index.js @@ -19,6 +19,15 @@ const StyledContainer = styled.div` margin-right: -16px; margin-top: 48px; `} + + #bar-banner { + margin-bottom: -3px; + } + + #bar-frame { + min-width: 100%; + max-width: 100%; + } `; const MainBar = ({ @@ -27,6 +36,10 @@ const MainBar = ({ snackbarExist, setMaintenanceExist, }) => { + React.useEffect(() => { + return () => setMaintenanceExist && setMaintenanceExist(false); + }, []); + return ( {/* {checkedMaintenance && !snackbarExist && ( From 412c897240cd3364c8869e5eb61085b73bb93fc0 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 18:05:55 +0300 Subject: [PATCH 16/23] Web:Common:Section: delete main bar --- packages/common/components/Section/index.js | 119 +----------------- .../Section/sub-components/section-bar.js | 17 --- 2 files changed, 4 insertions(+), 132 deletions(-) delete mode 100644 packages/common/components/Section/sub-components/section-bar.js diff --git a/packages/common/components/Section/index.js b/packages/common/components/Section/index.js index fd9758e5b2..73b91a7ee9 100644 --- a/packages/common/components/Section/index.js +++ b/packages/common/components/Section/index.js @@ -16,7 +16,7 @@ import SubSectionHeader from "./sub-components/section-header"; import SubSectionFilter from "./sub-components/section-filter"; import SubSectionBody from "./sub-components/section-body"; import SubSectionBodyContent from "./sub-components/section-body-content"; -import SubSectionBar from "./sub-components/section-bar"; + import SubSectionPaging from "./sub-components/section-paging"; //import SectionToggler from "./sub-components/section-toggler"; import InfoPanel from "./sub-components/info-panel"; @@ -35,78 +35,11 @@ const StyledSelectoWrapper = styled.div` } `; -const StyledMainBar = styled.div` - box-sizing: border-box; - - ${NoUserSelect} - - margin-left: -20px; - - width: calc(100% + 20px); - - #bar-banner { - margin-bottom: -3px; - } - - #bar-frame { - min-width: 100%; - max-width: 100%; - } - - @media ${tablet} { - width: calc(100% + 16px); - margin-left: -16px; - } - - ${isMobile && - css` - width: calc(100% + 32px) !important; - margin-left: -16px; - `} - - @media ${mobile} { - width: 100vw !important; - max-width: 100vw !important; - } - - ${isMobileOnly && - css` - width: 100vw !important; - max-width: 100vw !important; - - #bar-frame { - min-width: 100vw; - } - `} - - ${(props) => - !props.isSectionHeaderAvailable && - css` - width: 100vw !important; - max-width: 100vw !important; - - ${isMobile && - css` - position: fixed; - top: 48px; - left: 0; - margin-left: 0 !important; - box-sizing: border-box; - `} - `} -`; - function SectionHeader() { return null; } SectionHeader.displayName = "SectionHeader"; -function SectionBar() { - return null; -} - -SectionBar.displayName = "SectionBar"; - function SectionFilter() { return null; } @@ -136,7 +69,7 @@ class Section extends React.Component { static SectionHeader = SectionHeader; static SectionFilter = SectionFilter; static SectionBody = SectionBody; - static SectionBar = SectionBar; + static SectionPaging = SectionPaging; static InfoPanelBody = InfoPanelBody; static InfoPanelHeader = InfoPanelHeader; @@ -223,7 +156,7 @@ class Section extends React.Component { } = this.props; let sectionHeaderContent = null; - let sectionBarContent = null; + let sectionFilterContent = null; let sectionPagingContent = null; let sectionBodyContent = null; @@ -241,9 +174,7 @@ class Section extends React.Component { case SectionFilter.displayName: sectionFilterContent = child; break; - case SectionBar.displayName: - sectionBarContent = child; - break; + case SectionPaging.displayName: sectionPagingContent = child; break; @@ -268,7 +199,6 @@ class Section extends React.Component { !!sectionBodyContent || isSectionFilterAvailable || isSectionPagingAvailable, - isSectionBarAvailable = !!sectionBarContent, isSectionAvailable = isSectionHeaderAvailable || isSectionFilterAvailable || @@ -296,30 +226,10 @@ class Section extends React.Component { showText={showText} viewAs={viewAs} maintenanceExist={maintenanceExist} - isSectionBarAvailable={isSectionBarAvailable} isSectionHeaderAvailable={isSectionHeaderAvailable} infoPanelIsVisible={infoPanelIsVisible} settingsStudio={settingsStudio} > - {!isMobile && ( - - - {sectionBarContent - ? sectionBarContent.props.children - : null} - - - )} - {isSectionHeaderAvailable && !isMobile && ( - {isMobile && ( - - - {sectionBarContent - ? sectionBarContent.props.children - : null} - - - )} - {isSectionHeaderAvailable && isMobile && ( {children}; - } -} - -SectionBar.displayName = "SectionBar"; - -export default SectionBar; From bf4eee0f113762daa72acb322b76eee3d2afa725 Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Mon, 19 Sep 2022 18:08:00 +0300 Subject: [PATCH 17/23] Fix Confirm LinkInvite validation --- .../ASC.Api.Core/Security/EmailValidationKeyModelHelper.cs | 6 +++--- common/ASC.Api.Core/Security/RoomInvitationLinksService.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/ASC.Api.Core/Security/EmailValidationKeyModelHelper.cs b/common/ASC.Api.Core/Security/EmailValidationKeyModelHelper.cs index a53fe84b85..d4cd395bab 100644 --- a/common/ASC.Api.Core/Security/EmailValidationKeyModelHelper.cs +++ b/common/ASC.Api.Core/Security/EmailValidationKeyModelHelper.cs @@ -106,7 +106,7 @@ public class EmailValidationKeyModelHelper public ValidationResult Validate(EmailValidationKeyModel inDto) { - var (key, emplType, email, uiD, type, fileShare, roomId) = inDto; + var (key, emplType, email, uiD, type, roomAccess, roomId) = inDto; ValidationResult checkKeyResult; @@ -117,9 +117,9 @@ public class EmailValidationKeyModelHelper break; case ConfirmType.LinkInvite: - if (fileShare != default && !string.IsNullOrEmpty(roomId)) + if (roomAccess != default && !string.IsNullOrEmpty(roomId)) { - checkKeyResult = _provider.ValidateEmailKey(email + type + ((int)emplType + (int)fileShare + roomId), key, _provider.ValidEmailKeyInterval); + checkKeyResult = _provider.ValidateEmailKey(email + type + ((int)emplType + (int)roomAccess + roomId), key, _provider.ValidEmailKeyInterval); if (checkKeyResult == ValidationResult.Ok && !_roomLinksService.VisitProcess(roomId, email, key, _provider.ValidVisitLinkInterval)) { diff --git a/common/ASC.Api.Core/Security/RoomInvitationLinksService.cs b/common/ASC.Api.Core/Security/RoomInvitationLinksService.cs index 29d237123d..e95d68a1fd 100644 --- a/common/ASC.Api.Core/Security/RoomInvitationLinksService.cs +++ b/common/ASC.Api.Core/Security/RoomInvitationLinksService.cs @@ -69,7 +69,7 @@ public class RoomInvitationLinksService var postifx = (int)employeeType + fileShare + id.ToString(); var link = _commonLinkUtility.GetConfirmationUrl(email, ConfirmType.LinkInvite, postifx, guid) - + $"&emplType={employeeType:d}&roomId={id}&access={fileShare}"; + + $"&emplType={employeeType:d}&roomId={id}&roomAccess={fileShare}"; return link; } From 22d46d5d4aeeb41edd11cbb28451c451f75da8b9 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Mon, 19 Sep 2022 18:08:27 +0300 Subject: [PATCH 18/23] Web:Client: delete bar from Home and AccountsHome --- .../pages/AccountsHome/Section/Bar/index.js | 83 ------------------- .../src/pages/AccountsHome/Section/index.js | 1 - .../client/src/pages/AccountsHome/index.js | 7 +- .../src/pages/Home/Section/Bar/index.js | 80 ------------------ .../client/src/pages/Home/Section/index.js | 1 - packages/client/src/pages/Home/index.js | 11 --- 6 files changed, 1 insertion(+), 182 deletions(-) delete mode 100644 packages/client/src/pages/AccountsHome/Section/Bar/index.js delete mode 100644 packages/client/src/pages/Home/Section/Bar/index.js diff --git a/packages/client/src/pages/AccountsHome/Section/Bar/index.js b/packages/client/src/pages/AccountsHome/Section/Bar/index.js deleted file mode 100644 index 80796356f8..0000000000 --- a/packages/client/src/pages/AccountsHome/Section/Bar/index.js +++ /dev/null @@ -1,83 +0,0 @@ -import React, { useEffect, useState } from "react"; -import difference from "lodash/difference"; - -import SnackBar from "@docspace/components/snackbar"; -import { Consumer } from "@docspace/components/utils/context"; -import { getBannerAttribute } from "@docspace/components/utils/banner"; - -import { ADS_TIMEOUT } from "SRC_DIR/helpers/constants"; - -const bannerHOC = (props) => { - const { firstLoad, setMaintenanceExist } = props; - - const [htmlLink, setHtmlLink] = useState(); - const [campaigns, setCampaigns] = useState(); - - const { loadLanguagePath } = getBannerAttribute(); - - const bar = (localStorage.getItem("bar") || "") - .split(",") - .filter((bar) => bar.length > 0); - - const updateBanner = async () => { - const closed = JSON.parse(localStorage.getItem("barClose")); - const banner = difference(bar, closed); - let index = Number(localStorage.getItem("barIndex") || 0); - - if (banner.length < 1 || index + 1 >= banner.length) { - index = 0; - } else { - index++; - } - - try { - const [htmlUrl, campaigns] = await loadLanguagePath(); - setHtmlLink(htmlUrl); - setCampaigns(campaigns); - } catch (e) { - updateBanner(); - } - - localStorage.setItem("barIndex", index); - return; - }; - - useEffect(() => { - const updateTimeout = setTimeout(() => updateBanner(), 1000); - const updateInterval = setInterval(updateBanner, ADS_TIMEOUT); - - return () => { - clearTimeout(updateTimeout); - clearInterval(updateInterval); - }; - }, []); - - const onClose = () => { - setMaintenanceExist(false); - const closeItems = JSON.parse(localStorage.getItem("barClose")) || []; - const closed = - closeItems.length > 0 ? [...closeItems, campaigns] : [campaigns]; - localStorage.setItem("barClose", JSON.stringify(closed)); - setHtmlLink(null); - }; - - const onLoad = () => { - setMaintenanceExist(true); - }; - - return htmlLink && !firstLoad ? ( - - {(context) => ( - - )} - - ) : null; -}; - -export default bannerHOC; diff --git a/packages/client/src/pages/AccountsHome/Section/index.js b/packages/client/src/pages/AccountsHome/Section/index.js index d853a2b755..0dd73dbd2a 100644 --- a/packages/client/src/pages/AccountsHome/Section/index.js +++ b/packages/client/src/pages/AccountsHome/Section/index.js @@ -2,4 +2,3 @@ export { default as SectionHeaderContent } from "./Header"; export { default as SectionBodyContent } from "./Body"; export { default as SectionFilterContent } from "./Filter"; export { default as SectionPagingContent } from "./Paging"; -export { default as Bar } from "./Bar"; diff --git a/packages/client/src/pages/AccountsHome/index.js b/packages/client/src/pages/AccountsHome/index.js index 1b61a8c782..d3aa90b14f 100644 --- a/packages/client/src/pages/AccountsHome/index.js +++ b/packages/client/src/pages/AccountsHome/index.js @@ -18,7 +18,6 @@ import { SectionBodyContent, SectionFilterContent, SectionPagingContent, - Bar, } from "./Section"; import Dialogs from "./Section/Body/Dialogs"; //TODO: Move dialogs to another folder @@ -87,11 +86,7 @@ const PureHome = ({ - - {checkedMaintenance && !snackbarExist && ( - - )} - + diff --git a/packages/client/src/pages/Home/Section/Bar/index.js b/packages/client/src/pages/Home/Section/Bar/index.js deleted file mode 100644 index a6da0bc94b..0000000000 --- a/packages/client/src/pages/Home/Section/Bar/index.js +++ /dev/null @@ -1,80 +0,0 @@ -import React, { useEffect, useState } from "react"; -import { ADS_TIMEOUT } from "@docspace/client/src/helpers/filesConstants"; -import SnackBar from "@docspace/components/snackbar"; -import { Consumer } from "@docspace/components/utils/context"; -import difference from "lodash/difference"; -import { getBannerAttribute } from "@docspace/components/utils/banner"; - -const bannerHOC = (props) => { - const { firstLoad, setMaintenanceExist } = props; - - const [htmlLink, setHtmlLink] = useState(); - const [campaigns, setCampaigns] = useState(); - - const { loadLanguagePath } = getBannerAttribute(); - - const bar = (localStorage.getItem("bar") || "") - .split(",") - .filter((bar) => bar.length > 0); - - const updateBanner = async () => { - const closed = JSON.parse(localStorage.getItem("barClose")); - const banner = difference(bar, closed); - let index = Number(localStorage.getItem("barIndex") || 0); - - if (banner.length < 1 || index + 1 >= banner.length) { - index = 0; - } else { - index++; - } - - try { - const [htmlUrl, campaigns] = await loadLanguagePath(); - setHtmlLink(htmlUrl); - setCampaigns(campaigns); - } catch (e) { - updateBanner(); - } - - localStorage.setItem("barIndex", index); - return; - }; - - useEffect(() => { - const updateTimeout = setTimeout(() => updateBanner(), 1000); - const updateInterval = setInterval(updateBanner, ADS_TIMEOUT); - return () => { - clearTimeout(updateTimeout); - clearInterval(updateInterval); - }; - }, []); - - const onClose = () => { - setMaintenanceExist(false); - const closeItems = JSON.parse(localStorage.getItem("barClose")) || []; - const closed = - closeItems.length > 0 ? [...closeItems, campaigns] : [campaigns]; - localStorage.setItem("barClose", JSON.stringify(closed)); - setHtmlLink(null); - }; - - const onLoad = () => { - setMaintenanceExist(true); - }; - - return htmlLink && !firstLoad ? ( - - {(context) => ( - - )} - - ) : null; -}; - -export default bannerHOC; diff --git a/packages/client/src/pages/Home/Section/index.js b/packages/client/src/pages/Home/Section/index.js index d853a2b755..0dd73dbd2a 100644 --- a/packages/client/src/pages/Home/Section/index.js +++ b/packages/client/src/pages/Home/Section/index.js @@ -2,4 +2,3 @@ export { default as SectionHeaderContent } from "./Header"; export { default as SectionBodyContent } from "./Body"; export { default as SectionFilterContent } from "./Filter"; export { default as SectionPagingContent } from "./Paging"; -export { default as Bar } from "./Bar"; diff --git a/packages/client/src/pages/Home/index.js b/packages/client/src/pages/Home/index.js index a14b104560..4ea8eab35f 100644 --- a/packages/client/src/pages/Home/index.js +++ b/packages/client/src/pages/Home/index.js @@ -21,7 +21,6 @@ import { SectionFilterContent, SectionHeaderContent, SectionPagingContent, - Bar, } from "./Section"; import { InfoPanelBodyContent, InfoPanelHeaderContent } from "./InfoPanel"; import MediaViewer from "./MediaViewer"; @@ -524,16 +523,6 @@ class PureHome extends React.Component { )} - - {checkedMaintenance && !snackbarExist && ( - - )} - - {isFrame ? ( showFilter && From 004801327ab00fef419f9be12e3d00a8065208d1 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Tue, 20 Sep 2022 11:37:26 +0300 Subject: [PATCH 19/23] Web:Client:Components: commented useless code for main bar --- .../client/src/components/MainBar/index.js | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/packages/client/src/components/MainBar/index.js b/packages/client/src/components/MainBar/index.js index 656dc9991a..950363c980 100644 --- a/packages/client/src/components/MainBar/index.js +++ b/packages/client/src/components/MainBar/index.js @@ -30,30 +30,37 @@ const StyledContainer = styled.div` } `; +//TODO: remove commented code after update bar logic + const MainBar = ({ firstLoad, checkedMaintenance, snackbarExist, setMaintenanceExist, }) => { + // const [isVisible, setIsVisible] = React.useState(false); + React.useEffect(() => { + // setTimeout(() => setIsVisible(true), 9000); return () => setMaintenanceExist && setMaintenanceExist(false); }, []); return ( - {/* {checkedMaintenance && !snackbarExist && ( + {checkedMaintenance && !snackbarExist && ( + )} + {/* {isVisible && ( + console.log("load snackbar")} + /> )} */} - console.log("load snackbar")} - /> ); }; From f2ac8a3b0ff4c22b769849014cbae184c77baf59 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Tue, 20 Sep 2022 12:37:33 +0300 Subject: [PATCH 20/23] Web:Client:Shell: delete useless check isEditor --- packages/client/src/Shell.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/src/Shell.jsx b/packages/client/src/Shell.jsx index efc72e78bd..3152496735 100644 --- a/packages/client/src/Shell.jsx +++ b/packages/client/src/Shell.jsx @@ -405,12 +405,12 @@ const Shell = ({ items = [], page = "home", ...rest }) => { {isEditor || !isMobileOnly ? <> : } - {isMobileOnly && !isEditor && } + {isMobileOnly && }
- {!isMobileOnly && !isEditor && } + {!isMobileOnly && }
Date: Tue, 20 Sep 2022 12:46:24 +0300 Subject: [PATCH 21/23] Web: delete alert.react.svg icon --- public/images/alert.react.svg | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 public/images/alert.react.svg diff --git a/public/images/alert.react.svg b/public/images/alert.react.svg deleted file mode 100644 index 0493065446..0000000000 --- a/public/images/alert.react.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - From f1a8310ac3c0f158f76c8b3807d5188b928d2157 Mon Sep 17 00:00:00 2001 From: TimofeyBoyko Date: Tue, 20 Sep 2022 12:56:14 +0300 Subject: [PATCH 22/23] Web: move svg from toast to public path --- packages/components/snackbar/styled-snackbar-logo.js | 2 +- packages/components/toast/svg/index.js | 3 --- packages/components/toast/toastr.js | 4 +++- .../toast/svg => public/images}/check.toast.react.svg | 0 .../toast/svg => public/images}/danger.toast.react.svg | 0 .../toast/svg => public/images}/info.toast.react.svg | 0 6 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 packages/components/toast/svg/index.js rename {packages/components/toast/svg => public/images}/check.toast.react.svg (100%) rename {packages/components/toast/svg => public/images}/danger.toast.react.svg (100%) rename {packages/components/toast/svg => public/images}/info.toast.react.svg (100%) diff --git a/packages/components/snackbar/styled-snackbar-logo.js b/packages/components/snackbar/styled-snackbar-logo.js index 5de67ddfd3..8dc009a6e7 100644 --- a/packages/components/snackbar/styled-snackbar-logo.js +++ b/packages/components/snackbar/styled-snackbar-logo.js @@ -1,5 +1,5 @@ import styled from "styled-components"; -import InfoIcon from "../../../public/images/alert.react.svg"; +import InfoIcon from "../../../public/images/danger.toast.react.svg"; import commonIconsStyles from "../utils/common-icons-style"; const StyledLogoIcon = styled(InfoIcon)` diff --git a/packages/components/toast/svg/index.js b/packages/components/toast/svg/index.js deleted file mode 100644 index 521bd2d7cf..0000000000 --- a/packages/components/toast/svg/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export { default as CheckToastIcon } from "./check.toast.react.svg"; -export { default as DangerToastIcon } from "./danger.toast.react.svg"; -export { default as InfoToastIcon } from "./info.toast.react.svg"; diff --git a/packages/components/toast/toastr.js b/packages/components/toast/toastr.js index bda176fb90..47188c8004 100644 --- a/packages/components/toast/toastr.js +++ b/packages/components/toast/toastr.js @@ -2,7 +2,9 @@ import React from "react"; import { toast } from "react-toastify"; import styled from "styled-components"; -import { CheckToastIcon, DangerToastIcon, InfoToastIcon } from "./svg"; +import CheckToastIcon from "../../../public/images/check.toast.react.svg"; +import DangerToastIcon from "../../../public/images/danger.toast.react.svg"; +import InfoToastIcon from "../../../public/images/info.toast.react.svg"; import Text from "../text"; import { diff --git a/packages/components/toast/svg/check.toast.react.svg b/public/images/check.toast.react.svg similarity index 100% rename from packages/components/toast/svg/check.toast.react.svg rename to public/images/check.toast.react.svg diff --git a/packages/components/toast/svg/danger.toast.react.svg b/public/images/danger.toast.react.svg similarity index 100% rename from packages/components/toast/svg/danger.toast.react.svg rename to public/images/danger.toast.react.svg diff --git a/packages/components/toast/svg/info.toast.react.svg b/public/images/info.toast.react.svg similarity index 100% rename from packages/components/toast/svg/info.toast.react.svg rename to public/images/info.toast.react.svg From 6c1d1981a3cbd5dc302612f9cc82e0fc5c2c1b2b Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Tue, 20 Sep 2022 14:00:34 +0300 Subject: [PATCH 23/23] Web: Files: fixed plus icon click for shared folder --- packages/client/src/pages/Home/Section/Header/index.js | 10 ++++------ packages/common/components/Navigation/Navigation.js | 4 ++++ .../Navigation/sub-components/control-btn.js | 6 ++++++ .../components/Navigation/sub-components/plus-btn.js | 10 ++++++++-- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Header/index.js b/packages/client/src/pages/Home/Section/Header/index.js index c490bfd77d..aebb35c027 100644 --- a/packages/client/src/pages/Home/Section/Header/index.js +++ b/packages/client/src/pages/Home/Section/Header/index.js @@ -4,12 +4,7 @@ import styled, { css } from "styled-components"; import { withRouter } from "react-router"; import toastr from "@docspace/components/toast/toastr"; import Loaders from "@docspace/common/components/Loaders"; -import { - AppServerConfig, - FileAction, - FolderType, - RoomSearchArea, -} from "@docspace/common/constants"; +import { AppServerConfig } from "@docspace/common/constants"; import { withTranslation } from "react-i18next"; import { isMobile, isTablet, isMobileOnly } from "react-device-detect"; import DropDownItem from "@docspace/components/drop-down-item"; @@ -465,6 +460,7 @@ class SectionHeaderContent extends React.Component { isHeaderIndeterminate, showText, toggleInfoPanel, + isRoomsFolder, } = this.props; const menuItems = this.getMenuItems(); const isLoading = !title || !tReady; @@ -514,6 +510,8 @@ class SectionHeaderContent extends React.Component { titles={{ trash: t("EmptyRecycleBin"), }} + withMenu={!isRoomsFolder} + onPlusClick={this.onCreateRoom} /> )}
diff --git a/packages/common/components/Navigation/Navigation.js b/packages/common/components/Navigation/Navigation.js index b0e6eb7d30..6fe6bf6062 100644 --- a/packages/common/components/Navigation/Navigation.js +++ b/packages/common/components/Navigation/Navigation.js @@ -41,6 +41,8 @@ const Navigation = ({ toggleInfoPanel, isInfoPanelVisible, titles, + withMenu, + onPlusClick, ...rest }) => { const [isOpen, setIsOpen] = React.useState(false); @@ -184,6 +186,8 @@ const Navigation = ({ isInfoPanelVisible={isInfoPanelVisible} isDesktop={isDesktop} titles={titles} + withMenu={withMenu} + onPlusClick={onPlusClick} /> {isDesktop && ( diff --git a/packages/common/components/Navigation/sub-components/control-btn.js b/packages/common/components/Navigation/sub-components/control-btn.js index b67270f403..ca3206c4e3 100644 --- a/packages/common/components/Navigation/sub-components/control-btn.js +++ b/packages/common/components/Navigation/sub-components/control-btn.js @@ -102,6 +102,8 @@ const ControlButtons = ({ toggleDropBox, isDesktop, titles, + withMenu, + onPlusClick, }) => { const toggleInfoPanelAction = () => { toggleInfoPanel && toggleInfoPanel(); @@ -116,6 +118,8 @@ const ControlButtons = ({ )} {!personal && ( @@ -144,6 +148,8 @@ const ControlButtons = ({ )} {!isDesktop && ( diff --git a/packages/common/components/Navigation/sub-components/plus-btn.js b/packages/common/components/Navigation/sub-components/plus-btn.js index 24a01b565c..6a3746d848 100644 --- a/packages/common/components/Navigation/sub-components/plus-btn.js +++ b/packages/common/components/Navigation/sub-components/plus-btn.js @@ -8,7 +8,7 @@ const PlusButton = (props) => { const ref = useRef(null); const menuRef = useRef(null); - const { className, getData } = props; + const { className, getData, withMenu, onPlusClick } = props; const toggle = (e, isOpen) => { isOpen ? menuRef.current.show(e) : menuRef.current.hide(e); @@ -16,7 +16,8 @@ const PlusButton = (props) => { }; const onClick = (e) => { - toggle(e, !isOpen); + if (withMenu) toggle(e, !isOpen); + else onPlusClick && onPlusClick(); }; const onHide = () => { @@ -48,6 +49,11 @@ const PlusButton = (props) => { PlusButton.propTypes = { className: PropTypes.string, getData: PropTypes.func.isRequired, + onPlusClick: PropTypes.func, +}; + +PlusButton.defaultProps = { + withMenu: true, }; export default PlusButton;