fix: plain style for user tasks, colored boxes only for calendar events
Per webapp behavior: regular user tasks render as white background with a thin colored left border (clean/minimal); external calendar events (externalProvider != null) get a light tinted background box. Completed tasks use a subtle gray style. The all-day strip keeps solid bars for all entries (matching the webapp's ALL DAY section). v1.95.5
This commit is contained in:
parent
da31128121
commit
8fb9e04346
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "my-weekly-todo-list",
|
"name": "my-weekly-todo-list",
|
||||||
"version": "1.95.4",
|
"version": "1.95.5",
|
||||||
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -167,6 +167,7 @@ type TaskItem = {
|
|||||||
startTime: string | null;
|
startTime: string | null;
|
||||||
endTime: string | null;
|
endTime: string | null;
|
||||||
completed: boolean;
|
completed: boolean;
|
||||||
|
isExternal: boolean; // true = imported from Google/MS/Apple Calendar
|
||||||
project: { name: string; color: string | null } | null;
|
project: { name: string; color: string | null } | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -544,7 +545,9 @@ function WeekCalendarPDF({
|
|||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Task blocks — solid fill matching webapp style
|
// Task blocks:
|
||||||
|
// User tasks → white bg + thin colored left border (clean/minimal)
|
||||||
|
// Calendar events → light tinted bg + colored left border (boxed)
|
||||||
...timedTasks.map(t => {
|
...timedTasks.map(t => {
|
||||||
const startMins = parseTimeMinutes(t.startTime)!;
|
const startMins = parseTimeMinutes(t.startTime)!;
|
||||||
const endMins = t.endTime
|
const endMins = t.endTime
|
||||||
@ -561,39 +564,67 @@ function WeekCalendarPDF({
|
|||||||
const rawH = minutesToY(ceMin - csMin);
|
const rawH = minutesToY(ceMin - csMin);
|
||||||
const taskH = Math.max(rawH, 14);
|
const taskH = Math.max(rawH, 14);
|
||||||
|
|
||||||
const bgColor = t.completed ? DONE_BG : (t.project?.color || userStyle.taskColor);
|
const accentColor = t.project?.color || userStyle.weekdayColor;
|
||||||
const textColor = t.completed ? DONE_TEXT : contrastColor(bgColor);
|
|
||||||
const isShort = (ceMin - csMin) <= 30;
|
const isShort = (ceMin - csMin) <= 30;
|
||||||
const showTime = t.startTime && (!t.startTime.endsWith(':00') || isShort);
|
const showTime = t.startTime && (!t.startTime.endsWith(':00') || isShort);
|
||||||
|
|
||||||
|
if (t.completed) {
|
||||||
|
// Completed: subtle strikethrough-style, always plain
|
||||||
return React.createElement(View, {
|
return React.createElement(View, {
|
||||||
key: t.id,
|
key: t.id,
|
||||||
style: {
|
style: {
|
||||||
position: 'absolute',
|
position: 'absolute', top: topPx + 1, left: 2, right: 2,
|
||||||
top: topPx + 1,
|
height: taskH - 2, backgroundColor: WHITE,
|
||||||
left: 2,
|
borderLeftWidth: 2, borderLeftColor: DONE_BG,
|
||||||
right: 2,
|
paddingLeft: 5, paddingRight: 3, paddingVertical: 2,
|
||||||
height: taskH - 2,
|
|
||||||
backgroundColor: bgColor,
|
|
||||||
borderRadius: 3,
|
|
||||||
paddingHorizontal: 4,
|
|
||||||
paddingVertical: 2,
|
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
React.createElement(Text, {
|
React.createElement(Text, {
|
||||||
style: {
|
style: { fontSize: 7, color: DONE_TEXT, lineHeight: 1.25 },
|
||||||
fontFamily: 'Helvetica-Bold',
|
|
||||||
fontSize: 7,
|
|
||||||
color: textColor,
|
|
||||||
lineHeight: 1.25,
|
|
||||||
},
|
|
||||||
}, (t.title || '').slice(0, 44)),
|
}, (t.title || '').slice(0, 44)),
|
||||||
showTime
|
);
|
||||||
? React.createElement(Text, {
|
}
|
||||||
style: { fontSize: 6, color: textColor, opacity: 0.8, marginTop: 0.5 },
|
|
||||||
}, fmtTime(t.startTime!))
|
if (t.isExternal) {
|
||||||
: null,
|
// External calendar event: light tinted background box
|
||||||
|
const bg = lighten(accentColor, 0.8);
|
||||||
|
return React.createElement(View, {
|
||||||
|
key: t.id,
|
||||||
|
style: {
|
||||||
|
position: 'absolute', top: topPx + 1, left: 2, right: 2,
|
||||||
|
height: taskH - 2, backgroundColor: bg,
|
||||||
|
borderRadius: 3, borderLeftWidth: 3, borderLeftColor: accentColor,
|
||||||
|
paddingLeft: 5, paddingRight: 3, paddingVertical: 2,
|
||||||
|
overflow: 'hidden',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
React.createElement(Text, {
|
||||||
|
style: { fontFamily: 'Helvetica-Bold', fontSize: 7, color: '#1e293b', lineHeight: 1.25 },
|
||||||
|
}, (t.title || '').slice(0, 44)),
|
||||||
|
showTime ? React.createElement(Text, {
|
||||||
|
style: { fontSize: 6, color: accentColor, marginTop: 0.5 },
|
||||||
|
}, fmtTime(t.startTime!)) : null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Regular user task: white background, thin colored left border
|
||||||
|
return React.createElement(View, {
|
||||||
|
key: t.id,
|
||||||
|
style: {
|
||||||
|
position: 'absolute', top: topPx + 1, left: 2, right: 2,
|
||||||
|
height: taskH - 2, backgroundColor: WHITE,
|
||||||
|
borderLeftWidth: 3, borderLeftColor: accentColor,
|
||||||
|
paddingLeft: 5, paddingRight: 3, paddingVertical: 2,
|
||||||
|
overflow: 'hidden',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
React.createElement(Text, {
|
||||||
|
style: { fontFamily: 'Helvetica-Bold', fontSize: 7, color: '#1e293b', lineHeight: 1.25 },
|
||||||
|
}, (t.title || '').slice(0, 44)),
|
||||||
|
showTime ? React.createElement(Text, {
|
||||||
|
style: { fontSize: 6, color: accentColor, marginTop: 0.5 },
|
||||||
|
}, fmtTime(t.startTime!)) : null,
|
||||||
);
|
);
|
||||||
}).filter(Boolean),
|
}).filter(Boolean),
|
||||||
), // end time grid
|
), // end time grid
|
||||||
@ -848,6 +879,7 @@ export async function GET(request: Request) {
|
|||||||
const item: TaskItem = {
|
const item: TaskItem = {
|
||||||
id: task.id, title: task.title, startTime: task.startTime,
|
id: task.id, title: task.title, startTime: task.startTime,
|
||||||
endTime: task.endTime ?? null, completed: task.completed,
|
endTime: task.endTime ?? null, completed: task.completed,
|
||||||
|
isExternal: !!((task as any).externalProvider),
|
||||||
project: task.project,
|
project: task.project,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user