chore: review fixes

This commit is contained in:
Muhsin Keloth
2024-03-13 13:00:25 +05:30
parent a6db724f5b
commit 9dd40532a7
4 changed files with 39 additions and 28 deletions
@@ -112,7 +112,9 @@ export default {
exactTimeInAmPm() {
return `${
this.timeSlot.day === this.currentDay
? `${this.$t('REPLY_TIME.BACK_AT')} ${this.timeSlot.from}`
? this.$t('REPLY_TIME.BACK_AT', {
time: this.timeSlot.from,
})
: ''
}`;
},
@@ -123,24 +125,14 @@ export default {
if (hoursLeft > 0) {
const roundedUpHoursLeft = minutesLeft > 0 ? hoursLeft + 1 : hoursLeft;
const hourRelative = generateRelativeTime(
roundedUpHoursLeft,
'hour',
this.languageCode
);
timeLeftChars.push(`${hourRelative}`);
timeLeftChars.push(`${roundedUpHoursLeft} hours`);
}
if (minutesLeft > 0 && hoursLeft === 0) {
const roundedUpMinLeft =
Math.ceil(minutesLeft / MINUTE_ROUNDING_FACTOR) *
MINUTE_ROUNDING_FACTOR;
const minRelative = generateRelativeTime(
roundedUpMinLeft,
'minutes',
this.languageCode
);
timeLeftChars.push(`${minRelative}`);
timeLeftChars.push(`${roundedUpMinLeft} minutes`);
}
return timeLeftChars.join(' ');
@@ -151,7 +143,9 @@ export default {
return this.exactTimeInAmPm;
}
if (hoursLeft > 0 || minutesLeft > 0) {
return this.hoursAndMinutesLeft;
return this.$t('REPLY_TIME.BACK_IN', {
time: this.hoursAndMinutesLeft,
});
}
return this.$t('REPLY_TIME.BACK_IN_SOME_TIME');
},
@@ -165,16 +159,19 @@ export default {
'days',
this.languageCode
);
return `${hourRelative}`;
return this.$t('REPLY_TIME.WILL_BE_BACK', {
time: hourRelative,
});
}
if (
this.dayDiff >= 1 &&
this.presentHour >= this.currentDayTimings.closeHour
) {
return `${this.$t('REPLY_TIME.BACK_ON')} ${
this.dayNameOfNextWorkingDay
}`;
return this.$t('REPLY_TIME.BACK_ON', {
day: this.dayNameOfNextWorkingDay,
});
}
return this.hoursAndMinutesToBack;
},
},