diff --git a/src/app/ItemsPage.js b/src/app/ItemsPage.js
index 3ce4912..d8c508a 100644
--- a/src/app/ItemsPage.js
+++ b/src/app/ItemsPage.js
@@ -1,11 +1,16 @@
import React from "react";
-import { Box, Image, Wrap } from "@chakra-ui/core";
+import { Box, Wrap } from "@chakra-ui/core";
import gql from "graphql-tag";
import { useParams } from "react-router-dom";
import { useQuery } from "@apollo/client";
import HangerSpinner from "./components/HangerSpinner";
import { Heading1 } from "./util";
+import ItemCard, {
+ ItemBadgeList,
+ NcBadge,
+ NpBadge,
+} from "./components/ItemCard";
import useCurrentUser from "./components/useCurrentUser";
function ItemsPage() {
@@ -21,6 +26,7 @@ function ItemsPage() {
username
itemsTheyOwn {
id
+ isNc
name
thumbnailUrl
}
@@ -49,17 +55,15 @@ function ItemsPage() {
{data.user.itemsTheyOwn.map((item) => (
-
-
- {item.name}
-
+
+ {item.isNc ? : }
+
+ }
+ />
))}
diff --git a/src/app/ModelingPage.js b/src/app/ModelingPage.js
index c1e02b1..72dc4aa 100644
--- a/src/app/ModelingPage.js
+++ b/src/app/ModelingPage.js
@@ -1,5 +1,5 @@
import React from "react";
-import { Badge, Box, SimpleGrid, useColorModeValue } from "@chakra-ui/core";
+import { Badge, Box, SimpleGrid } from "@chakra-ui/core";
import { StarIcon } from "@chakra-ui/icons";
import gql from "graphql-tag";
import { useQuery } from "@apollo/client";
@@ -7,7 +7,8 @@ import { useQuery } from "@apollo/client";
import { Delay } from "./util";
import HangerSpinner from "./components/HangerSpinner";
import { Heading1, Heading2 } from "./util";
-import ItemSummary, { ItemSummaryBadgeList } from "./components/ItemSummary";
+import ItemCard from "./components/ItemCard";
+import { ItemBadgeList } from "./components/ItemCard";
function ModelingPage() {
return (
@@ -83,38 +84,16 @@ function ItemModelsList() {
}
function ItemModelCard({ item, currentUserOwnsItem, ...props }) {
- const borderColor = useColorModeValue("gray.100", "green.500");
-
- return (
-
-
- }
- focusSelector=".item-model-card:hover &, .item-model-card:focus &"
- />
-
+ const badges = (
+
);
+
+ return ;
}
function ItemModelBadges({ item, currentUserOwnsItem }) {
return (
-
+
{currentUserOwnsItem && (
@@ -124,7 +103,7 @@ function ItemModelBadges({ item, currentUserOwnsItem }) {
{item.speciesThatNeedModels.map((species) => (
{species.name}
))}
-
+
);
}
diff --git a/src/app/WardrobePage/Item.js b/src/app/WardrobePage/Item.js
index b96b0f8..fefa56f 100644
--- a/src/app/WardrobePage/Item.js
+++ b/src/app/WardrobePage/Item.js
@@ -18,7 +18,13 @@ import {
} from "@chakra-ui/icons";
import loadable from "@loadable/component";
-import ItemSummary, { ItemSummaryBadgeList } from "../components/ItemSummary";
+import {
+ ItemCardContent,
+ ItemBadgeList,
+ ItemBadgeTooltip,
+ NcBadge,
+ NpBadge,
+} from "../components/ItemCard";
import SupportOnly from "./support/SupportOnly";
const LoadableItemSupportDrawer = loadable(() =>
@@ -58,7 +64,7 @@ function Item({
<>
- }
itemNameId={itemNameId}
@@ -189,11 +195,9 @@ function ItemBadges({ item }) {
);
return (
-
+
{item.isNc ? (
-
- NC
-
+
) : (
// The main purpose of the NP badge is alignment: if there are
// zone badges, we want them to start at the same rough position,
@@ -201,9 +205,7 @@ function ItemBadges({ item }) {
// generally avoids zone badges, we'd rather have the NC badge be
// a little extra that might pop up and hide the NP case, rather
// than try to line things up like a table.
-
- NP
-
+
)}
{occupiedZoneLabels.map((zoneLabel) => (
@@ -211,7 +213,7 @@ function ItemBadges({ item }) {
{restrictedZoneLabels.map((zoneLabel) => (
))}
-
+
);
}
@@ -337,18 +339,6 @@ function ZoneBadge({ variant, zoneLabel }) {
return {shorthand};
}
-function ItemBadgeTooltip({ label, children }) {
- return (
- {label}}
- placement="top"
- openDelay={400}
- >
- {children}
-
- );
-}
-
/**
* containerHasFocus is a common CSS selector, for the case where our parent
* .item-container is hovered or the adjacent hidden radio/checkbox is
diff --git a/src/app/components/ItemSummary.js b/src/app/components/ItemCard.js
similarity index 70%
rename from src/app/components/ItemSummary.js
rename to src/app/components/ItemCard.js
index 06347c0..d36e4d2 100644
--- a/src/app/components/ItemSummary.js
+++ b/src/app/components/ItemCard.js
@@ -1,10 +1,43 @@
import React from "react";
import { css } from "emotion";
-import { Box, Image, Wrap, useColorModeValue, useTheme } from "@chakra-ui/core";
+import {
+ Badge,
+ Box,
+ Image,
+ Tooltip,
+ Wrap,
+ useColorModeValue,
+ useTheme,
+} from "@chakra-ui/core";
import { safeImageUrl } from "../util";
-function ItemSummary({
+function ItemCard({ item, badges, ...props }) {
+ const borderColor = useColorModeValue("gray.100", "green.500");
+
+ return (
+
+
+
+ );
+}
+
+export function ItemCardContent({
item,
badges,
isWorn,
@@ -140,7 +173,7 @@ function ItemName({ children, isDisabled, focusSelector, ...props }) {
);
}
-export function ItemSummaryBadgeList({ children }) {
+export function ItemBadgeList({ children }) {
return (
{children}
@@ -148,4 +181,32 @@ export function ItemSummaryBadgeList({ children }) {
);
}
-export default ItemSummary;
+export function ItemBadgeTooltip({ label, children }) {
+ return (
+ {label}}
+ placement="top"
+ openDelay={400}
+ >
+ {children}
+
+ );
+}
+
+export function NcBadge() {
+ return (
+
+ NC
+
+ );
+}
+
+export function NpBadge() {
+ return (
+
+ NP
+
+ );
+}
+
+export default ItemCard;