diff --git a/.gitignore b/.gitignore index cc21fac..47057d7 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,13 @@ *.so *.dylib terminalshop +terminalShop server_bin terminalshop_* +server.go.old +main +api/main +api/api-server # Go test/coverage files *.test diff --git a/README.md b/README.md index d4cbf05..0a53300 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Terminal Coffee Shop -A terminal-based coffee shop, accessible over SSH. Built with Go, Bubbletea, Wish, Chi, PostgreSQL, Stripe, and Shippo. +A coffee shop you access over SSH. Built with Go, Bubbletea, Wish, Chi, PostgreSQL, Stripe, and Shippo. ```bash ssh localhost -p 23456 @@ -9,7 +9,7 @@ ssh localhost -p 23456 ## Running locally ```bash -# Copy and fill in env vars +# Copy and fill in your env vars cp .env.example .env # Start the API server @@ -32,31 +32,27 @@ go run main.go ## What's working -- SSH server — key-based auth, auto user creation -- Shop page — browse products with live detail panel -- Cart — add/remove items, synced to API +- SSH server — key-based auth, auto user creation on first connect +- Splash screen with animated blinking cursor while auth + data loads +- Shop page — browse products with a live detail panel on the right +- Cart — add/remove items, synced to the API - Checkout flow — shipping address → payment → confirmation -- Saved addresses and cards -- Order history in account view +- Save/delete shipping addresses and payment cards +- Order history in the account view - FAQ page -- Responsive layout (small/medium/large terminal sizes) +- Help page +- Responsive layout across small, medium, and large terminals +- Centralized theme system (no more scattered hex values) - Token refresh +## Known bugs + +- Address delete has an off-by-one slice bug in `shipping_form.go:386` +- Account page has a leftover placeholder menu item somewhere in the models + ## TODO -**Features missing vs reference (terminal.shop):** -- [ ] Splash/loading screen on connect -- [ ] Animated logo with blinking cursor -- [ ] API token management page -- [ ] OAuth app management page -- [ ] About page -- [ ] Theme system — currently 40+ hardcoded hex colors scattered across files -- [ ] Viewport-based scrolling — currently manual scroll math with hardcoded heights - -**Known bugs:** -- [ ] Address delete slice bug in `shipping_form.go:386` — `[m.AddressCursor+1:]...` missing -- [ ] Account page has a placeholder "something" menu item in `models/coffee.go` - -**Code quality:** -- [ ] Nested state structs (reference uses `state.shop`, `state.cart`, etc. vs flat Model) -- [ ] Centralized styles file +- Viewport-based scrolling (currently manual scroll math with hardcoded heights) +- API token management page +- OAuth app management page +- About page diff --git a/api/api-server b/api/api-server deleted file mode 100755 index 6d20470..0000000 Binary files a/api/api-server and /dev/null differ diff --git a/api/main b/api/main deleted file mode 100755 index 58aab4e..0000000 Binary files a/api/main and /dev/null differ diff --git a/main b/main deleted file mode 100755 index d414120..0000000 Binary files a/main and /dev/null differ diff --git a/server.go.old b/server.go.old deleted file mode 100644 index 90143f0..0000000 --- a/server.go.old +++ /dev/null @@ -1,61 +0,0 @@ -package main - -import ( - "context" - "fmt" - "log" - "os" - "os/signal" - "syscall" - "time" - - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/ssh" - "github.com/charmbracelet/wish" - "github.com/charmbracelet/wish/bubbletea" - "github.com/charmbracelet/wish/logging" -) - -const ( - host = "localhost" - port = "23457" -) - -func teaHandler(s ssh.Session) (tea.Model, []tea.ProgramOption) { - m := InitialModel(s.User()) - return m, []tea.ProgramOption{tea.WithAltScreen()} -} - -func main() { - s, err := wish.NewServer( - wish.WithAddress(fmt.Sprintf("%s:%s", host, port)), - wish.WithHostKeyPath(".ssh/term_info_ed25519"), - wish.WithMiddleware( - bubbletea.Middleware(teaHandler), - logging.Middleware(), - ), - ) - if err != nil { - log.Fatalln(err) - } - - done := make(chan os.Signal, 1) - signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) - - log.Printf("Starting SSH server on %s:%s", host, port) - log.Printf("Connect with: ssh %s -p %s", host, port) - - go func() { - if err = s.ListenAndServe(); err != nil { - log.Fatalln(err) - } - }() - - <-done - log.Println("Stopping SSH server") - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() - if err := s.Shutdown(ctx); err != nil { - log.Fatalln(err) - } -} diff --git a/terminalShop b/terminalShop deleted file mode 100755 index b1d88b5..0000000 Binary files a/terminalShop and /dev/null differ