[FeaturedBrandsPanel] edited, display condition(TopButton)
This commit is contained in:
@@ -221,6 +221,7 @@ export default function FeaturedBrandsPanel({
|
|||||||
(state) => state.brand.brandShowroomData.data.brandShowroomInfo
|
(state) => state.brand.brandShowroomData.data.brandShowroomInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [displayTopButton, setDisplayTopButton] = useState(false);
|
||||||
const [firstFocusableTargetId, setFirstFocusableTargetId] = useState(null);
|
const [firstFocusableTargetId, setFirstFocusableTargetId] = useState(null);
|
||||||
const [isInitialFocusOccurred, setIsInitialFocusOccurred] = useState(false);
|
const [isInitialFocusOccurred, setIsInitialFocusOccurred] = useState(false);
|
||||||
const [isInitialRendered, setIsInitialRendered] = useState(true);
|
const [isInitialRendered, setIsInitialRendered] = useState(true);
|
||||||
@@ -242,6 +243,7 @@ export default function FeaturedBrandsPanel({
|
|||||||
const initialFocusTimeoutJob = useRef(new Job((func) => func(), 100));
|
const initialFocusTimeoutJob = useRef(new Job((func) => func(), 100));
|
||||||
const alamTimer = useRef(null);
|
const alamTimer = useRef(null);
|
||||||
const cbChangePageRef = useRef(null);
|
const cbChangePageRef = useRef(null);
|
||||||
|
const orderableFlexContainerRef = useRef(null);
|
||||||
|
|
||||||
const previousPanelIsDetail = Object.keys(panelInfo).length >= 6;
|
const previousPanelIsDetail = Object.keys(panelInfo).length >= 6;
|
||||||
const previousActionOccurredInGNB =
|
const previousActionOccurredInGNB =
|
||||||
@@ -433,6 +435,27 @@ export default function FeaturedBrandsPanel({
|
|||||||
previousPanelIsDetail,
|
previousPanelIsDetail,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let timer;
|
||||||
|
|
||||||
|
if (brandLayoutInfo) {
|
||||||
|
setDisplayTopButton(false);
|
||||||
|
|
||||||
|
timer = setTimeout(() => {
|
||||||
|
const orderableFlexContainer = orderableFlexContainerRef.current;
|
||||||
|
|
||||||
|
if (
|
||||||
|
orderableFlexContainer &&
|
||||||
|
orderableFlexContainer?.children.length > 1
|
||||||
|
) {
|
||||||
|
setDisplayTopButton(true);
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => clearTimeout(timer);
|
||||||
|
}, [brandLayoutInfo]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isInitialFocusOccurred && selectedPatnrId && selectedPatncNm) {
|
if (isInitialFocusOccurred && selectedPatnrId && selectedPatncNm) {
|
||||||
sendLogPartners({
|
sendLogPartners({
|
||||||
@@ -594,7 +617,7 @@ export default function FeaturedBrandsPanel({
|
|||||||
{
|
{
|
||||||
<TVerticalPagenator
|
<TVerticalPagenator
|
||||||
className={css.tVerticalPagenator}
|
className={css.tVerticalPagenator}
|
||||||
spotlightId={"brand_verticalPagenator"}
|
spotlightId="brand_verticalPagenator"
|
||||||
// enableFocusAction={false}
|
// enableFocusAction={false}
|
||||||
defaultContainerId={panelInfo?.focusedContainerId}
|
defaultContainerId={panelInfo?.focusedContainerId}
|
||||||
onFocusedContainerId={onFocusedContainerId}
|
onFocusedContainerId={onFocusedContainerId}
|
||||||
@@ -619,7 +642,10 @@ export default function FeaturedBrandsPanel({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{brandLayoutInfo && (
|
{brandLayoutInfo && (
|
||||||
<div className={css.orderableFlexContainer}>
|
<div
|
||||||
|
className={css.orderableFlexContainer}
|
||||||
|
ref={orderableFlexContainerRef}
|
||||||
|
>
|
||||||
{hasTemplateCodeWithValue(
|
{hasTemplateCodeWithValue(
|
||||||
brandLayoutInfo,
|
brandLayoutInfo,
|
||||||
TEMPLATE_CODE_CONF.LIVE_CHANNELS
|
TEMPLATE_CODE_CONF.LIVE_CHANNELS
|
||||||
@@ -799,7 +825,7 @@ export default function FeaturedBrandsPanel({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isInitialFocusOccurred && (
|
{displayTopButton && (
|
||||||
<TButton
|
<TButton
|
||||||
className={css.tButton}
|
className={css.tButton}
|
||||||
onClick={handleTopButtonClick}
|
onClick={handleTopButtonClick}
|
||||||
|
|||||||
Reference in New Issue
Block a user