Spaces:
Running
Running
axeronis commited on
Commit ·
07fe5c0
1
Parent(s): 7b274e7
feat: Add timezone and working hours display to Calendar header
Browse files
frontend/app/appointments/page.tsx
CHANGED
|
@@ -196,6 +196,8 @@ export default function AppointmentsPage() {
|
|
| 196 |
workingDays={bookingSettings.working_days}
|
| 197 |
workingHours={bookingSettings.working_hours}
|
| 198 |
resources={resources}
|
|
|
|
|
|
|
| 199 |
/>
|
| 200 |
)}
|
| 201 |
</div>
|
|
|
|
| 196 |
workingDays={bookingSettings.working_days}
|
| 197 |
workingHours={bookingSettings.working_hours}
|
| 198 |
resources={resources}
|
| 199 |
+
timezone={tenantData?.timezone || 'Asia/Bishkek'}
|
| 200 |
+
region={tenantData?.region || 'kg'}
|
| 201 |
/>
|
| 202 |
)}
|
| 203 |
</div>
|
frontend/components/bookings/CalendarView.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useState, useEffect, useMemo } from 'react'
|
|
| 4 |
import { startOfMonth, endOfMonth, eachDayOfInterval, format, isSameMonth, isToday, isSameDay, startOfWeek, endOfWeek, addMonths, subMonths, getDay, addDays, startOfDay, endOfDay, eachHourOfInterval, setHours } from 'date-fns'
|
| 5 |
import { ru } from 'date-fns/locale'
|
| 6 |
import { cn } from '@/lib/utils'
|
| 7 |
-
import { ChevronLeft, ChevronRight, Calendar as CalendarIcon, LayoutGrid, Clock, Users } from 'lucide-react'
|
| 8 |
|
| 9 |
type ViewMode = 'month' | 'day' | 'resources'
|
| 10 |
|
|
@@ -23,6 +23,9 @@ interface CalendarViewProps {
|
|
| 23 |
workingDays?: string[]
|
| 24 |
workingHours?: { start: string; end: string }
|
| 25 |
resources?: Resource[]
|
|
|
|
|
|
|
|
|
|
| 26 |
}
|
| 27 |
|
| 28 |
// Map day index (0=Sunday) to day code
|
|
@@ -54,7 +57,9 @@ export function CalendarView({
|
|
| 54 |
onSelectAppointment,
|
| 55 |
workingDays = ['mon', 'tue', 'wed', 'thu', 'fri'],
|
| 56 |
workingHours = { start: '09:00', end: '18:00' },
|
| 57 |
-
resources = []
|
|
|
|
|
|
|
| 58 |
}: CalendarViewProps) {
|
| 59 |
const [currentMonth, setCurrentMonth] = useState(new Date())
|
| 60 |
const [isMobile, setIsMobile] = useState(false)
|
|
@@ -412,6 +417,18 @@ export function CalendarView({
|
|
| 412 |
<CalendarIcon className="w-3.5 h-3.5" />
|
| 413 |
<span className="hidden sm:inline">Сегодня</span>
|
| 414 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 415 |
</div>
|
| 416 |
</div>
|
| 417 |
|
|
|
|
| 4 |
import { startOfMonth, endOfMonth, eachDayOfInterval, format, isSameMonth, isToday, isSameDay, startOfWeek, endOfWeek, addMonths, subMonths, getDay, addDays, startOfDay, endOfDay, eachHourOfInterval, setHours } from 'date-fns'
|
| 5 |
import { ru } from 'date-fns/locale'
|
| 6 |
import { cn } from '@/lib/utils'
|
| 7 |
+
import { ChevronLeft, ChevronRight, Calendar as CalendarIcon, LayoutGrid, Clock, Users, Globe, MapPin } from 'lucide-react'
|
| 8 |
|
| 9 |
type ViewMode = 'month' | 'day' | 'resources'
|
| 10 |
|
|
|
|
| 23 |
workingDays?: string[]
|
| 24 |
workingHours?: { start: string; end: string }
|
| 25 |
resources?: Resource[]
|
| 26 |
+
// Timezone & Region
|
| 27 |
+
timezone?: string // IANA timezone (e.g., 'Asia/Bishkek')
|
| 28 |
+
region?: string // Country code (e.g., 'kg', 'ru')
|
| 29 |
}
|
| 30 |
|
| 31 |
// Map day index (0=Sunday) to day code
|
|
|
|
| 57 |
onSelectAppointment,
|
| 58 |
workingDays = ['mon', 'tue', 'wed', 'thu', 'fri'],
|
| 59 |
workingHours = { start: '09:00', end: '18:00' },
|
| 60 |
+
resources = [],
|
| 61 |
+
timezone = 'Asia/Bishkek',
|
| 62 |
+
region = 'kg'
|
| 63 |
}: CalendarViewProps) {
|
| 64 |
const [currentMonth, setCurrentMonth] = useState(new Date())
|
| 65 |
const [isMobile, setIsMobile] = useState(false)
|
|
|
|
| 417 |
<CalendarIcon className="w-3.5 h-3.5" />
|
| 418 |
<span className="hidden sm:inline">Сегодня</span>
|
| 419 |
</button>
|
| 420 |
+
|
| 421 |
+
{/* Timezone & Working Hours Info */}
|
| 422 |
+
<div className="hidden md:flex items-center gap-3 text-xs text-slate-400">
|
| 423 |
+
<div className="flex items-center gap-1">
|
| 424 |
+
<Clock className="w-3.5 h-3.5" />
|
| 425 |
+
<span>{workingHours.start}–{workingHours.end}</span>
|
| 426 |
+
</div>
|
| 427 |
+
<div className="flex items-center gap-1">
|
| 428 |
+
<Globe className="w-3.5 h-3.5" />
|
| 429 |
+
<span>{timezone.split('/').pop()?.replace('_', ' ')}</span>
|
| 430 |
+
</div>
|
| 431 |
+
</div>
|
| 432 |
</div>
|
| 433 |
</div>
|
| 434 |
|