Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions internal/web/public/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,20 @@
box-shadow: 0 0 0 3px var(--bs-primary-bg-subtle);
}

/* Days are clickable to jump the workout view; show hover + selected state. */
.week-dot-item:hover .week-dot {
transform: scale(1.12);
}

.week-dot-item.is-selected .week-dot {
box-shadow: 0 0 0 3px var(--bs-primary);
}

.week-dot-item.is-selected .week-dot-label {
color: var(--bs-primary);
font-weight: 700;
}

.week-dot-label {
font-size: 0.62rem;
color: var(--bs-secondary-color);
Expand Down
14 changes: 12 additions & 2 deletions internal/web/public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,11 @@ function setFormContent(sets, date) {
var btn = document.getElementById('dateDisplayBtn');
if (btn) btn.textContent = formatFriendlyDate(date);

// Mark the matching "Last 7 days" dot as selected (if the date is in range).
document.querySelectorAll('.week-dot-item').forEach(function(it) {
it.classList.toggle('is-selected', it.getAttribute('data-date') === date);
});

if (sets) {
for (var i = 0; i < sets.length; i++) {
if (sets[i].Date == date) {
Expand Down Expand Up @@ -700,12 +705,17 @@ function renderWeekStreak(sets) {
var isToday = i === 0;
var hasWorkout = sets && sets.some(function(s) { return s.Date === dateStr; });
if (hasWorkout) activeCount++;
items.push({ label: dayLetters[d.getDay()], active: hasWorkout, today: isToday });
items.push({ label: dayLetters[d.getDay()], active: hasWorkout, today: isToday, date: dateStr });
}
var dotsHtml = items.map(function(item) {
var dotCls = 'week-dot' + (item.active ? ' has-workout' : '') + (item.today ? ' is-today' : '');
var lblCls = 'week-dot-label' + (item.today ? ' is-today' : '');
return '<div class="week-dot-item"><div class="' + dotCls + '"></div><span class="' + lblCls + '">' + item.label + '</span></div>';
// Click a day to jump the workout view to it (same path as prev/next).
return '<div class="week-dot-item" role="button" tabindex="0" title="' + item.date + '"' +
' style="cursor:pointer" data-date="' + item.date + '"' +
' onclick="setFormContent(window._allSets, \'' + item.date + '\')"' +
' onkeydown="if(event.key===\'Enter\'||event.key===\' \'){event.preventDefault();setFormContent(window._allSets,\'' + item.date + '\');}">' +
'<div class="' + dotCls + '"></div><span class="' + lblCls + '">' + item.label + '</span></div>';
}).join('');
el.innerHTML = '<div class="panel week-streak-panel"><div class="week-streak-inner">' +
'<span class="week-streak-title">Last 7 days</span>' +
Expand Down
2 changes: 1 addition & 1 deletion internal/web/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ <h6 class="modal-title fw-bold"><i class="bi bi-speedometer2 me-2"></i>Log Body
window._autoFill = {{ .Config.AutoFill }};
window._cvAutoLog = {{ .Config.CVAutoLog }};
window._serverDate = {{ .ServerDate | json }};
setFormDate(window._allSets);
renderWeekStreak(window._allSets);
setFormDate(window._allSets);
if (window._cvAutoLog) {
openSetsStream();
}
Expand Down
Loading