fix: search and status filter work together consistently

- Status filter chips stay visible during text search
- Search results filtered by selected status (search + filter = AND)
- Shows "Нет записей по фильтру" when search has results but filter excludes all
This commit is contained in:
2026-03-24 17:23:16 +03:00
parent 49d710b2e7
commit b48cc040e1
2 changed files with 10 additions and 7 deletions

View File

@@ -39,8 +39,6 @@ export function SearchBar({
onClear();
}
const isSearching = query.trim().length >= 2;
return (
<div className="space-y-2">
<div className="relative">
@@ -58,7 +56,7 @@ export function SearchBar({
</button>
)}
</div>
{!isSearching && (
{(
<div className="flex items-center gap-1.5">
<Filter size={12} className="text-neutral-600 shrink-0" />
<button

View File

@@ -792,12 +792,15 @@ function BookingsPageInner() {
</div>
{searchResults ? (
/* #5: Actionable search results */
/* #5: Actionable search results — filtered by status */
(() => {
const filtered = statusFilter === "all" ? searchResults : searchResults.filter((r) => r.status === statusFilter);
return (
<div className="mt-4 space-y-2">
{searchResults.length === 0 ? (
<p className="text-sm text-neutral-500 py-8 text-center">Ничего не найдено</p>
{filtered.length === 0 ? (
<p className="text-sm text-neutral-500 py-8 text-center">{searchResults.length === 0 ? "Ничего не найдено" : "Нет записей по фильтру"}</p>
) : (
searchResults.map((r) => (
filtered.map((r) => (
<BookingCard key={`${r.type}-${r.id}`} status={r.status as BookingStatus}>
<div className="flex items-start justify-between gap-3">
<div className="flex items-center gap-2 flex-wrap text-sm min-w-0">
@@ -820,6 +823,8 @@ function BookingsPageInner() {
))
)}
</div>
);
})()
) : (
<>
{/* Dashboard — what needs attention */}