Update journal and habit table

This commit is contained in:
2025-11-27 13:03:07 +01:00
parent 907232b001
commit 62072c3ceb
55 changed files with 2464 additions and 1477 deletions

View File

@@ -384,7 +384,7 @@ Rows are custom-ids, columns are days."
(sorted-habits (akk0/sort-habits habit-alist))
(html ""))
;; Start table
(setq html (concat html "<table style='margin-left: auto; margin-right:auto; margin-bottom: 0.8rem;'>\n"))
(setq html (concat html "<table class='habit-table' style='margin-left: auto; margin-right:auto; margin-bottom: 0.8rem;'>\n"))
;; Header row with day numbers
(setq html (concat html " <tr>\n <th></th>\n"))
@@ -392,7 +392,7 @@ Rows are custom-ids, columns are days."
(let ((day (+ (- day-number days-back) i 1)))
(setq html (concat
html
(cond ((= day day-number) "<th>●</th>")
(cond ((= day day-number) "<th class='habit-click-me'>click me ↓</th>")
((= 0 (% (- day day-number) 7)) "<th>○</th>")
(t "<th />"))))))
(setq html (concat html " </tr>\n"))
@@ -402,7 +402,7 @@ Rows are custom-ids, columns are days."
(dolist (entry sorted-habits)
(let* ((custom-id (car entry))
(history (akk0/get-habit-history habit-alist custom-id day-number days-back window-size)))
(setq html (concat html (format " <tr>\n <td style='padding-right: 20px; padding-top: 5px; padding-bottom: 5px;'><i>%s</i></td>\n" (capitalize (string-remove-prefix "dailies-" custom-id)))))
(setq html (concat html (format " <tr>\n <td class='habit-name' style='padding-right: 20px; padding-top: 5px; padding-bottom: 5px;'><i>%s</i></td>\n" (capitalize (string-remove-prefix "dailies-" custom-id)))))
;; Cell for each day
(dolist (day-data history)
@@ -451,7 +451,7 @@ Rows are custom-ids, columns are days."
html))
(akk0/habits-to-html-table habit-alist (string-to-number (format-time-string "%j")) 30 5)
(akk0/habits-to-html-table habit-alist (string-to-number (format-time-string "%j")) 21 5)
#+END_SRC
**** Expansion Section :autocollapse:
@@ -517,13 +517,30 @@ h2:has(.done.FREED), h3:has(.done.FREED), h4:has(.done.FREED), h5:has(.done.FREE
Style the cells, set legible text color, outline clickable:
#+BEGIN_SRC css :tangle ../html/static/style.css
.habit-cell {
.habit-table th, .habit-table td {
text-align: center;
vertical-align: middle;
width: 20px;
height: 20px;
cursor: pointer;
user-select: none;
padding: 8px;
max-width: 22px;
}
.habit-table th {
padding: 0;
}
.habit-click-me {
font-weight: normal;
font-size: calc(var(--font-size) * 0.7);
line-height: calc(var(--line-height) * 0.7);
text-align: center;
}
.habit-name {
max-width: 15rem !important;
}
.habit-cell.habit-brightness-1 { color: var(--grey5); outline-color: var(--grey5) !important; }
@@ -923,9 +940,14 @@ pre span.org-css-property {color:var(--purple4); font-weight: bol
*** General CSS :autocollapse:
**** Et Cetera
#+BEGIN_SRC css :tangle ../html/static/style.css
tbody { border-bottom: 1px dotted var(--grey1); }
thead { border-bottom: 1px solid var(--grey1); }
th, td { padding-right: 4rem; }
th.org-left { text-align: left; }
hr {
border: 0;
border-top: 2px dotted var(--black);
border-top: 2px dotted var(--grey1);
}
a, a:visited {
@@ -964,6 +986,7 @@ h3, h4, h5 {
.section-number-1, .section-number-2, .section-number-3, .section-number-4 { display: none; }
ul { margin-top: 0; }
#+END_SRC
**** Utility Classes