Изменила нейминг переменных

This commit is contained in:
Daria Golova
2022-10-25 16:49:48 +03:00
parent ba9f8a36bf
commit 86b0cb66bc
3 changed files with 21 additions and 21 deletions

View File

@@ -17,7 +17,7 @@
) )
.line-wrapper .line-wrapper
.line.flex.items-center( .line.flex.items-center(
v-for="hour in hoursArray" v-for="hour in timeCoil"
:key="hour" :key="hour"
) )
.middle-line .middle-line
@@ -29,7 +29,7 @@ export default {
name: "CalendarBackground", name: "CalendarBackground",
components: { CalendarColumn }, components: { CalendarColumn },
props: { props: {
hoursArray: Array, timeCoil: Array,
eventsData: Array, eventsData: Array,
currentDate: Object, currentDate: Object,
sidebarWidth: String, sidebarWidth: String,
@@ -57,7 +57,7 @@ export default {
}; };
}, },
backgroundHeight() { backgroundHeight() {
return (this.hoursArray.length - 1) * this.pixelsPerHour + 48; return (this.timeCoil.length - 1) * this.pixelsPerHour + 48;
}, },
horizontalScrollPresence() { horizontalScrollPresence() {
return { return {
@@ -74,11 +74,11 @@ export default {
}; };
this.eventsData.forEach(({ employees }) => { this.eventsData.forEach(({ employees }) => {
let findedElement = employees.find((elem) => elem.role === "owner"); let findedElement = employees.find((elem) => elem.role === "owner");
let emptyObjectPresence = this.findObjectInArray( let emptyDataPresence = this.findObjectInArray(
filteredArray, filteredArray,
ownerAbsence ownerAbsence
); );
if (!findedElement && !emptyObjectPresence) { if (!findedElement && !emptyDataPresence) {
filteredArray.push(ownerAbsence); filteredArray.push(ownerAbsence);
} }
if (findedElement) { if (findedElement) {

View File

@@ -1,7 +1,7 @@
<template lang="pug"> <template lang="pug">
.calendar-clock-column.flex.flex-col.items-end.gap-y-43.pt-9.pb-45px.px-3 .calendar-clock-column.flex.flex-col.items-end.gap-y-43.pt-9.pb-45px.px-3
span.text-base( span.text-base(
v-for="hour in hoursArray" v-for="hour in timeCoil"
:key="hour" :key="hour"
:class="currentHourStyle(hour)" :class="currentHourStyle(hour)"
) {{ hour }} ) {{ hour }}
@@ -11,7 +11,7 @@
export default { export default {
name: "CalendarClockColumn", name: "CalendarClockColumn",
props: { props: {
hoursArray: Array, timeCoil: Array,
currentTime: String, currentTime: String,
currentDate: Object, currentDate: Object,
dayEndTime: Number, dayEndTime: Number,

View File

@@ -12,14 +12,14 @@
) )
div div
calendar-clock-column( calendar-clock-column(
:hours-array="hoursArray" :timeCoil="timeCoil"
:current-time="currentTime" :current-time="currentTime"
:is-current-date="isCurrentDate" :is-current-date="isCurrentDate"
:day-end-time="validateEndTime" :day-end-time="validateEndTime"
) )
calendar-background( calendar-background(
:current-date="currentDate" :current-date="currentDate"
:hours-array="hoursArray" :time-coil="timeCoil"
:events-data="eventsData" :events-data="eventsData"
:sidebar-width="sidebarWidth" :sidebar-width="sidebarWidth"
) )
@@ -69,7 +69,7 @@ export default {
data() { data() {
return { return {
currentTime: "", currentTime: "",
hoursArray: [], timeCoil: [],
timer: null, timer: null,
isCurrentDate: true, isCurrentDate: true,
isShownIndicator: true, isShownIndicator: true,
@@ -140,7 +140,7 @@ export default {
) { ) {
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.changeCurrentTime(); this.changeCurrentTime();
this.changeHoursArray(); this.changeTimeCoil();
}, 5000); }, 5000);
} }
}, },
@@ -151,20 +151,20 @@ export default {
changeCurrentTime() { changeCurrentTime() {
this.currentTime = moment().format("HH:mm:ss"); this.currentTime = moment().format("HH:mm:ss");
}, },
hoursArrayInitialization() { timeCoilInitialization() {
this.hoursArray = []; this.timeCoil = [];
for (let i = this.validateStartTime; i <= this.validateEndTime; i++) { for (let i = this.validateStartTime; i <= this.validateEndTime; i++) {
if ( if (
i === this.hours && i === this.hours &&
this.hours !== this.validateEndTime && this.hours !== this.validateEndTime &&
this.isCurrentDate this.isCurrentDate
) { ) {
this.hoursArray.push(this.hoursMinutes); this.timeCoil.push(this.hoursMinutes);
} else this.hoursArray.push(`${i}:00`); } else this.timeCoil.push(`${i}:00`);
} }
}, },
changeHoursArray() { changeTimeCoil() {
this.hoursArray = this.hoursArray.map((elem) => { this.timeCoil = this.timeCoil.map((elem) => {
if (this.convertTime(elem, 0, -3) === this.hours) { if (this.convertTime(elem, 0, -3) === this.hours) {
return this.hoursMinutes; return this.hoursMinutes;
} }
@@ -207,7 +207,7 @@ export default {
this.timer this.timer
) { ) {
this.stopTimer(); this.stopTimer();
this.hoursArrayInitialization(); this.timeCoilInitialization();
} }
}, },
currentDate: function () { currentDate: function () {
@@ -216,18 +216,18 @@ export default {
this.isShownIndicator = this.isCurrentDate; this.isShownIndicator = this.isCurrentDate;
if (this.timer) { if (this.timer) {
this.stopTimer(); this.stopTimer();
this.hoursArrayInitialization(); this.timeCoilInitialization();
} }
if (this.isCurrentDate) { if (this.isCurrentDate) {
this.changeCurrentTime(); this.changeCurrentTime();
this.hoursArrayInitialization(); this.timeCoilInitialization();
this.startTimer(); this.startTimer();
} }
}, },
}, },
mounted() { mounted() {
this.changeCurrentTime(); this.changeCurrentTime();
this.hoursArrayInitialization(); this.timeCoilInitialization();
this.startTimer(); this.startTimer();
}, },
beforeUnmount() { beforeUnmount() {