Conversation
This commit passes the Version variable from the cli to the dialog UI layers. It modifies the ShowLogin and ShowMenu function signatures to accept the version string, wraps the TUI forms in an overarching vertical layout (tview.FlexRow), and appends a new tview.TextView at the bottom right containing the version. Tests have been updated to supply a default "dev" version matching the original signatures. Co-authored-by: arran4 <111667+arran4@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request introduces the display of the application version in the TUI login and menu screens. Changes include updating function signatures in the cli and dialog packages to accept a version string and modifying the TUI layout to include a footer for this information. Feedback suggests improving the versionView styling by respecting the theme's background color and disabling dynamic color parsing to prevent issues with version strings containing brackets. Additionally, a bug was identified where the version footer disappears after closing the help modal because the root view is reset incorrectly.
| versionView := tview.NewTextView(). | ||
| SetText(version). | ||
| SetTextAlign(tview.AlignRight). | ||
| SetDynamicColors(true). | ||
| SetTextColor(tcell.ColorDarkGray) | ||
| if rc != nil { | ||
| if attr, ok := rc.Attributes["title_color"]; ok { | ||
| versionView.SetTextColor(MapColor(attr.Foreground)) | ||
| } | ||
| } |
There was a problem hiding this comment.
There are two improvements for the versionView styling:
- Background Color: The
versionViewbackground is not set to match the theme'sscreen_color. If a custom background is used, this will result in a black bar at the bottom of the screen. - Dynamic Colors:
SetDynamicColors(true)is enabled, which could cause rendering issues if the version string contains characters like[or](e.g.,[dev]). It is safer to leave this disabled.
Additionally, this styling logic is duplicated in dialog/login.go. Consider refactoring it into a helper function.
| versionView := tview.NewTextView(). | |
| SetText(version). | |
| SetTextAlign(tview.AlignRight). | |
| SetDynamicColors(true). | |
| SetTextColor(tcell.ColorDarkGray) | |
| if rc != nil { | |
| if attr, ok := rc.Attributes["title_color"]; ok { | |
| versionView.SetTextColor(MapColor(attr.Foreground)) | |
| } | |
| } | |
| versionView := tview.NewTextView(). | |
| SetText(version). | |
| SetTextAlign(tview.AlignRight). | |
| SetTextColor(tcell.ColorDarkGray) | |
| if rc != nil { | |
| if attr, ok := rc.Attributes["title_color"]; ok { | |
| versionView.SetTextColor(MapColor(attr.Foreground)) | |
| } | |
| if attr, ok := rc.Attributes["screen_color"]; ok { | |
| versionView.SetBackgroundColor(MapColor(attr.Background)) | |
| } | |
| } |
| rootFlex := tview.NewFlex().SetDirection(tview.FlexRow). | ||
| AddItem(flex, 0, 1, true). | ||
| AddItem(versionView, 1, 1, false) |
There was a problem hiding this comment.
The introduction of rootFlex as the new root requires updating all existing app.SetRoot(flex, ...) calls to app.SetRoot(rootFlex, ...) to maintain the version display.
Specifically, the help modal's SetDoneFunc (around line 138 in the full file) still resets the root to flex, which will cause the version footer to disappear after the user closes the help details modal.
There was a problem hiding this comment.
The introduction of
rootFlexas the new root requires updating all existingapp.SetRoot(flex, ...)calls toapp.SetRoot(rootFlex, ...)to maintain the version display.Specifically, the help modal's
SetDoneFunc(around line 138 in the full file) still resets the root toflex, which will cause the version footer to disappear after the user closes the help details modal.
| versionView := tview.NewTextView(). | ||
| SetText(version). | ||
| SetTextAlign(tview.AlignRight). | ||
| SetDynamicColors(true). | ||
| SetTextColor(tcell.ColorDarkGray) | ||
| if rc != nil { | ||
| if attr, ok := rc.Attributes["title_color"]; ok { | ||
| versionView.SetTextColor(MapColor(attr.Foreground)) | ||
| } | ||
| } |
There was a problem hiding this comment.
Similar to the menu screen, the versionView here should also respect the theme's screen_color to avoid a black bar at the bottom, and SetDynamicColors(true) should be removed to prevent parsing errors with version strings containing brackets.
| versionView := tview.NewTextView(). | |
| SetText(version). | |
| SetTextAlign(tview.AlignRight). | |
| SetDynamicColors(true). | |
| SetTextColor(tcell.ColorDarkGray) | |
| if rc != nil { | |
| if attr, ok := rc.Attributes["title_color"]; ok { | |
| versionView.SetTextColor(MapColor(attr.Foreground)) | |
| } | |
| } | |
| versionView := tview.NewTextView(). | |
| SetText(version). | |
| SetTextAlign(tview.AlignRight). | |
| SetTextColor(tcell.ColorDarkGray) | |
| if rc != nil { | |
| if attr, ok := rc.Attributes["title_color"]; ok { | |
| versionView.SetTextColor(MapColor(attr.Foreground)) | |
| } | |
| if attr, ok := rc.Attributes["screen_color"]; ok { | |
| versionView.SetBackgroundColor(MapColor(attr.Background)) | |
| } | |
| } |
Adds the application version to the bottom right of both the login and main menu screens.
PR created automatically by Jules for task 8349584984254119109 started by @arran4