4.10.0: Добавлен поиск задач с иконкой
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m1s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m1s
This commit is contained in:
@@ -18,6 +18,7 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
||||
const [postponeDate, setPostponeDate] = useState('')
|
||||
const [isPostponing, setIsPostponing] = useState(false)
|
||||
const [toast, setToast] = useState(null)
|
||||
const [searchQuery, setSearchQuery] = useState('')
|
||||
const dateInputRef = useRef(null)
|
||||
|
||||
useEffect(() => {
|
||||
@@ -443,9 +444,16 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
||||
const today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
|
||||
// Фильтруем задачи по поисковому запросу
|
||||
const filteredTasks = searchQuery.trim()
|
||||
? tasks.filter(task =>
|
||||
task.name.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
)
|
||||
: tasks
|
||||
|
||||
const groups = {}
|
||||
|
||||
tasks.forEach(task => {
|
||||
filteredTasks.forEach(task => {
|
||||
const projects = getTaskProjects(task)
|
||||
|
||||
// Если у задачи нет проектов, добавляем в группу "Без проекта"
|
||||
@@ -534,7 +542,7 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
||||
})
|
||||
|
||||
return groups
|
||||
}, [tasks])
|
||||
}, [tasks, searchQuery])
|
||||
|
||||
// Сортируем проекты: сначала с невыполненными задачами, потом без них
|
||||
// Группа "Без проекта" всегда последняя в своей категории
|
||||
@@ -813,6 +821,40 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Поле поиска */}
|
||||
<div className="task-search-container">
|
||||
<svg
|
||||
className="task-search-icon"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
<circle cx="11" cy="11" r="8"></circle>
|
||||
<path d="m21 21-4.35-4.35"></path>
|
||||
</svg>
|
||||
<input
|
||||
type="text"
|
||||
className="task-search-input"
|
||||
placeholder="Поиск задач..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
/>
|
||||
{searchQuery && (
|
||||
<button
|
||||
className="task-search-clear"
|
||||
onClick={() => setSearchQuery('')}
|
||||
title="Очистить поиск"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{projectNames.length === 0 && !loading && tasks.length === 0 && (
|
||||
<div className="empty-state">
|
||||
<p>Задач пока нет. Добавьте задачу через кнопку "Добавить".</p>
|
||||
|
||||
Reference in New Issue
Block a user