[FeaturedBrandsPanel] test, system alert (luna)

This commit is contained in:
younghoon100.park
2024-06-28 13:19:06 +09:00
parent a388c2593a
commit 4afb2d4a8f
4 changed files with 103 additions and 15 deletions

View File

@@ -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(

View File

@@ -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: {

View File

@@ -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(

View File

@@ -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 }) => {