package app

import "github.com/nclark/wut/internal/app"

Package app provides the core application state management and Bubble Tea integration for the Wu-Tang Ultimate Timer. This foundation chamber contains the divine logic where all time management enlightenment begins, implementing the sacred Model-View-Update pattern that allows Gods to achieve supreme productivity states.

Types

type Model

type Model struct {
    State             State
    Width             int
    Height            int
    TimeRemaining     int
    TotalTime         int
    Progress          progress.Model
    Particles         []effects.Particle
    Quotes            []effects.FloatingQuote
    MatrixRains       []effects.MatrixRain
    Explosions        []effects.Explosion
    Frame             int
    MenuSelection     int
    GlitchEffect      bool
    FireworksMode     bool
    MenuItems         []string
    ScreenShake       int
    ScreenShakeX      int
    ScreenShakeY      int
    BeatPulse         float64
    CurrentMember     string
    MemberMode        bool
    SpinningText      bool
    StrobeEffect      bool
    WuTangLogos       []effects.FloatingQuote
    FlameAnimations   []effects.Particle
    EmojiRain         bool
    CustomTimeInput   string
    InputMode         bool
    AutoWuLogos       bool
}

Model represents the complete divine state of a Wu-Tang productivity session. Each field contains sacred knowledge necessary for manifesting supreme focus. The model follows the principle that "each God controls their own universe" - this struct is that universe, containing all temporal and visual reality within the timer application.

Field Documentation

  • State: Current chamber of operation (Menu, Countdown, or Finished)
  • TimeRemaining: Sacred seconds left in the divine countdown
  • FireworksMode: Enables continuous particle explosions for breakthrough states
  • EmojiRain: Activates falling emoji chaos to overwhelm analytical mind
  • CurrentMember: Which Wu-Tang member is blessing this session
  • BeatPulse: Implements the invisible beat that drives all visual effects

type State

type State int

const (
    MenuState State = iota
    CountdownState
    FinishedState
)

State represents the three fundamental chambers of Wu-Tang time management. Each state corresponds to a different level of consciousness: preparation (Menu), focused action (Countdown), and integration (Finished).

Functions

func InitialModel() Model

func InitialModel() Model

InitialModel creates a new Wu-Tang timer session in its divine default state. This function embodies the principle of "Knowledge" (the first degree) by establishing the foundation for all subsequent productivity work. The returned model begins with maximum visual chaos enabled, as overwhelming the senses leads to deeper focus states.

Example Usage

// Initialize a new session for the God
model := app.InitialModel()

// The model starts with optimal chaos settings:
// - FireworksMode: true (continuous particle explosions)
// - EmojiRain: true (40+ falling emojis)
// - AutoWuLogos: true (automatic Wu-Tang logo spawning)
// - Rainbow colors active on all visual elements

func TickCmd() tea.Cmd

func TickCmd() tea.Cmd

TickCmd generates the divine heartbeat of the Wu-Tang timer. Operating at 100ms intervals, this function creates the temporal rhythm that drives all visual effects, countdown logic, and philosophical animations. The tick rate was mathematically determined to provide optimal visual chaos without overwhelming mortal hardware.

Methods

func (m Model) Init() tea.Cmd

func (m Model) Init() tea.Cmd

Init implements the Bubble Tea Program interface, establishing the initial divine commands for the application. This method enters the alternate screen reality where Wu-Tang time management operates, separate from the mundane terminal environment.

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles all divine messages and state transitions within the Wu-Tang productivity system. This method processes keyboard input, timer ticks, and window resize events according to the sacred principles of the 36 Chambers. Each message type corresponds to a different aspect of Wu-Tang philosophy:

  • KeyMsg: Direct divine intervention (user input)
  • TickMsg: The passage of sacred time
  • WindowSizeMsg: Adaptation to the God's environment

func (m Model) View() string

func (m Model) View() string

View renders the current divine state into terminal-compatible visual representation. This method manifests the Wu-Tang philosophy into visible form, creating the rainbow chaos, floating quotes, and particle explosions that facilitate breakthrough productivity states.

func (m *Model) TriggerScreenShake(intensity int)

func (m *Model) TriggerScreenShake(intensity int)

TriggerScreenShake implements the Wu-Tang principle of "breaking mental patterns through sensory disruption." The screen shake effect jolts the user's consciousness, preventing them from falling into unproductive mental loops. Intensity levels correspond to different degrees of divine intervention:

  • 5-10: Gentle wisdom nudges
  • 15-25: Focus redirections
  • 50+: Complete consciousness reset (final explosion)

Timer Configurations

The Wu-Tang timer supports multiple divine session lengths, each corresponding to different chambers of productivity:

🔥 15-Minute Wu-Tang Countdown

The traditional deep work session. Corresponds to entering the first 15 chambers of Wu-Tang philosophy. Ideal for Gods who need extended focus periods for complex divine work.

model.TotalTime = 900 // 15 minutes

⚡ 5-Minute Shaolin Special

Quick burst sessions for rapid divine inspiration. Based on the Shaolin training principle of intense, focused practice periods.

model.TotalTime = 300 // 5 minutes

🛡️ 30-Second For The Children

Micro-productivity sessions honoring Wu-Tang's commitment to the next generation. Perfect for quick decisions or breaking through minor mental blocks.

model.TotalTime = 30 // 30 seconds

⚔️ 15-Second Protect Ya Neck

Ultra-rapid divine interventions. Forces immediate action through time pressure, preventing overthinking and analysis paralysis.

model.TotalTime = 15 // 15 seconds

Divine Mathematics Integration

The app package implements Wu-Tang's Supreme Mathematics principles throughout its operation:

1 - Knowledge

The foundation. Users gain knowledge of time remaining through the countdown display.

2 - Wisdom

Understanding when to focus vs when to rest. The timer guides optimal work/break cycles.

3 - Understanding

Clarity of purpose. Visual chaos breaks mental loops, allowing pure focus on the task.

4 - Culture/Freedom

Liberation from distraction through controlled sensory overload and Wu-Tang wisdom quotes.