CreateAboutDialog creates an about dialog with version information and links.
(versionInfo *version.BuildInfo, onClose func())
| 210 | |
| 211 | // CreateAboutDialog creates an about dialog with version information and links. |
| 212 | func CreateAboutDialog(versionInfo *version.BuildInfo, onClose func()) tview.Primitive { |
| 213 | // Format build date for display |
| 214 | buildDateDisplay := versionInfo.BuildDate |
| 215 | if buildDateDisplay != "unknown" { |
| 216 | if parsed, err := time.Parse(time.RFC3339, buildDateDisplay); err == nil { |
| 217 | buildDateDisplay = parsed.Format("2006-01-02 15:04:05 UTC") |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | // Create about text with dynamic information |
| 222 | aboutText := fmt.Sprintf(`pvetui |
| 223 | |
| 224 | A terminal user interface for Proxmox VE |
| 225 | |
| 226 | Version: %s |
| 227 | Build Date: %s |
| 228 | Commit: %s |
| 229 | Go Version: %s |
| 230 | OS/Arch: %s/%s |
| 231 | |
| 232 | Copyright © %s %s |
| 233 | Licensed under the %s |
| 234 | |
| 235 | GitHub: %s |
| 236 | Releases: %s`, |
| 237 | versionInfo.Version, |
| 238 | buildDateDisplay, |
| 239 | versionInfo.Commit, |
| 240 | versionInfo.GoVersion, |
| 241 | versionInfo.OS, |
| 242 | versionInfo.Arch, |
| 243 | version.GetCopyrightYearRange(), |
| 244 | version.Author, |
| 245 | version.License, |
| 246 | version.GetGitHubURL(), |
| 247 | version.GetGitHubReleaseURL()) |
| 248 | |
| 249 | // Use a wider modal to avoid wrapping long URLs; enforce a generous minimum width. |
| 250 | modal := NewWideModal(0.55, 70) |
| 251 | modal.SetText(aboutText) |
| 252 | modal.SetTextColor(theme.Colors.Primary) |
| 253 | modal.SetBorderColor(theme.Colors.Border) |
| 254 | modal.SetTitle("About") |
| 255 | modal.SetTitleColor(theme.Colors.Title) |
| 256 | modal.AddButtons([]string{"OK"}) |
| 257 | modal.SetDoneFunc(func(buttonIndex int, buttonLabel string) { |
| 258 | if onClose != nil { |
| 259 | onClose() |
| 260 | } |
| 261 | }) |
| 262 | |
| 263 | return modal |
| 264 | } |
no test coverage detected