From 81c6a4a0232d205e8f9fd3c9c8e81da2c30d4278 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 9 Jul 2024 13:19:23 -0700 Subject: [PATCH] Add outfit name to Shopping List page title Just some extra flair! I had considered something like this before, but felt it didn't flow well with the old title. --- .../wardrobe-2020/WardrobePage/ItemsPanel.js | 14 ++++++++++---- app/views/items/sources.html.haml | 6 ++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/javascript/wardrobe-2020/WardrobePage/ItemsPanel.js b/app/javascript/wardrobe-2020/WardrobePage/ItemsPanel.js index 9dcd1a29..927f0c38 100644 --- a/app/javascript/wardrobe-2020/WardrobePage/ItemsPanel.js +++ b/app/javascript/wardrobe-2020/WardrobePage/ItemsPanel.js @@ -295,14 +295,20 @@ function GetTheseItemsButton({ outfitState }) { } }, [searchParams, setIsVisible]); - const itemIds = [...outfitState.wornItemIds].sort(); - const targetUrl = `/items/sources/${itemIds.join(",")}`; - const isDisabled = itemIds.length === 0; - if (!isVisible) { return null; } + const itemIds = [...outfitState.wornItemIds].sort(); + const isDisabled = itemIds.length === 0; + + let targetUrl = `/items/sources/${itemIds.join(",")}`; + if (outfitState.name != null && outfitState.name.trim().length > 0) { + const params = new URLSearchParams(); + params.append("for", outfitState.name); + targetUrl += "?" + params.toString(); + } + return (