2026-03-20 03:54:58 +00:00
// PicoClaw - Ultra-lightweight personal AI agent
// License: MIT
//
// Copyright (c) 2026 PicoClaw contributors
package ui
import (
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
func ( a * App ) newHomePage ( ) tview . Primitive {
list := tview . NewList ( )
2026-03-20 09:04:57 +00:00
list . SetBorder ( true ) . SetTitle ( " [#00f0ff::b] ACTIVE CONFIGURATION " ) . SetTitleColor ( tcell . NewHexColor ( 0x00f0ff ) ) . SetBorderColor ( tcell . NewHexColor ( 0x00f0ff ) )
list . SetMainTextColor ( tcell . NewHexColor ( 0xe0e0e0 ) )
list . SetSecondaryTextColor ( tcell . NewHexColor ( 0x808080 ) )
list . SetSelectedStyle ( tcell . StyleDefault . Background ( tcell . NewHexColor ( 0x39ff14 ) ) . Foreground ( tcell . NewHexColor ( 0x050510 ) ) )
list . SetHighlightFullLine ( true )
list . SetBackgroundColor ( tcell . NewHexColor ( 0x050510 ) )
2026-03-20 03:54:58 +00:00
rebuildList := func ( ) {
sel := list . GetCurrentItem ( )
list . Clear ( )
2026-03-20 09:04:57 +00:00
list . AddItem ( "MODEL: " + a . cfg . CurrentModelLabel ( ) , "Select to configure AI model" , 'm' , func ( ) {
2026-03-20 03:54:58 +00:00
a . navigateTo ( "schemes" , a . newSchemesPage ( ) )
} )
2026-03-20 09:58:33 +00:00
list . AddItem ( "CHANNELS: Configure communication channels" , "Manage Telegram/Discord/WeChat channels" , 'n' , func ( ) {
a . navigateTo ( "channels" , a . newChannelsPage ( ) )
} )
2026-03-20 11:07:06 +00:00
list . AddItem ( "GATEWAY MANAGEMENT" , "Manage PicoClaw gateway daemon" , 'g' , func ( ) {
a . navigateTo ( "gateway" , a . newGatewayPage ( ) )
} )
2026-03-20 09:04:57 +00:00
list . AddItem ( "QUIT SYSTEM" , "Exit PicoClaw Launcher" , 'q' , func ( ) { a . tapp . Stop ( ) } )
2026-03-20 07:39:15 +00:00
if sel >= 0 && sel < list . GetItemCount ( ) {
2026-03-20 03:54:58 +00:00
list . SetCurrentItem ( sel )
}
}
rebuildList ( )
2026-03-20 07:39:15 +00:00
a . pageRefreshFns [ "home" ] = rebuildList
2026-03-20 03:54:58 +00:00
2026-03-20 09:04:57 +00:00
return a . buildShell ( "home" , list , " [#00f0ff]m:[-] configure model [#ff2a2a]q:[-] quit " )
2026-03-20 03:54:58 +00:00
}