Skip to content

Commit e608acf

Browse files
committed
refactor: remove session filter dropdown and update session history table logic
1 parent fade1dc commit e608acf

File tree

3 files changed

+41
-23
lines changed

3 files changed

+41
-23
lines changed

src/index.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,6 @@ <h4 id="selected-day-title">Today's Sessions</h4>
363363
<div class="sessions-header">
364364
<h3>Session History</h3>
365365
<div class="sessions-controls">
366-
<select id="sessions-filter-period" class="filter-select">
367-
<option value="today" selected>Today</option>
368-
<option value="week">This Week</option>
369-
<option value="month">This Month</option>
370-
<option value="all">All Time</option>
371-
</select>
372366
<button id="export-sessions-btn" class="export-btn" title="Export to Excel">
373367
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
374368
<path

src/managers/navigation-manager.js

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,9 @@ true // All sessions are focus sessions now
736736
} catch (error) {
737737
console.error('Failed to load session details:', error);
738738
const errorItem = document.createElement('div');
739-
errorItem.className = 'sessions-empty';
739+
errorItem.className = 'timeline-empty';
740740
errorItem.textContent = 'Error loading session data';
741-
sessionsList.appendChild(errorItem);
741+
timelineTrack.appendChild(errorItem);
742742
}
743743
}
744744

@@ -846,6 +846,9 @@ true // All sessions are focus sessions now
846846
await this.updateWeeklySessionsChart();
847847
this.updateDailyChart();
848848
await this.updateTagUsageChart();
849+
850+
// Update session history table for selected date
851+
await this.populateSessionsTableForDate(date);
849852
}
850853

851854
updateDailyDetails(date = this.currentDate) {
@@ -942,6 +945,9 @@ true // All sessions are focus sessions now
942945

943946
// Check if this session is from today
944947
const isToday = this.isSameDay(date, new Date());
948+
949+
// Define session type for display
950+
const sessionType = session.session_type || session.type || 'Focus';
945951

946952
// Parse start and end times
947953
const [startHour, startMinute] = session.start_time.split(':').map(Number);
@@ -1503,18 +1509,11 @@ true // All sessions are focus sessions now
15031509

15041510
// Sessions History Table Methods
15051511
async initSessionsTable() {
1506-
await this.populateSessionsTable('today');
1512+
await this.populateSessionsTableForDate(this.currentDate);
15071513
this.setupSessionsTableEventListeners();
15081514
}
15091515

15101516
setupSessionsTableEventListeners() {
1511-
const filterSelect = document.getElementById('sessions-filter-period');
1512-
if (filterSelect) {
1513-
filterSelect.addEventListener('change', async (e) => {
1514-
await this.populateSessionsTable(e.target.value);
1515-
});
1516-
}
1517-
15181517
const exportBtn = document.getElementById('export-sessions-btn');
15191518
if (exportBtn) {
15201519
exportBtn.addEventListener('click', () => {
@@ -1596,6 +1595,33 @@ true // All sessions are focus sessions now
15961595
return allSessions;
15971596
}
15981597

1598+
async populateSessionsTableForDate(date) {
1599+
const tableBody = document.getElementById('sessions-table-body');
1600+
if (!tableBody || !window.sessionManager) return;
1601+
1602+
const sessions = window.sessionManager.getSessionsForDate(date);
1603+
tableBody.innerHTML = '';
1604+
1605+
if (sessions.length === 0) {
1606+
tableBody.innerHTML = `
1607+
<tr>
1608+
<td colspan="5" class="sessions-table-empty">
1609+
No sessions found for selected date
1610+
</td>
1611+
</tr>
1612+
`;
1613+
return;
1614+
}
1615+
1616+
// Sort sessions by time (newest first)
1617+
sessions.sort((a, b) => b.start_time.localeCompare(a.start_time));
1618+
1619+
for (const session of sessions) {
1620+
const row = await this.createSessionTableRow(session);
1621+
tableBody.appendChild(row);
1622+
}
1623+
}
1624+
15991625
async createSessionTableRow(session) {
16001626
const row = document.createElement('tr');
16011627

@@ -1700,9 +1726,8 @@ true // All sessions are focus sessions now
17001726
await window.sessionManager.saveSessionsToStorage();
17011727

17021728
// Refresh the table
1703-
const filterSelect = document.getElementById('sessions-filter-period');
1704-
const currentPeriod = filterSelect ? filterSelect.value : 'today';
1705-
await this.populateSessionsTable(currentPeriod);
1729+
const currentDate = this.selectedDate || this.currentDate;
1730+
await this.populateSessionsTableForDate(currentDate);
17061731

17071732
// Refresh other views (with error handling for each)
17081733
try {
@@ -1774,9 +1799,8 @@ true // All sessions are focus sessions now
17741799

17751800
async exportSessionsToExcel() {
17761801
try {
1777-
const filterSelect = document.getElementById('sessions-filter-period');
1778-
const currentPeriod = filterSelect ? filterSelect.value : 'today';
1779-
const sessions = this.getSessionsForPeriod(currentPeriod);
1802+
const currentDate = this.selectedDate || this.currentDate;
1803+
const sessions = window.sessionManager.getSessionsForDate(currentDate);
17801804

17811805
if (sessions.length === 0) {
17821806
alert('No sessions to export for the selected period.');

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)