fix: clean up admin bookings — add all contact fields, remove redundant NotifyToggle/filters

- Add phone to MC registrations display, instagram/telegram to group bookings
- Remove NotifyToggle from all 3 tabs (handled by Reminders tab)
- Remove FilterChips (Новые/Без напоминания) — redundant with Reminders tab
- Remove unused urgencyMap, mcItems fetch, MasterClassSlot/MasterClassItem types
- Fix delete button layout (pinned right, doesn't wrap)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-19 16:04:47 +03:00
parent 3458f88367
commit e617660467

View File

@@ -3,7 +3,6 @@
import { useState, useEffect, useMemo } from "react"; import { useState, useEffect, useMemo } from "react";
import { Loader2, Trash2, Phone, Instagram, Send, ChevronDown, ChevronRight, Bell, CheckCircle2, XCircle, Clock, Star, Calendar, DoorOpen } from "lucide-react"; import { Loader2, Trash2, Phone, Instagram, Send, ChevronDown, ChevronRight, Bell, CheckCircle2, XCircle, Clock, Star, Calendar, DoorOpen } from "lucide-react";
import { adminFetch } from "@/lib/csrf"; import { adminFetch } from "@/lib/csrf";
import { NotifyToggle } from "../_components/NotifyToggle";
// --- Types --- // --- Types ---
@@ -12,6 +11,8 @@ interface GroupBooking {
name: string; name: string;
phone: string; phone: string;
groupInfo?: string; groupInfo?: string;
instagram?: string;
telegram?: string;
notifiedConfirm: boolean; notifiedConfirm: boolean;
notifiedReminder: boolean; notifiedReminder: boolean;
createdAt: string; createdAt: string;
@@ -21,6 +22,7 @@ interface McRegistration {
id: number; id: number;
masterClassTitle: string; masterClassTitle: string;
name: string; name: string;
phone?: string;
instagram: string; instagram: string;
telegram?: string; telegram?: string;
notifiedConfirm: boolean; notifiedConfirm: boolean;
@@ -45,69 +47,13 @@ interface OpenDayBooking {
classHall?: string; classHall?: string;
} }
interface MasterClassSlot {
date: string;
startTime: string;
endTime: string;
}
interface MasterClassItem {
title: string;
slots: MasterClassSlot[];
}
type Tab = "reminders" | "classes" | "master-classes" | "open-day"; type Tab = "reminders" | "classes" | "master-classes" | "open-day";
type NotifyFilter = "all" | "new" | "no-reminder";
// --- Filter Chips ---
function FilterChips({
filter,
setFilter,
newCount,
noReminderCount,
}: {
filter: NotifyFilter;
setFilter: (f: NotifyFilter) => void;
newCount: number;
noReminderCount: number;
}) {
const FILTERS: { key: NotifyFilter; label: string; count?: number }[] = [
{ key: "all", label: "Все" },
{ key: "new", label: "Новые", count: newCount },
{ key: "no-reminder", label: "Без напоминания", count: noReminderCount },
];
return (
<div className="flex items-center gap-2">
{FILTERS.map((f) => (
<button
key={f.key}
onClick={() => setFilter(f.key)}
className={`rounded-full px-3 py-1.5 text-xs font-medium transition-all ${
filter === f.key
? "bg-gold/20 text-gold border border-gold/40"
: "bg-neutral-800 text-neutral-400 border border-white/10 hover:text-white"
}`}
>
{f.label}
{f.count !== undefined && f.count > 0 && (
<span className="ml-1.5 rounded-full bg-red-500/20 text-red-400 px-1.5 py-0.5 text-[10px]">
{f.count}
</span>
)}
</button>
))}
</div>
);
}
// --- Group Bookings Tab --- // --- Group Bookings Tab ---
function GroupBookingsTab() { function GroupBookingsTab() {
const [bookings, setBookings] = useState<GroupBooking[]>([]); const [bookings, setBookings] = useState<GroupBooking[]>([]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [filter, setFilter] = useState<NotifyFilter>("all");
useEffect(() => { useEffect(() => {
adminFetch("/api/admin/group-bookings") adminFetch("/api/admin/group-bookings")
@@ -117,28 +63,6 @@ function GroupBookingsTab() {
.finally(() => setLoading(false)); .finally(() => setLoading(false));
}, []); }, []);
const newCount = bookings.filter((b) => !b.notifiedConfirm).length;
const noReminderCount = bookings.filter((b) => !b.notifiedReminder).length;
const filtered = useMemo(() => {
if (filter === "new") return bookings.filter((b) => !b.notifiedConfirm);
if (filter === "no-reminder") return bookings.filter((b) => !b.notifiedReminder);
return bookings;
}, [bookings, filter]);
async function handleToggle(id: number, field: "notified_confirm" | "notified_reminder") {
const b = bookings.find((x) => x.id === id);
if (!b) return;
const key = field === "notified_confirm" ? "notifiedConfirm" : "notifiedReminder";
const newValue = !b[key];
setBookings((prev) => prev.map((x) => x.id === id ? { ...x, [key]: newValue } : x));
await adminFetch("/api/admin/group-bookings", {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action: "toggle-notify", id, field, value: newValue }),
});
}
async function handleDelete(id: number) { async function handleDelete(id: number) {
await adminFetch(`/api/admin/group-bookings?id=${id}`, { method: "DELETE" }); await adminFetch(`/api/admin/group-bookings?id=${id}`, { method: "DELETE" });
setBookings((prev) => prev.filter((b) => b.id !== id)); setBookings((prev) => prev.filter((b) => b.id !== id));
@@ -147,41 +71,41 @@ function GroupBookingsTab() {
if (loading) return <LoadingSpinner />; if (loading) return <LoadingSpinner />;
return ( return (
<> <div className="space-y-2">
<FilterChips filter={filter} setFilter={setFilter} newCount={newCount} noReminderCount={noReminderCount} /> {bookings.length === 0 && <EmptyState total={0} />}
<div className="mt-3 space-y-2"> {bookings.map((b) => (
{filtered.length === 0 && <EmptyState total={bookings.length} />} <div
{filtered.map((b) => ( key={b.id}
<div className="rounded-xl border border-white/10 bg-neutral-900 p-4"
key={b.id} >
className={`rounded-xl border p-4 space-y-2 transition-colors ${ <div className="flex items-start justify-between gap-3">
!b.notifiedConfirm ? "border-gold/20 bg-gold/[0.03]" : "border-white/10 bg-neutral-900" <div className="flex items-center gap-2 flex-wrap text-sm min-w-0">
}`} <span className="font-medium text-white">{b.name}</span>
> <a href={`tel:${b.phone.replace(/\D/g, "")}`} className="inline-flex items-center gap-1 text-emerald-400 hover:text-emerald-300 text-xs">
<div className="flex items-center gap-3 flex-wrap"> <Phone size={10} />{b.phone}
<span className="font-medium text-white">{b.name}</span> </a>
<a href={`tel:${b.phone.replace(/\D/g, "")}`} className="inline-flex items-center gap-1 text-emerald-400 hover:text-emerald-300 text-sm"> {b.instagram && (
<Phone size={12} />{b.phone} <a href={`https://ig.me/m/${b.instagram.replace(/^@/, "")}`} target="_blank" rel="noopener noreferrer" className="inline-flex items-center gap-1 text-pink-400 hover:text-pink-300 text-xs">
</a> <Instagram size={10} />{b.instagram}
{b.groupInfo && ( </a>
<> )}
<span className="text-neutral-600">·</span> {b.telegram && (
<a href={`https://t.me/${b.telegram.replace(/^@/, "")}`} target="_blank" rel="noopener noreferrer" className="inline-flex items-center gap-1 text-blue-400 hover:text-blue-300 text-xs">
<Send size={10} />{b.telegram}
</a>
)}
{b.groupInfo && (
<span className="text-xs text-neutral-400 bg-neutral-800 rounded-full px-2 py-0.5">{b.groupInfo}</span> <span className="text-xs text-neutral-400 bg-neutral-800 rounded-full px-2 py-0.5">{b.groupInfo}</span>
</> )}
)} </div>
<span className="text-neutral-600 text-xs ml-auto">{fmtDate(b.createdAt)}</span> <div className="flex items-center gap-2 shrink-0">
<DeleteBtn onClick={() => handleDelete(b.id)} /> <span className="text-neutral-600 text-xs">{fmtDate(b.createdAt)}</span>
<DeleteBtn onClick={() => handleDelete(b.id)} />
</div>
</div> </div>
<NotifyToggle
confirmed={b.notifiedConfirm}
reminded={b.notifiedReminder}
onToggleConfirm={() => handleToggle(b.id, "notified_confirm")}
onToggleReminder={() => handleToggle(b.id, "notified_reminder")}
/>
</div> </div>
))} ))}
</div> </div>
</>
); );
} }
@@ -189,76 +113,31 @@ function GroupBookingsTab() {
function McRegistrationsTab() { function McRegistrationsTab() {
const [regs, setRegs] = useState<McRegistration[]>([]); const [regs, setRegs] = useState<McRegistration[]>([]);
const [mcItems, setMcItems] = useState<MasterClassItem[]>([]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [filter, setFilter] = useState<NotifyFilter>("all");
useEffect(() => { useEffect(() => {
Promise.all([ adminFetch("/api/admin/mc-registrations")
adminFetch("/api/admin/mc-registrations").then((r) => r.json()), .then((r) => r.json())
adminFetch("/api/admin/sections/masterClasses").then((r) => r.json()), .then((data: McRegistration[]) => setRegs(data))
])
.then(([regData, mcData]: [McRegistration[], { items: MasterClassItem[] }]) => {
setRegs(regData);
setMcItems(mcData.items || []);
})
.catch(() => {}) .catch(() => {})
.finally(() => setLoading(false)); .finally(() => setLoading(false));
}, []); }, []);
// Compute reminder urgency per MC title
const urgencyMap = useMemo(() => {
const map: Record<string, boolean> = {};
const now = Date.now();
const twoDays = 2 * 24 * 60 * 60 * 1000;
for (const mc of mcItems) {
map[mc.title] = (mc.slots || []).some((s) => {
if (!s.date) return false;
const slotTime = new Date(s.date + "T" + (s.startTime || "23:59")).getTime();
const diff = slotTime - now;
return diff >= 0 && diff <= twoDays;
});
}
return map;
}, [mcItems]);
const newCount = regs.filter((r) => !r.notifiedConfirm).length;
const noReminderCount = regs.filter((r) => !r.notifiedReminder).length;
const filtered = useMemo(() => {
if (filter === "new") return regs.filter((r) => !r.notifiedConfirm);
if (filter === "no-reminder") return regs.filter((r) => !r.notifiedReminder);
return regs;
}, [regs, filter]);
// Group by MC title // Group by MC title
const grouped = useMemo(() => { const grouped = useMemo(() => {
const map: Record<string, McRegistration[]> = {}; const map: Record<string, McRegistration[]> = {};
for (const r of filtered) { for (const r of regs) {
if (!map[r.masterClassTitle]) map[r.masterClassTitle] = []; if (!map[r.masterClassTitle]) map[r.masterClassTitle] = [];
map[r.masterClassTitle].push(r); map[r.masterClassTitle].push(r);
} }
return map; return map;
}, [filtered]); }, [regs]);
const [expanded, setExpanded] = useState<Record<string, boolean>>({}); const [expanded, setExpanded] = useState<Record<string, boolean>>({});
function toggleExpand(key: string) { function toggleExpand(key: string) {
setExpanded((prev) => ({ ...prev, [key]: !prev[key] })); setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));
} }
async function handleToggle(id: number, field: "notified_confirm" | "notified_reminder") {
const r = regs.find((x) => x.id === id);
if (!r) return;
const key = field === "notified_confirm" ? "notifiedConfirm" : "notifiedReminder";
const newValue = !r[key];
setRegs((prev) => prev.map((x) => x.id === id ? { ...x, [key]: newValue } : x));
await adminFetch("/api/admin/mc-registrations", {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action: "toggle-notify", id, field, value: newValue }),
});
}
async function handleDelete(id: number) { async function handleDelete(id: number) {
await adminFetch(`/api/admin/mc-registrations?id=${id}`, { method: "DELETE" }); await adminFetch(`/api/admin/mc-registrations?id=${id}`, { method: "DELETE" });
setRegs((prev) => prev.filter((r) => r.id !== id)); setRegs((prev) => prev.filter((r) => r.id !== id));
@@ -267,74 +146,57 @@ function McRegistrationsTab() {
if (loading) return <LoadingSpinner />; if (loading) return <LoadingSpinner />;
return ( return (
<> <div className="space-y-2">
<FilterChips filter={filter} setFilter={setFilter} newCount={newCount} noReminderCount={noReminderCount} /> {Object.keys(grouped).length === 0 && <EmptyState total={regs.length} />}
<div className="mt-3 space-y-2"> {Object.entries(grouped).map(([title, items]) => {
{Object.keys(grouped).length === 0 && <EmptyState total={regs.length} />} const isOpen = expanded[title] ?? false;
{Object.entries(grouped).map(([title, items]) => { return (
const isOpen = expanded[title] ?? false; <div key={title} className="rounded-xl border border-white/10 overflow-hidden">
const groupNewCount = items.filter((r) => !r.notifiedConfirm).length; <button
return ( onClick={() => toggleExpand(title)}
<div key={title} className="rounded-xl border border-white/10 overflow-hidden"> className="w-full flex items-center gap-3 px-4 py-3 bg-neutral-900 hover:bg-neutral-800/80 transition-colors text-left"
<button >
onClick={() => toggleExpand(title)} {isOpen ? <ChevronDown size={14} className="text-neutral-500 shrink-0" /> : <ChevronRight size={14} className="text-neutral-500 shrink-0" />}
className="w-full flex items-center gap-3 px-4 py-3 bg-neutral-900 hover:bg-neutral-800/80 transition-colors text-left" <span className="font-medium text-white text-sm truncate">{title}</span>
> <span className="text-[10px] text-neutral-500 bg-neutral-800 rounded-full px-2 py-0.5 shrink-0">{items.length}</span>
{isOpen ? <ChevronDown size={14} className="text-neutral-500 shrink-0" /> : <ChevronRight size={14} className="text-neutral-500 shrink-0" />} </button>
<span className="font-medium text-white text-sm truncate">{title}</span> {isOpen && (
<span className="text-[10px] text-neutral-500 bg-neutral-800 rounded-full px-2 py-0.5 shrink-0">{items.length}</span> <div className="px-4 pb-3 pt-1 space-y-1.5">
{urgencyMap[title] && ( {items.map((r) => (
<span className="text-[10px] text-red-400 bg-red-500/10 rounded-full px-2 py-0.5 shrink-0">скоро</span> <div
)} key={r.id}
{groupNewCount > 0 && ( className="rounded-lg border border-white/5 bg-neutral-800/30 p-3"
<span className="text-[10px] text-gold bg-gold/10 rounded-full px-2 py-0.5 shrink-0">{groupNewCount} новых</span> >
)}
</button>
{isOpen && (
<div className="px-4 pb-3 pt-1 space-y-1.5">
{items.map((r) => (
<div
key={r.id}
className={`rounded-lg border p-3 space-y-1.5 transition-colors ${
!r.notifiedConfirm ? "border-gold/20 bg-gold/[0.03]" : "border-white/5 bg-neutral-800/30"
}`}
>
<div className="flex items-center gap-2 flex-wrap text-sm"> <div className="flex items-center gap-2 flex-wrap text-sm">
<span className="font-medium text-white">{r.name}</span> <span className="font-medium text-white">{r.name}</span>
<span className="text-neutral-500">·</span> {r.phone && (
<a <a href={`tel:${r.phone.replace(/\D/g, "")}`} className="inline-flex items-center gap-1 text-emerald-400 hover:text-emerald-300 text-xs">
href={`https://ig.me/m/${r.instagram.replace(/^@/, "")}`} <Phone size={10} />{r.phone}
target="_blank" </a>
rel="noopener noreferrer" )}
className="inline-flex items-center gap-1 text-pink-400 hover:text-pink-300" {r.instagram && (
> <a
<Instagram size={12} /> href={`https://ig.me/m/${r.instagram.replace(/^@/, "")}`}
<span className="text-neutral-300">{r.instagram}</span> target="_blank"
</a> rel="noopener noreferrer"
className="inline-flex items-center gap-1 text-pink-400 hover:text-pink-300 text-xs"
>
<Instagram size={10} />{r.instagram}
</a>
)}
{r.telegram && ( {r.telegram && (
<> <a
<span className="text-neutral-600">·</span> href={`https://t.me/${r.telegram.replace(/^@/, "")}`}
<a target="_blank"
href={`https://t.me/${r.telegram.replace(/^@/, "")}`} rel="noopener noreferrer"
target="_blank" className="inline-flex items-center gap-1 text-blue-400 hover:text-blue-300 text-xs"
rel="noopener noreferrer" >
className="inline-flex items-center gap-1 text-blue-400 hover:text-blue-300" <Send size={10} />{r.telegram}
> </a>
<Send size={12} />
<span className="text-neutral-300">{r.telegram}</span>
</a>
</>
)} )}
<span className="text-neutral-600 text-xs ml-auto">{fmtDate(r.createdAt)}</span> <span className="text-neutral-600 text-xs ml-auto">{fmtDate(r.createdAt)}</span>
<DeleteBtn onClick={() => handleDelete(r.id)} /> <DeleteBtn onClick={() => handleDelete(r.id)} />
</div> </div>
<NotifyToggle
confirmed={r.notifiedConfirm}
reminded={r.notifiedReminder}
reminderUrgent={urgencyMap[r.masterClassTitle] && !r.notifiedReminder}
onToggleConfirm={() => handleToggle(r.id, "notified_confirm")}
onToggleReminder={() => handleToggle(r.id, "notified_reminder")}
/>
</div> </div>
))} ))}
</div> </div>
@@ -342,8 +204,7 @@ function McRegistrationsTab() {
</div> </div>
); );
})} })}
</div> </div>
</>
); );
} }
@@ -351,12 +212,9 @@ function McRegistrationsTab() {
function OpenDayBookingsTab() { function OpenDayBookingsTab() {
const [bookings, setBookings] = useState<OpenDayBooking[]>([]); const [bookings, setBookings] = useState<OpenDayBooking[]>([]);
const [eventDate, setEventDate] = useState("");
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [filter, setFilter] = useState<NotifyFilter>("all");
useEffect(() => { useEffect(() => {
// Get events to find active one
adminFetch("/api/admin/open-day") adminFetch("/api/admin/open-day")
.then((r) => r.json()) .then((r) => r.json())
.then((events: { id: number; date: string }[]) => { .then((events: { id: number; date: string }[]) => {
@@ -365,7 +223,6 @@ function OpenDayBookingsTab() {
return; return;
} }
const ev = events[0]; const ev = events[0];
setEventDate(ev.date);
return adminFetch(`/api/admin/open-day/bookings?eventId=${ev.id}`) return adminFetch(`/api/admin/open-day/bookings?eventId=${ev.id}`)
.then((r) => r.json()) .then((r) => r.json())
.then((data: OpenDayBooking[]) => setBookings(data)); .then((data: OpenDayBooking[]) => setBookings(data));
@@ -374,28 +231,10 @@ function OpenDayBookingsTab() {
.finally(() => setLoading(false)); .finally(() => setLoading(false));
}, []); }, []);
const reminderUrgent = useMemo(() => {
if (!eventDate) return false;
const now = Date.now();
const twoDays = 2 * 24 * 60 * 60 * 1000;
const eventTime = new Date(eventDate + "T10:00").getTime();
const diff = eventTime - now;
return diff >= 0 && diff <= twoDays;
}, [eventDate]);
const newCount = bookings.filter((b) => !b.notifiedConfirm).length;
const noReminderCount = bookings.filter((b) => !b.notifiedReminder).length;
const filtered = useMemo(() => {
if (filter === "new") return bookings.filter((b) => !b.notifiedConfirm);
if (filter === "no-reminder") return bookings.filter((b) => !b.notifiedReminder);
return bookings;
}, [bookings, filter]);
// Group by class — sorted by hall then time // Group by class — sorted by hall then time
const grouped = useMemo(() => { const grouped = useMemo(() => {
const map: Record<string, { hall: string; time: string; style: string; trainer: string; items: OpenDayBooking[] }> = {}; const map: Record<string, { hall: string; time: string; style: string; trainer: string; items: OpenDayBooking[] }> = {};
for (const b of filtered) { for (const b of bookings) {
const key = `${b.classHall}|${b.classTime}|${b.classStyle}`; const key = `${b.classHall}|${b.classTime}|${b.classStyle}`;
if (!map[key]) map[key] = { hall: b.classHall || "—", time: b.classTime || "—", style: b.classStyle || "—", trainer: b.classTrainer || "—", items: [] }; if (!map[key]) map[key] = { hall: b.classHall || "—", time: b.classTime || "—", style: b.classStyle || "—", trainer: b.classTrainer || "—", items: [] };
map[key].items.push(b); map[key].items.push(b);
@@ -405,26 +244,13 @@ function OpenDayBookingsTab() {
const hallCmp = a.hall.localeCompare(b.hall); const hallCmp = a.hall.localeCompare(b.hall);
return hallCmp !== 0 ? hallCmp : a.time.localeCompare(b.time); return hallCmp !== 0 ? hallCmp : a.time.localeCompare(b.time);
}); });
}, [filtered]); }, [bookings]);
const [expanded, setExpanded] = useState<Record<string, boolean>>({}); const [expanded, setExpanded] = useState<Record<string, boolean>>({});
function toggleExpand(key: string) { function toggleExpand(key: string) {
setExpanded((prev) => ({ ...prev, [key]: !prev[key] })); setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));
} }
async function handleToggle(id: number, field: "notified_confirm" | "notified_reminder") {
const b = bookings.find((x) => x.id === id);
if (!b) return;
const key = field === "notified_confirm" ? "notifiedConfirm" : "notifiedReminder";
const newValue = !b[key];
setBookings((prev) => prev.map((x) => x.id === id ? { ...x, [key]: newValue } : x));
await adminFetch("/api/admin/open-day/bookings", {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ action: "toggle-notify", id, field, value: newValue }),
});
}
async function handleDelete(id: number) { async function handleDelete(id: number) {
await adminFetch(`/api/admin/open-day/bookings?id=${id}`, { method: "DELETE" }); await adminFetch(`/api/admin/open-day/bookings?id=${id}`, { method: "DELETE" });
setBookings((prev) => prev.filter((b) => b.id !== id)); setBookings((prev) => prev.filter((b) => b.id !== id));
@@ -433,38 +259,30 @@ function OpenDayBookingsTab() {
if (loading) return <LoadingSpinner />; if (loading) return <LoadingSpinner />;
return ( return (
<> <div className="space-y-2">
<FilterChips filter={filter} setFilter={setFilter} newCount={newCount} noReminderCount={noReminderCount} /> {grouped.length === 0 && <EmptyState total={bookings.length} />}
<div className="mt-3 space-y-2"> {grouped.map(([key, group]) => {
{grouped.length === 0 && <EmptyState total={bookings.length} />} const isOpen = expanded[key] ?? false;
{grouped.map(([key, group]) => { return (
const isOpen = expanded[key] ?? false; <div key={key} className="rounded-xl border border-white/10 overflow-hidden">
const groupNewCount = group.items.filter((b) => !b.notifiedConfirm).length; <button
return ( onClick={() => toggleExpand(key)}
<div key={key} className="rounded-xl border border-white/10 overflow-hidden"> className="w-full flex items-center gap-3 px-4 py-3 bg-neutral-900 hover:bg-neutral-800/80 transition-colors text-left"
<button >
onClick={() => toggleExpand(key)} {isOpen ? <ChevronDown size={14} className="text-neutral-500 shrink-0" /> : <ChevronRight size={14} className="text-neutral-500 shrink-0" />}
className="w-full flex items-center gap-3 px-4 py-3 bg-neutral-900 hover:bg-neutral-800/80 transition-colors text-left" <span className="text-gold text-xs font-medium shrink-0">{group.time}</span>
> <span className="font-medium text-white text-sm truncate">{group.style}</span>
{isOpen ? <ChevronDown size={14} className="text-neutral-500 shrink-0" /> : <ChevronRight size={14} className="text-neutral-500 shrink-0" />} <span className="text-xs text-neutral-500 truncate hidden sm:inline">· {group.trainer}</span>
<span className="text-gold text-xs font-medium shrink-0">{group.time}</span> <span className="text-[10px] text-neutral-500 bg-neutral-800 rounded-full px-2 py-0.5 shrink-0 ml-auto">{group.hall}</span>
<span className="font-medium text-white text-sm truncate">{group.style}</span> <span className="text-[10px] text-neutral-500 bg-neutral-800 rounded-full px-2 py-0.5 shrink-0">{group.items.length} чел.</span>
<span className="text-xs text-neutral-500 truncate hidden sm:inline">· {group.trainer}</span> </button>
<span className="text-[10px] text-neutral-500 bg-neutral-800 rounded-full px-2 py-0.5 shrink-0 ml-auto">{group.hall}</span> {isOpen && (
<span className="text-[10px] text-neutral-500 bg-neutral-800 rounded-full px-2 py-0.5 shrink-0">{group.items.length} чел.</span> <div className="px-4 pb-3 pt-1 space-y-1.5">
{groupNewCount > 0 && ( {group.items.map((b) => (
<span className="text-[10px] text-gold bg-gold/10 rounded-full px-2 py-0.5 shrink-0">{groupNewCount} новых</span> <div
)} key={b.id}
</button> className="rounded-lg border border-white/5 bg-neutral-800/30 p-3"
{isOpen && ( >
<div className="px-4 pb-3 pt-1 space-y-1.5">
{group.items.map((b) => (
<div
key={b.id}
className={`rounded-lg border p-3 space-y-1.5 transition-colors ${
!b.notifiedConfirm ? "border-gold/20 bg-gold/[0.03]" : "border-white/5 bg-neutral-800/30"
}`}
>
<div className="flex items-center gap-2 flex-wrap text-sm"> <div className="flex items-center gap-2 flex-wrap text-sm">
<span className="font-medium text-white">{b.name}</span> <span className="font-medium text-white">{b.name}</span>
<a href={`tel:${b.phone}`} className="inline-flex items-center gap-1 text-emerald-400 hover:text-emerald-300 text-xs"> <a href={`tel:${b.phone}`} className="inline-flex items-center gap-1 text-emerald-400 hover:text-emerald-300 text-xs">
@@ -493,13 +311,6 @@ function OpenDayBookingsTab() {
<span className="text-neutral-600 text-xs ml-auto">{fmtDate(b.createdAt)}</span> <span className="text-neutral-600 text-xs ml-auto">{fmtDate(b.createdAt)}</span>
<DeleteBtn onClick={() => handleDelete(b.id)} /> <DeleteBtn onClick={() => handleDelete(b.id)} />
</div> </div>
<NotifyToggle
confirmed={b.notifiedConfirm}
reminded={b.notifiedReminder}
reminderUrgent={reminderUrgent && !b.notifiedReminder}
onToggleConfirm={() => handleToggle(b.id, "notified_confirm")}
onToggleReminder={() => handleToggle(b.id, "notified_reminder")}
/>
</div> </div>
))} ))}
</div> </div>
@@ -507,8 +318,7 @@ function OpenDayBookingsTab() {
</div> </div>
); );
})} })}
</div> </div>
</>
); );
} }