joshdholtz / wassup

Easily scriptable terminal dashboard
MIT License
75 stars 1 forks source link

better content management #1

Closed joshdholtz closed 2 years ago

joshdholtz commented 2 years ago

Motivation

Adding row (and pages) wasn't easily explainable because it was based on array or types. This also made the code very messy.

Description

The page.content block in Supfile now has an argument passed into it which is a ContentBuilder

Example

Single Page

pane.content do |builder|
  builder.add_row("Line 1 of page 1")
  builder.add_row("Line 1 of page 2")
end

Single Page

pane.content do | builder|
  builder.add_row("Line 1 of page 1")
  builder.add_row("Line 1 of page 2")
end

Single Page with data

pane.content do | builder|
  builder.add_row("Line 1 of page 1", "some url")
  builder.add_row("Line 2 of page 1", "some url")
end
igor-makarov commented 2 years ago

@joshdholtz looks good - I'm sure this is more clear. One thing I can't understand is (even before but also now) - how do 'pages' work? What are 'pages'?

joshdholtz commented 2 years ago

@igor-makarov Pages allow a pane to have multiple content screens inside of it

👇 In this example below, Pane 4 shows all open PRs in each repo in the fastlane-community GitHub organization and you cycle through with h and l

https://user-images.githubusercontent.com/401294/145448545-422229c7-2904-4101-8a2a-6aa4b34c4fdc.mov