Skip to content

Commit 0439d4e

Browse files
committed
Refactor updater documentation and configuration files; remove outdated files and enhance automatic update system setup. Update session manager to include tags for manual sessions, improve tag usage chart rendering, and streamline theme management system with automatic discovery and loading of themes. Add testing commands for timer sessions and clean up functionality. Adjust UI elements for better layout and accessibility.
1 parent fcbf54e commit 0439d4e

File tree

11 files changed

+188
-62
lines changed

11 files changed

+188
-62
lines changed

src-tauri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct ManualSession {
4747
notes: Option<String>,
4848
created_at: String, // ISO string
4949
date: String, // Date string for the session date
50+
tags: Option<Vec<serde_json::Value>>, // Array of tag objects
5051
}
5152

5253
#[derive(Serialize, Deserialize, Clone)]

src/components/update-notification.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class UpdateNotification {
8383
styles.textContent = `
8484
.update-notification-container {
8585
position: fixed;
86-
top: 0;
86+
top: 44px;
8787
left: 0;
8888
right: 0;
8989
z-index: 10000;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/index.html

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -254,22 +254,6 @@ <h3>Focus Weekly Summary</h3>
254254
</div>
255255
</div>
256256

257-
<!-- Tag Usage Pie Chart -->
258-
<div class="tag-usage-card">
259-
<h3>Tag Usage This Week</h3>
260-
<div class="tag-chart-container">
261-
<div class="tag-pie-chart" id="tag-pie-chart">
262-
<div class="pie-chart-placeholder">
263-
<i class="ri-pie-chart-line"></i>
264-
<span>No data available</span>
265-
</div>
266-
</div>
267-
<div class="tag-legend" id="tag-legend">
268-
<!-- Legend items will be populated by JavaScript -->
269-
</div>
270-
</div>
271-
</div>
272-
273257
<!-- Weekly Sessions Chart -->
274258
<div class="weekly-chart-card">
275259
<h3>This Week's Sessions</h3>
@@ -305,6 +289,59 @@ <h3>Today's Development</h3>
305289
</div>
306290
</div>
307291

292+
<!-- Tag Usage Pie Chart -->
293+
<div class="tag-usage-card">
294+
<h3>Tag Usage This Week</h3>
295+
<div class="tag-chart-container">
296+
<div class="tag-pie-chart" id="tag-pie-chart">
297+
<div class="pie-chart-placeholder">
298+
<i class="ri-pie-chart-line"></i>
299+
<span>No data available</span>
300+
</div>
301+
</div>
302+
<div class="tag-legend" id="tag-legend">
303+
<!-- Legend items will be populated by JavaScript -->
304+
</div>
305+
</div>
306+
</div>
307+
</div>
308+
309+
<!-- Right Column: Calendar -->
310+
<div class="calendar-right-column">
311+
<div class="mini-calendar-container">
312+
<div class="calendar-header">
313+
<button id="prev-month" class="nav-btn">&lt;</button>
314+
<h3 id="current-month">June 2025</h3>
315+
<button id="next-month" class="nav-btn">&gt;</button>
316+
</div>
317+
<div class="calendar-grid" id="calendar-grid">
318+
<!-- Will be filled by JavaScript -->
319+
</div>
320+
321+
<!-- Session Details for Selected Day -->
322+
<div class="selected-day-details" id="selected-day-details">
323+
<div class="sessions-header">
324+
<h4 id="selected-day-title">Today's Sessions</h4>
325+
<button class="add-session-btn" id="add-session-btn" title="Add Session">
326+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
327+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v12m6-6H6" />
328+
</svg>
329+
</button>
330+
</div>
331+
<!-- Timeline Container -->
332+
<div class="sessions-timeline" id="sessions-timeline">
333+
<!-- Timeline Hours -->
334+
<div class="timeline-hours" id="timeline-hours">
335+
<!-- Will be filled by JavaScript with hour markers -->
336+
</div>
337+
<!-- Timeline Track -->
338+
<div class="timeline-track" id="timeline-track">
339+
<!-- Will show session blocks positioned by time -->
340+
</div>
341+
</div>
342+
</div>
343+
</div>
344+
308345
<!-- Sessions History Table -->
309346
<div class="sessions-history-card">
310347
<div class="sessions-header">
@@ -347,43 +384,6 @@ <h3>Session History</h3>
347384
</div>
348385
</div>
349386
</div>
350-
351-
<!-- Right Column: Calendar -->
352-
<div class="calendar-right-column">
353-
<div class="mini-calendar-container">
354-
<div class="calendar-header">
355-
<button id="prev-month" class="nav-btn">&lt;</button>
356-
<h3 id="current-month">June 2025</h3>
357-
<button id="next-month" class="nav-btn">&gt;</button>
358-
</div>
359-
<div class="calendar-grid" id="calendar-grid">
360-
<!-- Will be filled by JavaScript -->
361-
</div>
362-
363-
<!-- Session Details for Selected Day -->
364-
<div class="selected-day-details" id="selected-day-details">
365-
<div class="sessions-header">
366-
<h4 id="selected-day-title">Today's Sessions</h4>
367-
<button class="add-session-btn" id="add-session-btn" title="Add Session">
368-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
369-
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v12m6-6H6" />
370-
</svg>
371-
</button>
372-
</div>
373-
<!-- Timeline Container -->
374-
<div class="sessions-timeline" id="sessions-timeline">
375-
<!-- Timeline Hours -->
376-
<div class="timeline-hours" id="timeline-hours">
377-
<!-- Will be filled by JavaScript with hour markers -->
378-
</div>
379-
<!-- Timeline Track -->
380-
<div class="timeline-track" id="timeline-track">
381-
<!-- Will show session blocks positioned by time -->
382-
</div>
383-
</div>
384-
</div>
385-
</div>
386-
</div>
387387
</div>
388388
</div>
389389

src/managers/navigation-manager.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export class NavigationManager {
135135
await this.updateFocusSummary();
136136
await this.updateWeeklySessionsChart();
137137
this.updateDailyChart();
138+
await this.updateTagUsageChart();
138139
});
139140

140141
nextWeekBtn.addEventListener('click', async () => {
@@ -143,6 +144,7 @@ export class NavigationManager {
143144
await this.updateFocusSummary();
144145
await this.updateWeeklySessionsChart();
145146
this.updateDailyChart();
147+
await this.updateTagUsageChart();
146148
});
147149

148150
// Initial updates will be handled by switchView when calendar is shown
@@ -614,6 +616,64 @@ export class NavigationManager {
614616
}
615617
}
616618

619+
async updateTagUsageChart() {
620+
try {
621+
// Get all available tags
622+
const tags = window.tagManager ? window.tagManager.tags : [];
623+
624+
// Get sessions for the current week
625+
const sessions = [];
626+
const startOfWeek = this.getWeekStart(this.currentDate);
627+
628+
for (let i = 0; i < 7; i++) {
629+
const date = new Date(startOfWeek);
630+
date.setDate(startOfWeek.getDate() + i);
631+
632+
if (window.sessionManager) {
633+
const dailySessions = window.sessionManager.getSessionsForDate(date);
634+
635+
// Filter to focus sessions only and add date info
636+
const focusSessions = dailySessions
637+
.filter(s => {
638+
const sessionType = s.session_type || s.type;
639+
return sessionType === 'focus' || sessionType === 'custom';
640+
})
641+
.map(session => ({
642+
...session,
643+
date: date.toISOString().split('T')[0] // Add date in YYYY-MM-DD format
644+
}));
645+
sessions.push(...focusSessions);
646+
}
647+
}
648+
649+
// Get tag statistics for current week
650+
const tagStatsData = this.tagStatistics.getCurrentWeekTagStats(sessions, tags);
651+
652+
// Render the pie chart
653+
this.tagStatistics.renderTagPieChart('tag-pie-chart', 'tag-legend', tagStatsData);
654+
655+
} catch (error) {
656+
console.error('Error updating tag usage chart:', error);
657+
658+
// Show placeholder on error
659+
const chartContainer = document.getElementById('tag-pie-chart');
660+
const legendContainer = document.getElementById('tag-legend');
661+
662+
if (chartContainer) {
663+
chartContainer.innerHTML = `
664+
<div class="pie-chart-placeholder">
665+
<i class="ri-pie-chart-line"></i>
666+
<span>Error loading data</span>
667+
</div>
668+
`;
669+
}
670+
671+
if (legendContainer) {
672+
legendContainer.innerHTML = '';
673+
}
674+
}
675+
}
676+
617677
async updateSelectedDayDetails(date = this.currentDate) {
618678
const selectedDayTitle = document.getElementById('selected-day-title');
619679
const timelineTrack = document.getElementById('timeline-track');
@@ -799,6 +859,7 @@ export class NavigationManager {
799859
await this.updateFocusSummary();
800860
await this.updateWeeklySessionsChart();
801861
this.updateDailyChart();
862+
await this.updateTagUsageChart();
802863
}
803864

804865
updateDailyDetails(date = this.currentDate) {
@@ -808,6 +869,7 @@ export class NavigationManager {
808869
this.updateFocusSummary();
809870
this.updateWeeklySessionsChart();
810871
this.updateDailyChart();
872+
this.updateTagUsageChart();
811873
}
812874

813875
updateWeeklyChart() {
@@ -1685,6 +1747,12 @@ export class NavigationManager {
16851747
console.warn('Failed to update weekly chart after deletion:', e);
16861748
}
16871749

1750+
try {
1751+
await this.updateTagUsageChart();
1752+
} catch (e) {
1753+
console.warn('Failed to update tag usage chart after deletion:', e);
1754+
}
1755+
16881756
try {
16891757
await this.updateTimelineForDate(new Date());
16901758
} catch (e) {

src/managers/session-manager.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ export class SessionManager {
233233
start_time: formData.get('startTime'),
234234
end_time: this.calculateEndTime(formData.get('startTime'), parseInt(formData.get('duration'))),
235235
notes: formData.get('notes') || null,
236-
created_at: new Date().toISOString()
236+
created_at: new Date().toISOString(),
237+
tags: [] // Manual sessions start without tags, but field is included for compatibility
237238
};
238239

239240
// Validate form

src/styles/statistics.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,18 @@
240240
font-weight: 500;
241241
}
242242

243+
.tag-legend-others {
244+
opacity: 0.8;
245+
border-top: 1px solid #f3f4f6;
246+
padding-top: 8px;
247+
margin-top: 4px;
248+
}
249+
250+
.tag-legend-others .tag-legend-name {
251+
font-style: italic;
252+
font-size: 13px;
253+
}
254+
243255
/* Pie chart segments */
244256
.pie-segment {
245257
position: absolute;

0 commit comments

Comments
 (0)