diff --git a/src/app/ItemPage.js b/src/app/ItemPage.js
index 85e3f57..49b9954 100644
--- a/src/app/ItemPage.js
+++ b/src/app/ItemPage.js
@@ -23,16 +23,24 @@ import OutfitPreview from "./components/OutfitPreview";
function ItemPage() {
const { itemId } = useParams();
+ return ;
+}
+/**
+ * ItemPageContent is the content of ItemPage, but we also use it as the
+ * entry point for ItemPageDrawer! When embedded in ItemPageDrawer, the
+ * `isEmbedded` prop is true, so we know not to e.g. set the page title.
+ */
+export function ItemPageContent({ itemId, isEmbedded }) {
return (
-
+
);
}
-function ItemPageHeader({ itemId }) {
+function ItemPageHeader({ itemId, isEmbedded }) {
const { error, data } = useQuery(
gql`
query ItemPage($itemId: ID!) {
@@ -47,7 +55,7 @@ function ItemPageHeader({ itemId }) {
{ variables: { itemId }, returnPartialData: true }
);
- usePageTitle(data?.item?.name);
+ usePageTitle(data?.item?.name, { skip: isEmbedded });
if (error) {
return {error.message};
@@ -67,7 +75,14 @@ function ItemPageHeader({ itemId }) {
- {item?.name || "Item name here"}
+
+ {item?.name || "Item name here"}
+
@@ -131,7 +146,7 @@ function ItemPageBadges({ item }) {
encodeURIComponent(item.name)
}
>
- Trades
+ Trade Post
)}
diff --git a/src/app/ItemPageDrawer.js b/src/app/ItemPageDrawer.js
new file mode 100644
index 0000000..68cd14c
--- /dev/null
+++ b/src/app/ItemPageDrawer.js
@@ -0,0 +1,30 @@
+import React from "react";
+import {
+ Drawer,
+ DrawerBody,
+ DrawerContent,
+ DrawerCloseButton,
+ DrawerOverlay,
+ useBreakpointValue,
+} from "@chakra-ui/core";
+
+import { ItemPageContent } from "./ItemPage";
+
+function ItemPageDrawer({ item, isOpen, onClose }) {
+ const placement = useBreakpointValue({ base: "bottom", lg: "right" });
+
+ return (
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default ItemPageDrawer;
diff --git a/src/app/WardrobePage/Item.js b/src/app/WardrobePage/Item.js
index fefa56f..ad235ac 100644
--- a/src/app/WardrobePage/Item.js
+++ b/src/app/WardrobePage/Item.js
@@ -16,6 +16,7 @@ import {
InfoIcon,
NotAllowedIcon,
} from "@chakra-ui/icons";
+import { Link } from "react-router-dom";
import loadable from "@loadable/component";
import {
@@ -27,6 +28,7 @@ import {
} from "../components/ItemCard";
import SupportOnly from "./support/SupportOnly";
+const LoadableItemPageDrawer = loadable(() => import("../ItemPageDrawer"));
const LoadableItemSupportDrawer = loadable(() =>
import("./support/ItemSupportDrawer")
);
@@ -58,6 +60,7 @@ function Item({
onRemove,
isDisabled = false,
}) {
+ const [infoDrawerIsOpen, setInfoDrawerIsOpen] = React.useState(false);
const [supportDrawerIsOpen, setSupportDrawerIsOpen] = React.useState(false);
return (
@@ -97,13 +100,25 @@ function Item({
}
label="More info"
- href={`https://impress.openneo.net/items/${
- item.id
- }-${item.name.replace(/ /g, "-")}`}
- onClick={(e) => e.stopPropagation()}
+ to={`/items/${item.id}`}
+ onClick={(e) => {
+ const willProbablyOpenInNewTab =
+ e.metaKey || e.shiftKey || e.altKey || e.ctrlKey;
+ if (willProbablyOpenInNewTab) {
+ return;
+ }
+
+ setInfoDrawerIsOpen(true);
+ e.preventDefault();
+ }}
/>
+ setInfoDrawerIsOpen(false)}
+ />
{
+ if (skip) return;
document.title = title ? `${title} | Dress to Impress` : "Dress to Impress";
- }, [title]);
+ }, [title, skip]);
}
/**