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 { BiRename } from "react-icons/bi";
|
||||||
import { IoCloudUploadOutline } from "react-icons/io5";
|
import { IoCloudUploadOutline } from "react-icons/io5";
|
||||||
import { MdMoreVert } from "react-icons/md";
|
import { MdMoreVert } from "react-icons/md";
|
||||||
|
import { buildOutfitUrl } from "./useOutfitState";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ItemsPanel shows the items in the current outfit, and lets the user toggle
|
* 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.
|
* It also contains the outfit menu, for saving etc.
|
||||||
*/
|
*/
|
||||||
function OutfitHeading({ outfitState, outfitSaving, dispatchToOutfit }) {
|
function OutfitHeading({ outfitState, outfitSaving, dispatchToOutfit }) {
|
||||||
|
const outfitCopyUrl = buildOutfitUrl(outfitState, { withoutOutfitId: true });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// The Editable wraps everything, including the menu, because the menu has
|
// The Editable wraps everything, including the menu, because the menu has
|
||||||
// a Rename option.
|
// a Rename option.
|
||||||
|
@ -400,8 +403,13 @@ function OutfitHeading({ outfitState, outfitSaving, dispatchToOutfit }) {
|
||||||
<Portal>
|
<Portal>
|
||||||
<MenuList>
|
<MenuList>
|
||||||
{outfitState.id && (
|
{outfitState.id && (
|
||||||
<MenuItem icon={<EditIcon />} isDisabled>
|
<MenuItem
|
||||||
Edit a copy <i>(Coming soon)</i>
|
icon={<EditIcon />}
|
||||||
|
as="a"
|
||||||
|
href={outfitCopyUrl}
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
Edit a copy
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
|
|
@ -599,16 +599,16 @@ function getZonesAndItems(itemsById, wornItemIds, closetedItemIds) {
|
||||||
return zonesAndItems;
|
return zonesAndItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildOutfitUrl(outfitState) {
|
export function buildOutfitUrl(outfitState, { withoutOutfitId = false } = {}) {
|
||||||
const { id } = outfitState;
|
const { id } = outfitState;
|
||||||
|
|
||||||
const { origin, pathname } = window.location;
|
const { origin } = window.location;
|
||||||
|
|
||||||
if (id) {
|
if (id && !withoutOutfitId) {
|
||||||
return origin + `/outfits/${id}`;
|
return origin + `/outfits/${id}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return origin + pathname + "?" + buildOutfitQueryString(outfitState);
|
return origin + "/outfits/new?" + buildOutfitQueryString(outfitState);
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildOutfitQueryString(outfitState) {
|
function buildOutfitQueryString(outfitState) {
|
||||||
|
|
Loading…
Reference in a new issue