summaryrefslogtreecommitdiff
path: root/web/static/js
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-25 17:05:49 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-25 17:09:41 -1000
commitdedda31d064ddcb4f857f2db851c5a8c1e19deba (patch)
tree2f76f41806727afa54449cdac8672056a5f8615c /web/static/js
parentec8a9c0ea46dec7d26caa763e3adefcaf3fc7552 (diff)
Implement architectural refactors for feature requests #28, #30, #31, #33-38
Phase 1: Bugs as First-Class Atoms (#28) - Add resolved_at column to bugs table (migration 007) - Add GetUnresolvedBugs(), ResolveBug(), UnresolveBug() store methods - Include bugs in Tasks tab via BugToAtom() with completion toggle - Add unit tests for bug resolution Phase 2: Timeline as Default + Enhancements (#35, #37) - Change default tab from tasks to timeline - Add IsCompleted, DaySection, Source fields to TimelineItem - Group timeline items by today/tomorrow/later sections - Add completion checkboxes for tasks/cards, grey completed items - Collapse tomorrow/later sections by default Phase 3: Shopping Quick-Add (#33) - Add user_shopping_items table (migration 008) - Add SaveUserShoppingItem(), GetUserShoppingItems(), ToggleUserShoppingItem() - Add HandleShoppingQuickAdd() and HandleShoppingToggle() handlers - Add quick-add form to shopping tab Phase 4: Mobile Swipe Navigation (#38) - Add touch event handlers for swipe left/right tab switching - 50px threshold triggers tab change Phase 5: Consistent Background Opacity (#30) - Add CSS variables for panel/card/input/modal backgrounds - Update templates to use consistent opacity classes Phase 6: Tab Reorganization (#37) - Reorganize tabs: Timeline, Shopping, Conditions as main tabs - Move Tasks, Planning, Meals under Details dropdown Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'web/static/js')
-rw-r--r--web/static/js/app.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/web/static/js/app.js b/web/static/js/app.js
index 52d0c91..6646400 100644
--- a/web/static/js/app.js
+++ b/web/static/js/app.js
@@ -207,3 +207,61 @@ function toggleTask(taskId) {
console.log('Toggle task:', taskId);
// To be implemented in Phase 2
}
+
+// Mobile Swipe Navigation
+(function() {
+ let touchStartX = 0;
+ let touchEndX = 0;
+ const SWIPE_THRESHOLD = 50; // Minimum px for a swipe
+
+ // Get ordered list of tab names (main tabs only for swipe)
+ const TAB_ORDER = ['timeline', 'shopping', 'tasks', 'planning', 'meals'];
+
+ function handleSwipe() {
+ const swipeDistance = touchEndX - touchStartX;
+
+ if (Math.abs(swipeDistance) < SWIPE_THRESHOLD) {
+ return; // Not a significant swipe
+ }
+
+ const currentIndex = TAB_ORDER.indexOf(currentTab);
+ if (currentIndex === -1) return;
+
+ let newIndex;
+ if (swipeDistance > 0) {
+ // Swiped right -> previous tab
+ newIndex = currentIndex - 1;
+ } else {
+ // Swiped left -> next tab
+ newIndex = currentIndex + 1;
+ }
+
+ // Bounds check
+ if (newIndex < 0 || newIndex >= TAB_ORDER.length) {
+ return;
+ }
+
+ const newTab = TAB_ORDER[newIndex];
+ const tabButton = document.querySelector(`[hx-get="/tabs/${newTab}"]`);
+
+ if (tabButton) {
+ console.log(`Swipe navigation: ${currentTab} -> ${newTab}`);
+ tabButton.click();
+ }
+ }
+
+ // Set up touch event listeners on the tab content area
+ document.addEventListener('DOMContentLoaded', function() {
+ const tabContent = document.getElementById('tab-content');
+ if (!tabContent) return;
+
+ tabContent.addEventListener('touchstart', function(e) {
+ touchStartX = e.changedTouches[0].screenX;
+ }, { passive: true });
+
+ tabContent.addEventListener('touchend', function(e) {
+ touchEndX = e.changedTouches[0].screenX;
+ handleSwipe();
+ }, { passive: true });
+ });
+})();