diff --git a/src/app/UserOutfitsPage.js b/src/app/UserOutfitsPage.js
index 92a1998..f06f696 100644
--- a/src/app/UserOutfitsPage.js
+++ b/src/app/UserOutfitsPage.js
@@ -5,12 +5,9 @@ import gql from "graphql-tag";
import { useQuery } from "@apollo/client";
import { Link } from "react-router-dom";
-import { ErrorMessage, Heading1, useCommonStyles } from "./util";
+import { Heading1, MajorErrorMessage, useCommonStyles } from "./util";
import HangerSpinner from "./components/HangerSpinner";
-import OutfitThumbnail, {
- outfitThumbnailFragment,
- getOutfitThumbnailRenderSize,
-} from "./components/OutfitThumbnail";
+import OutfitThumbnail from "./components/OutfitThumbnail";
import useRequireLogin from "./components/useRequireLogin";
import WIPCallout from "./components/WIPCallout";
@@ -31,14 +28,13 @@ function UserOutfitsPageContent() {
const { loading: queryLoading, error, data } = useQuery(
gql`
- query UserOutfitsPageContent($size: LayerImageSize) {
+ query UserOutfitsPageContent {
currentUser {
id
outfits {
id
name
-
- ...OutfitThumbnailFragment
+ updatedAt
# For alt text
petAppearance {
@@ -58,13 +54,8 @@ function UserOutfitsPageContent() {
}
}
}
- ${outfitThumbnailFragment}
`,
{
- variables: {
- // NOTE: This parameter is used inside `OutfitThumbnailFragment`!
- size: "SIZE_" + getOutfitThumbnailRenderSize(),
- },
context: { sendAuth: true },
skip: userLoading,
}
@@ -79,7 +70,7 @@ function UserOutfitsPageContent() {
}
if (error) {
- return Error loading outfits: {error.message};
+ return ;
}
const outfits = data.currentUser.outfits;
@@ -106,8 +97,8 @@ function OutfitCard({ outfit }) {
{({ css }) => (
console.error(e),
}
);
@@ -89,8 +85,8 @@ function OutfitThumbnailIfCached({ outfitId }) {
return (
);
}
-function buildOutfitThumbnailUrl(petAppearance, itemAppearances) {
- const size = getOutfitThumbnailRenderSize();
- const visibleLayers = getVisibleLayers(petAppearance, itemAppearances);
- const layerUrls = visibleLayers.map(
- (layer) => layer.svgUrl || layer.imageUrl
- );
-
- return `/api/outfitImage?size=${size}&layerUrls=${layerUrls.join(",")}`;
-}
-
-/**
- * getOutfitThumbnailRenderSize returns the right image size to render at
- * 150x150, for the current device.
- *
- * On high-DPI devices, we'll download a 300x300 image to render at 150x150
- * scale. On standard-DPI devices, we'll download a 150x150 image, to save
- * bandwidth.
- */
-export function getOutfitThumbnailRenderSize() {
- if (window.devicePixelRatio > 1) {
- return 300;
- } else {
- return 150;
- }
-}
-
-// NOTE: The query must include a `$size: LayerImageSize` parameter, probably
-// with the return value of `getOutfitThumbnailRenderSize`!
-export const outfitThumbnailFragment = gql`
- fragment OutfitThumbnailFragment on Outfit {
- petAppearance {
- id
- layers {
- id
- svgUrl
- imageUrl(size: $size)
- }
- species {
- id
- name
- }
- color {
- id
- name
- }
- ...PetAppearanceForGetVisibleLayers
- }
- itemAppearances {
- id
- layers {
- id
- svgUrl
- imageUrl(size: $size)
- }
- ...ItemAppearanceForGetVisibleLayers
- }
- }
- ${petAppearanceFragmentForGetVisibleLayers}
- ${itemAppearanceFragmentForGetVisibleLayers}
-`;
-
export default OutfitThumbnail;