Skip to content

Commit a3198f1

Browse files
committed
πŸŽ§πŸ’¨ ↝ New page component if user hasn't finished onboarding/location. [ SGV2-9 SGV2-10 // FCDB-3 ]
1 parent a41aaeb commit a3198f1

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

β€Žcomponents/Content/Planets/Sectors/SectorSetup.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function CreateBasePlanetSector() {
2929
}
3030
} catch (error) {
3131
console.error(error.message);
32-
}
32+
};
3333
};
3434

3535
fetchUserPlanet();

β€Žcomponents/_Core/Section/Navbar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export const UserDropdownMenu = ({ user } : { user: string }) => {
157157
.then((result) => {
158158
if (result.data) {
159159
setProfile(result.data[0]);
160-
}
160+
};
161161
});
162162
}, [session]);
163163

β€Žpages/index.tsx

+26-1
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,43 @@ export function PublicLanding() {
3737
/>
3838
);
3939

40+
// User data config
4041
const session = useSession();
42+
const supabase = useSupabaseClient();
43+
const [profile, setProfile] = useState<any>(null);
44+
useEffect(() => {
45+
supabase.from("profiles")
46+
.select()
47+
.eq("id", session?.user?.id)
48+
.then((result) => {
49+
if (result.data) {
50+
setProfile(result.data[0]);
51+
};
52+
});
53+
}, [session, supabase]);
54+
useEffect(() => {
55+
if (profile) {
56+
console.log(profile.location ?? "Location not available");
57+
};
58+
}, [profile]);
4159

4260
// Component context
4361
const [showFeedOverlay, setShowFeedOverlay] = useState(false);
4462
const handleOpenFeedOverlay = () => {
4563
setShowFeedOverlay(true);
4664
};
4765

66+
// Screen size parameters
4867
const isDesktopOrLaptop = useMediaQuery({ query: '(min-width: 1224px)' });
4968
const isTabletOrMobile = useMediaQuery({ query: '(max-width: 1224px)' });
5069

51-
if (session) {
70+
if (session && !profile?.location) {
71+
return (
72+
<p>Location</p>
73+
);
74+
};
75+
76+
if (session && profile?.location) {
5277
return (
5378
<LayoutNoNav>
5479
<Navigation />

0 commit comments

Comments
Β (0)