2026-11-16 13:21:20 +08:00
|
|
|
package appui
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/egoist/asuka/colors"
|
|
|
|
|
"github.com/egoist/asuka/sdk/svg"
|
|
|
|
|
"github.com/egoist/asuka/ui"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// serverIcon is a rack, drawn as vector paths: Asuka's built-in symbols
|
|
|
|
|
// have no server glyph on Android, and an SVG keeps it crisp at any size.
|
|
|
|
|
var serverIcon = svg.MustParse(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="8" x="2" y="2" rx="2"/><rect width="20" height="8" x="2" y="14" rx="2"/><line x1="6" x2="6.01" y1="6" y2="6"/><line x1="6" x2="6.01" y1="18" y2="18"/></svg>`)
|
|
|
|
|
|
2026-11-16 19:55:05 +08:00
|
|
|
// sparklesIcon marks the turn footer. Drawn here for the same reason as
|
|
|
|
|
// the server icon: not every platform's symbol set has the name.
|
|
|
|
|
var sparklesIcon = svg.MustParse(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l1.7 4.3L18 9l-4.3 1.7L12 15l-1.7-4.3L6 9l4.3-1.7L12 3z"/><path d="M19 15l.8 1.9L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-1.1L19 15z"/></svg>`)
|
|
|
|
|
|
2026-11-16 13:21:20 +08:00
|
|
|
// instancesButton opens the server list: one button, because picking a
|
|
|
|
|
// server is also how the live one is replaced.
|
|
|
|
|
func (c *controller) instancesButton() ui.Node {
|
|
|
|
|
return ui.View(ui.ViewProps{
|
|
|
|
|
OnPress: func() { c.instancesOpen.Set(true) },
|
|
|
|
|
Label: ui.Val("实例"),
|
|
|
|
|
Hint: ui.Val("打开服务器列表"),
|
|
|
|
|
Style: ui.Style{Padding: ui.All(8)},
|
|
|
|
|
}, svg.View(svg.Props{
|
|
|
|
|
Icon: serverIcon,
|
|
|
|
|
Color: ui.Val(colors.Accent),
|
|
|
|
|
Style: ui.Style{Width: ui.Pt(22), Height: ui.Pt(22)},
|
|
|
|
|
}))
|
|
|
|
|
}
|