Finally implement "Edit a copy"
I guess "Coming soon" was a lie oops lmao it was bothering me so I finally added it :p
This commit is contained in:
parent
ac642ea697
commit
4b2d1f949b
2 changed files with 14 additions and 6 deletions
|
@ -32,6 +32,7 @@ import Item, { ItemListContainer, ItemListSkeleton } from "./Item";
|
|||
import { BiRename } from "react-icons/bi";
|
||||
import { IoCloudUploadOutline } from "react-icons/io5";
|
||||
import { MdMoreVert } from "react-icons/md";
|
||||
import { buildOutfitUrl } from "./useOutfitState";
|
||||
|
||||
/**
|
||||
* ItemsPanel shows the items in the current outfit, and lets the user toggle
|
||||
|
@ -359,6 +360,8 @@ function OutfitSavingIndicator({ outfitSaving }) {
|
|||
* It also contains the outfit menu, for saving etc.
|
||||
*/
|
||||
function OutfitHeading({ outfitState, outfitSaving, dispatchToOutfit }) {
|
||||
const outfitCopyUrl = buildOutfitUrl(outfitState, { withoutOutfitId: true });
|
||||
|
||||
return (
|
||||
// The Editable wraps everything, including the menu, because the menu has
|
||||
// a Rename option.
|
||||
|
@ -400,8 +403,13 @@ function OutfitHeading({ outfitState, outfitSaving, dispatchToOutfit }) {
|
|||
<Portal>
|
||||
<MenuList>
|
||||
{outfitState.id && (
|
||||
<MenuItem icon={<EditIcon />} isDisabled>
|
||||
Edit a copy <i>(Coming soon)</i>
|
||||
<MenuItem
|
||||
icon={<EditIcon />}
|
||||
as="a"
|
||||
href={outfitCopyUrl}
|
||||
target="_blank"
|
||||
>
|
||||
Edit a copy
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem
|
||||
|
|
|
@ -599,16 +599,16 @@ function getZonesAndItems(itemsById, wornItemIds, closetedItemIds) {
|
|||
return zonesAndItems;
|
||||
}
|
||||
|
||||
function buildOutfitUrl(outfitState) {
|
||||
export function buildOutfitUrl(outfitState, { withoutOutfitId = false } = {}) {
|
||||
const { id } = outfitState;
|
||||
|
||||
const { origin, pathname } = window.location;
|
||||
const { origin } = window.location;
|
||||
|
||||
if (id) {
|
||||
if (id && !withoutOutfitId) {
|
||||
return origin + `/outfits/${id}`;
|
||||
}
|
||||
|
||||
return origin + pathname + "?" + buildOutfitQueryString(outfitState);
|
||||
return origin + "/outfits/new?" + buildOutfitQueryString(outfitState);
|
||||
}
|
||||
|
||||
function buildOutfitQueryString(outfitState) {
|
||||
|
|
Loading…
Reference in a new issue