moment.js uninstall && LiveChannel new Date로 로직 수정

This commit is contained in:
고동영
2024-03-29 17:33:08 +09:00
parent 170ab756c2
commit 5287d951bc
4 changed files with 12 additions and 12 deletions

View File

@@ -41,7 +41,6 @@
"@enact/webos": "^3.3.0", "@enact/webos": "^3.3.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"ilib": "^14.3.0", "ilib": "^14.3.0",
"moment": "^2.30.1",
"prop-types": "^15.6.2", "prop-types": "^15.6.2",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",

View File

@@ -1,7 +1,6 @@
import React, { memo, useCallback, useEffect, useMemo, useState } from "react"; import React, { memo, useCallback, useEffect, useMemo, useState } from "react";
import classNames from "classnames"; import classNames from "classnames";
import moment from "moment";
import Spottable from "@enact/spotlight/Spottable"; import Spottable from "@enact/spotlight/Spottable";
@@ -82,23 +81,25 @@ export default memo(function PlayerItemCard({
}, [onFocus]); }, [onFocus]);
useEffect(() => { useEffect(() => {
const today = moment(); const today = new Date();
const startDtMoment = moment(startDt); const startDtMoment = new Date(startDt);
const endDtMoment = moment(endDt); const endDtMoment = new Date(endDt);
//라이브 영상 시간 (분) // 라이브 영상 시간 (분)
const liveTime = endDtMoment.diff(startDtMoment, "minutes"); const liveTime = Math.floor((endDtMoment - startDtMoment) / (1000 * 60));
//경과시간 (분) // 경과시간 (분)
const elapsedTime = today.diff(startDtMoment, "minutes"); const elapsedTime = Math.floor((today - startDtMoment) / (1000 * 60));
const progressPercentage = (elapsedTime / liveTime) * 100; const progressPercentage = (elapsedTime / liveTime) * 100;
console.log("#progressPercentage", progressPercentage);
if (elapsedTime > 0) { if (elapsedTime > 0) {
setGaugeWidth(progressPercentage); setGaugeWidth(progressPercentage);
} else { } else {
setGaugeWidth(0); setGaugeWidth(0);
} }
}, [gaugeWidth]); }, [startDt, endDt, gaugeWidth]);
const progressStyle = useMemo( const progressStyle = useMemo(
() => ({ width: `${gaugeWidth}%` }), () => ({ width: `${gaugeWidth}%` }),
[gaugeWidth] [gaugeWidth]

View File

@@ -215,7 +215,7 @@ const PlayerPanel = ({ hideChildren, isTabActivated, ...props }) => {
<div className={classNames(css.overIcon, css.backLiveicon)}> <div className={classNames(css.overIcon, css.backLiveicon)}>
<SpottableBtn onClick={onClickBack} className={css.backIcon} /> <SpottableBtn onClick={onClickBack} className={css.backIcon} />
<div className={panelInfo?.type === "LIVE" && css.liveIcon} /> <div className={panelInfo?.type === "LIVE" && css.liveIcon} />
{/* <div className={css.logo}>{"123"}</div> */} <div className={css.logo}>{"123"}</div>
</div> </div>
<div className={classNames(css.overIcon, css.topIcon)} /> <div className={classNames(css.overIcon, css.topIcon)} />
<div className={classNames(css.overIcon, css.downIcon)} /> <div className={classNames(css.overIcon, css.downIcon)} />

View File

@@ -26,7 +26,7 @@
cursor: pointer; cursor: pointer;
} }
&.arrowClose { &.arrowClose {
right: 0px; right: -2px;
> button { > button {
&.button { &.button {
background-image: url(../../../assets/images/btn/btn-toopen-nor.svg); background-image: url(../../../assets/images/btn/btn-toopen-nor.svg);