Skip to content

Commit dc75a0e

Browse files
committed
fix: improve drag handling and session management updates
1 parent 53bbd50 commit dc75a0e

File tree

4 files changed

+62
-5
lines changed

4 files changed

+62
-5
lines changed

src/managers/navigation-manager.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,9 @@ export class NavigationManager {
957957

958958
// Drag to move
959959
sessionElement.addEventListener('mousedown', (e) => {
960-
if (e.target.classList.contains('session-handle')) return;
960+
// Don't start drag if clicking on resize handles
961+
if (e.target.classList.contains('session-handle') ||
962+
e.target.closest('.session-handle')) return;
961963
this.startSessionDrag(e, sessionElement, session);
962964
});
963965

src/managers/session-manager.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,13 @@ export class SessionManager {
220220
NotificationUtils.showNotificationPing('Session added successfully', 'success');
221221
}
222222

223+
// Store the selected date before closing modal (as closeModal sets it to null)
224+
const dateForRefresh = this.selectedDate;
223225
this.closeModal();
224226

225227
// Refresh the session list
226228
if (this.navManager) {
227-
await this.navManager.updateSelectedDayDetails(this.selectedDate);
229+
await this.navManager.updateSelectedDayDetails(dateForRefresh);
228230
await this.navManager.updateFocusSummary();
229231
await this.navManager.updateWeeklySessionsChart();
230232
await this.navManager.updateDailyChart();
@@ -290,12 +292,14 @@ export class SessionManager {
290292
// TODO: Call backend when available
291293
// await invoke('delete_session', { date: dateString, sessionId: this.currentEditingSession.id });
292294

295+
// Store the selected date before closing modal (as closeModal sets it to null)
296+
const dateForRefresh = this.selectedDate;
293297
this.closeModal();
294298
NotificationUtils.showNotificationPing('Session deleted successfully', 'success');
295299

296300
// Refresh the session list
297301
if (this.navManager) {
298-
await this.navManager.updateSelectedDayDetails(this.selectedDate);
302+
await this.navManager.updateSelectedDayDetails(dateForRefresh);
299303
await this.navManager.updateFocusSummary();
300304
await this.navManager.updateWeeklySessionsChart();
301305
await this.navManager.updateDailyChart();
@@ -313,7 +317,7 @@ export class SessionManager {
313317
}
314318

315319
generateSessionId() {
316-
return Date.now().toString() + Math.random().toString(36).substr(2, 9);
320+
return Date.now().toString() + Math.random().toString(36).substring(2, 11);
317321
}
318322

319323
calculateEndTime(startTime, durationMinutes) {

src/styles/timeline.css

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@
8585
z-index: 5;
8686
}
8787

88+
.timeline-session-content {
89+
cursor: move;
90+
pointer-events: none;
91+
flex: 1;
92+
display: flex;
93+
flex-direction: column;
94+
align-items: center;
95+
justify-content: center;
96+
}
97+
98+
.timeline-session-content-minimal {
99+
cursor: move;
100+
pointer-events: none;
101+
}
102+
88103
.timeline-session:hover {
89104
transform: translateY(-1px);
90105
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
@@ -144,6 +159,19 @@
144159
opacity: 0;
145160
transition: opacity 0.2s ease;
146161
z-index: 15;
162+
position: absolute;
163+
top: 0;
164+
bottom: 0;
165+
width: 8px;
166+
cursor: ew-resize;
167+
}
168+
169+
.timeline-session.today-session .session-handle.left {
170+
left: -4px;
171+
}
172+
173+
.timeline-session.today-session .session-handle.right {
174+
right: -4px;
147175
}
148176

149177
.timeline-session.today-session:hover .session-handle {
@@ -178,6 +206,29 @@
178206
}
179207

180208
/* Session Handle Visual Indicators */
209+
.session-handle {
210+
position: absolute;
211+
top: 0;
212+
bottom: 0;
213+
width: 8px;
214+
cursor: ew-resize;
215+
z-index: 20;
216+
opacity: 0;
217+
transition: opacity 0.2s ease;
218+
}
219+
220+
.session-handle.left {
221+
left: -4px;
222+
}
223+
224+
.session-handle.right {
225+
right: -4px;
226+
}
227+
228+
.timeline-session:hover .session-handle {
229+
opacity: 1;
230+
}
231+
181232
.session-handle::before {
182233
content: '';
183234
position: absolute;

src/utils/theme-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ThemeLoader {
3939
// that gets updated by the build process or manually maintained
4040

4141
// This could be enhanced to use a build-time script that generates this list
42-
const knownThemes = [
42+
const knownThemes = [
4343
'espresso.css',
4444
'pipboy.css',
4545
'pommodore64.css'

0 commit comments

Comments
 (0)