From 8068a1d260df88932617be5c11487e47ab0154d9 Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 23 Nov 2020 11:25:23 -0800 Subject: [PATCH] offer/seek trade pages, with placeholder data --- src/app/App.js | 16 +++ src/app/ItemTradesPage.js | 226 ++++++++++++++++++++++++++++++++++++++ src/app/UserItemsPage.js | 2 +- 3 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 src/app/ItemTradesPage.js diff --git a/src/app/App.js b/src/app/App.js index 03b37a9..d7f18a9 100644 --- a/src/app/App.js +++ b/src/app/App.js @@ -18,6 +18,12 @@ import WardrobePageLayout from "./WardrobePage/WardrobePageLayout"; const HomePage = loadable(() => import("./HomePage")); const ItemPage = loadable(() => import("./ItemPage")); +const ItemTradesOfferingPage = loadable(() => + import("./ItemTradesPage").then((m) => m.ItemTradesOfferingPage) +); +const ItemTradesSeekingPage = loadable(() => + import("./ItemTradesPage").then((m) => m.ItemTradesSeekingPage) +); const ModelingPage = loadable(() => import("./ModelingPage")); const UserItemsPage = loadable(() => import("./UserItemsPage")); const WardrobePage = loadable(() => import("./WardrobePage"), { @@ -70,6 +76,16 @@ function App() { + + + + + + + + + + diff --git a/src/app/ItemTradesPage.js b/src/app/ItemTradesPage.js new file mode 100644 index 0000000..7f031b4 --- /dev/null +++ b/src/app/ItemTradesPage.js @@ -0,0 +1,226 @@ +import React from "react"; +import { css } from "emotion"; +import { Box, Tooltip, useColorModeValue, useToken } from "@chakra-ui/core"; +import gql from "graphql-tag"; +import { useQuery } from "@apollo/client"; +import { useHistory, useParams } from "react-router-dom"; + +import { Heading2, usePageTitle } from "./util"; +import ItemPageLayout from "./ItemPageLayout"; + +export function ItemTradesOfferingPage() { + return ( + + ); +} + +export function ItemTradesSeekingPage() { + return ( + + ); +} + +function ItemTradesPage({ title, userHeading, compareListHeading }) { + const { itemId } = useParams(); + + const { loading, error, data } = useQuery( + gql` + query ItemTradesPage($itemId: ID!) { + item(id: $itemId) { + id + name + isNc + isPb + thumbnailUrl + description + createdAt + } + } + `, + { variables: { itemId }, returnPartialData: true } + ); + + usePageTitle(`${data?.item?.name} | ${title}`, { skip: loading }); + + if (error) { + return {error.message}; + } + + return ( + + + {title} + + + + ); +} + +function ItemTradesTable({ itemId, userHeading, compareListHeading }) { + return ( + + + + {userHeading} + List + + {/* A small wording tweak to fit better on the xsmall screens! */} + Last updated + Updated + + Compare + + + + + + + + + + + ); +} + +function ItemTradesTableRow({ compareListHeading }) { + const href = "/user/6/items#list-1"; + + const history = useHistory(); + const onClick = React.useCallback(() => history.push(href), [history, href]); + const focusBackground = useColorModeValue("gray.100", "gray.600"); + + return ( + + Matchu + + + Top priorities and such so yeah + + + <1 week + + + {compareListHeading}: + + + Adorable Freckles + + + Constellation Dress + + + + } + > + + 2 match + 2 matches + + + + + ); +} + +function ItemTradesTableCell({ children, as = "td", ...props }) { + const borderColor = useColorModeValue("gray.300", "gray.400"); + const borderColorCss = useToken("colors", borderColor); + const borderRadiusCss = useToken("radii", "md"); + + return ( + + {children} + + ); +} diff --git a/src/app/UserItemsPage.js b/src/app/UserItemsPage.js index 61f0606..6b02ba7 100644 --- a/src/app/UserItemsPage.js +++ b/src/app/UserItemsPage.js @@ -412,7 +412,7 @@ function ClosetList({ closetList, isCurrentUser, showHeading }) { }); return ( - + {showHeading && (