diff --git a/app/root.tsx b/app/root.tsx index 87aea73..a91539e 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -65,7 +65,7 @@ function App() { revalidator.revalidate(); // handle events if (event === "INITIAL_SESSION") { - if (session?.user) setUser(session.user); + setUser(session?.user); } else if (event === "SIGNED_IN") { setUser(session?.user); } else if (event === "SIGNED_OUT") { diff --git a/app/routes/$.tsx b/app/routes/$.tsx index 6c4495a..d9d2e3a 100644 --- a/app/routes/$.tsx +++ b/app/routes/$.tsx @@ -1,7 +1,5 @@ +// 404 route - -export default function SplatRoute(){ - return
- 404 Not Found!! -
-} \ No newline at end of file +export default function SplatRoute() { + return
404 Not Found!!
; +} diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 6ab1c02..3c5dd07 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -9,21 +9,9 @@ export const meta: MetaFunction = () => { }; export default function Index() { - const [isDone, setIsDone] = useState(false); - const headingClicked = () => setIsDone(true); - return (
-

- {isDone ? "done" : "click here"} -

- - {Array.from(Array(50)).map((item, index) => ( -

{index}

- ))} +

Landing page

); } diff --git a/app/routes/profile.tsx b/app/routes/profile.tsx new file mode 100644 index 0000000..9b68ac6 --- /dev/null +++ b/app/routes/profile.tsx @@ -0,0 +1,30 @@ +import { Link, useOutletContext } from "@remix-run/react"; +import { ContextProps } from "~/utils/types/ContextProps.type"; + +export default function Profile() { + const { supabase, user } = useOutletContext(); + + // unauthenticated render + if (!user) { + return ( +
+

Log in to see your profile.

+ + + +
+ ); + } + + // authenticated render + return ( +
+

+ My Profile (no one else can see my profile) +

+

UUID: {user.id}

+

Name: {user.user_metadata.full_name}

+

Email: {user.user_metadata.email}

+
+ ); +} diff --git a/app/routes/user.$id.tsx b/app/routes/user.$id.tsx deleted file mode 100644 index c6511bb..0000000 --- a/app/routes/user.$id.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { useParams } from "@remix-run/react" - -export default function Index() { - const {id} = useParams(); - - return (
-

Username: {id}

-
) -} \ No newline at end of file diff --git a/app/tests/somefile.test.tsx b/app/tests/somefile.test.tsx index cde0d83..baa42ed 100644 --- a/app/tests/somefile.test.tsx +++ b/app/tests/somefile.test.tsx @@ -3,10 +3,11 @@ import { render, screen } from "@testing-library/react"; import { userEvent } from "@testing-library/user-event"; import "@testing-library/jest-dom"; -import Index from "../routes/_index"; +// import Index from "../routes/_index"; describe("App", () => { - it("clicks to change text", async () => { + it("dummy test", async () => { + /* // ARRANGE render(); @@ -16,5 +17,8 @@ describe("App", () => { // ASSERT expect(screen.getByRole("heading")).toHaveTextContent("done"); + */ + + expect(1 + 2).toBe(3); }); });