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
|
2016-09-24 20:18:09 +02:00
|
|
|
Chat *components.Chat
|
2016-09-11 17:55:19 +02:00
|
|
|
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)
|
2016-09-24 20:18:09 +02:00
|
|
|
chat := components.CreateChat(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,
|
|
|
|
)
|
|
|
|
}
|