Improve calendar day highlighting to better distinguish weekends
Refactor `TasksWithCalendar.tsx` to apply specific styling for weekends and today's date, enhancing visual clarity. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ceced2fc-aa46-458d-ba87-ddd4b7bb1518 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/659922a9-0087-461c-90dd-6d9a58b81d4d/ceced2fc-aa46-458d-ba87-ddd4b7bb1518/0tPSQjg
This commit is contained in:
@@ -14,10 +14,6 @@ run = ["npm", "run", "start"]
|
|||||||
localPort = 5000
|
localPort = 5000
|
||||||
externalPort = 80
|
externalPort = 80
|
||||||
|
|
||||||
[[ports]]
|
|
||||||
localPort = 39581
|
|
||||||
externalPort = 3001
|
|
||||||
|
|
||||||
[[ports]]
|
[[ports]]
|
||||||
localPort = 41353
|
localPort = 41353
|
||||||
externalPort = 3000
|
externalPort = 3000
|
||||||
|
|||||||
@@ -334,18 +334,19 @@ export default function TasksWithCalendar({ tasks, onTaskUpdate, onTaskEdit }: T
|
|||||||
const isWeekend = date.getDay() === 0 || date.getDay() === 6;
|
const isWeekend = date.getDay() === 0 || date.getDay() === 6;
|
||||||
const isHovered = hoveredDate && isSameDay(date, hoveredDate);
|
const isHovered = hoveredDate && isSameDay(date, hoveredDate);
|
||||||
|
|
||||||
|
|
||||||
|
// Use important modifier to ensure weekend styling overrides any conflicting CSS
|
||||||
|
const weekendClasses = isWeekend ? '!bg-muted/80 border-muted-foreground/30 shadow-sm' : '';
|
||||||
|
const todayClasses = isToday ? 'border-primary ring-1 ring-primary ring-offset-1 ring-offset-background' : 'border-border';
|
||||||
|
const hoverClasses = isHovered && draggedTask ? 'ring-2 ring-primary bg-primary/15 border-primary shadow-lg' : '';
|
||||||
|
const dragClasses = draggedTask && !isHovered ? 'border-dashed border-primary/30' : '';
|
||||||
|
|
||||||
|
const finalClassName = `p-2 min-h-[100px] transition-all border-2 ${todayClasses} ${weekendClasses} ${hoverClasses} ${dragClasses}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={index}
|
key={index}
|
||||||
className={`p-2 min-h-[100px] transition-all border-2 ${
|
className={finalClassName}
|
||||||
isToday ? 'border-primary ring-1 ring-primary ring-offset-1 ring-offset-background' : 'border-border'
|
|
||||||
} ${
|
|
||||||
isWeekend ? 'bg-muted/50 border-muted' : ''
|
|
||||||
} ${
|
|
||||||
isHovered && draggedTask ? 'ring-2 ring-primary bg-primary/15 border-primary shadow-lg' : ''
|
|
||||||
} ${
|
|
||||||
draggedTask && !isHovered ? 'border-dashed border-primary/30' : ''
|
|
||||||
}`}
|
|
||||||
onDragOver={handleDragOver}
|
onDragOver={handleDragOver}
|
||||||
onDragEnter={() => handleDragEnter(date)}
|
onDragEnter={() => handleDragEnter(date)}
|
||||||
onDragLeave={handleDragLeave}
|
onDragLeave={handleDragLeave}
|
||||||
@@ -357,11 +358,13 @@ export default function TasksWithCalendar({ tasks, onTaskUpdate, onTaskEdit }: T
|
|||||||
data-testid={`calendar-date-${format(date, 'yyyy-MM-dd')}`}
|
data-testid={`calendar-date-${format(date, 'yyyy-MM-dd')}`}
|
||||||
>
|
>
|
||||||
<div className="text-center mb-2">
|
<div className="text-center mb-2">
|
||||||
<div className="text-xs text-muted-foreground font-medium">
|
<div className={`text-xs font-medium ${
|
||||||
|
isWeekend ? 'text-muted-foreground font-semibold' : 'text-muted-foreground'
|
||||||
|
}`}>
|
||||||
{format(date, 'EEE')}
|
{format(date, 'EEE')}
|
||||||
</div>
|
</div>
|
||||||
<div className={`text-xs font-semibold ${
|
<div className={`text-xs font-semibold ${
|
||||||
isToday ? 'text-primary' : ''
|
isToday ? 'text-primary' : isWeekend ? 'text-primary/80' : ''
|
||||||
}`}>
|
}`}>
|
||||||
{format(date, 'MMM d')}
|
{format(date, 'MMM d')}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user