Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: color-code calendar events by subcalendar source in Day, Week, and Month views

Adam Eivy24510f72a5da
diff --git a/client/src/components/calendar/DayView.jsx b/client/src/components/calendar/DayView.jsx
index 2b89acda9c..1a89f91951 100644
--- a/client/src/components/calendar/DayView.jsx
+++ b/client/src/components/calendar/DayView.jsx
@@ -97,7 +97,17 @@ function formatDate(date) {
return date.toLocaleDateString([], { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric' });
}
-export default function DayView() {
+function buildSubcalendarColorMap(accounts) {
+ const map = new Map();
+ for (const account of (accounts || [])) {
+ for (const sc of (account.subcalendars || [])) {
+ if (sc.color) map.set(sc.calendarId, sc.color);
+ }
+ }
+ return map;
+}
+
+export default function DayView({ accounts }) {
const [date, setDate] = useState(() => {
const d = new Date();
d.setHours(0, 0, 0, 0);
@@ -140,6 +150,7 @@ export default function DayView() {
const allDayEvents = useMemo(() => events.filter(e => e.isAllDay), [events]);
const timedEvents = useMemo(() => events.filter(e => !e.isAllDay), [events]);
const layout = useMemo(() => layoutEvents(timedEvents), [timedEvents]);
+ const colorMap = useMemo(() => buildSubcalendarColorMap(accounts), [accounts]);
// Current time indicator
const now = new Date();
@@ -175,15 +186,22 @@ export default function DayView() {
{allDayEvents.length > 0 && (
<div className="space-y-1">
<span className="text-xs text-gray-500 uppercase">All Day</span>
- {allDayEvents.map(event => (
- <button
- key={`${event.accountId}-${event.id}`}
- onClick={() => setSelectedEvent(event)}
- className="w-full text-left px-3 py-2 bg-port-accent/10 text-port-accent rounded text-sm hover:bg-port-accent/20 transition-colors"
- >
- {event.title}
- </button>
- ))}
+ {allDayEvents.map(event => {
+ const adColor = colorMap.get(event.subcalendarId) || null;
+ return (
+ <button
+ key={`${event.accountId}-${event.id}`}
+ onClick={() => setSelectedEvent(event)}
+ className="w-full text-left px-3 py-2 rounded text-sm transition-colors hover:brightness-125"
+ style={{
+ backgroundColor: adColor ? `${adColor}20` : 'rgb(59 130 246 / 0.1)',
+ color: adColor || 'var(--port-accent, #3b82f6)'
+ }}
+ >
+ {event.title}
+ </button>
+ );
+ })}
</div>
)}
@@ -216,17 +234,20 @@ export default function DayView() {
const { column, totalColumns } = layout.get(key) || { column: 0, totalColumns: 1 };
const widthPercent = 100 / totalColumns;
const leftPercent = column * widthPercent;
+ const eventColor = colorMap.get(event.subcalendarId) || null;
return (
<button
key={key}
onClick={() => setSelectedEvent(event)}
- className="absolute px-1.5 py-0.5 bg-port-accent/20 border-l-2 border-port-accent rounded text-left overflow-hidden hover:bg-port-accent/30 transition-colors"
+ className={`absolute px-1.5 py-0.5 border-l-2 rounded text-left overflow-hidden transition-colors ${eventColor ? 'hover:brightness-125' : 'hover:bg-port-accent/30'}`}
style={{
top,
height,
minHeight: PX_PER_15MIN,
left: `calc(${leftPercent}% + 2px)`,
- width: `calc(${widthPercent}% - 4px)`
+ width: `calc(${widthPercent}% - 4px)`,
+ borderLeftColor: eventColor || 'var(--port-accent, #3b82f6)',
+ backgroundColor: eventColor ? `${eventColor}25` : 'rgb(59 130 246 / 0.2)'
}}
>
<div className="text-xs leading-tight font-medium text-white truncate">{event.title}</div>
diff --git a/client/src/components/calendar/MonthView.jsx b/client/src/components/calendar/MonthView.jsx
index 1283f845c2..b1879a4714 100644
--- a/client/src/components/calendar/MonthView.jsx
+++ b/client/src/components/calendar/MonthView.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect, useCallback } from 'react';
+import { useState, useEffect, useCallback, useMemo } from 'react';
import { ChevronLeft, ChevronRight, RefreshCw } from 'lucide-react';
import * as api from '../../services/api';
import socket from '../../services/socket';
@@ -30,7 +30,17 @@ function getMonthGrid(year, month) {
const DAY_NAMES = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
-export default function MonthView() {
+function buildSubcalendarColorMap(accounts) {
+ const map = new Map();
+ for (const account of (accounts || [])) {
+ for (const sc of (account.subcalendars || [])) {
+ if (sc.color) map.set(sc.calendarId, sc.color);
+ }
+ }
+ return map;
+}
+
+export default function MonthView({ accounts }) {
const now = new Date();
const [year, setYear] = useState(now.getFullYear());
const [month, setMonth] = useState(now.getMonth());
@@ -81,6 +91,7 @@ export default function MonthView() {
eventsByDay[dayKey].push(event);
}
+ const colorMap = useMemo(() => buildSubcalendarColorMap(accounts), [accounts]);
const todayStr = now.toDateString();
return (
@@ -137,20 +148,27 @@ export default function MonthView() {
{cell.date.getDate()}
</div>
<div className="space-y-0.5">
- {dayEvents.slice(0, 3).map(event => (
- <button
- key={`${event.accountId}-${event.id}`}
- onClick={() => setSelectedEvent(event)}
- className="w-full text-left px-1 py-0.5 bg-port-accent/15 text-port-accent rounded text-[10px] truncate hover:bg-port-accent/25 transition-colors"
- >
- {!event.isAllDay && (
- <span className="text-gray-500 mr-1">
- {new Date(event.startTime).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' })}
- </span>
- )}
- {event.title}
- </button>
- ))}
+ {dayEvents.slice(0, 3).map(event => {
+ const evColor = colorMap.get(event.subcalendarId) || null;
+ return (
+ <button
+ key={`${event.accountId}-${event.id}`}
+ onClick={() => setSelectedEvent(event)}
+ className="w-full text-left px-1 py-0.5 rounded text-[10px] truncate transition-colors hover:brightness-125"
+ style={{
+ backgroundColor: evColor ? `${evColor}20` : 'rgb(59 130 246 / 0.15)',
+ color: evColor || 'var(--port-accent, #3b82f6)'
+ }}
+ >
+ {!event.isAllDay && (
+ <span className="text-gray-500 mr-1">
+ {new Date(event.startTime).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' })}
+ </span>
+ )}
+ {event.title}
+ </button>
+ );
+ })}
{dayEvents.length > 3 && (
<div className="text-[10px] text-gray-500 pl-1">+{dayEvents.length - 3} more</div>
)}
diff --git a/client/src/components/calendar/WeekView.jsx b/client/src/components/calendar/WeekView.jsx
index 11d95a10ef..aa32569db9 100644
--- a/client/src/components/calendar/WeekView.jsx
+++ b/client/src/components/calendar/WeekView.jsx
@@ -102,7 +102,17 @@ function layoutEvents(events) {
return layout;
}
-export default function WeekView() {
+function buildSubcalendarColorMap(accounts) {
+ const map = new Map();
+ for (const account of (accounts || [])) {
+ for (const sc of (account.subcalendars || [])) {
+ if (sc.color) map.set(sc.calendarId, sc.color);
+ }
+ }
+ return map;
+}
+
+export default function WeekView({ accounts }) {
const [weekStart, setWeekStart] = useState(() => getWeekStart(new Date()));
const [events, setEvents] = useState([]);
const [loading, setLoading] = useState(true);
@@ -142,6 +152,8 @@ export default function WeekView() {
setLoading(true);
};
+ const colorMap = useMemo(() => buildSubcalendarColorMap(accounts), [accounts]);
+
// Group events by day
const eventsByDay = weekDays.map(day => {
const dayStr = day.toDateString();
@@ -215,15 +227,22 @@ export default function WeekView() {
<div className="w-14 shrink-0 text-[10px] text-gray-500 text-right pr-1 pt-1">All day</div>
{allDayByDay.map((dayEvents, i) => (
<div key={i} className="flex-1 border-l border-port-border p-0.5 min-h-[28px]">
- {dayEvents.map(event => (
- <button
- key={eventKey(event)}
- onClick={() => setSelectedEvent(event)}
- className="w-full text-left px-1 py-0.5 bg-port-accent/15 text-port-accent rounded text-[10px] truncate hover:bg-port-accent/25 transition-colors"
- >
- {event.title}
- </button>
- ))}
+ {dayEvents.map(event => {
+ const adColor = colorMap.get(event.subcalendarId) || null;
+ return (
+ <button
+ key={eventKey(event)}
+ onClick={() => setSelectedEvent(event)}
+ className="w-full text-left px-1 py-0.5 rounded text-[10px] truncate transition-colors hover:brightness-125"
+ style={{
+ backgroundColor: adColor ? `${adColor}20` : 'rgb(59 130 246 / 0.15)',
+ color: adColor || 'var(--port-accent, #3b82f6)'
+ }}
+ >
+ {event.title}
+ </button>
+ );
+ })}
</div>
))}
</div>
@@ -263,17 +282,20 @@ export default function WeekView() {
const { column, totalColumns } = layout.get(key) || { column: 0, totalColumns: 1 };
const widthPercent = 100 / totalColumns;
const leftPercent = column * widthPercent;
+ const evColor = colorMap.get(event.subcalendarId) || null;
return (
<button
key={key}
onClick={() => setSelectedEvent(event)}
- className="absolute px-0.5 py-0.5 bg-port-accent/20 border-l-2 border-port-accent rounded text-left overflow-hidden hover:bg-port-accent/30 transition-colors"
+ className={`absolute px-0.5 py-0.5 border-l-2 rounded text-left overflow-hidden transition-colors ${evColor ? 'hover:brightness-125' : 'hover:bg-port-accent/30'}`}
style={{
top,
height,
minHeight: PX_PER_15MIN,
left: `calc(${leftPercent}% + 1px)`,
- width: `calc(${widthPercent}% - 2px)`
+ width: `calc(${widthPercent}% - 2px)`,
+ borderLeftColor: evColor || 'var(--port-accent, #3b82f6)',
+ backgroundColor: evColor ? `${evColor}25` : 'rgb(59 130 246 / 0.2)'
}}
>
<div className="text-[10px] leading-tight font-medium text-white truncate">{event.title}</div>