calender stuff

This commit is contained in:
th committed 2026-04-08 14:04:23 +02:00
1 parent 8e78468743
commit e0fca064ae
15 files changed
+1716 -67

No files matched your search

+10 -2
View File
@@ -7,6 +7,8 @@ export const state = {
buckets: [],
activeBucket: 'all',
activeTags: [],
hideTermine: localStorage.getItem('hyprcrd-hide-termine') === '1',
superView: localStorage.getItem('hyprcrd-superview') === '1',
activeGroup: null,
sortMode: localStorage.getItem('hyprcrd-sort') || 'manual',
editingId: null,
@@ -42,11 +44,17 @@ export function tagChipHtml(tag) {
return `<span class="tag-chip">${segs.join('<span class="tag-sep">/</span>')}</span>`;
}
function effectiveDate(c) {
const m = (c.title || '').match(/^(\d{4}-\d{2}-\d{2})/);
if (m) return m[1];
return (c.created_at || '').substring(0, 10);
}
export function sortedCards(cards) {
const arr = [...cards];
switch (state.sortMode) {
case 'newest': return arr.sort((a, b) => (b.created_at || '').localeCompare(a.created_at || ''));
case 'oldest': return arr.sort((a, b) => (a.created_at || '').localeCompare(b.created_at || ''));
case 'newest': return arr.sort((a, b) => effectiveDate(b).localeCompare(effectiveDate(a)));
case 'oldest': return arr.sort((a, b) => effectiveDate(a).localeCompare(effectiveDate(b)));
case 'alpha': return arr.sort((a, b) => (a.title || '').localeCompare(b.title || ''));
case 'tag': return arr.sort((a, b) => {
const at = (a.tags || '').split(',')[0] || '\uffff';