Files
proxy-suite-flake/windows/crates/ps-gui/src/ui/widgets.rs
T
faumarayandClaude Opus 5.5 c9ce7a1982 windows: the app's DPI bypass page
zapret on or off and its engine; for Flowseal's presets, the preset (the
release's own list, matched as the service matches names) and game
traffic; for zapret2, learning, IPv6 and the strategy log; the sites to
handle besides the engine's lists and the sites to leave alone; TCP
timestamps. News from the service replaces what the user has not
changed, never what they are typing; a save shows the list as saved.

ps-client: set_path for any one option, set_zapret_sites (tidied,
deduplicated). gui-shot.sh takes ordered steps: click, type, key, wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:30:25 +03:00

50 lines
1.9 KiB
Rust

//! Pieces the pages share: the page frame, cards, a unit's state as a tag.
use gpui_kit::component::tag::Tag;
use gpui_kit::assets::IconName;
use gpui_kit::component::*;
use gpui_kit::*;
pub fn brand(cx: &App) -> impl IntoElement {
div().h_flex().gap_2().items_center().child(Icon::new(IconName::Shield).text_color(cx.theme().primary)).child(div().font_semibold().child("Proxy Suite"))
}
/// A page: its title, then what is under it.
pub fn page(title: &'static str, cx: &App) -> Div {
div().v_flex().gap_4().p_6().w_full().max_w(px(920.)).child(div().text_xl().font_semibold().text_color(cx.theme().foreground).child(title))
}
/// A bordered section of a page, titled, with what it controls on the right of the title.
pub fn card(title: impl Into<SharedString>, action: Option<AnyElement>, cx: &App) -> Div {
div()
.v_flex()
.gap_3()
.p_4()
.rounded_lg()
.border_1()
.border_color(cx.theme().border)
.bg(cx.theme().background)
.child(div().h_flex().justify_between().items_center().child(div().font_semibold().child(title.into())).children(action))
}
/// A unit's state, as the service says it, coloured by what it means.
pub fn state_tag(state: &str) -> Tag {
let tag = match state {
"active" => Tag::success(),
"activating" | "reloading" | "deactivating" => Tag::warning(),
"failed" => Tag::danger(),
_ => Tag::secondary(),
};
tag.child(state.to_owned())
}
/// A quieter line of explanation.
pub fn hint(text: impl Into<SharedString>, cx: &App) -> Div {
div().text_sm().text_color(cx.theme().muted_foreground).child(text.into())
}
/// A label and its value, in a row.
pub fn fact(label: &'static str, value: impl Into<SharedString>, cx: &App) -> Div {
div().h_flex().gap_2().text_sm().child(div().w(px(110.)).text_color(cx.theme().muted_foreground).child(label)).child(value.into())
}