From b797d0d66023162238161cddb1c8981c3bb9cafe Mon Sep 17 00:00:00 2001 From: Cosmo Date: Wed, 22 Apr 2026 19:50:35 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20redesign=20add-event=20modal=20=E2=80=94?= =?UTF-8?q?=20vertical=20layout,=20toggle=20switch,=20unified=20time=20pic?= =?UTF-8?q?ker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/CalendarTab.tsx | 266 ++++++++++++++++++++++--------------- 1 file changed, 156 insertions(+), 110 deletions(-) diff --git a/components/CalendarTab.tsx b/components/CalendarTab.tsx index 30b58bf..26487b6 100644 --- a/components/CalendarTab.tsx +++ b/components/CalendarTab.tsx @@ -44,9 +44,6 @@ function AddEventModal({ defaultDate, onClose, onSaved }: { defaultDate: string; const selectedCal = CALENDAR_OPTIONS.find(c => c.owner === owner) || CALENDAR_OPTIONS[0] - const dateObj = date ? new Date(date + 'T00:00:00') : new Date() - const dateLabel = dateObj.toLocaleDateString('ru-RU', { weekday: 'short', day: 'numeric', month: 'long' }) - const save = async () => { if (!title.trim()) { setError('Введите название'); return } setSaving(true); setError('') @@ -59,148 +56,197 @@ function AddEventModal({ defaultDate, onClose, onSaved }: { defaultDate: string; } catch (e: any) { setError(e.message || 'Ошибка сохранения'); setSaving(false) } } - const fieldInputStyle: React.CSSProperties = { - padding: '14px 18px', borderRadius: 14, width: '100%', - background: 'rgba(255,255,255,0.04)', border: '1px solid rgba(255,255,255,0.07)', - color: 'var(--text-primary)', fontSize: 15, outline: 'none', fontFamily: 'inherit', - } - - const fieldLabelStyle: React.CSSProperties = { - fontSize: 11, color: 'var(--text-secondary)', fontWeight: 600, - marginBottom: 8, display: 'block', textTransform: 'uppercase', letterSpacing: '0.08em', - } - return ( -
+
e.stopPropagation()}> - {/* Colored header */} + {/* Header */}
-
-
-
- -
-
-
Новое событие
-
{dateLabel}
-
-
- -
+ + Новое событие + +
{/* Body */} -
+
{/* Calendar selector */} -
- -
- {CALENDAR_OPTIONS.map(cal => { - const isSelected = owner === cal.owner - return ( - - ) - })} -
+
+ {CALENDAR_OPTIONS.map(cal => { + const sel = owner === cal.owner + return ( + + ) + })}
{/* Title */} -
- - setTitle(e.target.value)} placeholder="Что запланировано?" autoFocus style={fieldInputStyle} /> + setTitle(e.target.value)} + placeholder="Название события" + autoFocus + style={{ + width: '100%', padding: '15px 18px', borderRadius: 14, + background: 'rgba(255,255,255,0.04)', + border: '1px solid rgba(255,255,255,0.07)', + color: 'var(--text-primary)', fontSize: 16, fontWeight: 500, + outline: 'none', fontFamily: 'inherit', + marginBottom: 16, + }} + /> + + {/* Date */} +
+
Дата
+ setDate(e.target.value)} + style={{ + width: '100%', padding: '14px 18px', borderRadius: 14, + background: 'rgba(255,255,255,0.04)', + border: '1px solid rgba(255,255,255,0.07)', + color: 'var(--text-primary)', fontSize: 15, + outline: 'none', fontFamily: 'inherit', + }} + />
- {/* Date + All day */} -
-
- - setDate(e.target.value)} style={fieldInputStyle} /> -
- -
+
+
+ - {/* Time */} + {/* Time pickers */} {!allDay && ( -
- -
-
- - setStartTime(e.target.value)} style={{ ...fieldInputStyle, paddingLeft: 36 }} /> -
-
-
- - setEndTime(e.target.value)} style={{ ...fieldInputStyle, paddingLeft: 36 }} /> -
+
+
Время
+
+ setStartTime(e.target.value)} + style={{ + flex: 1, padding: '14px 18px', border: 'none', + background: 'transparent', color: 'var(--text-primary)', + fontSize: 16, fontWeight: 600, fontFamily: 'inherit', + outline: 'none', textAlign: 'center', + }} + /> +
до
+ setEndTime(e.target.value)} + style={{ + flex: 1, padding: '14px 18px', border: 'none', + background: 'transparent', color: 'var(--text-primary)', + fontSize: 16, fontWeight: 600, fontFamily: 'inherit', + outline: 'none', textAlign: 'center', + }} + />
)} + {/* Error */} {error && ( -
- {error} -
+
{error}
)} {/* Submit */}