feat(ui): Redesign main menu with compact 3x5 grid layout
Redesigned main menu for better space efficiency and visual organization: - Changed from flexible GridWrap to fixed 3-column grid layout - Organized modules into priority-based sections with category labels - Category labels positioned above each section (Convert, Inspect, Disc, Playback) - Reduced tile size from 150x65 to 135x58 for better spacing - Removed excessive padding for more compact layout - All 15 modules now visible in organized 3x5 grid Layout organization: - Row 1-2: Convert modules (Convert, Merge, Trim, Filters, Audio, Subtitles) - Row 3: Inspect/Advanced (Compare, Inspect, Upscale) - Row 4: Disc modules (Author, Rip, Blu-Ray) - Row 5: Misc modules (Player, Thumb, Settings) This addresses user feedback about wasted space and provides a more polished, professional appearance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b079bff6fb
commit
d240f1f773
|
|
@ -182,7 +182,7 @@ func (r *moduleTileRenderer) Layout(size fyne.Size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *moduleTileRenderer) MinSize() fyne.Size {
|
func (r *moduleTileRenderer) MinSize() fyne.Size {
|
||||||
return fyne.NewSize(150, 65)
|
return fyne.NewSize(135, 58)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *moduleTileRenderer) Refresh() {
|
func (r *moduleTileRenderer) Refresh() {
|
||||||
|
|
|
||||||
|
|
@ -82,52 +82,76 @@ func BuildMainMenu(modules []ModuleInfo, onModuleClick func(string), onModuleDro
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
categorized := map[string][]fyne.CanvasObject{}
|
// Create module map for quick lookup
|
||||||
for i := range modules {
|
moduleMap := make(map[string]ModuleInfo)
|
||||||
mod := modules[i] // Create new variable for this iteration
|
for _, mod := range modules {
|
||||||
modID := mod.ID // Capture for closure
|
moduleMap[mod.ID] = mod
|
||||||
cat := mod.Category
|
}
|
||||||
if cat == "" {
|
|
||||||
cat = "General"
|
// Helper to build a tile
|
||||||
|
buildTile := func(modID string) fyne.CanvasObject {
|
||||||
|
mod, exists := moduleMap[modID]
|
||||||
|
if !exists {
|
||||||
|
return layout.NewSpacer()
|
||||||
}
|
}
|
||||||
|
|
||||||
var tapFunc func()
|
var tapFunc func()
|
||||||
var dropFunc func([]fyne.URI)
|
var dropFunc func([]fyne.URI)
|
||||||
if mod.Enabled {
|
if mod.Enabled {
|
||||||
// Create new closure with properly captured modID
|
id := modID
|
||||||
id := modID // Explicit capture
|
tapFunc = func() { onModuleClick(id) }
|
||||||
tapFunc = func() {
|
|
||||||
onModuleClick(id)
|
|
||||||
}
|
|
||||||
dropFunc = func(items []fyne.URI) {
|
dropFunc = func(items []fyne.URI) {
|
||||||
logging.Debug(logging.CatUI, "MainMenu dropFunc called for module=%s itemCount=%d", id, len(items))
|
logging.Debug(logging.CatUI, "MainMenu dropFunc called for module=%s itemCount=%d", id, len(items))
|
||||||
onModuleDrop(id, items)
|
onModuleDrop(id, items)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logging.Debug(logging.CatUI, "Creating tile for module=%s enabled=%v hasDropFunc=%v", modID, mod.Enabled, dropFunc != nil)
|
return buildModuleTile(mod, tapFunc, dropFunc)
|
||||||
categorized[cat] = append(categorized[cat], buildModuleTile(mod, tapFunc, dropFunc))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var sections []fyne.CanvasObject
|
// Helper to create category label
|
||||||
for _, cat := range sortedKeys(categorized) {
|
makeCatLabel := func(text string) *canvas.Text {
|
||||||
catLabel := canvas.NewText(cat, textColor)
|
label := canvas.NewText(text, textColor)
|
||||||
catLabel.TextSize = 12
|
label.TextSize = 10
|
||||||
catLabel.TextStyle = fyne.TextStyle{Bold: true}
|
label.Alignment = fyne.TextAlignLeading
|
||||||
tileSize := fyne.NewSize(170, 75)
|
return label
|
||||||
sections = append(sections,
|
|
||||||
catLabel,
|
|
||||||
container.NewGridWrap(tileSize, categorized[cat]...),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
padding := canvas.NewRectangle(color.Transparent)
|
// Build rows with category labels above tiles
|
||||||
padding.SetMinSize(fyne.NewSize(0, 4))
|
var rows []fyne.CanvasObject
|
||||||
|
|
||||||
sectionsBox := container.NewVBox(sections...)
|
// Convert section
|
||||||
scroll := container.NewVScroll(sectionsBox)
|
rows = append(rows, makeCatLabel("Convert"))
|
||||||
|
rows = append(rows, container.NewGridWithColumns(3,
|
||||||
|
buildTile("convert"), buildTile("merge"), buildTile("trim"),
|
||||||
|
))
|
||||||
|
rows = append(rows, container.NewGridWithColumns(3,
|
||||||
|
buildTile("filters"), buildTile("audio"), buildTile("subtitles"),
|
||||||
|
))
|
||||||
|
|
||||||
|
// Inspect section
|
||||||
|
rows = append(rows, makeCatLabel("Inspect"))
|
||||||
|
rows = append(rows, container.NewGridWithColumns(3,
|
||||||
|
buildTile("compare"), buildTile("inspect"), buildTile("upscale"),
|
||||||
|
))
|
||||||
|
|
||||||
|
// Disc section
|
||||||
|
rows = append(rows, makeCatLabel("Disc"))
|
||||||
|
rows = append(rows, container.NewGridWithColumns(3,
|
||||||
|
buildTile("author"), buildTile("rip"), buildTile("bluray"),
|
||||||
|
))
|
||||||
|
|
||||||
|
// Playback section
|
||||||
|
rows = append(rows, makeCatLabel("Playback"))
|
||||||
|
rows = append(rows, container.NewGridWithColumns(3,
|
||||||
|
buildTile("player"), buildTile("thumb"), buildTile("settings"),
|
||||||
|
))
|
||||||
|
|
||||||
|
gridBox := container.NewVBox(rows...)
|
||||||
|
scroll := container.NewVScroll(gridBox)
|
||||||
scroll.SetMinSize(fyne.NewSize(0, 0))
|
scroll.SetMinSize(fyne.NewSize(0, 0))
|
||||||
|
|
||||||
body := container.NewBorder(
|
body := container.NewBorder(
|
||||||
container.NewVBox(header, padding),
|
header,
|
||||||
nil, nil, nil,
|
nil, nil, nil,
|
||||||
scroll,
|
scroll,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user