Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
hirenko-v authored Sep 19, 2024
1 parent 88fd949 commit 879a373
Showing 1 changed file with 33 additions and 37 deletions.
70 changes: 33 additions & 37 deletions cmd/msg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (MsgExecutor) Execute(_ context.Context, in executor.ExecuteInput) (executo
if len(commandParts) > 2 && commandParts[1] == "selects" {
switch commandParts[2] {
case "first":
// User selected the first option, now show both selects side by side
// User selected the first option, now show both selects sequentially
return showBothSelects(), nil
case "second":
// User selected the second option, respond accordingly
Expand All @@ -62,7 +62,7 @@ func (MsgExecutor) Execute(_ context.Context, in executor.ExecuteInput) (executo
}, nil
}

// initialMessages shows only the first select option.
// initialMessages shows only the first dropdown.
func initialMessages() executor.ExecuteOutput {
cmdPrefix := func(cmd string) string {
return fmt.Sprintf("%s %s %s", api.MessageBotNamePlaceholder, pluginName, cmd)
Expand Down Expand Up @@ -102,7 +102,7 @@ func initialMessages() executor.ExecuteOutput {
}
}

// showBothSelects displays the second select option after the first one is selected.
// showBothSelects displays the second dropdown after the first one is selected.
func showBothSelects() executor.ExecuteOutput {
cmdPrefix := func(cmd string) string {
return fmt.Sprintf("%s %s %s", api.MessageBotNamePlaceholder, pluginName, cmd)
Expand All @@ -115,50 +115,46 @@ func showBothSelects() executor.ExecuteOutput {
},
Sections: []api.Section{
{
Columns: []api.Column{ // Use columns to layout dropdowns side by side
{
Selects: api.Selects{
ID: "select-id-1",
Items: []api.Select{
Selects: api.Selects{
ID: "select-id-1",
Items: []api.Select{
{
Name: "first",
Command: cmdPrefix("selects first"),
OptionGroups: []api.OptionGroup{
{
Name: "first",
Command: cmdPrefix("selects first"),
OptionGroups: []api.OptionGroup{
{
Name: "Group 1",
Options: []api.OptionItem{
{Name: "BAR", Value: "BAR"},
{Name: "BAZ", Value: "BAZ"},
{Name: "XYZ", Value: "XYZ"},
},
},
Name: "Group 1",
Options: []api.OptionItem{
{Name: "BAR", Value: "BAR"},
{Name: "BAZ", Value: "BAZ"},
{Name: "XYZ", Value: "XYZ"},
},
},
},
},
},
{
Selects: api.Selects{
ID: "select-id-2",
Items: []api.Select{
},
},
{
Selects: api.Selects{
ID: "select-id-2",
Items: []api.Select{
{
Name: "second",
Command: cmdPrefix("selects second"),
OptionGroups: []api.OptionGroup{
{
Name: "second",
Command: cmdPrefix("selects second"),
OptionGroups: []api.OptionGroup{
{
Name: "Second Group",
Options: []api.OptionItem{
{Name: "Option A", Value: "Option A"},
{Name: "Option B", Value: "Option B"},
},
},
},
InitialOption: &api.OptionItem{
Name: "Option A",
Value: "Option A",
Name: "Second Group",
Options: []api.OptionItem{
{Name: "Option A", Value: "Option A"},
{Name: "Option B", Value: "Option B"},
},
},
},
InitialOption: &api.OptionItem{
Name: "Option A",
Value: "Option A",
},
},
},
},
Expand Down

0 comments on commit 879a373

Please sign in to comment.