5.3.0: Кнопка «По плану», логика чипа «Сегодня»
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m4s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m4s
This commit is contained in:
@@ -429,12 +429,8 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
||||
|
||||
const handleDateSelect = (date) => {
|
||||
if (!date) return
|
||||
|
||||
// Преобразуем дату в формат YYYY-MM-DD
|
||||
const formattedDate = formatDateToLocal(date)
|
||||
setPostponeDate(formattedDate)
|
||||
|
||||
// Применяем дату и закрываем модальное окно
|
||||
if (selectedTaskForPostpone) {
|
||||
handlePostponeSubmitWithDate(formattedDate)
|
||||
}
|
||||
@@ -1108,6 +1104,31 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
||||
|
||||
const isToday = nextShowAtStr === todayStr
|
||||
const isTomorrow = nextShowAtStr === tomorrowStr
|
||||
// Не показывать «Сегодня», если next_show_at уже сегодня или в прошлом
|
||||
const showTodayChip = !nextShowAtStr || nextShowAtStr > todayStr
|
||||
|
||||
// Дата "по плану" (repetition_date / repetition_period или завтра)
|
||||
const task = selectedTaskForPostpone
|
||||
let plannedDate
|
||||
const now = new Date()
|
||||
now.setHours(0, 0, 0, 0)
|
||||
if (task.repetition_date) {
|
||||
const nextDate = calculateNextDateFromRepetitionDate(task.repetition_date)
|
||||
if (nextDate) plannedDate = nextDate
|
||||
} else if (task.repetition_period && !isZeroPeriod(task.repetition_period)) {
|
||||
const nextDate = calculateNextDateFromRepetitionPeriod(task.repetition_period)
|
||||
if (nextDate) plannedDate = nextDate
|
||||
}
|
||||
if (!plannedDate) {
|
||||
plannedDate = new Date(now)
|
||||
plannedDate.setDate(plannedDate.getDate() + 1)
|
||||
}
|
||||
plannedDate.setHours(0, 0, 0, 0)
|
||||
const plannedDateStr = formatDateToLocal(plannedDate)
|
||||
const plannedNorm = plannedDateStr.slice(0, 10)
|
||||
const nextShowNorm = nextShowAtStr ? String(nextShowAtStr).slice(0, 10) : ''
|
||||
// Показываем кнопку, если текущий next_show_at не совпадает с датой по плану
|
||||
const isCurrentDatePlanned = plannedNorm && nextShowNorm && plannedNorm === nextShowNorm
|
||||
|
||||
const modalContent = (
|
||||
<div className="task-postpone-modal-overlay" onClick={handlePostponeClose}>
|
||||
@@ -1134,7 +1155,7 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
||||
/>
|
||||
</div>
|
||||
<div className="task-postpone-quick-buttons">
|
||||
{!isToday && (
|
||||
{showTodayChip && (
|
||||
<button
|
||||
onClick={handleTodayClick}
|
||||
className="task-postpone-quick-button"
|
||||
@@ -1152,6 +1173,15 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
||||
Завтра
|
||||
</button>
|
||||
)}
|
||||
{!isCurrentDatePlanned && (
|
||||
<button
|
||||
onClick={() => handlePostponeSubmitWithDate(plannedDateStr)}
|
||||
className="task-postpone-quick-button"
|
||||
disabled={isPostponing}
|
||||
>
|
||||
По плану
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user