65 lines
2.0 KiB
JavaScript
65 lines
2.0 KiB
JavaScript
import React from 'react';
|
|
import {Droppable} from "@hello-pangea/dnd";
|
|
import {useShopStore} from "./shop_store";
|
|
// #!render_count
|
|
import {useRenderCount} from "@uidotdev/usehooks";
|
|
import {BacklogGroups} from "./BacklogGroups";
|
|
import {SearchBar} from "./SearchBar";
|
|
import {BacklogSearchResult} from "./BacklogSearchResult";
|
|
|
|
/**
|
|
* Component that renders the backlog in the aside
|
|
*/
|
|
export function Backlog() {
|
|
// #!render_count
|
|
const renderCount = useRenderCount();
|
|
|
|
const data = useShopStore((state) => state.groups);
|
|
const items = useShopStore((state) => state.cards);
|
|
|
|
const onClickToggleMobileSideMenu = useShopStore((state) => state.switchSideMenu);
|
|
const isMobile = useShopStore((state) => state.isMobile);
|
|
const showSearch = useShopStore((state) => state.listed_cards.length > 0);
|
|
|
|
// #!render_count
|
|
console.log("Backlog renders: ", renderCount)
|
|
|
|
return (
|
|
<Droppable
|
|
droppableId={data.id}
|
|
isDropDisabled={false}>
|
|
|
|
{(provided) => (
|
|
<div
|
|
className="backlog-container"
|
|
ref={provided.innerRef}
|
|
{...provided.droppableProps}>
|
|
|
|
|
|
|
|
<div className="backlog-bar">
|
|
<SearchBar/>
|
|
|
|
{isMobile ? (
|
|
<div className="mobileCloseMenu">
|
|
<button onClick={onClickToggleMobileSideMenu}>
|
|
<img src="/images/shop/icon-close-white.svg" alt="add"/>
|
|
</button>
|
|
</div>
|
|
) : null}
|
|
</div>
|
|
|
|
{showSearch ? <BacklogSearchResult/> : <BacklogGroups/>}
|
|
|
|
{provided.placeholder && (
|
|
<div style={{display: 'none'}}>
|
|
{provided.placeholder}
|
|
</div>
|
|
)}
|
|
</div>
|
|
)}
|
|
|
|
</Droppable>
|
|
);
|
|
|
|
} |