Rename disinclude to exclude and style as soft badge

This commit is contained in:
tyuXX 2026-10-21 18:51:26 +00:00
parent d0fd394fbd
commit 573a249580
3 changed files with 39 additions and 17 deletions

View file

@ -571,6 +571,8 @@ code {
.card-badges { .card-badges {
display: flex; display: flex;
align-items: center;
flex-wrap: wrap;
gap: 4px; gap: 4px;
} }
@ -623,20 +625,40 @@ code {
border: 1px solid #cbd5e1; border: 1px solid #cbd5e1;
} }
.btn-exclude,
.btn-disinclude { .btn-disinclude {
background: transparent; font-family: inherit;
border: 1px solid #cbd5e1; font-size: 0.725rem;
color: var(--text-muted); font-weight: 600;
font-size: 0.7rem; line-height: inherit;
display: inline-flex;
align-items: center;
padding: 1px 6px; padding: 1px 6px;
border-radius: 4px; border-radius: 4px;
background: #f1f5f9;
color: #64748b;
border: 1px solid #e2e8f0;
cursor: pointer; cursor: pointer;
transition: all 0.15s ease;
user-select: none;
} }
.btn-exclude:hover,
.btn-disinclude:hover { .btn-disinclude:hover {
background: #f1f5f9; background: #e2e8f0;
color: var(--text-main); color: #334155;
border-color: #94a3b8; border-color: #cbd5e1;
}
.btn-exclude:active,
.btn-disinclude:active {
background: #cbd5e1;
}
.btn-exclude:focus-visible,
.btn-disinclude:focus-visible {
outline: 2px solid var(--primary);
outline-offset: 1px;
} }
.assignment-card.is-excluded { .assignment-card.is-excluded {

View file

@ -23,8 +23,8 @@ document.addEventListener('DOMContentLoaded', () => {
assignmentList.addEventListener('click', async (e) => { assignmentList.addEventListener('click', async (e) => {
const target = e.target; const target = e.target;
// Disinclude / Restore button // Exclude / Restore button
if (target.classList.contains('btn-disinclude')) { if (target.classList.contains('btn-exclude') || target.classList.contains('btn-disinclude')) {
const assignmentId = target.dataset.id; const assignmentId = target.dataset.id;
const card = target.closest('.assignment-card'); const card = target.closest('.assignment-card');
if (!card) return; if (!card) return;
@ -43,8 +43,8 @@ document.addEventListener('DOMContentLoaded', () => {
if (data.success && data.stats) { if (data.success && data.stats) {
card.dataset.excluded = newExcluded ? 'true' : 'false'; card.dataset.excluded = newExcluded ? 'true' : 'false';
card.classList.toggle('is-excluded', newExcluded); card.classList.toggle('is-excluded', newExcluded);
target.textContent = newExcluded ? 'Restore' : 'Disinclude'; target.textContent = newExcluded ? 'Restore' : 'Exclude';
target.title = newExcluded ? 'Restore this homework to your active list' : 'Disinclude this homework (e.g. from another class)'; target.title = newExcluded ? 'Restore this homework to your active list' : 'Exclude this homework (e.g. from another class)';
const checkbox = card.querySelector('.assignment-toggle'); const checkbox = card.querySelector('.assignment-toggle');
if (checkbox) checkbox.disabled = newExcluded; if (checkbox) checkbox.disabled = newExcluded;
@ -55,7 +55,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (badgesContainer) { if (badgesContainer) {
const b = document.createElement('span'); const b = document.createElement('span');
b.className = 'badge badge-excluded'; b.className = 'badge badge-excluded';
b.textContent = 'Disincluded'; b.textContent = 'Excluded';
badgesContainer.insertBefore(b, target); badgesContainer.insertBefore(b, target);
} }
} else if (!newExcluded && badgeExcluded) { } else if (!newExcluded && badgeExcluded) {
@ -66,7 +66,7 @@ document.addEventListener('DOMContentLoaded', () => {
applyFilters(); applyFilters();
} }
} catch (err) { } catch (err) {
console.error('Failed to toggle disinclude:', err); console.error('Failed to toggle exclude:', err);
} finally { } finally {
target.disabled = false; target.disabled = false;
} }

View file

@ -192,7 +192,7 @@
<% } %> <% } %>
<% if (item.excluded) { %> <% if (item.excluded) { %>
<span class="badge badge-excluded">Disincluded</span> <span class="badge badge-excluded">Excluded</span>
<% } else if (item.completed) { %> <% } else if (item.completed) { %>
<span class="badge badge-completed">Done</span> <span class="badge badge-completed">Done</span>
<% } else if (item.status === 'next-week') { %> <% } else if (item.status === 'next-week') { %>
@ -207,11 +207,11 @@
<button <button
type="button" type="button"
class="btn-disinclude" class="btn-exclude"
data-id="<%= item.id %>" data-id="<%= item.id %>"
title="<%= item.excluded ? 'Restore this homework to your active list' : 'Disinclude this homework (e.g. from another class)' %>" title="<%= item.excluded ? 'Restore this homework to your active list' : 'Exclude this homework (e.g. from another class)' %>"
> >
<%= item.excluded ? 'Restore' : 'Disinclude' %> <%= item.excluded ? 'Restore' : 'Exclude' %>
</button> </button>
</div> </div>
</div> </div>