[홈패널] 롤링/랜돔 로직 변경

This commit is contained in:
sungmin.in
2024-03-28 19:40:12 +09:00
parent cd4400db45
commit eab4d01334
6 changed files with 62 additions and 86 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -7,6 +7,9 @@ import Spotlight from "@enact/spotlight";
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
import Spottable from "@enact/spotlight/Spottable";
import btnPlay from "../../../../assets/images/btn/btn-play-thumb-nor.png";
import emptyHorImage from "../../../../assets/images/img-home-banner-empty-hor.png";
import emptyVerImage from "../../../../assets/images/img-home-banner-empty-ver.png";
import liveShow from "../../../../assets/images/tag-liveshow.png";
import { pushPanel } from "../../../actions/panelActions";
import TVideoPlayer from "../../../components/TVideoPlayer/TVideoPlayer";
@@ -262,9 +265,18 @@ export default function RandomUnit({
isHorizontal && css.isHorizontal
)}
>
{randomData.tmnlImgPath !== null ? (
{/* {randomData.tmnlImgPath !== null ? (
<img src={randomData.tmnlImgPath} />
) : null}
) : null} */}
{randomData.tmnlImgPath == null ? (
<img
src={
randomData.vtctpYn === "Y" ? emptyVerImage : emptyHorImage
}
/>
) : (
<img src={randomData.tmnlImgPath} />
)}
</div>
) : (
<TVideoPlayer

View File

@@ -7,9 +7,11 @@ import Spotlight from "@enact/spotlight";
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
import Spottable from "@enact/spotlight/Spottable";
import btnPlay from "../../../../assets/images/btn/btn-play-thumb-nor.png";
import emptyHorImage from "../../../../assets/images/img-home-banner-empty-hor.png";
import emptyVerImage from "../../../../assets/images/img-home-banner-empty-ver.png";
import liveShow from "../../../../assets/images/tag-liveshow.png";
import { pushPanel } from "../../../actions/panelActions";
import TVideoPlayer from "../../../components/TVideoPlayer/TVideoPlayer";
import useScrollReset from "../../../hooks/useScrollReset";
import { panel_names } from "../../../utils/Config";
import css from "./RollingUnit.module.less";
@@ -44,30 +46,6 @@ export default function RollingUnit({
const { handleScrollReset, handleStopScrolling } = useScrollReset(scrollTop);
// 비디오 인덱스 서치
const videoIndexSearch = useCallback(() => {
let tempArray = [];
for (let i = 0; i < rollingData.length; i++) {
if (rollingData[i].shptmBanrTpNm === "LIVE") {
tempArray.push(i);
}
}
const upDataArray = [...videoIndex, tempArray];
setVideoIndex(upDataArray);
}, [videoIndex]);
const videoErrorCheck = (errorCheck) => {
setVideoError(errorCheck);
// 비디오 오류시, 다음 비디오로 이동
// for (let i = 0; i < videoIndex.length; i++) {
// if (startIndex != videoIndex[i]) {
// return setStartIndex(i);
// }
// }
};
// 비디오 에러일시, 클릭 이동
const videoErrorClick = () => {
dispatch(
@@ -278,10 +256,6 @@ export default function RollingUnit({
}
}, [count, rollingFocus]);
useEffect(() => {
videoIndexSearch();
}, []);
return (
<Container
className={classNames(
@@ -321,69 +295,46 @@ export default function RollingUnit({
rollingData[startIndex].shptmBanrTpNm === "VOD" ? (
<SpottableComponent
className={classNames(css.itemBox, isHorizontal && css.isHorizontal)}
onClick={
videoError === true &&
rollingData[startIndex].shptmBanrTpNm === "LIVE"
? videoErrorClick
: videoClick
}
onClick={videoClick}
onFocus={onFocus}
onBlur={onBlur}
spotlightId={spotlightId}
spotlightDisabled={contentsFocus}
>
{rollingData[startIndex].shptmBanrTpNm === "LIVE" &&
videoError === false ? (
<p className={css.liveIcon}>
<img src={liveShow} />
</p>
) : null}
{/* 비디오 오류, 비디오 포커스 상태, 라이브 일 경우 */}
{videoError === true &&
rollingFocus === true &&
rollingData[startIndex].shptmBanrTpNm === "LIVE" ? (
<div className={css.errorContents}>
<div>
<img
className={css.errorlogo}
src={rollingData[startIndex].patncLogoPath}
/>
<p className={css.errorText}>
Click the screen to see more products!
</p>
</div>
</div>
) : null}
{rollingFocus === false ? (
<div
className={classNames(
css.itemBox,
isHorizontal && css.isHorizontal
)}
>
{rollingData[startIndex].tmnlImgPath !== null ? (
<img src={rollingData[startIndex].tmnlImgPath} />
) : null}
</div>
) : (
<TVideoPlayer
showUrl={rollingData[startIndex].showUrl}
className={""}
width={rollingData[startIndex].vtctpYn === "Y" ? 486 : 744}
height={rollingData[startIndex].vtctpYn === "Y" ? 858 : 420}
videoIsPlaying={rollingFocus}
videoErrorCheck={videoErrorCheck}
videoType={rollingData[startIndex].shptmBanrTpNm}
{rollingData[startIndex].tmnlImgPath == null ? (
<img
src={
rollingData[startIndex].vtctpYn === "Y"
? emptyVerImage
: emptyHorImage
}
/>
) : (
<img src={rollingData[startIndex].tmnlImgPath} />
)}
{videoError === false ? (
<div className={css.btnPlay}>
{rollingData[startIndex].tmnlImgPath == null ? (
""
) : (
<img src={btnPlay} />
)}
</div>
</div>
<p className={css.brandIcon}>
<img src={rollingData[startIndex].patncLogoPath} />
</p>
) : null}
</SpottableComponent>
) : rollingData[startIndex].shptmBanrTpNm === "Today's Deals" ? (
<SpottableComponent

View File

@@ -25,6 +25,19 @@
.size(@w: 486px, @h: 858px);
}
}
.btnPlay {
.size(@w: 100%, @h: 100%);
display: flex;
align-items: center;
justify-content: center;
position: absolute;
left: 0;
top: 0;
z-index: 2;
> img {
.size(@w: 120px, @h: 120px);
}
}
&.isHorizontal {
.size(@w: 744px, @h: 420px);
.imgBanner {
@@ -39,8 +52,8 @@
align-items: center;
justify-content: center;
.errorlogo {
width: 200px;
height: 200px;
width: 120px;
height: 120px;
object-fit: cover;
}