view more in comment
Browse files- docker-compose.yml +0 -2
- src/public/script.js +30 -2
- src/public/style.css +62 -2
docker-compose.yml
CHANGED
|
@@ -1,5 +1,3 @@
|
|
| 1 |
-
version: '3.8'
|
| 2 |
-
|
| 3 |
services:
|
| 4 |
app:
|
| 5 |
build: .
|
|
|
|
|
|
|
|
|
|
| 1 |
services:
|
| 2 |
app:
|
| 3 |
build: .
|
src/public/script.js
CHANGED
|
@@ -150,12 +150,25 @@ function renderFullPlan() {
|
|
| 150 |
let entry = state.ressentis.find(r => r.date === isoDate);
|
| 151 |
let lineClass = (runningDate.getTime() === today.getTime()) ? "today-line" : "";
|
| 152 |
|
|
|
|
| 153 |
daysHtml += `<div class="log-line ${lineClass}">
|
| 154 |
-
<span class="date">${dateStr}</span
|
| 155 |
|
| 156 |
if (entry) {
|
| 157 |
let stars = "★".repeat(entry.rating || 0);
|
| 158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
}
|
| 160 |
if (runningDate.getTime() === today.getTime()) {
|
| 161 |
const timeStr = new Date().toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' });
|
|
@@ -492,3 +505,18 @@ window.downloadBackup = function () {
|
|
| 492 |
downloadAnchorNode.click();
|
| 493 |
downloadAnchorNode.remove();
|
| 494 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
let entry = state.ressentis.find(r => r.date === isoDate);
|
| 151 |
let lineClass = (runningDate.getTime() === today.getTime()) ? "today-line" : "";
|
| 152 |
|
| 153 |
+
let uniqueId = `comment-${isoDate}`;
|
| 154 |
daysHtml += `<div class="log-line ${lineClass}">
|
| 155 |
+
<span class="date">${dateStr}</span>: <span class="dose dose-${dose}">${dose} mg</span>`;
|
| 156 |
|
| 157 |
if (entry) {
|
| 158 |
let stars = "★".repeat(entry.rating || 0);
|
| 159 |
+
let comment = entry.commentaire || '';
|
| 160 |
+
let needsToggle = comment.length > 80; // Threshold for showing view more
|
| 161 |
+
|
| 162 |
+
daysHtml += ` <span class="stars">${stars}</span> <span class="emoji">${entry.emoji || ''}</span>`;
|
| 163 |
+
|
| 164 |
+
if (comment) {
|
| 165 |
+
daysHtml += ` <span class="comment-wrapper">`;
|
| 166 |
+
daysHtml += `<span class="comment" id="${uniqueId}">${comment}</span>`;
|
| 167 |
+
if (needsToggle) {
|
| 168 |
+
daysHtml += ` <span class="view-toggle" onclick="toggleComment('${uniqueId}')">view more</span>`;
|
| 169 |
+
}
|
| 170 |
+
daysHtml += `</span>`;
|
| 171 |
+
}
|
| 172 |
}
|
| 173 |
if (runningDate.getTime() === today.getTime()) {
|
| 174 |
const timeStr = new Date().toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' });
|
|
|
|
| 505 |
downloadAnchorNode.click();
|
| 506 |
downloadAnchorNode.remove();
|
| 507 |
}
|
| 508 |
+
|
| 509 |
+
window.toggleComment = function (commentId) {
|
| 510 |
+
const commentEl = document.getElementById(commentId);
|
| 511 |
+
const toggleEl = event.target; // The clicked "view more/less" element
|
| 512 |
+
|
| 513 |
+
if (commentEl.classList.contains('expanded')) {
|
| 514 |
+
// Collapse
|
| 515 |
+
commentEl.classList.remove('expanded');
|
| 516 |
+
toggleEl.textContent = 'view more';
|
| 517 |
+
} else {
|
| 518 |
+
// Expand
|
| 519 |
+
commentEl.classList.add('expanded');
|
| 520 |
+
toggleEl.textContent = 'view less';
|
| 521 |
+
}
|
| 522 |
+
}
|
src/public/style.css
CHANGED
|
@@ -266,9 +266,9 @@ textarea {
|
|
| 266 |
margin: 4px 0;
|
| 267 |
display: flex;
|
| 268 |
flex-wrap: wrap;
|
| 269 |
-
/* Allow wrapping on small screens but keep tight on large */
|
| 270 |
align-items: center;
|
| 271 |
-
gap:
|
|
|
|
| 272 |
}
|
| 273 |
|
| 274 |
.today-line {
|
|
@@ -311,17 +311,77 @@ textarea {
|
|
| 311 |
/* Log Line Elements */
|
| 312 |
.date {
|
| 313 |
min-width: 120px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
}
|
| 315 |
|
| 316 |
.stars {
|
| 317 |
color: var(--warn-color);
|
| 318 |
font-family: sans-serif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
|
| 321 |
/* Ensure stars don't use monospace if it breaks? actually Fira Code is fine. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
.comment {
|
| 323 |
font-style: italic;
|
| 324 |
color: #aaa;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
}
|
| 326 |
|
| 327 |
/* Calendar Styles */
|
|
|
|
| 266 |
margin: 4px 0;
|
| 267 |
display: flex;
|
| 268 |
flex-wrap: wrap;
|
|
|
|
| 269 |
align-items: center;
|
| 270 |
+
gap: 6px;
|
| 271 |
+
max-width: 100%;
|
| 272 |
}
|
| 273 |
|
| 274 |
.today-line {
|
|
|
|
| 311 |
/* Log Line Elements */
|
| 312 |
.date {
|
| 313 |
min-width: 120px;
|
| 314 |
+
flex-shrink: 0;
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
.dose {
|
| 318 |
+
flex-shrink: 0;
|
| 319 |
}
|
| 320 |
|
| 321 |
.stars {
|
| 322 |
color: var(--warn-color);
|
| 323 |
font-family: sans-serif;
|
| 324 |
+
flex-shrink: 0;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
.emoji {
|
| 328 |
+
flex-shrink: 0;
|
| 329 |
}
|
| 330 |
|
| 331 |
/* Ensure stars don't use monospace if it breaks? actually Fira Code is fine. */
|
| 332 |
+
.comment-wrapper {
|
| 333 |
+
display: inline;
|
| 334 |
+
flex: 1 1 auto;
|
| 335 |
+
min-width: 0;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
.comment {
|
| 339 |
font-style: italic;
|
| 340 |
color: #aaa;
|
| 341 |
+
display: inline;
|
| 342 |
+
overflow: hidden;
|
| 343 |
+
text-overflow: ellipsis;
|
| 344 |
+
white-space: nowrap;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
.comment-wrapper:not(:has(.comment.expanded)) {
|
| 348 |
+
display: flex;
|
| 349 |
+
align-items: center;
|
| 350 |
+
gap: 6px;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
.comment-wrapper:not(:has(.comment.expanded)) .comment {
|
| 354 |
+
flex: 1 1 auto;
|
| 355 |
+
min-width: 0;
|
| 356 |
+
overflow: hidden;
|
| 357 |
+
text-overflow: ellipsis;
|
| 358 |
+
white-space: nowrap;
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
.comment.expanded {
|
| 362 |
+
white-space: normal;
|
| 363 |
+
word-wrap: break-word;
|
| 364 |
+
overflow: visible;
|
| 365 |
+
display: inline;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
.view-toggle {
|
| 369 |
+
color: var(--accent-color);
|
| 370 |
+
cursor: pointer;
|
| 371 |
+
text-decoration: underline;
|
| 372 |
+
font-size: 0.85em;
|
| 373 |
+
user-select: none;
|
| 374 |
+
white-space: nowrap;
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
.comment.expanded ~ .view-toggle {
|
| 378 |
+
display: inline;
|
| 379 |
+
margin-left: 4px;
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
.view-toggle:hover {
|
| 383 |
+
color: var(--text-color);
|
| 384 |
+
text-shadow: 0 0 5px var(--text-color);
|
| 385 |
}
|
| 386 |
|
| 387 |
/* Calendar Styles */
|