From 6af892c9a6eb43cb3e7841af5ae8f8729814560b Mon Sep 17 00:00:00 2001 From: Ricky Stretch Date: Wed, 25 Mar 2026 09:10:44 -0400 Subject: [PATCH] schedule views update --- frontend/src/components/SchedulePage.jsx | 38 ++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/SchedulePage.jsx b/frontend/src/components/SchedulePage.jsx index 58281df..9c30332 100644 --- a/frontend/src/components/SchedulePage.jsx +++ b/frontend/src/components/SchedulePage.jsx @@ -1203,6 +1203,10 @@ function DayView({ events: rawEvents, selectedDate, onSelect, onSwipe }) { const events = expandEvents(rawEvents, dayStart, dayEnd); const hours=Array.from({length:DAY_END - DAY_START},(_,i)=>i+DAY_START); const day=events.filter(e=>sameDay(new Date(e.start_at),selectedDate)); + const allDayEvs=day.filter(e=>e.all_day); + const timedEvs=day.filter(e=>!e.all_day); + const tzOff=-new Date().getTimezoneOffset(); + const tzLabel=`GMT${tzOff>=0?'+':'-'}${String(Math.floor(Math.abs(tzOff)/60)).padStart(2,'0')}`; const scrollRef = useRef(null); const touchRef = useRef({ x:0, y:0 }); useEffect(()=>{ if(scrollRef.current) scrollRef.current.scrollTop = 7 * HOUR_H; },[selectedDate]); @@ -1222,6 +1226,16 @@ function DayView({ events: rawEvents, selectedDate, onSelect, onSwipe }) {
{DAYS[selectedDate.getDay()]}
{selectedDate.getDate()}
+
+
{tzLabel}
+
+ {allDayEvs.map(e=>( +
onSelect(e)} style={{background:e.event_type?.colour||'#6366f1',color:'white',borderRadius:3,padding:'2px 6px',fontSize:12,fontWeight:600,cursor:'pointer',whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis'}}> + {e.title} +
+ ))} +
+
{hours.map(h=>( @@ -1230,7 +1244,7 @@ function DayView({ events: rawEvents, selectedDate, onSelect, onSwipe }) {
))} - {layoutEvents(day).map(({event:e,col,totalCols})=>{ + {layoutEvents(timedEvs).map(({event:e,col,totalCols})=>{ const s=new Date(e.start_at), en=new Date(e.end_at); const top=eventTopOffset(s), height=eventHeightPx(s,en); return( @@ -1262,6 +1276,8 @@ function WeekView({ events: rawEvents, selectedDate, onSelect }) { const events = expandEvents(rawEvents, _ws, _we); const ws=weekStart(selectedDate), days=Array.from({length:7},(_,i)=>{const d=new Date(ws);d.setDate(d.getDate()+i);return d;}); const hours=Array.from({length:DAY_END - DAY_START},(_,i)=>i+DAY_START), today=new Date(); + const tzOff=-new Date().getTimezoneOffset(); + const tzLabel=`GMT${tzOff>=0?'+':'-'}${String(Math.floor(Math.abs(tzOff)/60)).padStart(2,'0')}`; const scrollRef = useRef(null); const touchRef = useRef({ x:0, y:0 }); useEffect(()=>{ if(scrollRef.current) scrollRef.current.scrollTop = 7 * HOUR_H; },[selectedDate]); @@ -1283,6 +1299,22 @@ function WeekView({ events: rawEvents, selectedDate, onSelect }) {
{days.map((d,i)=>
{DAYS[d.getDay()]} {d.getDate()}
)}
+ {/* All-day row */} +
+
{tzLabel}
+ {days.map((d,di)=>{ + const adEvs=events.filter(e=>e.all_day&&sameDay(new Date(e.start_at),d)); + return( +
+ {adEvs.map(e=>( +
onSelect(e)} style={{background:e.event_type?.colour||'#6366f1',color:'white',borderRadius:3,padding:'2px 4px',fontSize:10,fontWeight:600,cursor:'pointer',whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis'}}> + {e.title} +
+ ))} +
+ ); + })} +
{/* Scrollable time grid */}
@@ -1294,7 +1326,7 @@ function WeekView({ events: rawEvents, selectedDate, onSelect }) {
{/* Day columns */} {days.map((d,di)=>{ - const dayEvs=events.filter(e=>sameDay(new Date(e.start_at),d)); + const dayEvs=events.filter(e=>!e.all_day&&sameDay(new Date(e.start_at),d)); return(
{hours.map(h=>
)} @@ -1358,7 +1390,7 @@ function MonthView({ events: rawEvents, selectedDate, onSelect, onSelectDay }) { borderRadius:3,padding:'1px 4px',fontSize:11,marginBottom:1,cursor:'pointer', whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',flexShrink:0, }}> - {!e.all_day&&{fmtTime(e.start_at)}}{e.title} + {e.all_day?All Day::{fmtTime(e.start_at)}}{e.title}
))} {dayEvs.length>2&&
+{dayEvs.length-2} more
}