40 lines
665 B
Go
Raw Normal View History

2016-09-11 17:55:19 +02:00
package views
import (
"github.com/erroneousboat/slack-term/src/components"
"github.com/gizak/termui"
)
type View struct {
Input *components.Input
Chat *termui.List
Channels *termui.List
Mode *termui.Par
}
func CreateChatView() *View {
input := components.CreateInput()
2016-09-13 21:02:02 +02:00
channels := components.CreateChannelsComponent(input.Par.Height)
chat := components.CreateChatComponent(input.Par.Height)
2016-09-11 17:55:19 +02:00
mode := components.CreateModeComponent()
view := &View{
Input: input,
Channels: channels,
Chat: chat,
Mode: mode,
}
return view
}
func (v *View) Refresh() {
termui.Render(
v.Input,
v.Chat,
v.Channels,
v.Mode,
)
}