Skip to content

Commit

Permalink
πŸŽ§πŸ’¨ ↝ New page component if user hasn't finished onboarding/location. …
Browse files Browse the repository at this point in the history
…[ SGV2-9 SGV2-10 // FCDB-3 ]
  • Loading branch information
Gizmotronn committed Mar 18, 2024
1 parent a41aaeb commit a3198f1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/Content/Planets/Sectors/SectorSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function CreateBasePlanetSector() {
}
} catch (error) {
console.error(error.message);
}
};
};

fetchUserPlanet();
Expand Down
2 changes: 1 addition & 1 deletion components/_Core/Section/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const UserDropdownMenu = ({ user } : { user: string }) => {
.then((result) => {
if (result.data) {
setProfile(result.data[0]);
}
};
});
}, [session]);

Expand Down
27 changes: 26 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,43 @@ export function PublicLanding() {
/>
);

// User data config
const session = useSession();
const supabase = useSupabaseClient();
const [profile, setProfile] = useState<any>(null);
useEffect(() => {
supabase.from("profiles")
.select()
.eq("id", session?.user?.id)
.then((result) => {
if (result.data) {
setProfile(result.data[0]);
};
});
}, [session, supabase]);
useEffect(() => {
if (profile) {
console.log(profile.location ?? "Location not available");
};
}, [profile]);

// Component context
const [showFeedOverlay, setShowFeedOverlay] = useState(false);
const handleOpenFeedOverlay = () => {
setShowFeedOverlay(true);
};

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

if (session) {
if (session && !profile?.location) {
return (
<p>Location</p>
);
};

if (session && profile?.location) {
return (
<LayoutNoNav>
<Navigation />
Expand Down

0 comments on commit a3198f1

Please sign in to comment.