From e9cb269c21265135dc4b44f043f0bcdfe5781bac Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Wed, 3 Apr 2024 11:09:51 +0300 Subject: [PATCH 1/6] CW-prod-privacy-policy Added privacy policy page --- .../App/router/configuration/emptyLayout.tsx | 6 +++ src/pages/PrivacyPolicy/PrivacyPolicy.scss | 38 +++++++++++++++++++ src/pages/PrivacyPolicy/PrivacyPolicy.tsx | 20 ++++++++++ src/pages/PrivacyPolicy/index.ts | 1 + src/shared/constants/routePaths.tsx | 1 + 5 files changed, 66 insertions(+) create mode 100644 src/pages/PrivacyPolicy/PrivacyPolicy.scss create mode 100644 src/pages/PrivacyPolicy/PrivacyPolicy.tsx create mode 100644 src/pages/PrivacyPolicy/index.ts diff --git a/src/pages/App/router/configuration/emptyLayout.tsx b/src/pages/App/router/configuration/emptyLayout.tsx index 52ca45102d..a794de5928 100644 --- a/src/pages/App/router/configuration/emptyLayout.tsx +++ b/src/pages/App/router/configuration/emptyLayout.tsx @@ -1,3 +1,4 @@ +import { PrivacyPolicy } from "@/pages/PrivacyPolicy"; import { EmptyPage } from "@/pages/empty"; import { ROUTE_PATHS } from "@/shared/constants"; import { EmptyLayout } from "@/shared/layouts"; @@ -11,5 +12,10 @@ export const EMPTY_LAYOUT_CONFIGURATION: LayoutConfiguration = { exact: true, component: EmptyPage, }, + { + path: ROUTE_PATHS.PRIVACY_POLICY, + exact: true, + component: PrivacyPolicy, + }, ], }; diff --git a/src/pages/PrivacyPolicy/PrivacyPolicy.scss b/src/pages/PrivacyPolicy/PrivacyPolicy.scss new file mode 100644 index 0000000000..8c0948aead --- /dev/null +++ b/src/pages/PrivacyPolicy/PrivacyPolicy.scss @@ -0,0 +1,38 @@ +@import "../../styles/sizes"; + +.container-pdf { + width: 100%; + height: 100%; + background-color: #525659; + display: flex; +} + +.preview-pdf { + margin: auto; + border-radius: 0.625rem; + max-height: 70%; + max-width: 80%; + + @include phone { + max-width: unset; + width: unset !important; + max-height: unset !important; + height: unset !important; + } + + .react-pdf__Page canvas { + max-width: 100%; + width: fit-content !important; + max-height: 90vh !important; + height: fit-content !important; + margin-bottom: 0.25rem; + + + @include phone { + max-width: unset; + width: unset !important; + max-height: unset !important; + height: unset !important; + } + } +} \ No newline at end of file diff --git a/src/pages/PrivacyPolicy/PrivacyPolicy.tsx b/src/pages/PrivacyPolicy/PrivacyPolicy.tsx new file mode 100644 index 0000000000..ac35cff9d8 --- /dev/null +++ b/src/pages/PrivacyPolicy/PrivacyPolicy.tsx @@ -0,0 +1,20 @@ +import React from "react"; +import { Document, Page } from "react-pdf/dist/esm/entry.webpack5"; +import "./PrivacyPolicy.scss"; + +export function PrivacyPolicy() { + return ( +
+ + + + + + + +
+ ); +} \ No newline at end of file diff --git a/src/pages/PrivacyPolicy/index.ts b/src/pages/PrivacyPolicy/index.ts new file mode 100644 index 0000000000..57726d1f19 --- /dev/null +++ b/src/pages/PrivacyPolicy/index.ts @@ -0,0 +1 @@ +export * from "./PrivacyPolicy" \ No newline at end of file diff --git a/src/shared/constants/routePaths.tsx b/src/shared/constants/routePaths.tsx index b2a8b5be75..5988cee388 100644 --- a/src/shared/constants/routePaths.tsx +++ b/src/shared/constants/routePaths.tsx @@ -44,4 +44,5 @@ export enum ROUTE_PATHS { SAVE_SAADIA = "/save-saadia", V04_INBOX = "/inbox-v04", INBOX = "/inbox", + PRIVACY_POLICY = "/privacy-policy", } From 9ecf7cdb69f152e74d89fbba9e17a3376a52cfd7 Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Tue, 9 Apr 2024 11:22:43 +0300 Subject: [PATCH 2/6] CW-prod-policy fix privacy-policy path --- src/pages/PrivacyPolicy/PrivacyPolicy.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pages/PrivacyPolicy/PrivacyPolicy.tsx b/src/pages/PrivacyPolicy/PrivacyPolicy.tsx index ac35cff9d8..250154adbc 100644 --- a/src/pages/PrivacyPolicy/PrivacyPolicy.tsx +++ b/src/pages/PrivacyPolicy/PrivacyPolicy.tsx @@ -5,10 +5,7 @@ import "./PrivacyPolicy.scss"; export function PrivacyPolicy() { return (
- + @@ -17,4 +14,4 @@ export function PrivacyPolicy() {
); -} \ No newline at end of file +} From 157e4c77b59471d15c60e298560a673b664dd6a5 Mon Sep 17 00:00:00 2001 From: Andrey Mikhadyuk Date: Tue, 16 Apr 2024 11:20:27 +0300 Subject: [PATCH 3/6] add experimentalForceLongPolling to firestore settings Potentially fixes: https://www.notion.so/daostack/Handle-Firebase-backend-low-internet-issues-f509a1563ace4ed396ba27a436e0394b --- src/shared/utils/firebase.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/utils/firebase.tsx b/src/shared/utils/firebase.tsx index 12a829f463..e3e1b1e1e0 100644 --- a/src/shared/utils/firebase.tsx +++ b/src/shared/utils/firebase.tsx @@ -11,6 +11,9 @@ interface FirebaseError extends Error { } firebase.initializeApp(config.firebase); +firebase.firestore().settings({ + experimentalForceLongPolling: true, +}); if (REACT_APP_ENV === Environment.Local) { firebase.auth().useEmulator(local.firebase.authDomain); From 400d050e6b3e64603c5d8d026505f73effc7c835 Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Sun, 21 Apr 2024 22:14:11 +0300 Subject: [PATCH 4/6] CW-Webview-fix-backbutton Fixed back-button redirect --- src/pages/empty/EmptyPage.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/pages/empty/EmptyPage.tsx b/src/pages/empty/EmptyPage.tsx index 632864af8c..c4eec74e79 100644 --- a/src/pages/empty/EmptyPage.tsx +++ b/src/pages/empty/EmptyPage.tsx @@ -1,5 +1,19 @@ -import React, { FC } from "react"; +import React, { FC, useEffect } from "react"; +import { useSelector } from "react-redux"; +import { history } from "@/shared/appConfig"; +import { getInboxPagePath } from "@/shared/utils"; +import { selectUser } from "../Auth/store/selectors"; -const EmptyPage: FC = () => null; +const EmptyPage: FC = () => { + const user = useSelector(selectUser()); + + useEffect(() => { + if (user) { + history.push(getInboxPagePath()); + } + }, [user]); + + return null; +}; export default EmptyPage; From 4f0d7cced7cc81266e67b0845620271e22ad742b Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Mon, 2 Sep 2024 18:12:26 +0300 Subject: [PATCH 5/6] CW-hotfix-app-crash Remove traces --- src/pages/OldCommon/hooks/useCommonMembers.ts | 6 ------ .../hooks/useCases/useDiscussionMessagesById.ts | 13 ++----------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/pages/OldCommon/hooks/useCommonMembers.ts b/src/pages/OldCommon/hooks/useCommonMembers.ts index f07c8221f5..c5aa04d912 100644 --- a/src/pages/OldCommon/hooks/useCommonMembers.ts +++ b/src/pages/OldCommon/hooks/useCommonMembers.ts @@ -1,6 +1,5 @@ import { useCallback, useRef, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; -import { trace } from "firebase/performance"; import { CommonService, Logger, UserService } from "@/services"; import { store } from "@/shared/appConfig"; import { LoadingState } from "@/shared/interfaces"; @@ -11,7 +10,6 @@ import { selectUserStates, } from "@/store/states"; import { useDeepCompareEffect } from "react-use"; -import { perf } from "@/shared/utils/firebase"; interface Options { commonId?: string; @@ -113,9 +111,6 @@ export const useCommonMembers = ({ commonId }: Options): Return => { (async () => { try { - const useCommonMembersTrace = trace(perf, 'useCommonMembers'); - useCommonMembersTrace.start(); - const cachedUserStates = selectUserStates()(store.getState()); const hasUsersFromCache = commonMembers.some( ({ userId }) => cachedUserStates[userId]?.data, @@ -188,7 +183,6 @@ export const useCommonMembers = ({ commonId }: Options): Return => { }; }); dispatch(cacheActions.updateUserStates(fetchedUsers)); - useCommonMembersTrace.stop(); } catch (err) { Logger.error(err); setState((prevState) => ({ diff --git a/src/shared/hooks/useCases/useDiscussionMessagesById.ts b/src/shared/hooks/useCases/useDiscussionMessagesById.ts index 7e6fc36d32..b83b95d047 100644 --- a/src/shared/hooks/useCases/useDiscussionMessagesById.ts +++ b/src/shared/hooks/useCases/useDiscussionMessagesById.ts @@ -1,7 +1,6 @@ import { useState, useCallback } from "react"; import { useDispatch, useSelector } from "react-redux"; import { useDeepCompareEffect, useUpdateEffect } from "react-use"; -import { trace } from "firebase/performance"; import { DiscussionMessageService, MESSAGES_NUMBER_IN_BATCH, @@ -21,7 +20,7 @@ import { User, } from "@/shared/models"; import { InternalLinkData } from "@/shared/utils"; -import firebase, { perf } from "@/shared/utils/firebase"; +import firebase from "@/shared/utils/firebase"; import { cacheActions, selectDiscussionMessagesStateByDiscussionId, @@ -154,10 +153,7 @@ export const useDiscussionMessagesById = ({ const fetchRepliedMessages = useCallback( async (messageId: string, endDate: Date): Promise => { - const fetchRepliedMessagesTrace = trace(perf, 'fetchRepliedMessagesTrace'); try { - fetchRepliedMessagesTrace.start(); - if (state.data?.find((item) => item.id === messageId)) { return Promise.resolve(); } @@ -211,9 +207,8 @@ export const useDiscussionMessagesById = ({ updatedDiscussionMessages: discussionsWithText, }), ); - fetchRepliedMessagesTrace.stop(); } catch(err) { - fetchRepliedMessagesTrace.stop(); + // console.log(err); } }, [ @@ -248,9 +243,6 @@ export const useDiscussionMessagesById = ({ } try { - const fetchDiscussionMessagesTrace = trace(perf, 'fetchDiscussionMessages'); - fetchDiscussionMessagesTrace.start(); - DiscussionMessageService.subscribeToDiscussionMessagesByDiscussionId( discussionId, lastVisible && lastVisible[discussionId], @@ -320,7 +312,6 @@ export const useDiscussionMessagesById = ({ setIsBatchLoading(false); }, ); - fetchDiscussionMessagesTrace.stop(); } catch(err) { setIsBatchLoading(false); } From f5d9c718d97442943cb9a7119a0bd95197ebc77e Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Mon, 2 Sep 2024 18:42:50 +0300 Subject: [PATCH 6/6] CW-hotfix-app-crash Added conditional function call --- .../components/FeedItemBreadcrumbs/FeedItemBreadcrumbs.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/FeedItemBreadcrumbs/FeedItemBreadcrumbs.tsx b/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/FeedItemBreadcrumbs/FeedItemBreadcrumbs.tsx index 1bc6ee1895..f96140bc7c 100644 --- a/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/FeedItemBreadcrumbs/FeedItemBreadcrumbs.tsx +++ b/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/FeedItemBreadcrumbs/FeedItemBreadcrumbs.tsx @@ -67,7 +67,7 @@ const FeedItemBreadcrumbs: FC = ({ }); return () => { - unsubscribe(); + unsubscribe && unsubscribe(); }; }, [breadcrumbs.activeItem?.id]);