Skip to content

zhengkyl/review-ssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

usage demo

Movie review/watchlist

movie lists

Search (powered by TMDB)

movie search

Image, summary, and minimalist rating system

movie details

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

https://stackoverflow.com/questions/36279253/go-compiled-binary-wont-run-in-an-alpine-docker-container-on-ubuntu-host

CGO_ENABLED=0 go build

About

minimalist movie review terminal app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published