26 lines
1.1 KiB
Go
26 lines
1.1 KiB
Go
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>`)
|
||
|
|
|
||
|
|
// 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)},
|
||
|
|
}))
|
||
|
|
}
|