parent
40ca615ffc
commit
ecdcb6b34f
@ -89,32 +89,58 @@ func CreateAppContext(flgConfig string, flgToken string, flgDebug bool, version
|
||||
return nil, err
|
||||
}
|
||||
|
||||
columns := []*termui.Row{
|
||||
termui.NewCol(config.SidebarWidth, 0, view.Channels),
|
||||
}
|
||||
|
||||
threads := false
|
||||
if len(view.Threads.ChannelItems) > 0 {
|
||||
threads = true
|
||||
}
|
||||
|
||||
// Setup the interface
|
||||
if flgDebug {
|
||||
termui.Body.AddRows(
|
||||
termui.NewRow(
|
||||
termui.NewCol(config.SidebarWidth, 0, view.Channels),
|
||||
if threads && flgDebug {
|
||||
columns = append(
|
||||
columns,
|
||||
[]*termui.Row{
|
||||
termui.NewCol(config.MainWidth-config.ThreadsWidth-3, 0, view.Chat),
|
||||
termui.NewCol(config.ThreadsWidth, 0, view.Threads),
|
||||
termui.NewCol(3, 0, view.Debug),
|
||||
}...,
|
||||
)
|
||||
} else if threads {
|
||||
columns = append(
|
||||
columns,
|
||||
[]*termui.Row{
|
||||
termui.NewCol(config.MainWidth-config.ThreadsWidth, 0, view.Chat),
|
||||
termui.NewCol(config.ThreadsWidth, 0, view.Threads),
|
||||
}...,
|
||||
)
|
||||
} else if flgDebug {
|
||||
columns = append(
|
||||
columns,
|
||||
[]*termui.Row{
|
||||
termui.NewCol(config.MainWidth-5, 0, view.Chat),
|
||||
termui.NewCol(config.MainWidth-6, 0, view.Debug),
|
||||
),
|
||||
termui.NewRow(
|
||||
termui.NewCol(config.SidebarWidth, 0, view.Mode),
|
||||
termui.NewCol(config.MainWidth, 0, view.Input),
|
||||
),
|
||||
}...,
|
||||
)
|
||||
} else {
|
||||
termui.Body.AddRows(
|
||||
termui.NewRow(
|
||||
termui.NewCol(config.SidebarWidth, 0, view.Channels),
|
||||
columns = append(
|
||||
columns,
|
||||
[]*termui.Row{
|
||||
termui.NewCol(config.MainWidth, 0, view.Chat),
|
||||
),
|
||||
termui.NewRow(
|
||||
termui.NewCol(config.SidebarWidth, 0, view.Mode),
|
||||
termui.NewCol(config.MainWidth, 0, view.Input),
|
||||
),
|
||||
}...,
|
||||
)
|
||||
}
|
||||
|
||||
termui.Body.AddRows(
|
||||
termui.NewRow(columns...),
|
||||
termui.NewRow(
|
||||
termui.NewCol(config.SidebarWidth, 0, view.Mode),
|
||||
termui.NewCol(config.MainWidth, 0, view.Input),
|
||||
),
|
||||
)
|
||||
|
||||
termui.Body.Align()
|
||||
termui.Render(termui.Body)
|
||||
|
||||
@ -128,6 +154,7 @@ func CreateAppContext(flgConfig string, flgToken string, flgDebug bool, version
|
||||
Config: config,
|
||||
Debug: flgDebug,
|
||||
Mode: CommandMode,
|
||||
Focus: ChatFocus,
|
||||
Notify: notify,
|
||||
}, nil
|
||||
}
|
||||
|
@ -228,7 +228,6 @@ func actionRedrawGrid(ctx *context.AppContext, threads bool, debug bool) {
|
||||
termui.NewCol(3, 0, ctx.View.Debug),
|
||||
}...,
|
||||
)
|
||||
|
||||
} else if threads {
|
||||
columns = append(
|
||||
columns,
|
||||
@ -547,6 +546,7 @@ func actionChangeChannel(ctx *context.AppContext) {
|
||||
ctx.View.Threads.SetChannels([]components.ChannelItem{})
|
||||
actionRedrawGrid(ctx, haveThreads, ctx.Debug)
|
||||
} else {
|
||||
termui.Render(ctx.View.Threads)
|
||||
termui.Render(ctx.View.Channels)
|
||||
termui.Render(ctx.View.Chat)
|
||||
}
|
||||
@ -592,8 +592,6 @@ func actionChangeThread(ctx *context.AppContext) {
|
||||
// Set messages for the channel
|
||||
ctx.View.Chat.SetMessages(msgs)
|
||||
|
||||
// Set focus, necessary to know when replying to thread or chat
|
||||
|
||||
termui.Render(ctx.View.Channels)
|
||||
termui.Render(ctx.View.Threads)
|
||||
termui.Render(ctx.View.Chat)
|
||||
|
@ -58,7 +58,16 @@ func CreateView(config *config.Config, svc *service.SlackService) (*View, error)
|
||||
)
|
||||
|
||||
// Threads: set threads in component
|
||||
threads.SetChannels(thr)
|
||||
if len(thr) > 0 {
|
||||
|
||||
// Make the first thread the current Channel
|
||||
threads.SetChannels(
|
||||
append(
|
||||
[]components.ChannelItem{channels.GetSelectedChannel()},
|
||||
thr...,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
// Debug: create the component
|
||||
debug := components.CreateDebugComponent(input.Par.Height)
|
||||
|
Loading…
Reference in New Issue
Block a user