parent
40ca615ffc
commit
ecdcb6b34f
@ -89,32 +89,58 @@ func CreateAppContext(flgConfig string, flgToken string, flgDebug bool, version
|
|||||||
return nil, err
|
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
|
// Setup the interface
|
||||||
if flgDebug {
|
if threads && flgDebug {
|
||||||
termui.Body.AddRows(
|
columns = append(
|
||||||
termui.NewRow(
|
columns,
|
||||||
termui.NewCol(config.SidebarWidth, 0, view.Channels),
|
[]*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-5, 0, view.Chat),
|
||||||
termui.NewCol(config.MainWidth-6, 0, view.Debug),
|
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 {
|
} else {
|
||||||
termui.Body.AddRows(
|
columns = append(
|
||||||
termui.NewRow(
|
columns,
|
||||||
termui.NewCol(config.SidebarWidth, 0, view.Channels),
|
[]*termui.Row{
|
||||||
termui.NewCol(config.MainWidth, 0, view.Chat),
|
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.Body.Align()
|
||||||
termui.Render(termui.Body)
|
termui.Render(termui.Body)
|
||||||
|
|
||||||
@ -128,6 +154,7 @@ func CreateAppContext(flgConfig string, flgToken string, flgDebug bool, version
|
|||||||
Config: config,
|
Config: config,
|
||||||
Debug: flgDebug,
|
Debug: flgDebug,
|
||||||
Mode: CommandMode,
|
Mode: CommandMode,
|
||||||
|
Focus: ChatFocus,
|
||||||
Notify: notify,
|
Notify: notify,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,6 @@ func actionRedrawGrid(ctx *context.AppContext, threads bool, debug bool) {
|
|||||||
termui.NewCol(3, 0, ctx.View.Debug),
|
termui.NewCol(3, 0, ctx.View.Debug),
|
||||||
}...,
|
}...,
|
||||||
)
|
)
|
||||||
|
|
||||||
} else if threads {
|
} else if threads {
|
||||||
columns = append(
|
columns = append(
|
||||||
columns,
|
columns,
|
||||||
@ -547,6 +546,7 @@ func actionChangeChannel(ctx *context.AppContext) {
|
|||||||
ctx.View.Threads.SetChannels([]components.ChannelItem{})
|
ctx.View.Threads.SetChannels([]components.ChannelItem{})
|
||||||
actionRedrawGrid(ctx, haveThreads, ctx.Debug)
|
actionRedrawGrid(ctx, haveThreads, ctx.Debug)
|
||||||
} else {
|
} else {
|
||||||
|
termui.Render(ctx.View.Threads)
|
||||||
termui.Render(ctx.View.Channels)
|
termui.Render(ctx.View.Channels)
|
||||||
termui.Render(ctx.View.Chat)
|
termui.Render(ctx.View.Chat)
|
||||||
}
|
}
|
||||||
@ -592,8 +592,6 @@ func actionChangeThread(ctx *context.AppContext) {
|
|||||||
// Set messages for the channel
|
// Set messages for the channel
|
||||||
ctx.View.Chat.SetMessages(msgs)
|
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.Channels)
|
||||||
termui.Render(ctx.View.Threads)
|
termui.Render(ctx.View.Threads)
|
||||||
termui.Render(ctx.View.Chat)
|
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: 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: create the component
|
||||||
debug := components.CreateDebugComponent(input.Par.Height)
|
debug := components.CreateDebugComponent(input.Par.Height)
|
||||||
|
Loading…
Reference in New Issue
Block a user