CSR-886: more cleanup

This commit is contained in:
Adam Caouette 2023-05-17 19:34:56 -04:00
parent d7f406b2ba
commit a585627110

View file

@ -84,32 +84,6 @@ export default {
selectableDatesData: [], // NOTE: uses monthNum (1-based), NOT monthIndex (0-based)
today: null,
hideSomeDaysForInitialView: null,
// TO BE MADE "CONSTANTS"
monthsBeforeToLoadOffset: 36,
monthsAfterToLoadOffset: 12,
initialViewRowsToShow: 5,
// TBD OR REMOVED
hasPartialMonthInitialView: true,
hasSplitInitialView: true,
initialViewIncludesFullSecondMonth: false,
initialViewRowsTally: 0,
isAddingNewMonth: false,
currentScrollTop: 0,
lastApiCallStartDate: null,
lastApiCallEndDate: null,
newToday: {
dateObj: null,
dateNum: null,
dayIndex: null,
yearNum: null,
monthIndex: null,
monthEndDateNum: null,
},
initialViewStartDateNum: null,
initialViewEndDateNum: null,
daysLeftOver: null,
};
},
props: {
@ -228,14 +202,9 @@ export default {
let todayMonthIndex = todayDate.getMonth() + 1;
let todayYearNum = todayDate.getFullYear();
let todayDayIndex = todayDate.getDay();
let todayDateNum = todayDate.getDate();
let currentMonthStart = new Date(todayYearNum, todayMonthIndex - 1, 1);
let currentMonthEnd = new Date(todayYearNum, todayMonthIndex, 0);
let currentWeekStartDate = this.getWeekStartDate(todayDate);
let currentWeekEndDateNum = this.getWeekEndDate(todayDate);
let calendarViewDirection = "none";
if (config.selectableDatesSetting === "past") calendarViewDirection = "past";
if (config.selectableDatesSetting === "custom") calendarViewDirection = "future";
@ -245,15 +214,14 @@ export default {
config.initialViewRowsToShow
);
let initialViewStartDate = todayDate; // <<<<<<<<<<<<<
let initialViewStartDate = todayDate;
let initialViewEndDate = initialViewWeeks[initialViewWeeks.length - 1].weekEndDate;
let secondMonthEnd;
let saturday1month = initialViewWeeks[0].weekEndDate.getMonth(); // <<<<<<<<<<<<<
let saturday1month = initialViewWeeks[0].weekEndDate.getMonth();
let sunday5month =
initialViewWeeks[initialViewWeeks.length - 1].weekStartDate.getMonth(); // <<<<<<<<<<<<<
initialViewWeeks[initialViewWeeks.length - 1].weekStartDate.getMonth();
let hideSomeDaysForInitialView = false; // <<<<<<<<<<<<<
let hideSecondMonth = false; // <<<<<<<<<<<<<
let hideSomeDaysForInitialView = false;
let hideSecondMonth = false;
// TODO - NEED TO CREATE OPPOSITE LOGIC FOR "past" DIRECTION LIKE BELOW vvvvv
if (calendarViewDirection === "future") {
@ -293,8 +261,8 @@ export default {
initializeComponent(initialData) {
this.setCalendarData(initialData);
},
scrollToElement(elementId, speed, easing) {
// TODO - needs to be cleaned up & refactored
function scrollTopSmooth(wrapper, target, duration = 300, timingName = "linear") {
const initY = wrapper.scrollTop;
const wrapperRect = wrapper.getBoundingClientRect();
@ -365,7 +333,7 @@ export default {
}
} else {
// TODO - IF A CALENDAR WITH BOTH PAST AND FUTURE WAS EVER NEEDED
// for (let i = this.monthsAfterToLoadOffset; i >= this.monthsBeforeToLoadOffset; i--) {
// for (let i = monthsAfterToLoadOffset; i >= monthsBeforeToLoadOffset; i--) {
// months.push(this.getMonthDataPAST(i));
// }
}
@ -541,7 +509,6 @@ export default {
monthToShow.dates[monthToShow.dates.length - 1].inputValue.dateString
);
this.isLoading = false;
// this.hasSplitInitialView = false; // if was partial view, this removes hidden styling on days
this.hideSomeDaysForInitialView = false; // if hid days on initial partial view, this removes hidden styling on days
monthToShow.monthClass = monthToShow.monthClass.replace(" month-hidden", "");
this.scrollToElement(monthToShow.monthString);