fix: add missing notif types to frontend (new_booking, room_service, new_review, unread_messages)
Some checks failed
Deploy to Production / deploy (push) Has been cancelled
Some checks failed
Deploy to Production / deploy (push) Has been cancelled
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Sun, Moon, Monitor, Bell, LogOut, ChevronDown, Menu,
|
||||
BookOpen, X, CheckCheck, CalendarCheck2, CalendarX2,
|
||||
Sparkles, AlertTriangle, Star, CreditCard, Info,
|
||||
ArrowRight, Wrench,
|
||||
ArrowRight, Wrench, MessageSquare, UtensilsCrossed,
|
||||
} from 'lucide-react'
|
||||
import { useTheme } from '../../contexts/ThemeContext'
|
||||
import { useAuth } from '../../contexts/AuthContext'
|
||||
@@ -18,18 +18,24 @@ const NOTIF_META: Record<NotifType, {
|
||||
iconBg: string
|
||||
iconColor: string
|
||||
}> = {
|
||||
booking_new: { icon: BookOpen, iconBg: 'bg-brand-100 dark:bg-brand-900/40', iconColor: 'text-brand-600 dark:text-brand-400' },
|
||||
booking_cancelled: { icon: CalendarX2, iconBg: 'bg-red-100 dark:bg-red-900/30', iconColor: 'text-red-600 dark:text-red-400' },
|
||||
booking_checkin: { icon: CalendarCheck2, iconBg: 'bg-emerald-100 dark:bg-emerald-900/30', iconColor: 'text-emerald-600 dark:text-emerald-400' },
|
||||
booking_checkout: { icon: ArrowRight, iconBg: 'bg-slate-100 dark:bg-slate-700', iconColor: 'text-slate-600 dark:text-slate-400' },
|
||||
housekeeping: { icon: Sparkles, iconBg: 'bg-sky-100 dark:bg-sky-900/30', iconColor: 'text-sky-600 dark:text-sky-400' },
|
||||
channel_error: { icon: AlertTriangle, iconBg: 'bg-orange-100 dark:bg-orange-900/30', iconColor: 'text-orange-600 dark:text-orange-400' },
|
||||
payment: { icon: CreditCard, iconBg: 'bg-violet-100 dark:bg-violet-900/30', iconColor: 'text-violet-600 dark:text-violet-400' },
|
||||
review: { icon: Star, iconBg: 'bg-yellow-100 dark:bg-yellow-900/30', iconColor: 'text-yellow-600 dark:text-yellow-400' },
|
||||
system: { icon: Info, iconBg: 'bg-slate-100 dark:bg-slate-700', iconColor: 'text-slate-500 dark:text-slate-400' },
|
||||
maintenance: { icon: Wrench, iconBg: 'bg-red-100 dark:bg-red-900/30', iconColor: 'text-red-600 dark:text-red-400' },
|
||||
booking_new: { icon: BookOpen, iconBg: 'bg-brand-100 dark:bg-brand-900/40', iconColor: 'text-brand-600 dark:text-brand-400' },
|
||||
new_booking: { icon: BookOpen, iconBg: 'bg-brand-100 dark:bg-brand-900/40', iconColor: 'text-brand-600 dark:text-brand-400' },
|
||||
booking_cancelled: { icon: CalendarX2, iconBg: 'bg-red-100 dark:bg-red-900/30', iconColor: 'text-red-600 dark:text-red-400' },
|
||||
booking_checkin: { icon: CalendarCheck2, iconBg: 'bg-emerald-100 dark:bg-emerald-900/30', iconColor: 'text-emerald-600 dark:text-emerald-400' },
|
||||
booking_checkout: { icon: ArrowRight, iconBg: 'bg-slate-100 dark:bg-slate-700', iconColor: 'text-slate-600 dark:text-slate-400' },
|
||||
housekeeping: { icon: Sparkles, iconBg: 'bg-sky-100 dark:bg-sky-900/30', iconColor: 'text-sky-600 dark:text-sky-400' },
|
||||
channel_error: { icon: AlertTriangle, iconBg: 'bg-orange-100 dark:bg-orange-900/30', iconColor: 'text-orange-600 dark:text-orange-400' },
|
||||
payment: { icon: CreditCard, iconBg: 'bg-violet-100 dark:bg-violet-900/30', iconColor: 'text-violet-600 dark:text-violet-400' },
|
||||
review: { icon: Star, iconBg: 'bg-yellow-100 dark:bg-yellow-900/30', iconColor: 'text-yellow-600 dark:text-yellow-400' },
|
||||
new_review: { icon: Star, iconBg: 'bg-yellow-100 dark:bg-yellow-900/30', iconColor: 'text-yellow-600 dark:text-yellow-400' },
|
||||
system: { icon: Info, iconBg: 'bg-slate-100 dark:bg-slate-700', iconColor: 'text-slate-500 dark:text-slate-400' },
|
||||
maintenance: { icon: Wrench, iconBg: 'bg-red-100 dark:bg-red-900/30', iconColor: 'text-red-600 dark:text-red-400' },
|
||||
room_service: { icon: UtensilsCrossed, iconBg: 'bg-orange-100 dark:bg-orange-900/30', iconColor: 'text-orange-600 dark:text-orange-400' },
|
||||
unread_messages: { icon: MessageSquare, iconBg: 'bg-sky-100 dark:bg-sky-900/30', iconColor: 'text-sky-600 dark:text-sky-400' },
|
||||
}
|
||||
|
||||
const NOTIF_META_FALLBACK = NOTIF_META.system
|
||||
|
||||
function relativeTime(iso: string): string {
|
||||
const diff = Math.floor((Date.now() - new Date(iso).getTime()) / 1000)
|
||||
if (diff < 60) return 'только что'
|
||||
@@ -131,7 +137,7 @@ function NotificationsPanel({ onClose }: { onClose: () => void }) {
|
||||
) : (
|
||||
<div className="divide-y divide-slate-100 dark:divide-slate-700/60">
|
||||
{shown.map(n => {
|
||||
const meta = NOTIF_META[n.type]
|
||||
const meta = NOTIF_META[n.type] ?? NOTIF_META_FALLBACK
|
||||
const Icon = meta.icon
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -4,6 +4,7 @@ import { api } from '../lib/api'
|
||||
|
||||
export type NotifType =
|
||||
| 'booking_new'
|
||||
| 'new_booking'
|
||||
| 'booking_cancelled'
|
||||
| 'booking_checkin'
|
||||
| 'booking_checkout'
|
||||
@@ -11,8 +12,11 @@ export type NotifType =
|
||||
| 'channel_error'
|
||||
| 'payment'
|
||||
| 'review'
|
||||
| 'new_review'
|
||||
| 'system'
|
||||
| 'maintenance'
|
||||
| 'room_service'
|
||||
| 'unread_messages'
|
||||
|
||||
export interface Notification {
|
||||
id: string
|
||||
|
||||
Reference in New Issue
Block a user