From e6df07a08a9888a5174ece319337723564030419 Mon Sep 17 00:00:00 2001 From: Ido Shamun Date: Thu, 6 Feb 2025 19:59:05 +0200 Subject: [PATCH 1/4] fix: show privacy on mobile to everyone + link fix --- .../layouts/AccountLayout/SidebarNav.tsx | 45 +++---------------- 1 file changed, 5 insertions(+), 40 deletions(-) diff --git a/packages/webapp/components/layouts/AccountLayout/SidebarNav.tsx b/packages/webapp/components/layouts/AccountLayout/SidebarNav.tsx index 1dfac0c0c6..7d642b0969 100644 --- a/packages/webapp/components/layouts/AccountLayout/SidebarNav.tsx +++ b/packages/webapp/components/layouts/AccountLayout/SidebarNav.tsx @@ -1,5 +1,5 @@ import type { ReactElement } from 'react'; -import React, { useCallback, useContext, useEffect, useMemo } from 'react'; +import React, { useCallback, useContext, useEffect } from 'react'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import classNames from 'classnames'; import AuthContext from '@dailydotdev/shared/src/contexts/AuthContext'; @@ -7,14 +7,9 @@ import CloseButton from '@dailydotdev/shared/src/components/CloseButton'; import { disabledRefetch } from '@dailydotdev/shared/src/lib/func'; import { useRouter } from 'next/router'; import { isTouchDevice } from '@dailydotdev/shared/src/lib/tooltip'; -import Link from '@dailydotdev/shared/src/components/utilities/Link'; import SidebarNavItem from './SidebarNavItem'; -import { - AccountPage, - accountPage, - accountSidebarPages, - AccountSidebarPagesSection, -} from './common'; +import type { AccountPage } from './common'; +import { accountPage } from './common'; interface SidebarNavProps { className?: string; @@ -38,19 +33,7 @@ function SidebarNav({ queryFn: () => false, ...disabledRefetch, }); - const { user, isGdprCovered } = useContext(AuthContext); - - const keys = useMemo( - () => - pageKeys.filter((key) => { - if (key === AccountPage.Privacy) { - return isGdprCovered; - } - - return true; - }), - [isGdprCovered], - ); + const { user } = useContext(AuthContext); useEffect(() => { if (!isTouchDevice()) { @@ -84,7 +67,7 @@ function SidebarNav({
- {keys.map((key) => { + {pageKeys.map((key) => { const href = `/${basePath}${accountPage[key].href}`; const isActive = globalThis?.window?.location.pathname === href; @@ -98,24 +81,6 @@ function SidebarNav({ /> ); })} - {!isGdprCovered && ( - - {accountSidebarPages.map((accountSidebarPage) => ( - - - {accountSidebarPage.title} - - - ))} - - )}
); From afae7afabc658b15750a2b522253a20e42ae23fc Mon Sep 17 00:00:00 2001 From: Ido Shamun Date: Thu, 6 Feb 2025 20:03:24 +0200 Subject: [PATCH 2/4] refactor: useAuthContext --- .../webapp/components/layouts/AccountLayout/SidebarNav.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/webapp/components/layouts/AccountLayout/SidebarNav.tsx b/packages/webapp/components/layouts/AccountLayout/SidebarNav.tsx index 7d642b0969..eb8cf72582 100644 --- a/packages/webapp/components/layouts/AccountLayout/SidebarNav.tsx +++ b/packages/webapp/components/layouts/AccountLayout/SidebarNav.tsx @@ -1,8 +1,8 @@ import type { ReactElement } from 'react'; -import React, { useCallback, useContext, useEffect } from 'react'; +import React, { useCallback, useEffect } from 'react'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import classNames from 'classnames'; -import AuthContext from '@dailydotdev/shared/src/contexts/AuthContext'; +import { useAuthContext } from '@dailydotdev/shared/src/contexts/AuthContext'; import CloseButton from '@dailydotdev/shared/src/components/CloseButton'; import { disabledRefetch } from '@dailydotdev/shared/src/lib/func'; import { useRouter } from 'next/router'; @@ -33,7 +33,7 @@ function SidebarNav({ queryFn: () => false, ...disabledRefetch, }); - const { user } = useContext(AuthContext); + const { user } = useAuthContext(); useEffect(() => { if (!isTouchDevice()) { From 0beb640cbf96e4d1f2516490e621a5d34ab8541f Mon Sep 17 00:00:00 2001 From: Ido Shamun Date: Thu, 6 Feb 2025 20:08:19 +0200 Subject: [PATCH 3/4] Trigger Build From 132a4d4ca5535d760f2226d0816ef8c7365db20f Mon Sep 17 00:00:00 2001 From: Ido Shamun Date: Thu, 6 Feb 2025 20:16:10 +0200 Subject: [PATCH 4/4] refactor: remove unused var --- .../layouts/AccountLayout/common.tsx | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/packages/webapp/components/layouts/AccountLayout/common.tsx b/packages/webapp/components/layouts/AccountLayout/common.tsx index a0da6eb8e1..86e7fa4635 100644 --- a/packages/webapp/components/layouts/AccountLayout/common.tsx +++ b/packages/webapp/components/layouts/AccountLayout/common.tsx @@ -15,13 +15,6 @@ import classed from '@dailydotdev/shared/src/lib/classed'; import type { LoggedUser } from '@dailydotdev/shared/src/lib/user'; import type { ReactNode } from 'react'; import React from 'react'; -import { - faq, - privacyPolicy, - reportIssue, - requestFeature, - termsOfService, -} from '@dailydotdev/shared/src/lib/constants'; export interface ManageSocialProvidersProps { type: ManageSocialProviderTypes; @@ -58,39 +51,6 @@ export enum AccountSecurityDisplay { ConnectEmail = 'connect_email', } -interface AccountSidebarPage { - title: string; - href: string; - target: string; -} -export const accountSidebarPages: AccountSidebarPage[] = [ - { - title: 'FAQ', - href: faq, - target: '_blank', - }, - { - title: 'Request a feature', - href: requestFeature, - target: '_blank', - }, - { - title: 'Report an issue', - href: reportIssue, - target: '_blank', - }, - { - title: 'Privacy policy', - href: privacyPolicy, - target: '_blank', - }, - { - title: 'Terms of service', - href: termsOfService, - target: '_blank', - }, -]; - export const accountPage: Record = { profile: { title: 'Profile',