From accf34d98bec5f7e404d60e01d9c6e5d14817f91 Mon Sep 17 00:00:00 2001 From: Pooria Setayesh Date: Fri, 10 May 2024 23:52:49 +0330 Subject: [PATCH 1/2] feat: complete login or register button when user is not logged in --- src/app/[locale]/(main)/layout.tsx | 1 + .../Header/components/TopSection.tsx | 50 ++++++++++++------- src/data/i18n/en.json | 6 ++- src/data/i18n/fa.json | 6 ++- 4 files changed, 44 insertions(+), 19 deletions(-) diff --git a/src/app/[locale]/(main)/layout.tsx b/src/app/[locale]/(main)/layout.tsx index 7583eb3..e0b9382 100644 --- a/src/app/[locale]/(main)/layout.tsx +++ b/src/app/[locale]/(main)/layout.tsx @@ -56,6 +56,7 @@ const MainLayout: FC = async ({ children }) => { {children} diff --git a/src/components/Header/components/TopSection.tsx b/src/components/Header/components/TopSection.tsx index a484e75..9fa6a63 100644 --- a/src/components/Header/components/TopSection.tsx +++ b/src/components/Header/components/TopSection.tsx @@ -1,14 +1,14 @@ import Logo from '@/components/common/Logo'; import useCustomSearchParams from '@/hooks/useCustomSearchParams'; import useInputFiller from '@/hooks/useInputFiller'; +import { Link as NextLink } from '@/navigation'; import { AccountCircleOutlined, SearchOutlined, ShoppingBasketOutlined, } from '@mui/icons-material'; -import { Divider, Link, TextField } from '@mui/material'; +import { Button, Link, Stack, TextField } from '@mui/material'; import Badge from '@mui/material/Badge'; -import Box from '@mui/material/Box'; import IconButton from '@mui/material/IconButton'; import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; @@ -16,7 +16,6 @@ import Toolbar from '@mui/material/Toolbar'; import { alpha, styled } from '@mui/material/styles'; import { useTranslations } from 'next-intl'; import { DOMAttributes, FC, useState } from 'react'; -import { Link as NextLink } from '@/navigation'; const Form = styled('form')(({ theme }) => ({ position: 'relative', @@ -54,6 +53,7 @@ const TopSection: FC = () => { }; const menuId = 'primary-search-account-menu'; + const isLoggedIn = true; return ( <> @@ -88,8 +88,35 @@ const TopSection: FC = () => { }} /> - - + + + {isLoggedIn ? ( + + ) : ( + + + + )} + { - - - - - + Date: Fri, 10 May 2024 23:54:22 +0330 Subject: [PATCH 2/2] chore: add link of login page --- src/components/Header/components/TopSection.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/Header/components/TopSection.tsx b/src/components/Header/components/TopSection.tsx index 9fa6a63..5dac7c2 100644 --- a/src/components/Header/components/TopSection.tsx +++ b/src/components/Header/components/TopSection.tsx @@ -92,6 +92,8 @@ const TopSection: FC = () => { {isLoggedIn ? (