feat(ui): Add orange background for modules missing dependencies
Modules with handlers but missing dependencies now show orange background with stripes instead of grey. This distinguishes them from unimplemented modules (grey) and helps users identify what needs to be installed.
This commit is contained in:
parent
5fe3c853f4
commit
d7175ed04d
|
|
@ -65,20 +65,22 @@ func (m *MonoTheme) Size(name fyne.ThemeSizeName) float32 {
|
||||||
// ModuleTile is a clickable tile widget for module selection
|
// ModuleTile is a clickable tile widget for module selection
|
||||||
type ModuleTile struct {
|
type ModuleTile struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
label string
|
label string
|
||||||
color color.Color
|
color color.Color
|
||||||
enabled bool
|
enabled bool
|
||||||
onTapped func()
|
missingDependencies bool
|
||||||
onDropped func([]fyne.URI)
|
onTapped func()
|
||||||
flashing bool
|
onDropped func([]fyne.URI)
|
||||||
draggedOver bool
|
flashing bool
|
||||||
|
draggedOver bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewModuleTile creates a new module tile
|
// NewModuleTile creates a new module tile
|
||||||
func NewModuleTile(label string, col color.Color, enabled bool, tapped func(), dropped func([]fyne.URI)) *ModuleTile {
|
func NewModuleTile(label string, col color.Color, enabled bool, missingDeps bool, tapped func(), dropped func([]fyne.URI)) *ModuleTile {
|
||||||
m := &ModuleTile{
|
m := &ModuleTile{
|
||||||
label: strings.ToUpper(label),
|
label: strings.ToUpper(label),
|
||||||
color: col,
|
color: col,
|
||||||
|
missingDependencies: missingDeps,
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
onTapped: tapped,
|
onTapped: tapped,
|
||||||
onDropped: dropped,
|
onDropped: dropped,
|
||||||
|
|
@ -150,8 +152,11 @@ func (m *ModuleTile) CreateRenderer() fyne.WidgetRenderer {
|
||||||
tileColor := m.color
|
tileColor := m.color
|
||||||
labelColor := TextColor // White text for all modules
|
labelColor := TextColor // White text for all modules
|
||||||
|
|
||||||
// Grey background for disabled tiles
|
// Orange background for modules missing dependencies
|
||||||
if !m.enabled {
|
if m.missingDependencies {
|
||||||
|
tileColor = color.NRGBA{R: 255, G: 152, B: 0, A: 255} // Orange
|
||||||
|
} else if !m.enabled {
|
||||||
|
// Grey background for not implemented modules
|
||||||
tileColor = color.NRGBA{R: 80, G: 80, B: 80, A: 255}
|
tileColor = color.NRGBA{R: 80, G: 80, B: 80, A: 255}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,12 @@ import (
|
||||||
|
|
||||||
// ModuleInfo contains information about a module for display
|
// ModuleInfo contains information about a module for display
|
||||||
type ModuleInfo struct {
|
type ModuleInfo struct {
|
||||||
ID string
|
ID string
|
||||||
Label string
|
Label string
|
||||||
Color color.Color
|
Color color.Color
|
||||||
Enabled bool
|
Enabled bool
|
||||||
Category string
|
Category string
|
||||||
|
MissingDependencies bool // true if disabled due to missing dependencies
|
||||||
}
|
}
|
||||||
|
|
||||||
// HistoryEntry represents a completed job in the history
|
// HistoryEntry represents a completed job in the history
|
||||||
|
|
@ -168,8 +169,8 @@ func BuildMainMenu(modules []ModuleInfo, onModuleClick func(string), onModuleDro
|
||||||
|
|
||||||
// buildModuleTile creates a single module tile
|
// buildModuleTile creates a single module tile
|
||||||
func buildModuleTile(mod ModuleInfo, tapped func(), dropped func([]fyne.URI)) fyne.CanvasObject {
|
func buildModuleTile(mod ModuleInfo, tapped func(), dropped func([]fyne.URI)) fyne.CanvasObject {
|
||||||
logging.Debug(logging.CatUI, "building tile %s color=%v enabled=%v", mod.ID, mod.Color, mod.Enabled)
|
logging.Debug(logging.CatUI, "building tile %s color=%v enabled=%v missingDeps=%v", mod.ID, mod.Color, mod.Enabled, mod.MissingDependencies)
|
||||||
return NewModuleTile(mod.Label, mod.Color, mod.Enabled, tapped, dropped)
|
return NewModuleTile(mod.Label, mod.Color, mod.Enabled, mod.MissingDependencies, tapped, dropped)
|
||||||
}
|
}
|
||||||
|
|
||||||
// buildQueueTile creates the queue status tile
|
// buildQueueTile creates the queue status tile
|
||||||
|
|
|
||||||
20
main.go
20
main.go
|
|
@ -1617,14 +1617,22 @@ func (s *appState) showMainMenu() {
|
||||||
// Convert Module slice to ui.ModuleInfo slice
|
// Convert Module slice to ui.ModuleInfo slice
|
||||||
var mods []ui.ModuleInfo
|
var mods []ui.ModuleInfo
|
||||||
for _, m := range modulesList {
|
for _, m := range modulesList {
|
||||||
|
hasHandler := m.Handle != nil
|
||||||
|
depsAvailable := isModuleAvailable(m.ID)
|
||||||
|
|
||||||
// Module is enabled if: (1) it's Settings (special case) OR (2) it has a handler AND dependencies are available
|
// Module is enabled if: (1) it's Settings (special case) OR (2) it has a handler AND dependencies are available
|
||||||
enabled := m.ID == "settings" || (m.Handle != nil && isModuleAvailable(m.ID))
|
enabled := m.ID == "settings" || (hasHandler && depsAvailable)
|
||||||
|
|
||||||
|
// Missing dependencies = has handler but dependencies not available
|
||||||
|
missingDeps := hasHandler && !depsAvailable && m.ID != "settings"
|
||||||
|
|
||||||
mods = append(mods, ui.ModuleInfo{
|
mods = append(mods, ui.ModuleInfo{
|
||||||
ID: m.ID,
|
ID: m.ID,
|
||||||
Label: m.Label,
|
Label: m.Label,
|
||||||
Color: m.Color,
|
Color: m.Color,
|
||||||
Category:m.Category,
|
Category: m.Category,
|
||||||
Enabled: enabled,
|
Enabled: enabled,
|
||||||
|
MissingDependencies: missingDeps,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user