Compare commits
No commits in common. "b2b16a2edcb1132fbb9c782ff04ca2f3d86a8289" and "f0b1d2281e7d73bc1dca5b4cc0934080948a52b6" have entirely different histories.
b2b16a2edc
...
f0b1d2281e
3 changed files with 45 additions and 47 deletions
|
@ -21,26 +21,14 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def button_link_to(content_or_url, url = nil, icon: nil, **options)
|
def button_link_to(content, url, icon: nil, **options)
|
||||||
if url.present?
|
|
||||||
content = content_or_url
|
|
||||||
url = url
|
|
||||||
else
|
|
||||||
content = nil
|
|
||||||
url = content_or_url
|
|
||||||
end
|
|
||||||
|
|
||||||
klass = options.fetch(:class, "") + " button"
|
klass = options.fetch(:class, "") + " button"
|
||||||
link_to url, class: klass, **options do
|
link_to url, class: klass, **options do
|
||||||
concat icon
|
concat icon
|
||||||
concat " "
|
concat " "
|
||||||
if block_given?
|
|
||||||
yield
|
|
||||||
else
|
|
||||||
concat content
|
concat content
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def advertise_campaign_progress(campaign, &block)
|
def advertise_campaign_progress(campaign, &block)
|
||||||
if campaign && campaign.advertised?
|
if campaign && campaign.advertised?
|
||||||
|
|
|
@ -34,10 +34,17 @@ import {
|
||||||
QuestionIcon,
|
QuestionIcon,
|
||||||
WarningTwoIcon,
|
WarningTwoIcon,
|
||||||
} from "@chakra-ui/icons";
|
} from "@chakra-ui/icons";
|
||||||
import { IoBagCheck } from "react-icons/io5";
|
import { FaCartPlus } from "react-icons/fa6";
|
||||||
import { CSSTransition, TransitionGroup } from "react-transition-group";
|
import { CSSTransition, TransitionGroup } from "react-transition-group";
|
||||||
|
import { useSearchParams } from "react-router-dom";
|
||||||
|
|
||||||
import { Delay, ErrorMessage, Heading1, Heading2 } from "../util";
|
import {
|
||||||
|
Delay,
|
||||||
|
ErrorMessage,
|
||||||
|
Heading1,
|
||||||
|
Heading2,
|
||||||
|
useLocalStorage,
|
||||||
|
} from "../util";
|
||||||
import Item, { ItemListContainer, ItemListSkeleton } from "./Item";
|
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";
|
||||||
|
@ -272,34 +279,43 @@ function ItemZoneGroupSkeleton({ itemCount }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ShoppingListButton shows the "Shopping list" button, to link to the Shopping=
|
* GetTheseItemsButton shows the "Get these items!" button, to link to the
|
||||||
* List page for the items in this outfit. If there are no items being worn,
|
* Item Getting Guide page for the items in this outfit. If there are no items
|
||||||
* this is disabled.
|
* being worn, this is disabled.
|
||||||
*/
|
*/
|
||||||
function ShoppingListButton({ outfitState }) {
|
function GetTheseItemsButton({ outfitState }) {
|
||||||
|
const [searchParams] = useSearchParams();
|
||||||
|
const [isVisible, setIsVisible] = useLocalStorage("DTIShowGetTheseItems");
|
||||||
|
|
||||||
|
// Enable this feature by visiting `/outfits/new?features=get-these-items`.
|
||||||
|
React.useEffect(() => {
|
||||||
|
const features = searchParams.get("features") ?? "";
|
||||||
|
if (features.split(",").includes("get-these-items")) {
|
||||||
|
setIsVisible(true);
|
||||||
|
}
|
||||||
|
}, [searchParams, setIsVisible]);
|
||||||
|
|
||||||
const itemIds = [...outfitState.wornItemIds].sort();
|
const itemIds = [...outfitState.wornItemIds].sort();
|
||||||
|
const targetUrl = `/items/sources/${itemIds.join(",")}`;
|
||||||
const isDisabled = itemIds.length === 0;
|
const isDisabled = itemIds.length === 0;
|
||||||
|
|
||||||
let targetUrl = `/items/sources/${itemIds.join(",")}`;
|
if (!isVisible) {
|
||||||
if (outfitState.name != null && outfitState.name.trim().length > 0) {
|
return null;
|
||||||
const params = new URLSearchParams();
|
|
||||||
params.append("for", outfitState.name);
|
|
||||||
targetUrl += "?" + params.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
label="Shopping list"
|
label="Get these items!"
|
||||||
placement="top"
|
placement="top"
|
||||||
background="purple.500"
|
background="purple.500"
|
||||||
color="white"
|
color="white"
|
||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
aria-label="Shopping list"
|
aria-label="Get these items!"
|
||||||
as={isDisabled ? "button" : "a"}
|
as={isDisabled ? "button" : "a"}
|
||||||
href={isDisabled ? undefined : targetUrl}
|
href={isDisabled ? undefined : targetUrl}
|
||||||
target={isDisabled ? undefined : "_blank"}
|
target={isDisabled ? undefined : "_blank"}
|
||||||
icon={<IoBagCheck />}
|
icon={<FaCartPlus />}
|
||||||
colorScheme="purple"
|
colorScheme="purple"
|
||||||
size="sm"
|
size="sm"
|
||||||
isRound
|
isRound
|
||||||
|
@ -444,7 +460,7 @@ function OutfitHeading({ outfitState, outfitSaving, dispatchToOutfit }) {
|
||||||
<Box width="4" flex="1 0 auto" />
|
<Box width="4" flex="1 0 auto" />
|
||||||
<OutfitSavingIndicator outfitSaving={outfitSaving} />
|
<OutfitSavingIndicator outfitSaving={outfitSaving} />
|
||||||
<Box width="3" flex="0 0 auto" />
|
<Box width="3" flex="0 0 auto" />
|
||||||
<ShoppingListButton outfitState={outfitState} />
|
<GetTheseItemsButton outfitState={outfitState} />
|
||||||
<Box width="2" flex="0 0 auto" />
|
<Box width="2" flex="0 0 auto" />
|
||||||
<Menu placement="bottom-end">
|
<Menu placement="bottom-end">
|
||||||
<MenuButton
|
<MenuButton
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
- page_title = params[:for] ? "Shopping List for \"#{params[:for]}\"" : "Shopping List"
|
- title "Item Getting Guide"
|
||||||
|
%h1#title Item Getting Guide
|
||||||
- title page_title
|
|
||||||
%h1#title= page_title
|
|
||||||
|
|
||||||
:markdown
|
|
||||||
Here's a custom shopping list for exactly the items in your outfit!
|
|
||||||
Have fun bringing your design to life!!
|
|
||||||
|
|
||||||
- if @items[:nc_mall].present?
|
- if @items[:nc_mall].present?
|
||||||
%h2 NC Mall items
|
%h2 NC Mall items
|
||||||
|
@ -27,16 +21,16 @@
|
||||||
|
|
||||||
%td.actions-cell
|
%td.actions-cell
|
||||||
- if @items_needed[:nc_mall].present?
|
- if @items_needed[:nc_mall].present?
|
||||||
= button_link_to "https://ncmall.neopets.com/",
|
%button{
|
||||||
target: "_blank",
|
onclick: "alert('Todo!')",
|
||||||
data: {"action-kind": "bulk-nc-mall"} do
|
data: {"action-kind": "bulk-nc-mall"},
|
||||||
|
}
|
||||||
= cart_icon alt: ""
|
= cart_icon alt: ""
|
||||||
Buy all in NC Mall
|
Buy all in NC Mall
|
||||||
%tbody
|
%tbody
|
||||||
- @items[:nc_mall].each do |item|
|
- @items[:nc_mall].each do |item|
|
||||||
= render "item_list_row", item: do
|
= render "item_list_row", item: do
|
||||||
= button_link_to "https://ncmall.neopets.com/",
|
%button{onclick: "alert('Todo!')"}
|
||||||
target: "_blank" do
|
|
||||||
= cart_icon alt: ""
|
= cart_icon alt: ""
|
||||||
Buy (#{item.current_nc_price} NC)
|
Buy (#{item.current_nc_price} NC)
|
||||||
|
|
||||||
|
@ -74,9 +68,10 @@
|
||||||
(~#{dyeworks_estimated_potions_cost_for @items_needed[:dyeworks]} NC)
|
(~#{dyeworks_estimated_potions_cost_for @items_needed[:dyeworks]} NC)
|
||||||
%td.actions-cell
|
%td.actions-cell
|
||||||
- if @items_needed[:dyeworks].present?
|
- if @items_needed[:dyeworks].present?
|
||||||
= button_link_to "https://ncmall.neopets.com/",
|
%button{
|
||||||
target: "_blank",
|
onclick: "alert('Todo!')",
|
||||||
data: {"action-kind": "bulk-nc-mall"} do
|
data: {"action-kind": "bulk-nc-mall"},
|
||||||
|
}
|
||||||
= cart_icon alt: ""
|
= cart_icon alt: ""
|
||||||
Buy all in NC Mall
|
Buy all in NC Mall
|
||||||
%tbody
|
%tbody
|
||||||
|
@ -111,8 +106,7 @@
|
||||||
}
|
}
|
||||||
(Limited-time)
|
(Limited-time)
|
||||||
|
|
||||||
= button_link_to "https://ncmall.neopets.com/",
|
%button{onclick: "alert('Todo!')"}
|
||||||
target: "_blank" do
|
|
||||||
= cart_icon alt: ""
|
= cart_icon alt: ""
|
||||||
Buy base (#{item.dyeworks_base_item.current_nc_price} NC)
|
Buy base (#{item.dyeworks_base_item.current_nc_price} NC)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue