-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdayview.diff
More file actions
104 lines (101 loc) · 4.78 KB
/
Copy pathdayview.diff
File metadata and controls
104 lines (101 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
diff --git a/src/components/Calendar/DayView.jsx b/src/components/Calendar/DayView.jsx
index d6d135b..f597f0d 100644
--- a/src/components/Calendar/DayView.jsx
+++ b/src/components/Calendar/DayView.jsx
@@ -3,35 +3,22 @@ import { useRef, useState, useEffect } from 'react';
import { format } from 'date-fns';
import { useCalendar } from '../../contexts/useCalendar';
import { useEvents } from '../../contexts/useEvents';
-import { cn, getEventColor, formatDuration } from '../../utils/helpers';
+import { cn, getEventColor } from '../../utils/helpers';
import {
formatTime,
getDayHours,
sortEventsByStart
} from '../../utils/dateUtils';
-import { Clock } from 'lucide-react';
+import { Clock, MapPin } from 'lucide-react';
import { useHourScale } from '../../utils/useHourScale';
import { getEventOverlapLayout } from '../../utils/eventOverlap';
import './DayView.css';
-const buildEventSnippet = (event) => {
- const pieces = [];
- if (event.category) {
- pieces.push(`${event.category.charAt(0).toUpperCase()}${event.category.slice(1)}`);
- }
- pieces.push(event.title || 'Untitled');
- if (event.location) {
- pieces.push(event.location);
- }
- if (event.reminder) {
- pieces.push(`${event.reminder}m reminder`);
- }
- return pieces.join(' · ');
-};
+
const DayView = () => {
- const { currentDate, openEventModal } = useCalendar();
- const { getEventsForDate, updateEvent } = useEvents();
+ const { currentDate, openEventModal, isArchiveMode } = useCalendar();
+ const { getEventsForDate, updateEvent, archiveEvent } = useEvents();
const MotionDiv = motion.div;
const MotionButton = motion.button;
@@ -154,21 +141,51 @@ const DayView = () => {
backgroundColor: event.color || getEventColor(event.category),
cursor: 'grab'
}}
- onClick={() => openEventModal(event)}
+ onClick={(e) => {
+ if (isArchiveMode) {
+ e.stopPropagation();
+ archiveEvent(event.id);
+ } else {
+ openEventModal(event);
+ }
+ }}
draggable
onDragStart={(e) => handleDragStart(event, e)}
initial={{ opacity: 0, scale: 0.95 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ delay: index * 0.04 }}
>
- <div className="event-time">
- <Clock size={12} />
- <span>
- {formatTime(new Date(event.start))}–{formatTime(new Date(event.end))}
+ <div className="event-time" style={{ whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
+ <Clock size={10} style={{ display: 'inline', marginRight: '4px', verticalAlign: '-1px' }} />
+ <span style={{ fontSize: '0.65rem', fontWeight: '500' }}>
+ {formatTime(new Date(event.start))} - {formatTime(new Date(event.end))}
</span>
- <span className="event-duration">{formatDuration(event.start, event.end)}</span>
</div>
- <div className="event-snippet">{buildEventSnippet(event)}</div>
+ <div className="event-snippet" style={{ fontSize: '0.75rem', fontWeight: '600', lineHeight: '1.2', marginTop: '2px', whiteSpace: 'normal', display: '-webkit-box', WebkitLineClamp: 3, WebkitBoxOrient: 'vertical', overflow: 'hidden' }}>
+ {event.title || 'Untitled'}
+ </div>
+ {event.location && (
+ <a
+ href={`https://maps.google.com/?q=${encodeURIComponent(event.location)}`}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="event-location-link"
+ onClick={(e) => { e.stopPropagation(); }}
+ style={{ display: 'flex', alignItems: 'flex-start', gap: '4px', marginTop: '4px', color: 'rgba(255,255,255,0.9)', textDecoration: 'none', fontSize: '0.65rem', fontWeight: '500' }}
+ >
+ <MapPin size={10} style={{ flexShrink: 0, marginTop: '2px' }} />
+ <span style={{
+ display: '-webkit-box',
+ WebkitLineClamp: 2,
+ WebkitBoxOrient: 'vertical',
+ overflow: 'hidden',
+ whiteSpace: 'normal',
+ pointerEvents: 'none'
+ }}>
+ {event.location}
+ </span>
+ </a>
+ )}
</MotionButton>
);
})}