From 4afb2d4a8f510a0d8beb68957c859e46aaf32768 Mon Sep 17 00:00:00 2001 From: "younghoon100.park" Date: Fri, 28 Jun 2024 13:19:06 +0900 Subject: [PATCH] [FeaturedBrandsPanel] test, system alert (luna) --- .../src/actions/mainActions.js | 77 ++++++++++++++++++- com.twin.app.shoptime/src/lunaSend/common.js | 5 +- .../FeaturedBrandsPanel.jsx | 14 ++++ .../UpComing/UpComingList/UpComingList.jsx | 22 +++--- 4 files changed, 103 insertions(+), 15 deletions(-) diff --git a/com.twin.app.shoptime/src/actions/mainActions.js b/com.twin.app.shoptime/src/actions/mainActions.js index a52875b0..08bf7495 100644 --- a/com.twin.app.shoptime/src/actions/mainActions.js +++ b/com.twin.app.shoptime/src/actions/mainActions.js @@ -37,10 +37,81 @@ export const getMainLiveShow = (props) => (dispatch, getState) => { // Live 알람 설정/해제 IF-LGSP-012 export const setMainLiveUpcomingAlarm = (props) => (dispatch, getState) => { - const { alamDispFlag, endDt, patnrId, showId, strtDt } = props; + const { + alamDispFlag, + endDt, + patnrId, + patncNm, + showId, + showNm, + strtDt, + testStrtDt, + } = props; const onSuccess = (response) => { - console.log("@@ setMainLiveUpcomingAlarm onSuccess", response.data); + console.log("setMainLiveUpcomingAlarm onSuccess", response.data); + + if (alamDispFlag === "Y") { + const data = { + startTime: { + // year: new Date(strtDt).getFullYear(), + // month: new Date(strtDt).getMonth() + 1, + // day: new Date(strtDt).getDate(), + // hour: new Date(strtDt).getHours(), + // minute: new Date(strtDt).getMinutes(), + // second: new Date(strtDt).getSeconds(), + + // pyh, delete test case + year: new Date(testStrtDt).getFullYear(), + month: new Date(testStrtDt).getMonth() + 1, + day: new Date(testStrtDt).getDate(), + hour: new Date(testStrtDt).getHours(), + minute: new Date(testStrtDt).getMinutes(), + second: new Date(testStrtDt).getSeconds(), + }, + params: { + message: `[${patncNm}] ${showNm}\nWatch Live show now?`, + buttons: [ + { + label: HelperMethods.$L("yes"), + }, + { + label: HelperMethods.$L("no"), + }, + ], + launch: { + contentTarget: `V3_8002_Tv_FB_${patnrId}`, + }, + showId: showId, + }, + }; + + dispatch( + addReservation(data, { + onSuccess: (res) => { + console.log("LUNA SEND addReservation success", res); + }, + onFailure: (err) => { + // todo pyh, add callback in case of failure + console.log("LUNA SEND addReservation failed", err); + }, + }) + ); + } + // + else if (alamDispFlag === "N") { + dispatch( + deleteReservation(showId, { + onSuccess: (res) => { + console.log("LUNA SEND deleteReservation success", res); + }, + onFailure: (err) => { + // todo pyh, add callback in case of failure + console.log("LUNA SEND deleteReservation failed", err); + }, + }) + ); + } /* ---------------------------------------------- example @@ -94,7 +165,7 @@ export const setMainLiveUpcomingAlarm = (props) => (dispatch, getState) => { }; const onFail = (error) => { - console.error("@@ setMainLiveUpcomingAlarm onFail", error); + console.error("setMainLiveUpcomingAlarm onFail", error); }; TAxios( diff --git a/com.twin.app.shoptime/src/lunaSend/common.js b/com.twin.app.shoptime/src/lunaSend/common.js index eb929b4f..505e34a8 100644 --- a/com.twin.app.shoptime/src/lunaSend/common.js +++ b/com.twin.app.shoptime/src/lunaSend/common.js @@ -230,7 +230,10 @@ export const addReservation = (data) => { label: data.params.buttons[1].label, }, ], - autoTimeout: 30, + // todo pyh, delete, test case + autoTimeout: 60 * 5, + + // autoTimeout: 30, }, }, information: { diff --git a/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBrandsPanel.jsx b/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBrandsPanel.jsx index f56dcdc3..b94fdd29 100644 --- a/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBrandsPanel.jsx +++ b/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/FeaturedBrandsPanel.jsx @@ -614,7 +614,21 @@ export default function FeaturedBrandsPanel({ ---------------------------------------------- */ + // dispatch(deleteReservation(deletedAlertShows, { + // onSuccess: (res) => { + // console.log("LUNA SEND deleteReservation success", res); + // dispatch(setMainLiveUpcomingAlarm(upcomingAlarmInfo)); + // dispatch(deleteMyUpcomingAlertShow({ showList: deletedAlertShows })); + // }, + // onFailure: (err) => { + // console.log("LUNA SEND deleteReservation failed", err); + // } + // })); + + // dispatch(setMainLiveUpcomingAlarm(upcomingAlarmInfo)); + + // showList, { patnrId: number, showId: string }[] dispatch(deleteMyUpcomingAlertShow({ showList: deletedAlertShows })); alamTimer.current = setTimeout( diff --git a/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/UpComing/UpComingList/UpComingList.jsx b/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/UpComing/UpComingList/UpComingList.jsx index f6e132e2..7f41001c 100644 --- a/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/UpComing/UpComingList/UpComingList.jsx +++ b/com.twin.app.shoptime/src/views/FeaturedBrandsPanel/UpComing/UpComingList/UpComingList.jsx @@ -11,7 +11,7 @@ import TVirtualGridList from "../../../../components/TVirtualGridList/TVirtualGr import useLogService from "../../../../hooks/useLogService"; import useScrollTo from "../../../../hooks/useScrollTo"; import { ACTIVE_POPUP } from "../../../../utils/Config"; -// import useScrollTopByDistance from "../../../../hooks/useScrollTopByDistance"; +import { formatGMTString } from "../../../../utils/helperMethods"; import UpComingCard from "./UpComingCard/UpComingCard"; import css from "./UpComingList.module.less"; @@ -29,6 +29,10 @@ const getTimeDifferenceInSeconds = (strtDt) => { return timeDifferenceInSeconds; }; +const addMinutesToDate = (date, minutes = 3) => { + return new Date(date.getTime() + minutes * 60000); +}; + export default memo(function UpComingList({ brandLiveChannelUpcoming, handleItemFocus, @@ -37,7 +41,6 @@ export default memo(function UpComingList({ const { sendLogUpcomingFlag } = useLogService(); const { getScrollTo, scrollLeft } = useScrollTo(); - // const { scrollTopByDistance } = useScrollTopByDistance(); const dispatch = useDispatch(); @@ -49,10 +52,6 @@ export default memo(function UpComingList({ (state) => state.myPage.upComingData?.upComingAlertShow?.alertShows ); - const cursorVisible = useSelector( - (state) => state.common.appStatus.cursorVisible - ); - const alamTimer = useRef(null); useEffect(() => { @@ -99,9 +98,14 @@ export default memo(function UpComingList({ const upcomingAlarmInfo = { alamDispFlag: "Y", endDt, + patncNm, // for system alert patnrId, showId, + showNm, // for system alert strtDt, + + // pyh, delete test case + testStrtDt: formatGMTString(addMinutesToDate(new Date())), }; if (isReminderOff) { @@ -164,11 +168,7 @@ export default memo(function UpComingList({ if (handleItemFocus) { handleItemFocus(); } - - if (cursorVisible) { - return; - } - }, [cursorVisible, handleItemFocus]); + }, [handleItemFocus]); const renderItem = useCallback( ({ index, ...rest }) => {