diff --git a/static/js/shop/CrateList.jsx b/static/js/shop/CrateList.jsx index 04e49b68..e23e11c1 100644 --- a/static/js/shop/CrateList.jsx +++ b/static/js/shop/CrateList.jsx @@ -16,10 +16,16 @@ export function CrateList() { setActiveCrate: state.setActiveCrate, })); return ( - + { + // if e === null, that means that an accordion item was collapsed rather than expanded. e will be non-null when an item is expanded + if (e !== null) + setActiveCrate(e); + else + setActiveCrate("") + }}> {crates.map((crate, index) => - setActiveCrate(crate.id)}>Crate #{`${index}`} + Crate #{`${index}`} diff --git a/static/js/shop/shop_store.js b/static/js/shop/shop_store.js index a22a5fa9..a205fef9 100644 --- a/static/js/shop/shop_store.js +++ b/static/js/shop/shop_store.js @@ -356,6 +356,7 @@ const useCart = ((set, get) => ({ setCrateMode: (id, mode) => { get()._setCrateMode(id, mode) get().fillWarnings(id); + get().setActiveCrate(crate_to); }, addCardFromBacklog: (crate_to, index_from, index_to, just_mounted) => { @@ -363,6 +364,7 @@ const useCart = ((set, get) => ({ if (!dest) return {}; get()._addCardFromBacklog(dest, index_from, index_to) get().fillWarnings(dest); + get().setActiveCrate(dest); if (!just_mounted) { get().cardAdded() } @@ -371,6 +373,7 @@ const useCart = ((set, get) => ({ moveCard: (crate_from, index_from, crate_to, index_to) => { get()._moveCard(crate_from, index_from, crate_to, index_to); get().fillWarnings(crate_to); + get().setActiveCrate(crate_to); if (crate_from !== crate_to) get().fillWarnings(crate_from); }, deleteCard: (crate_id, index) => {