Skip to content

Commit

Permalink
deck fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mluena committed Jan 2, 2025
1 parent d4d1173 commit 118cdf7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/containers/widgets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const WidgetsContainer: FC = () => {
window.print();
}, 2000);
}, []);
console.log(widgetsAvailable, enabledWidgets);

return (
<WidgetsLayout>
<AppTools />
Expand Down
7 changes: 3 additions & 4 deletions src/containers/widgets/widgets-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const WidgetsMenu: FC = () => {
const activeLayersIds = activeLayers?.map((layer) => layer.id);
const widgetsIds = widgets.map((widget) => widget.slug);
const enabledWidgets = useWidgetsIdsByLocation();
const categoryByWidgets = findCategoryByWidgets(activeWidgets);

const handleAllWidgets = useCallback(() => {
activeWidgets.length === widgets.length ? setActiveWidgets([]) : setActiveWidgets(widgetsIds);
Expand All @@ -55,12 +54,12 @@ const WidgetsMenu: FC = () => {
const updatedWidgets = activeWidgets.includes(e)
? activeWidgets.filter((widget) => widget !== e)
: [...activeWidgets, e].filter((widget) => widget !== 'widgets_deck_tool');

const newCategory = findCategoryByWidgets(updatedWidgets);
setActiveWidgets(updatedWidgets);
if (updatedWidgets) setCategory(categoryByWidgets);
if (updatedWidgets) setCategory(newCategory);
},

[activeWidgets, setActiveWidgets, setCategory, categoryByWidgets]
[activeWidgets, setActiveWidgets, setCategory]
);

const handleLayers = useCallback(
Expand Down

0 comments on commit 118cdf7

Please sign in to comment.