repositorypackage
0.0.0-20240529011351-d8ffff776466
Repository: https://github.com/zhengkyl/review-ssh.git
Documentation: pkg.go.dev
# README
review-ssh
A minimalist terminal app to review movies. Frontend for review-api
. Try it at ssh reviews.kylezhe.ng
UI built using bubbletea
and images captured with vhs
.
Demo

Movie review/watchlist

Search (powered by TMDB)

Image, summary, and minimalist rating system

Development
This is my first project with Go so I made questionable choices.
Here are problems I struggled to solve and should probably be completely redone.
- Async stuff like fetching data and then performing a callback.
- Handling key events and focus across nested components.
- Reusable components. I ended up with a lot of makeshift spaghetti code. At the same time, I overgeneralized too early (see unused vscroll component).
Notes
I opted to only work with struct pointers for components.
_, cmd := child.Update(msg)
This was to avoid type assertions everywhere like below.
// type MyModel struct {
// child child.Model
// }
// func (m *MyModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
//...
model, cmd := child.Update(msg)
m.child = model.(child.Model)
Scaffold new component
import (
tea "github.com/charmbracelet/bubbletea"
"github.com/zhengkyl/review-ssh/ui/common"
)
type Model struct {
props common.Props
focused bool
}
func New(p common.Props) *Model {
return &Model{
props: p,
focused: false,
}
}
func (m *Model) Focused() bool {
return m.focused
}
func (m *Model) Focus() {
m.focused = true
}
func (m *Model) Blur() {
m.focused = false
}
func (m *Model) SetSize(width, height int) {
}
func (m *Model) Update(msg tea.Msg) (common.Model, tea.Cmd) {
return m, nil
}
func (m *Model) View() string {
return ""
}
Deploying
CGO_ENABLED=0 go build