Fix Gio button alignment hints

This commit is contained in:
2026-04-06 08:58:22 +07:00
parent d591d61c0b
commit fd8656ffa0

View File

@@ -626,7 +626,7 @@ func (u *ui) layoutStatusBanner(gtx layout.Context) layout.Dimensions {
connected := u.statusState != nil && u.statusState.Connected connected := u.statusState != nil && u.statusState.Connected
statusText := "Offline" statusText := "Offline"
statusColor := warningColor statusColor := warningColor
details := "No active tunnel." details := "No active tunnel. Open the VLESS or WireGuard tab and press Connect on a saved config."
if connected { if connected {
statusText = "Connected" statusText = "Connected"
@@ -738,15 +738,11 @@ func (u *ui) layoutDashboard(gtx layout.Context) layout.Dimensions {
}), }),
layout.Rigid(spacerW(12)), layout.Rigid(spacerW(12)),
layout.Flexed(1, func(gtx layout.Context) layout.Dimensions { layout.Flexed(1, func(gtx layout.Context) layout.Dimensions {
return u.metricCard(gtx, "Subscriptions", fmt.Sprintf("%d", len(u.subs.Subscriptions)), accentSoftColor) return u.metricCard(gtx, "WireGuard configs", fmt.Sprintf("%d", len(u.configs.WireGuard)), accentSoftColor)
}), }),
layout.Rigid(spacerW(12)), layout.Rigid(spacerW(12)),
layout.Flexed(1, func(gtx layout.Context) layout.Dimensions { layout.Flexed(1, func(gtx layout.Context) layout.Dimensions {
state := "Offline" return u.metricCard(gtx, "Subscriptions", fmt.Sprintf("%d", len(u.subs.Subscriptions)), successColor)
if u.statusState != nil && u.statusState.Connected {
state = strings.ToUpper(u.statusState.ConfigType)
}
return u.metricCard(gtx, "Active mode", state, successColor)
}), }),
) )
}), }),
@@ -991,12 +987,14 @@ func (u *ui) buttonLike(gtx layout.Context, btn *widget.Clickable, label string,
Left: hPad, Left: hPad,
Right: hPad, Right: hPad,
}.Layout(gtx, func(gtx layout.Context) layout.Dimensions { }.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
return layout.Center.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
lbl := material.Label(u.theme, unit.Sp(14), label) lbl := material.Label(u.theme, unit.Sp(14), label)
lbl.Color = fg lbl.Color = fg
lbl.Alignment = text.Middle lbl.Alignment = text.Middle
return lbl.Layout(gtx) return lbl.Layout(gtx)
}) })
}) })
})
} }
func (u *ui) card(gtx layout.Context, bg color.NRGBA, content layout.Widget) layout.Dimensions { func (u *ui) card(gtx layout.Context, bg color.NRGBA, content layout.Widget) layout.Dimensions {