forked from M-Labs/web2019
Disable warnings and options for the spare cards crate mode
Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
parent
2673f81526
commit
161666b09c
|
@ -25,6 +25,7 @@ export function ProductCartItem({card_index, crate_index, first, last}) {
|
||||||
const card_counted_resources = useShopStore(state => state.crates[crate_index].items[card_index].counted_resources, compareObjectsEmptiness);
|
const card_counted_resources = useShopStore(state => state.crates[crate_index].items[card_index].counted_resources, compareObjectsEmptiness);
|
||||||
|
|
||||||
const highlighted = useShopStore((state) => state.crates[crate_index].id === state.highlighted.crate && card_index === state.highlighted.card);
|
const highlighted = useShopStore((state) => state.crates[crate_index].id === state.highlighted.crate && card_index === state.highlighted.card);
|
||||||
|
const options_disabled = useShopStore((state) => !!state.crateParams(state.crates[crate_index].crate_mode).warnings_disabled);
|
||||||
const crate_id = useShopStore((state) => state.crates[crate_index].id);
|
const crate_id = useShopStore((state) => state.crates[crate_index].id);
|
||||||
const setHighlight = useShopStore((state) => state.highlightCard);
|
const setHighlight = useShopStore((state) => state.highlightCard);
|
||||||
const removeHighlight = useShopStore((state) => state.highlightReset);
|
const removeHighlight = useShopStore((state) => state.highlightReset);
|
||||||
|
@ -34,9 +35,9 @@ export function ProductCartItem({card_index, crate_index, first, last}) {
|
||||||
console.log("ProductCartItem renders: ", renderCount)
|
console.log("ProductCartItem renders: ", renderCount)
|
||||||
|
|
||||||
|
|
||||||
const options = card && card.options && card.options.length > 0;
|
const options = !options_disabled && card && card.options && card.options.length > 0;
|
||||||
const warnings = card_show_warnings && card_show_warnings.length > 0;
|
const warnings = !options_disabled && card_show_warnings && card_show_warnings.length > 0;
|
||||||
const resources = card_counted_resources && card_counted_resources.length > 0;
|
const resources = !options_disabled && card_counted_resources && card_counted_resources.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Draggable draggableId={card.id} index={card_index}>
|
<Draggable draggableId={card.id} index={card_index}>
|
||||||
|
|
|
@ -23,14 +23,16 @@ export function SummaryCrateCard({crate_index, card_index}) {
|
||||||
(a, b) => a.id === b.id);
|
(a, b) => a.id === b.id);
|
||||||
const card_show_warnings = useShopStore(state => state.crates[crate_index].items[card_index].show_warnings, compareObjectsEmptiness);
|
const card_show_warnings = useShopStore(state => state.crates[crate_index].items[card_index].show_warnings, compareObjectsEmptiness);
|
||||||
const card_options_data = useShopStore(state => state.crates[crate_index].items[card_index].options_data, compareObjectsEmptiness);
|
const card_options_data = useShopStore(state => state.crates[crate_index].items[card_index].options_data, compareObjectsEmptiness);
|
||||||
|
const options_disabled = useShopStore((state) => !!state.crateParams(state.crates[crate_index].crate_mode).warnings_disabled);
|
||||||
|
|
||||||
|
|
||||||
// #!render_count
|
// #!render_count
|
||||||
console.log("SummaryCrateCard renders: ", renderCount)
|
console.log("SummaryCrateCard renders: ", renderCount)
|
||||||
|
|
||||||
|
|
||||||
const options = card && card.options && card.options.length > 0;
|
const options = !options_disabled && card && card.options && card.options.length > 0;
|
||||||
const options_data = card_options_data && Object.keys(card_options_data).length > 0;
|
const options_data = !options_disabled && card_options_data && Object.keys(card_options_data).length > 0;
|
||||||
const warnings = card_show_warnings && card_show_warnings.length > 0;
|
const warnings = !options_disabled && card_show_warnings && card_show_warnings.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr
|
<tr
|
||||||
|
|
Loading…
Reference in New Issue