BlueGit

blue-star tribegen

ui tweaks

timfa Tim · pushed by timfa

Authored 2026-01-29 · 9 months ago

Hash
63a6e793b2ee8618af71b31494867839998bb754
Parent
569cc974
1 file changed +23 −2
web/js/app.js +23 −2
@@ -639,7 +639,20 @@ class TribeGenApp
639 639 const list = document.getElementById('participantsList');
640 640 const selected = Array.from(list.querySelectorAll('.participant-checkbox:checked')).map(cb => cb.dataset.id);
641 641 const count = selected.length;
642 document.getElementById('participantCount').textContent = `${count} selected`;
642 const participantCount = document.getElementById('participantCount');
643 const minRequired = this.participantMin || 1;
644 const maxAllowed = this.participantMax || 3;
645 let warning = '';
646 if (count < minRequired)
647 {
648 warning = `need at least ${minRequired}`;
649 } else if (count > maxAllowed)
650 {
651 warning = `${count - maxAllowed} too many`;
652 }
653
654 const warningHtml = warning ? `<br><span style="color:#d9534f;">${warning.trim()}</span>` : '';
655 participantCount.innerHTML = `${count} selected${warningHtml}`;
643 656
644 657 const startBtn = document.getElementById('startEventBtn');
645 658 if (count >= (this.participantMin || 1) && count <= (this.participantMax || 3))
@@ -734,7 +747,15 @@ class TribeGenApp
734 747 renderStorage ()
735 748 {
736 749 const foodDisplay = document.getElementById('foodDisplay');
737 foodDisplay.textContent = `Food: ${this.currentSave.food_count}`;
750 const monthsLeft = this.currentSave.food_months_remaining;
751 if (monthsLeft !== undefined && monthsLeft !== null)
752 {
753 const label = Number(monthsLeft) === 1 ? 'month' : 'months';
754 foodDisplay.textContent = `Food: ${monthsLeft} ${label}`;
755 } else
756 {
757 foodDisplay.textContent = `Food: ${this.currentSave.food_count}`;
758 }
738 759
739 760 const storageItems = document.getElementById('storageItems');
740 761 storageItems.innerHTML = '';
@@ -639,7 +639,20 @@ class TribeGenApp
639 const list = document.getElementById('participantsList');
639 const list = document.getElementById('participantsList');
640 const selected = Array.from(list.querySelectorAll('.participant-checkbox:checked')).map(cb => cb.dataset.id);
640 const selected = Array.from(list.querySelectorAll('.participant-checkbox:checked')).map(cb => cb.dataset.id);
641 const count = selected.length;
641 const count = selected.length;
642 document.getElementById('participantCount').textContent = `${count} selected`;
642 const participantCount = document.getElementById('participantCount');
643 const minRequired = this.participantMin || 1;
644 const maxAllowed = this.participantMax || 3;
645 let warning = '';
646 if (count < minRequired)
647 {
648 warning = `need at least ${minRequired}`;
649 } else if (count > maxAllowed)
650 {
651 warning = `${count - maxAllowed} too many`;
652 }
653
654 const warningHtml = warning ? `<br><span style="color:#d9534f;">${warning.trim()}</span>` : '';
655 participantCount.innerHTML = `${count} selected${warningHtml}`;
643
656
644 const startBtn = document.getElementById('startEventBtn');
657 const startBtn = document.getElementById('startEventBtn');
645 if (count >= (this.participantMin || 1) && count <= (this.participantMax || 3))
658 if (count >= (this.participantMin || 1) && count <= (this.participantMax || 3))
@@ -734,7 +747,15 @@ class TribeGenApp
734 renderStorage ()
747 renderStorage ()
735 {
748 {
736 const foodDisplay = document.getElementById('foodDisplay');
749 const foodDisplay = document.getElementById('foodDisplay');
737 foodDisplay.textContent = `Food: ${this.currentSave.food_count}`;
750 const monthsLeft = this.currentSave.food_months_remaining;
751 if (monthsLeft !== undefined && monthsLeft !== null)
752 {
753 const label = Number(monthsLeft) === 1 ? 'month' : 'months';
754 foodDisplay.textContent = `Food: ${monthsLeft} ${label}`;
755 } else
756 {
757 foodDisplay.textContent = `Food: ${this.currentSave.food_count}`;
758 }
738
759
739 const storageItems = document.getElementById('storageItems');
760 const storageItems = document.getElementById('storageItems');
740 storageItems.innerHTML = '';
761 storageItems.innerHTML = '';