mirror of
https://github.com/ZSeven-W/openpencil.git
synced 2026-05-31 19:04:29 +07:00
fix(panels): compile out the git button on web (no git backend)
Some checks failed
Rust check (native) / macos-latest / 1.94 (push) Waiting to run
Rust check (native) / windows-latest / 1.94 (push) Waiting to run
Rust multi-platform build / linux-aarch64 (push) Waiting to run
Rust multi-platform build / macos-aarch64 (push) Waiting to run
Rust multi-platform build / windows-x86_64 (push) Waiting to run
Rust multi-platform build / macos-x86_64 (push) Waiting to run
Rust multi-platform build / windows-aarch64 (push) Waiting to run
Rust multi-platform build / ios-aarch64 (cargo check only) (push) Waiting to run
Rust multi-platform build / ios-aarch64-sim (cargo check only) (push) Waiting to run
Rust check (native) / ubuntu-latest / 1.94 (push) Failing after 3s
Rust check (native) / cargo-deny (native) (push) Failing after 1s
Rust check (native) / diagnostics golden drift (push) Failing after 3s
Rust multi-platform build / linux-x86_64 (push) Failing after 2s
Rust multi-platform build / wasm32-unknown-unknown / op-host-web (compile guard) (push) Failing after 2s
Rust multi-platform build / android-aarch64 (cargo check only) (push) Failing after 1s
Rust multi-platform build / android-x86_64 (cargo check only) (push) Failing after 2s
WASM bundle check (kickoff §1.2) / cargo check --target wasm32-unknown-unknown (push) Failing after 2s
WASM bundle check (kickoff §1.2) / cargo-deny --target wasm32-unknown-unknown check bans (push) Failing after 2s
Some checks failed
Rust check (native) / macos-latest / 1.94 (push) Waiting to run
Rust check (native) / windows-latest / 1.94 (push) Waiting to run
Rust multi-platform build / linux-aarch64 (push) Waiting to run
Rust multi-platform build / macos-aarch64 (push) Waiting to run
Rust multi-platform build / windows-x86_64 (push) Waiting to run
Rust multi-platform build / macos-x86_64 (push) Waiting to run
Rust multi-platform build / windows-aarch64 (push) Waiting to run
Rust multi-platform build / ios-aarch64 (cargo check only) (push) Waiting to run
Rust multi-platform build / ios-aarch64-sim (cargo check only) (push) Waiting to run
Rust check (native) / ubuntu-latest / 1.94 (push) Failing after 3s
Rust check (native) / cargo-deny (native) (push) Failing after 1s
Rust check (native) / diagnostics golden drift (push) Failing after 3s
Rust multi-platform build / linux-x86_64 (push) Failing after 2s
Rust multi-platform build / wasm32-unknown-unknown / op-host-web (compile guard) (push) Failing after 2s
Rust multi-platform build / android-aarch64 (cargo check only) (push) Failing after 1s
Rust multi-platform build / android-x86_64 (cargo check only) (push) Failing after 2s
WASM bundle check (kickoff §1.2) / cargo check --target wasm32-unknown-unknown (push) Failing after 2s
WASM bundle check (kickoff §1.2) / cargo-deny --target wasm32-unknown-unknown check bans (push) Failing after 2s
The web/wasm build has no git backend and never paints GitPanel, so the top-bar git button toggled an invisible panel (Codex stop-time review). Gate the button's paint + hit-test on a `GIT_BUTTON_AVAILABLE` const (`!cfg!(target_arch = "wasm32")`) so it only exists on desktop.
This commit is contained in:
parent
a4b70fa055
commit
50e95fbf89
1 changed files with 34 additions and 25 deletions
|
|
@ -32,6 +32,11 @@ const PAD: f32 = 12.0;
|
|||
const DIVIDER_W: f32 = 1.0;
|
||||
const DIVIDER_H: f32 = 14.0;
|
||||
const DIVIDER_GAP: f32 = 4.0;
|
||||
/// The git button needs a desktop git backend (`op-git` via the
|
||||
/// desktop host) to populate + paint the panel; the web/wasm build
|
||||
/// has none, so the button is compiled out there — otherwise it would
|
||||
/// toggle an invisible panel (Codex stop-time review).
|
||||
const GIT_BUTTON_AVAILABLE: bool = !cfg!(target_arch = "wasm32");
|
||||
/// Gap between the stacked per-agent brand icons in the chip.
|
||||
const AGENT_ICON_GAP: f32 = 4.0;
|
||||
/// Diameter of a macOS-style window-control dot.
|
||||
|
|
@ -370,8 +375,9 @@ impl TopBar {
|
|||
if rect_contains(figma_rect, point) {
|
||||
return Some(TopBarHit::OpenFigmaImport);
|
||||
}
|
||||
// Git-panel toggle, just right of the centred file name.
|
||||
if rect_contains(self.git_button_rect(rect), point) {
|
||||
// Git-panel toggle, just right of the centred file name
|
||||
// (desktop only — see `GIT_BUTTON_AVAILABLE`).
|
||||
if GIT_BUTTON_AVAILABLE && rect_contains(self.git_button_rect(rect), point) {
|
||||
return Some(TopBarHit::ToggleGitPanel);
|
||||
}
|
||||
// Right cluster: Maximize / Sun / Globe-with-chevron (right→left).
|
||||
|
|
@ -587,9 +593,11 @@ impl Widget for TopBar {
|
|||
);
|
||||
|
||||
// Git-panel button just right of the file name (TS GitButton):
|
||||
// a branch glyph + optional branch name. Always shown — a
|
||||
// click toggles the git panel (which offers `init` when the
|
||||
// doc isn't yet in a repo).
|
||||
// a branch glyph + optional branch name. Always shown on
|
||||
// desktop — a click toggles the git panel (which offers `init`
|
||||
// when the doc isn't yet in a repo). Compiled out on web,
|
||||
// which has no git backend to paint a panel.
|
||||
if GIT_BUTTON_AVAILABLE {
|
||||
let git_rect = self.git_button_rect(rect);
|
||||
draw_icon(
|
||||
cx.backend,
|
||||
|
|
@ -612,6 +620,7 @@ impl Widget for TopBar {
|
|||
Point2D::new(git_rect.origin.x + ICON_SIZE + 6.0, center_y + 4.0),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Right cluster ──────────────────────────────────────
|
||||
// Right → left: Maximize | Sun | Globe+Chevron. Globe is a
|
||||
|
|
|
|||
Loading…
Reference in a new issue