restructured main

This commit is contained in:
steven carpenter 2025-06-28 22:42:18 -04:00
parent b33d3acf22
commit e59765bfc6
2 changed files with 48 additions and 238 deletions

View file

@ -1 +1,48 @@
# GoCal
# GoCal
This is a terminal-based calendar and hourly schedule viewer built using [Bubble Tea](https://github.com/charmbracelet/bubbletea) and styled with [Lipgloss](https://github.com/charmbracelet/lipgloss).
---
## Project Structure
| File | Description |
|----------------|-------------------------------------------------------------------|
| `main.go` | Entry point of the application. Initializes the program and sets the initial model state (current year/month and cursor position). |
| `constants.go` | Defines global constants such as calendar grid size and cell dimensions used throughout the app. |
| `styles.go` | Contains all the Lipgloss style definitions for calendar cells, headers, and hourly schedule views. |
| `model.go` | Defines the data model struct (`model`) that holds the application state, and the `viewMode` type representing current UI mode. Also contains the `Init` function for Bubble Tea. |
| `update.go` | Implements all update logic for handling user input and updating the model state in both month and hourly views. Includes the fix to properly update cursor position when switching months. |
| `view.go` | Contains all rendering logic that converts the current model state into styled terminal output for both month and hourly views. |
---
## Features
- Month view with navigable calendar grid.
- Highlighted current day.
- Cursor highlighting with keyboard navigation.
- Enter key switches to hourly schedule view for the selected day.
- Hourly view with current hour highlighted.
- Switch back to month view with ESC.
---
## Usage
Run the program:
```bash
go run .
```
Controls:
- [a] / [d]: Navigate previous / next month.
- Arrow keys: Move cursor around days.
- [Enter]: Switch to hourly view for selected day.
- [Esc]: Return to month view.
- [q] / Ctrl+C: Quit.