Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 70ed33f

Browse files
committed
Show the NewGoal form when the user is logged in and haven't set his goal yet
1 parent 05d11dd commit 70ed33f

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/components/HomePageFeed.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { useEffect, useReducer, useState } from 'react'
1717
import { signIn, useSession } from 'next-auth/client'
1818
import {
1919
NewComment,
20+
NewGoal,
2021
NewUpdate,
2122
UpdateComment,
2223
UpdateComments,
@@ -232,9 +233,9 @@ export default function HomePageFeed({
232233
<div className="hidden lg:block lg:col-span-3 xl:col-span-2">
233234
<HomePageSideNavBar />
234235
</div>
235-
<main className="lg:col-span-9 xl:col-span-6">
236+
<main className="lg:col-span-9 xl:col-span-6 px-2">
236237
<div className="space-y-3">
237-
{showGoal && (
238+
{showGoal ? (
238239
<div className="bg-white px-4 py-6 shadow sm:p-6 sm:rounded-lg">
239240
<div className="flex">
240241
<A href={`${(session.user as User).username}`}>
@@ -248,6 +249,19 @@ export default function HomePageFeed({
248249
</div>
249250
<NewUpdate goal={goal} updateFromHomePage={true} />
250251
</div>
252+
) : (
253+
session && (
254+
<>
255+
<div className="bg-white px-4 py-6 shadow sm:p-6 sm:rounded-lg">
256+
<div className="flex">
257+
<span className="block text-lg text-center text-indigo-600 font-semibold tracking-wide">
258+
🚀 Set Your Goal:
259+
</span>
260+
</div>
261+
<NewGoal />
262+
</div>
263+
</>
264+
)
251265
)}
252266
<div>
253267
<h1 className="sr-only">Recent questions</h1>

0 commit comments

Comments
 (0)