[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 // Live 알람 설정/해제 IF-LGSP-012
export const setMainLiveUpcomingAlarm = (props) => (dispatch, getState) => { 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) => { 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 /* ---------------------------------------------- example
@@ -94,7 +165,7 @@ export const setMainLiveUpcomingAlarm = (props) => (dispatch, getState) => {
}; };
const onFail = (error) => { const onFail = (error) => {
console.error("@@ setMainLiveUpcomingAlarm onFail", error); console.error("setMainLiveUpcomingAlarm onFail", error);
}; };
TAxios( TAxios(

View File

@@ -230,7 +230,10 @@ export const addReservation = (data) => {
label: data.params.buttons[1].label, label: data.params.buttons[1].label,
}, },
], ],
autoTimeout: 30, // todo pyh, delete, test case
autoTimeout: 60 * 5,
// autoTimeout: 30,
}, },
}, },
information: { 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)); dispatch(setMainLiveUpcomingAlarm(upcomingAlarmInfo));
// showList, { patnrId: number, showId: string }[]
dispatch(deleteMyUpcomingAlertShow({ showList: deletedAlertShows })); dispatch(deleteMyUpcomingAlertShow({ showList: deletedAlertShows }));
alamTimer.current = setTimeout( alamTimer.current = setTimeout(

View File

@@ -11,7 +11,7 @@ import TVirtualGridList from "../../../../components/TVirtualGridList/TVirtualGr
import useLogService from "../../../../hooks/useLogService"; import useLogService from "../../../../hooks/useLogService";
import useScrollTo from "../../../../hooks/useScrollTo"; import useScrollTo from "../../../../hooks/useScrollTo";
import { ACTIVE_POPUP } from "../../../../utils/Config"; import { ACTIVE_POPUP } from "../../../../utils/Config";
// import useScrollTopByDistance from "../../../../hooks/useScrollTopByDistance"; import { formatGMTString } from "../../../../utils/helperMethods";
import UpComingCard from "./UpComingCard/UpComingCard"; import UpComingCard from "./UpComingCard/UpComingCard";
import css from "./UpComingList.module.less"; import css from "./UpComingList.module.less";
@@ -29,6 +29,10 @@ const getTimeDifferenceInSeconds = (strtDt) => {
return timeDifferenceInSeconds; return timeDifferenceInSeconds;
}; };
const addMinutesToDate = (date, minutes = 3) => {
return new Date(date.getTime() + minutes * 60000);
};
export default memo(function UpComingList({ export default memo(function UpComingList({
brandLiveChannelUpcoming, brandLiveChannelUpcoming,
handleItemFocus, handleItemFocus,
@@ -37,7 +41,6 @@ export default memo(function UpComingList({
const { sendLogUpcomingFlag } = useLogService(); const { sendLogUpcomingFlag } = useLogService();
const { getScrollTo, scrollLeft } = useScrollTo(); const { getScrollTo, scrollLeft } = useScrollTo();
// const { scrollTopByDistance } = useScrollTopByDistance();
const dispatch = useDispatch(); const dispatch = useDispatch();
@@ -49,10 +52,6 @@ export default memo(function UpComingList({
(state) => state.myPage.upComingData?.upComingAlertShow?.alertShows (state) => state.myPage.upComingData?.upComingAlertShow?.alertShows
); );
const cursorVisible = useSelector(
(state) => state.common.appStatus.cursorVisible
);
const alamTimer = useRef(null); const alamTimer = useRef(null);
useEffect(() => { useEffect(() => {
@@ -99,9 +98,14 @@ export default memo(function UpComingList({
const upcomingAlarmInfo = { const upcomingAlarmInfo = {
alamDispFlag: "Y", alamDispFlag: "Y",
endDt, endDt,
patncNm, // for system alert
patnrId, patnrId,
showId, showId,
showNm, // for system alert
strtDt, strtDt,
// pyh, delete test case
testStrtDt: formatGMTString(addMinutesToDate(new Date())),
}; };
if (isReminderOff) { if (isReminderOff) {
@@ -164,11 +168,7 @@ export default memo(function UpComingList({
if (handleItemFocus) { if (handleItemFocus) {
handleItemFocus(); handleItemFocus();
} }
}, [handleItemFocus]);
if (cursorVisible) {
return;
}
}, [cursorVisible, handleItemFocus]);
const renderItem = useCallback( const renderItem = useCallback(
({ index, ...rest }) => { ({ index, ...rest }) => {