From 617e5b02332cc1e9d131336bed1f5f578a15b0c7 Mon Sep 17 00:00:00 2001 From: cedric karungu <83704005+Cedric921@users.noreply.github.com> Date: Fri, 9 Feb 2024 22:24:09 +0200 Subject: [PATCH] Refact: No Team (#2187) * refact: desable Create new Team Btn if isTeamMember * fix: show NoTeam Component * fix: delete no used fonts * fix: logic to show Create Team Pop up * fix: logic to show Create Team Pop up * fix: check emailVerfied into useEffect --- apps/web/app/[locale]/layout.tsx | 10 ++-------- apps/web/components/pages/main/no-team.tsx | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/apps/web/app/[locale]/layout.tsx b/apps/web/app/[locale]/layout.tsx index bc513a35c..717ef37b6 100644 --- a/apps/web/app/[locale]/layout.tsx +++ b/apps/web/app/[locale]/layout.tsx @@ -30,13 +30,7 @@ interface Props { }; } -import { Plus_Jakarta_Sans, Poppins } from 'next/font/google'; - -const jakarta = Plus_Jakarta_Sans({ - subsets: ['latin'], - variable: '--font-jakarta', - display: 'swap' -}); +import { Poppins } from 'next/font/google'; const poppins = Poppins({ subsets: ['latin'], @@ -66,7 +60,7 @@ const LocaleLayout = ({ children, params: { locale }, pageProps }: Props) => { // eslint-disable-next-line @typescript-eslint/no-var-requires const messages = require(`../../messages/${locale}.json`); return ( - + {/*
diff --git a/apps/web/components/pages/main/no-team.tsx b/apps/web/components/pages/main/no-team.tsx index 7845e093e..d0e96f001 100644 --- a/apps/web/components/pages/main/no-team.tsx +++ b/apps/web/components/pages/main/no-team.tsx @@ -1,8 +1,10 @@ -import { useAuthenticateUser, useModal } from '@app/hooks'; +'use client'; + +import { useAuthenticateUser, useModal, useOrganizationTeams } from '@app/hooks'; import { clsxm } from '@app/utils'; import { Avatar, Button, Text, Tooltip } from 'lib/components'; import { CreateTeamModal } from 'lib/features'; -import { PropsWithChildren } from 'react'; +import React, { PropsWithChildren } from 'react'; import noTeamImg from '../../../public/assets/svg/no-team.svg'; import { useTranslations } from 'next-intl'; @@ -11,6 +13,12 @@ const NoTeam = ({ className, ...rest }: Props) => { const t = useTranslations(); const { isOpen, closeModal, openModal } = useModal(); const { user } = useAuthenticateUser(); + const { teams } = useOrganizationTeams(); + + React.useEffect(() => { + closeModal(); + if (teams.length < 1 && user?.isEmailVerified == true) openModal(); + }, [closeModal, openModal, teams.length, user?.isEmailVerified]); return (