diff --git a/pages/user/[userId]/lists.tsx b/pages/user/[userId]/lists/index.tsx similarity index 54% rename from pages/user/[userId]/lists.tsx rename to pages/user/[userId]/lists/index.tsx index 0a6e5c8..bef49e8 100644 --- a/pages/user/[userId]/lists.tsx +++ b/pages/user/[userId]/lists/index.tsx @@ -1,4 +1,4 @@ -import UserItemListsIndexPage from "../../../src/app/UserItemListsIndexPage"; +import UserItemListsIndexPage from "../../../../src/app/UserItemListsIndexPage"; export default function UserItemListsIndexPageWrapper() { return ; diff --git a/pages/user/[userId]/lists/owns/[listId].tsx b/pages/user/[userId]/lists/owns/[listId].tsx new file mode 100644 index 0000000..62de41d --- /dev/null +++ b/pages/user/[userId]/lists/owns/[listId].tsx @@ -0,0 +1,5 @@ +import UserItemListPage from "../../../../../src/app/UserItemListPage"; + +export default function UserItemListPageWrapper() { + return ; +} diff --git a/pages/user/[userId]/lists/wants/[listId].tsx b/pages/user/[userId]/lists/wants/[listId].tsx new file mode 100644 index 0000000..b4e5aa5 --- /dev/null +++ b/pages/user/[userId]/lists/wants/[listId].tsx @@ -0,0 +1,4 @@ +// These two routes are the same! Essentially it's a route param that must +// either be "owns" or "wants". +import UserItemListPageWrapper from "../owns/[listId]"; +export default UserItemListPageWrapper; diff --git a/src/app/App.js b/src/app/App.js index e8a49f6..9eaf8e9 100644 --- a/src/app/App.js +++ b/src/app/App.js @@ -11,7 +11,6 @@ import WardrobePageLayout from "./WardrobePage/WardrobePageLayout"; import { loadable } from "./util"; const HomePage = loadable(() => import("./HomePage")); -const UserItemListPage = loadable(() => import("./UserItemListPage")); const WardrobePage = loadable(() => import("./WardrobePage"), { fallback: , }); @@ -34,11 +33,6 @@ function App() { - - - - - diff --git a/src/app/UserItemListPage.js b/src/app/UserItemListPage.js index 3e99d25..003c582 100644 --- a/src/app/UserItemListPage.js +++ b/src/app/UserItemListPage.js @@ -23,9 +23,8 @@ import { EmailIcon, } from "@chakra-ui/icons"; import { gql, useMutation, useQuery } from "@apollo/client"; -import { useParams } from "react-router-dom"; -import { HashLink } from "react-router-hash-link"; import Link from "next/link"; +import { useRouter } from "next/router"; import { List as VirtualizedList, AutoSizer, @@ -41,7 +40,8 @@ import useSupport from "./WardrobePage/support/useSupport"; import WIPCallout from "./components/WIPCallout"; function UserItemListPage() { - const { listId } = useParams(); + const { query } = useRouter(); + const { listId } = query; const currentUser = useCurrentUser(); const { loading, error, data } = useQuery( @@ -118,12 +118,19 @@ function UserItemListPage() { separator={} > - - {creator.username}'s lists - + + {creator.username}'s lists + - - {linkBackText} + {/* TODO: The "wants" version of this link doesn't always scroll down + * the page properly, now that we're not using the + * react-router-hash-link library. Oh well for now! + * Would be nice to fix by having Next.js eliminate the loading + * spinner perhaps?...*/} + + + {linkBackText} +