Back to Blocks

Claude Terminal

Loading...

Task Details
PXL-864Done
Urgent

📅 Show meal timing editor on all days

Estimate3 points
b2-heraui/ux

You can see and adjust your meal schedule on any day, not just today. This makes it easy to plan meals for tomorrow or review how you ate yesterday.


> Technical Details

Current Implementation Analysis

The meal timing feature consists of these key files:

Core Files

  • MealTimingSummaryCell.swift (NutriKit/Refactor Inbox/UIKit/) - UIKit table view cell that hosts the SwiftUI timing view
  • MealTimingSummaryView.swift (NutriKit/Refactor Inbox/Views/Components/) - SwiftUI view showing the "NOW" header and timeline
  • TimeSlider.swift (Packages/UI/Sources/UI/Components/Views/) - The actual timeline slider component with liveMode toggle
  • MealTimeSlotsStore.swift (NutriKit/Refactor Inbox/Views/Components/) - Observable store managing time slot state
  • DayViewController.swift (NutriKit/Refactor Inbox/UIKit/) - Contains shouldShowTimingSummary logic that restricts to today only

Key Gating Logic (lines 82-101 in DayViewController.swift)

private var shouldShowTimingSummary: Bool {
    let currentDate = Date()
    let calendar = Calendar.current
    let isPageToday = calendar.isDate(date, inSameDayAs: currentDate)
    
    // Wee hours handling (12 AM - 5:59 AM)
    let hour = calendar.component(.hour, from: currentDate)
    let isWeeHours = hour >= 0 && hour < 6
    
    if isWeeHours {
        let yesterday = calendar.date(byAdding: .day, value: -1, to: currentDate)!
        let isPageYesterday = calendar.isDate(date, inSameDayAs: yesterday)
        return isPageToday || isPageYesterday
    }
    return isPageToday
}

TimeSlider liveMode Property

The TimeSlider component already supports two modes:

  • liveMode: true - Shows live updating time with "NOW" indicator (current behavior for today)
  • liveMode: false - Interactive mode without live time updates (used in meal editing)

MealTimingSummaryView Header (lines 72-98)

Currently always shows "Now" text when not dragging:

if isDragging {
    Text(L10n.MealTiming.createNewMealAt)
} else {
    Text(L10n.MealTiming.now)  // "Now" - needs to be conditional
}
Implementation Strategy
  1. Modify shouldShowTimingSummary to always return true (or refactor to always show timing cell)
  2. Add isToday parameter to MealTimingSummaryView to:
    • Conditionally hide the "Now" header text on non-current days
    • Pass liveMode: isToday to TimeSlider
    • Show a different header label like "Meal Timeline" for historical/future days
  3. Update configureTimingSummaryCell to pass the date context so the view knows whether to show live mode
  4. Ensure drag-to-create works - The existing onCreateMeal callback and TimeSlider drag logic should work unchanged
  5. Handle edge cases:
    • During "wee hours" (12 AM - 5:59 AM), the cell shows on both yesterday and today with appropriate modes
    • Future days should clearly indicate they're for planning
Requirements
  • Display the meal timing cell at the bottom of the day view for ALL days (past, present, and future)
  • For non-current days: do NOT show the "NOW" time indicator (since "now" only applies to today)
  • Display the meal spread visualization showing existing meals for that day
  • Enable drag-to-create functionality so users can create new meals by dragging on the timeline
  • Ensure the UI clearly indicates this is the meal timing interface without the "now" indicator causing confusion
  • The cell should be visually consistent with the current day's version, but adapted to show historical/future context
User Value
  • Allows users to plan future meals by visualizing and creating meal entries in advance
  • Enables reviewing and editing past meal timing patterns
  • Provides consistent UI/UX across all days in the app
Acceptance Criteria
  • Meal timing cell appears on ALL day views (past, present, future)
  • "Now" indicator and live time ONLY shows when viewing today
  • Non-today days show a static header (e.g., "Meal Timeline" or date)
  • Drag-to-create meal works on all days
  • Existing meals display correctly on the timeline for all days
  • Wee hours edge case: Yesterday's cell shows meal timeline (not "Now"), today's shows "Now"
  • No regressions to current today functionality

Build instruction: Use -destination 'platform=iOS Simulator,name=iPhone 17 Pro' when building this project

Created Jan 6, 2026, 12:30 PM | Updated Jan 30, 2026, 12:31 PM