From c90f97f4ecfaa6b274e472faaa4aba49530a5c23 Mon Sep 17 00:00:00 2001 From: Roie Natan Date: Thu, 19 Oct 2023 13:44:28 +0100 Subject: [PATCH 01/37] about page root common: show join common button --- .../MembershipRequestModal/MembershipRequestIntroduce.tsx | 4 ++-- .../CommonEntranceJoin/CommonEntranceJoin.module.scss | 2 +- .../components/CommonEntranceJoin/CommonEntranceJoin.tsx | 2 +- .../components/CommonTopNavigation/CommonTopNavigation.tsx | 2 +- src/pages/common/providers/CommonData/CommonData.tsx | 3 --- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/pages/OldCommon/components/CommonDetailContainer/MembershipRequestModal/MembershipRequestIntroduce.tsx b/src/pages/OldCommon/components/CommonDetailContainer/MembershipRequestModal/MembershipRequestIntroduce.tsx index 56e4cc4274..8d36895b95 100644 --- a/src/pages/OldCommon/components/CommonDetailContainer/MembershipRequestModal/MembershipRequestIntroduce.tsx +++ b/src/pages/OldCommon/components/CommonDetailContainer/MembershipRequestModal/MembershipRequestIntroduce.tsx @@ -1,11 +1,11 @@ import React, { useCallback } from "react"; import { useSelector } from "react-redux"; import { Formik, FormikConfig } from "formik"; -import { Button } from "@/shared/components"; import { Form, TextField, LinksArray } from "@/shared/components/Form/Formik"; import { ScreenSize, MAX_LINK_TITLE_LENGTH } from "@/shared/constants"; import { CommonLink } from "@/shared/models"; import { getScreenSize } from "@/shared/store/selectors"; +import { Button, ButtonVariant } from "@/shared/ui-kit"; import { parseLinksForSubmission } from "@/shared/utils"; import { IStageProps } from "./MembershipRequestModal"; import { MembershipRequestStage } from "./constants"; @@ -95,7 +95,7 @@ export default function MembershipRequestIntroduce(props: IStageProps) { className="membership-request-introduce__submit-button" type="submit" disabled={!isValid} - shouldUseFullWidth={isMobileView} + variant={ButtonVariant.PrimaryPink} > Continue diff --git a/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.module.scss b/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.module.scss index a7bc347d2c..4ce189cea1 100644 --- a/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.module.scss +++ b/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.module.scss @@ -2,9 +2,9 @@ @import "../../../../../../../../../../styles/sizes"; .joinButton { - max-width: 8.5rem; margin-top: 1.75rem; padding: 0 0.875rem; + width: 100%; @include tablet { margin-top: 1.625rem; diff --git a/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx b/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx index db5c6179d9..e1136a86d1 100644 --- a/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx +++ b/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx @@ -67,7 +67,7 @@ const CommonEntranceJoin: FC = (props) => { page

)} - {withJoinRequest && (isJoinAllowed || isJoinPending) && ( + {!isProject && (isJoinAllowed || isJoinPending) && ( )} {!commonMember && rootCommonMember && From d4118d20b8016e951b76ac09c3fd33aa596cdab5 Mon Sep 17 00:00:00 2001 From: Andrey Mikhadyuk Date: Mon, 23 Oct 2023 10:42:23 +0300 Subject: [PATCH 05/37] remove `Edit profile` button on mobile --- .../UserDetails/UserDetails.module.scss | 9 -------- .../components/UserDetails/UserDetails.tsx | 22 +++++-------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/pages/MyAccount/components/Profile/components/UserDetails/UserDetails.module.scss b/src/pages/MyAccount/components/Profile/components/UserDetails/UserDetails.module.scss index da7141e309..9af7df8f38 100644 --- a/src/pages/MyAccount/components/Profile/components/UserDetails/UserDetails.module.scss +++ b/src/pages/MyAccount/components/Profile/components/UserDetails/UserDetails.module.scss @@ -83,15 +83,6 @@ } } -.editProfileButton { - --btn-h: 1.5rem; - --btn-pl: 0.25rem; - --btn-pr: 0.25rem; - - margin-top: 0.25rem; - font-weight: 500; -} - .userPhoto { width: 6.25rem; height: 6.25rem; diff --git a/src/pages/MyAccount/components/Profile/components/UserDetails/UserDetails.tsx b/src/pages/MyAccount/components/Profile/components/UserDetails/UserDetails.tsx index 57dc568219..a2f8c92335 100644 --- a/src/pages/MyAccount/components/Profile/components/UserDetails/UserDetails.tsx +++ b/src/pages/MyAccount/components/Profile/components/UserDetails/UserDetails.tsx @@ -289,23 +289,11 @@ const UserDetails: ForwardRefRenderFunction< /> {!isEditing && ( - <> - - {isMobileView && ( - - )} - + )} {!isEditing && user.intro && ( From bfd5174cb080f9942b2945ba3f9ba3e59e6d4c5a Mon Sep 17 00:00:00 2001 From: Roie Natan Date: Mon, 23 Oct 2023 10:24:04 +0100 Subject: [PATCH 06/37] update isJoinAllowed condition --- .../components/CommonEntranceJoin/CommonEntranceJoin.tsx | 2 +- src/pages/common/providers/CommonData/CommonData.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx b/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx index 7415a9e920..c823fa7709 100644 --- a/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx +++ b/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx @@ -14,7 +14,7 @@ interface CommonEntranceJoinProps { } const CommonEntranceJoin: FC = (props) => { - const { withJoinRequest = false, common, isProject } = props; + const { common, isProject } = props; const history = useHistory(); const { parentCommon, diff --git a/src/pages/common/providers/CommonData/CommonData.tsx b/src/pages/common/providers/CommonData/CommonData.tsx index 03035d23b9..4f6f99cafc 100644 --- a/src/pages/common/providers/CommonData/CommonData.tsx +++ b/src/pages/common/providers/CommonData/CommonData.tsx @@ -123,7 +123,7 @@ const CommonData: FC = (props) => { isGlobalDataFetched && !isJoinPending && ((!isProject && !commonMember) || - (isProject && parentCommonMember && !commonMember)), + (isProject && rootCommonMember && parentCommonMember && !commonMember)), ); const handleMenuItemSelect = useCallback( From f36f26267a0ed7bcad1d6cd90ea94c674cc20315 Mon Sep 17 00:00:00 2001 From: Andrey Mikhadyuk Date: Mon, 23 Oct 2023 14:10:09 +0300 Subject: [PATCH 07/37] add sorting to the feed item list --- src/store/states/common/reducer.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/store/states/common/reducer.ts b/src/store/states/common/reducer.ts index 27c63fa277..150dd9154e 100644 --- a/src/store/states/common/reducer.ts +++ b/src/store/states/common/reducer.ts @@ -43,6 +43,14 @@ const initialState: CommonState = { recentAssignedCircle: null, }; +const sortFeedItems = (data: FeedItemFollowLayoutItem[]): void => { + data.sort( + (prevItem, nextItem) => + nextItem.feedItem.updatedAt.toMillis() - + prevItem.feedItem.updatedAt.toMillis(), + ); +}; + const updateFeedItemInList = ( state: WritableDraft, payload: { @@ -76,10 +84,17 @@ const updateFeedItemInList = ( ...updatedItem, }, }; + sortFeedItems(nextData); } + const firstDocTimestamp = nextData[0]?.feedItem.updatedAt || null; + const lastDocTimestamp = + nextData[nextData.length - 1]?.feedItem.updatedAt || null; + state.feedItems = { ...state.feedItems, + firstDocTimestamp, + lastDocTimestamp, data: nextData, }; }; @@ -95,8 +110,6 @@ const addNewFeedItems = ( }[], shouldSortNewItems = false, ) => { - let firstDocTimestamp = state.feedItems.firstDocTimestamp; - const data = payload.reduceRight((acc, { commonFeedItem, statuses }) => { const nextData = [...acc]; const itemIndex = nextData.findIndex( @@ -117,7 +130,6 @@ const addNewFeedItems = ( itemId: commonFeedItem.id, feedItem: commonFeedItem, }; - firstDocTimestamp = commonFeedItem.updatedAt; if (itemIndex >= 0) { nextData[itemIndex] = finalItem; @@ -139,11 +151,16 @@ const addNewFeedItems = ( return nextData; }, state.feedItems.data || []); + sortFeedItems(data); + + const firstDocTimestamp = data[0]?.feedItem.updatedAt || null; + const lastDocTimestamp = data[data.length - 1]?.feedItem.updatedAt || null; state.feedItems = { ...state.feedItems, data, firstDocTimestamp, + lastDocTimestamp, }; }; From 53a3e6cee2a734f111024306323d27d6f8bb9674 Mon Sep 17 00:00:00 2001 From: Andrey Mikhadyuk Date: Mon, 23 Oct 2023 15:20:53 +0300 Subject: [PATCH 08/37] add sorting to update list of inbox items --- src/store/states/inbox/reducer.ts | 40 +++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/store/states/inbox/reducer.ts b/src/store/states/inbox/reducer.ts index af17b96832..ef82ac6c60 100644 --- a/src/store/states/inbox/reducer.ts +++ b/src/store/states/inbox/reducer.ts @@ -7,7 +7,7 @@ import { checkIsFeedItemFollowLayoutItem, FeedLayoutItemWithFollowData, } from "@/shared/interfaces"; -import { ChatChannel, CommonFeed } from "@/shared/models"; +import { ChatChannel, CommonFeed, Timestamp } from "@/shared/models"; import * as actions from "./actions"; import { InboxItems, InboxState } from "./types"; import { getFeedLayoutItemDateForSorting } from "./utils"; @@ -30,6 +30,26 @@ const initialState: InboxState = { nextChatChannelItemId: null, }; +const sortInboxItems = (data: FeedLayoutItemWithFollowData[]): void => { + data.sort( + (prevItem, nextItem) => + getFeedLayoutItemDateForSorting(nextItem).toMillis() - + getFeedLayoutItemDateForSorting(prevItem).toMillis(), + ); +}; + +const getDocTimestamps = ( + data: FeedLayoutItemWithFollowData[], +): { + firstDocTimestamp: Timestamp | null; + lastDocTimestamp: Timestamp | null; +} => ({ + firstDocTimestamp: data[0] ? getFeedLayoutItemDateForSorting(data[0]) : null, + lastDocTimestamp: data[data.length - 1] + ? getFeedLayoutItemDateForSorting(data[data.length - 1]) + : null, +}); + const updateInboxItemInList = ( state: WritableDraft, payload: { @@ -64,10 +84,14 @@ const updateInboxItemInList = ( ...nextData[itemIndex], ...updatedItem, }; + sortInboxItems(nextData); } + const { firstDocTimestamp, lastDocTimestamp } = getDocTimestamps(nextData); state.items = { ...state.items, + firstDocTimestamp, + lastDocTimestamp, data: nextData, }; }; @@ -162,9 +186,13 @@ const updateFeedItemInInboxItem = ( feedItem: { ...newFeedItem }, }, }; + sortInboxItems(nextData); + const { firstDocTimestamp, lastDocTimestamp } = getDocTimestamps(nextData); state.items = { ...state.items, + firstDocTimestamp, + lastDocTimestamp, data: nextData, }; }; @@ -285,9 +313,13 @@ const updateChatChannelItemInInboxItem = ( lastMessage: updatedChatChannelItem.lastMessage || undefined, }, }; + sortInboxItems(nextData); + const { firstDocTimestamp, lastDocTimestamp } = getDocTimestamps(nextData); state.items = { ...state.items, + firstDocTimestamp, + lastDocTimestamp, data: nextData, }; }; @@ -421,8 +453,6 @@ export const reducer = createReducer(initialState) (chatChannelItem) => chatChannelItem.itemId === item.item.itemId, ), ); - let firstDocTimestamp = nextState.items.firstDocTimestamp; - const data = payload.reduceRight((acc, { item, statuses }) => { const nextData = [...acc]; const itemIndex = nextData.findIndex( @@ -443,7 +473,6 @@ export const reducer = createReducer(initialState) } const finalItem: FeedLayoutItemWithFollowData = { ...item }; - firstDocTimestamp = getFeedLayoutItemDateForSorting(item); if (itemIndex < 0) { return [finalItem, ...nextData]; @@ -453,11 +482,14 @@ export const reducer = createReducer(initialState) return nextData; }, nextState.items.data || []); + sortInboxItems(data); + const { firstDocTimestamp, lastDocTimestamp } = getDocTimestamps(data); nextState.items = { ...nextState.items, data, firstDocTimestamp, + lastDocTimestamp, }; }), ) From e389ed95f6b69c62badcb0d654e6d0b982dc1e17 Mon Sep 17 00:00:00 2001 From: Andrey Mikhadyuk Date: Mon, 23 Oct 2023 17:38:25 +0300 Subject: [PATCH 09/37] disable scroll anchor for feed item list --- .../commonFeed/components/FeedLayout/FeedLayout.module.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/commonFeed/components/FeedLayout/FeedLayout.module.scss b/src/pages/commonFeed/components/FeedLayout/FeedLayout.module.scss index aea11cb6ba..d08805480b 100644 --- a/src/pages/commonFeed/components/FeedLayout/FeedLayout.module.scss +++ b/src/pages/commonFeed/components/FeedLayout/FeedLayout.module.scss @@ -5,6 +5,7 @@ padding: 0 1.5rem; display: flex; flex-direction: column; + overflow-anchor: none; & > * { margin-bottom: 0; From 14c31926a14aa1fa47901fdefdd6da47f148560b Mon Sep 17 00:00:00 2001 From: Roie Natan Date: Mon, 23 Oct 2023 15:48:09 +0100 Subject: [PATCH 10/37] bring back withJoinRequest --- .../components/CommonEntranceJoin/CommonEntranceJoin.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx b/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx index c823fa7709..95d06595b2 100644 --- a/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx +++ b/src/pages/common/components/CommonTabPanels/components/AboutTab/components/CommonEntranceInfo/components/CommonEntranceJoin/CommonEntranceJoin.tsx @@ -14,7 +14,7 @@ interface CommonEntranceJoinProps { } const CommonEntranceJoin: FC = (props) => { - const { common, isProject } = props; + const { withJoinRequest, common, isProject } = props; const history = useHistory(); const { parentCommon, @@ -68,7 +68,7 @@ const CommonEntranceJoin: FC = (props) => { page

)} - {!isProject && (isJoinAllowed || isJoinPending) && ( + {withJoinRequest && !isProject && (isJoinAllowed || isJoinPending) && (