Skip to content

Commit

Permalink
Refact: No Team (#2187)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Cedric921 authored Feb 9, 2024
1 parent 6ddf890 commit 617e5b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
10 changes: 2 additions & 8 deletions apps/web/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -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 (
<html lang={locale} className={`${poppins.variable} ${jakarta.variable}`}>
<html lang={locale} className={poppins.variable}>
{/* <head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
Expand Down
16 changes: 12 additions & 4 deletions apps/web/components/pages/main/no-team.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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 (
<div className={clsxm('flex justify-center items-center flex-col xs:mt-32 mt-8 mx-auto', className)} {...rest}>
Expand All @@ -24,11 +32,11 @@ const NoTeam = ({ className, ...rest }: Props) => {
</p>
</div>

<Tooltip placement="auto" label={t('common.NO_TEAM_TOOLTIP')} enabled={!user?.isEmailVerified}>
<Tooltip placement="auto" label={t('common.NO_TEAM_TOOLTIP')} enabled={user?.isEmailVerified == false}>
<Button
className="mt-10 text-base font-medium capitalize"
onClick={openModal}
disabled={!user?.isEmailVerified}
disabled={user?.isEmailVerified == false}
>
{t('common.CREATE_TEAM')}
</Button>
Expand Down

0 comments on commit 617e5b0

Please sign in to comment.