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:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "play-life-web",
|
"name": "play-life-web",
|
||||||
"version": "5.2.2",
|
"version": "5.3.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -429,12 +429,8 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
|||||||
|
|
||||||
const handleDateSelect = (date) => {
|
const handleDateSelect = (date) => {
|
||||||
if (!date) return
|
if (!date) return
|
||||||
|
|
||||||
// Преобразуем дату в формат YYYY-MM-DD
|
|
||||||
const formattedDate = formatDateToLocal(date)
|
const formattedDate = formatDateToLocal(date)
|
||||||
setPostponeDate(formattedDate)
|
setPostponeDate(formattedDate)
|
||||||
|
|
||||||
// Применяем дату и закрываем модальное окно
|
|
||||||
if (selectedTaskForPostpone) {
|
if (selectedTaskForPostpone) {
|
||||||
handlePostponeSubmitWithDate(formattedDate)
|
handlePostponeSubmitWithDate(formattedDate)
|
||||||
}
|
}
|
||||||
@@ -1108,6 +1104,31 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
|||||||
|
|
||||||
const isToday = nextShowAtStr === todayStr
|
const isToday = nextShowAtStr === todayStr
|
||||||
const isTomorrow = nextShowAtStr === tomorrowStr
|
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 = (
|
const modalContent = (
|
||||||
<div className="task-postpone-modal-overlay" onClick={handlePostponeClose}>
|
<div className="task-postpone-modal-overlay" onClick={handlePostponeClose}>
|
||||||
@@ -1134,7 +1155,7 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="task-postpone-quick-buttons">
|
<div className="task-postpone-quick-buttons">
|
||||||
{!isToday && (
|
{showTodayChip && (
|
||||||
<button
|
<button
|
||||||
onClick={handleTodayClick}
|
onClick={handleTodayClick}
|
||||||
className="task-postpone-quick-button"
|
className="task-postpone-quick-button"
|
||||||
@@ -1152,6 +1173,15 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
|||||||
Завтра
|
Завтра
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
{!isCurrentDatePlanned && (
|
||||||
|
<button
|
||||||
|
onClick={() => handlePostponeSubmitWithDate(plannedDateStr)}
|
||||||
|
className="task-postpone-quick-button"
|
||||||
|
disabled={isPostponing}
|
||||||
|
>
|
||||||
|
По плану
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user