Number of Events working Correctly

master
Pedram Keshavarzi 3 years ago
parent a5ca336e39
commit 60624da2a2
  1. 56
      src/components/Calendar/CalendarComponents/components/DaysList.js

@ -159,7 +159,7 @@ const DaysList = ({
const customDayItemClassName = customDaysClassName.find((day) => const customDayItemClassName = customDaysClassName.find((day) =>
isSameDay(dayItem, day) isSameDay(dayItem, day)
); );
const classNames = '' const classNames = ''
.concat(isToday && !isSelected ? ` -today ${calendarTodayClassName}` : '') .concat(isToday && !isSelected ? ` -today ${calendarTodayClassName}` : '')
.concat(!dayItem.isStandard ? ' -blank' : '') .concat(!dayItem.isStandard ? ' -blank' : '')
@ -256,43 +256,30 @@ const DaysList = ({
isStandard, isStandard,
}); });
// showing Dots Of Events
const specialDate = (sDay, sMonth, sYear) => { const specialDate = (sDay, sMonth, sYear) => {
for (var i = 0; i < events.length; i++) { return events.map((e) => {
if (sDay == events[i].day && sMonth == events[i].month && sYear == events[i].year) { if (sDay == e.day && sMonth == e.month && sYear == e.year) {
return (sDay, sMonth, sYear); return '.';
} }
} })
}; };
const showEventDescription = (sDay, sMonth, sYear) => {
const logEachDateDes = (sDay, sMonth, sYear) =>{ return events.map((e) => {
return events.map((e) =>{
if (sDay == e.day && sMonth == e.month && sYear == e.year) {
if (sDay == e.day && sMonth == e.month && sYear == e.year) {
return <p key={'description' + e.id}>{e.description}</p>
}
})
}
const showEventDescription = (sDay , sMonth, sYear) => { return (<div key={'description' + e.id}><p>{e.description}</p></div>)
for (var i = 0; i < events.length; i++) {
if (sDay == events[i].day && sMonth == events[i].month && sYear == events[i].year) {
return(events[i].description);
} }
}
})
} }
return ( return (
<div <div
@ -308,8 +295,8 @@ const DaysList = ({
handleDayPress({ ...dayItem, isDisabled }); handleDayPress({ ...dayItem, isDisabled });
// console.log(specialDate(day)); // console.log(specialDate(day));
// console.log(showEventDescription(day)) // console.log(showEventDescription(day))
// showEvent(showEventDescription(day, month, year)) showEvent(showEventDescription(day, month, year))
showEvent(logEachDateDes(day, month, year))
}} }}
onKeyDown={({ key }) => { onKeyDown={({ key }) => {
/* istanbul ignore else */ /* istanbul ignore else */
@ -327,7 +314,8 @@ const DaysList = ({
data-is-default-selectable={shouldEnableKeyboardNavigation} data-is-default-selectable={shouldEnableKeyboardNavigation}
> >
{!isStandard ? '' : getLanguageDigits(day)} {!isStandard ? '' : getLanguageDigits(day)}
{specialDate(day, month, year) == (day, month, year) ? <span>.</span> : ' '} {/* Dots Of Events */}
<span>{specialDate(day, month, year)}</span>
</div> </div>
); );
}; };

Loading…
Cancel
Save