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}
);
}