Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

Commit bad76c7

Browse files
fix: Login Session issue in Mobile View (#55)
* fix: Session issue in Mobile View * Update pages/index.js Co-authored-by: Krish Gupta <[email protected]> Co-authored-by: Krish Gupta <[email protected]>
1 parent c8295a3 commit bad76c7

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

pages/index.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ const home = ({ session }) => {
4545

4646
// Mobile menu data
4747
const mobileMenu = [
48-
{ name: 'Login', icon: LoginIcon, href: '/login'},
4948
{ name: 'Marketplace', icon: PlayIcon, href:'/dashboard' }
5049
]
5150

@@ -221,7 +220,7 @@ const home = ({ session }) => {
221220
</div>
222221
</div>
223222
<div className="mt-6">
224-
<nav className="grid gap-y-8">
223+
<nav className="grid gap-y-6">
225224
{mobileMenu.map((item) => (
226225
<a
227226
key={item.name}
@@ -232,6 +231,32 @@ const home = ({ session }) => {
232231
<span className="ml-3 text-base font-medium text-gray-900">{item.name}</span>
233232
</a>
234233
))}
234+
235+
<div className="flex py-1 justify-between">
236+
{/* Login button */}
237+
{!session?(
238+
<a
239+
href="/login"
240+
className="-m-3 p-3 flex items-center rounded-md hover:bg-gray-50"
241+
>
242+
<LoginIcon className="flex-shrink-0 h-6 w-6 text-purple-600" aria-hidden="true" />
243+
<span className="ml-3 text-base font-medium text-gray-900">Login</span>
244+
</a>
245+
):(
246+
<>
247+
{/* Profile and Logout button */}
248+
<div className="flex items-center">
249+
<img className="h-8 w-8 mx-2 rounded-full" src={session.picture} alt="" />
250+
<div className="text-base font-medium">{session.name}</div>
251+
</div>
252+
<button
253+
type="button"
254+
className="p-1"
255+
>
256+
<LogoutIcon onClick={() => signOut()} className="h-6 w-6" aria-hidden="true" />
257+
</button>
258+
</>)}
259+
</div>
235260
</nav>
236261
</div>
237262
</div>

0 commit comments

Comments
 (0)