|
|
|
|
@@ -4,6 +4,7 @@ import { useDispatch, useSelector } from "react-redux";
|
|
|
|
|
|
|
|
|
|
import Spotlight from "@enact/spotlight";
|
|
|
|
|
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
|
|
|
|
|
import { setContainerLastFocusedElement } from "@enact/spotlight/src/container";
|
|
|
|
|
|
|
|
|
|
import { getSubCategory } from "../../actions/mainActions";
|
|
|
|
|
import SectionTitle from "../../components/SectionTitle/SectionTitle";
|
|
|
|
|
@@ -11,8 +12,12 @@ import TBody from "../../components/TBody/TBody";
|
|
|
|
|
import TButtonTab, { LIST_TYPE } from "../../components/TButtonTab/TButtonTab";
|
|
|
|
|
import TDropDown from "../../components/TDropDown/TDropDown";
|
|
|
|
|
import THeader from "../../components/THeader/THeader";
|
|
|
|
|
import TopButton from "../../components/TopButton/TopButton";
|
|
|
|
|
import TPanel from "../../components/TPanel/TPanel";
|
|
|
|
|
import useScrollTo from "../../hooks/useScrollTo";
|
|
|
|
|
import useScrollToTop from "../../hooks/useScrollToTop";
|
|
|
|
|
import { $L } from "../../utils/helperMethods";
|
|
|
|
|
import { SpotlightIds } from "../../utils/SpotlightIds";
|
|
|
|
|
import ItemContents from "./CategoryContents/ItemContents/ItemContents";
|
|
|
|
|
import ShowContents from "./CategoryContents/ShowContents/ShowContents";
|
|
|
|
|
import css from "./CategoryPanel.module.less";
|
|
|
|
|
@@ -38,6 +43,8 @@ export default function CategoryPanel() {
|
|
|
|
|
const categoryDatas = useSelector((state) => state.main.subCategoryData);
|
|
|
|
|
const panelInfos = useSelector((state) => state.panels.panels?.[0]);
|
|
|
|
|
|
|
|
|
|
const { getScrollTo, scrollTop } = useScrollTo();
|
|
|
|
|
|
|
|
|
|
const { lgCatCd, lgCatNm, COUNT } = panelInfos.panelInfo || {};
|
|
|
|
|
const {
|
|
|
|
|
bannerInfos,
|
|
|
|
|
@@ -59,7 +66,9 @@ export default function CategoryPanel() {
|
|
|
|
|
setDropDownTab(0);
|
|
|
|
|
|
|
|
|
|
if (panelInfos?.panelInfo) {
|
|
|
|
|
dispatch(getSubCategory({ lgCatCd, filterType: "CAT00202" }));
|
|
|
|
|
dispatch(
|
|
|
|
|
getSubCategory({ lgCatCd, pageSize: "100", filterType: "CAT00202" }, 1)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}, [panelInfos, lgCatCd, dispatch]);
|
|
|
|
|
|
|
|
|
|
@@ -90,17 +99,24 @@ export default function CategoryPanel() {
|
|
|
|
|
const filterType = dropDownTab === 0 ? "CAT00202" : "CAT00201";
|
|
|
|
|
const tabType = tab === 0 ? "CAT00101" : "CAT00102";
|
|
|
|
|
|
|
|
|
|
dispatch(getSubCategory({ lgCatCd, tabType, filterType }));
|
|
|
|
|
dispatch(getSubCategory({ lgCatCd, pageSize: "100", tabType, filterType }));
|
|
|
|
|
}, [dropDownTab, dispatch, tab]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
scrollTop({ animate: false });
|
|
|
|
|
setContainerLastFocusedElement(null, [SpotlightIds.TBODY]);
|
|
|
|
|
Spotlight.focus("tab-0");
|
|
|
|
|
}, [panelInfos]);
|
|
|
|
|
|
|
|
|
|
const handleTopButtonClick = useCallback(() => {
|
|
|
|
|
setContainerLastFocusedElement(null, ["categoryContentsBox"]);
|
|
|
|
|
Spotlight.focus(`tab-${tab}`);
|
|
|
|
|
}, []);
|
|
|
|
|
}, [tab]);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<TPanel>
|
|
|
|
|
<THeader title="Category" />
|
|
|
|
|
<TBody className={css.tBody}>
|
|
|
|
|
<TBody className={css.tBody} cbScrollTo={getScrollTo}>
|
|
|
|
|
<div className={css.paddingContainer}>
|
|
|
|
|
{panelInfos && panelInfos.panelInfo && categoryDatas && (
|
|
|
|
|
<SectionTitle
|
|
|
|
|
@@ -124,12 +140,14 @@ export default function CategoryPanel() {
|
|
|
|
|
onItemClick={handleItemClick}
|
|
|
|
|
selectedIndex={tab}
|
|
|
|
|
listType={LIST_TYPE.medium}
|
|
|
|
|
scrollTop={scrollTop}
|
|
|
|
|
/>
|
|
|
|
|
<TDropDown
|
|
|
|
|
className={css.dropdown}
|
|
|
|
|
onSelect={handleSelectFilter}
|
|
|
|
|
selectedIndex={dropDownTab}
|
|
|
|
|
width="small"
|
|
|
|
|
scrollTop={scrollTop}
|
|
|
|
|
>
|
|
|
|
|
{filterMethods}
|
|
|
|
|
</TDropDown>
|
|
|
|
|
@@ -137,6 +155,7 @@ export default function CategoryPanel() {
|
|
|
|
|
)}
|
|
|
|
|
{tab === 0 && <ShowContents />}
|
|
|
|
|
{tab === 1 && <ItemContents />}
|
|
|
|
|
<TopButton onTopButtonClick={handleTopButtonClick} />
|
|
|
|
|
</div>
|
|
|
|
|
</TBody>
|
|
|
|
|
</TPanel>
|
|
|
|
|
|