T45 Website: native captures stand in where a browser cannot run, an OG image, no web notes

This commit is contained in:
ZacharyZhang-NY committed 2026-09-30 00:03:23 -04:00
1 parent 587e08b5cb
commit 327bdf4b7f
68 files changed
+315 -155

No files matched your search

+1 -17
View File
@@ -7,7 +7,7 @@ use ely_gpui_component::{
};
use gpui::{App, Div, IntoElement, ParentElement, Styled, Window, div, px};
use crate::ui::{code, row, section, specimen, specimens, web_note};
use crate::ui::{code, row, section, specimen, specimens};
/// A window drawn inside the page.
pub fn window_frame(width: f32, height: f32, cx: &App) -> Div {
@@ -116,10 +116,6 @@ pub fn window_controls(cx: &App) -> impl IntoElement + use<> {
"Minimize and zoom act on this window. Close here only logs.",
cx,
))
.children(web_note(
"A browser owns the page's window: gpui on the web only logs minimize and zoom.",
cx,
))
}
pub fn drag_area(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
@@ -146,10 +142,6 @@ pub fn drag_area(window: &mut Window, cx: &mut App) -> impl IntoElement + use<>
.child("Double-click to zoom this window"),
)
.child(code("drag_region(id, window, cx)", cx))
.children(web_note(
"A browser owns the page's window: gpui on the web neither moves nor zooms it.",
cx,
))
}
pub fn resize_border(cx: &App) -> impl IntoElement + use<> {
@@ -162,10 +154,6 @@ pub fn resize_border(cx: &App) -> impl IntoElement + use<> {
"Linux draws its own edges. This macOS window keeps the system's, so the border lays out only.",
))
.child(code("ResizeBorder::new().child(app)", cx))
.children(web_note(
"A browser sizes the page's canvas itself: gpui on the web resizes no window from its edges.",
cx,
))
}
pub fn menus(cx: &App) -> impl IntoElement + use<> {
@@ -189,8 +177,4 @@ pub fn menus(cx: &App) -> impl IntoElement + use<> {
.child(Caption::new(
"MenuBar draws the same menus inside the window. It lands with Menus, chapter 8.",
))
.children(web_note(
"A browser page has no menu bar and no Dock: gpui on the web keeps neither cx.set_menus nor cx.set_dock_menu.",
cx,
))
}
+19 -25
View File
@@ -11,7 +11,7 @@ use gpui::{App, IntoElement, ParentElement, Styled, Window, div};
use super::chrome::window_frame;
use crate::{
probe::{Opened, probe},
ui::{own_window, row, section, specimen},
ui::{native_only, row, section, specimen},
};
fn log_action(name: &'static str) -> impl Fn(&mut Window, &mut App) + 'static {
@@ -59,18 +59,15 @@ pub fn update_window(cx: &App) -> impl IntoElement + use<> {
.child(update_dialog().on_later(log_action("later"))),
cx,
))
.child(own_window(
probe(
"update-open",
Button::new("update-open", "Open update window")
.variant(ButtonVariant::Outline)
.on_click(|_, _, cx| match update_dialog().open(cx) {
Ok(handle) => Opened::insert("update", handle.into(), cx),
Err(error) => log::error!("gallery: update window failed: {error:#}"),
}),
),
cx,
))
.child(native_only(probe(
"update-open",
Button::new("update-open", "Open update window")
.variant(ButtonVariant::Outline)
.on_click(|_, _, cx| match update_dialog().open(cx) {
Ok(handle) => Opened::insert("update", handle.into(), cx),
Err(error) => log::error!("gallery: update window failed: {error:#}"),
}),
)))
}
const REPORT: &str = "Exception Type: EXC_BAD_ACCESS (SIGSEGV)
@@ -104,18 +101,15 @@ pub fn crash_reporter(cx: &App) -> impl IntoElement + use<> {
.child(reporter(true)),
cx,
))
.child(own_window(
probe(
"crash-open",
Button::new("crash-open", "Open crash window")
.variant(ButtonVariant::Outline)
.on_click(move |_, _, cx| match reporter(false).open(cx) {
Ok(handle) => Opened::insert("crash", handle.into(), cx),
Err(error) => log::error!("gallery: crash window failed: {error:#}"),
}),
),
cx,
))
.child(native_only(probe(
"crash-open",
Button::new("crash-open", "Open crash window")
.variant(ButtonVariant::Outline)
.on_click(move |_, _, cx| match reporter(false).open(cx) {
Ok(handle) => Opened::insert("crash", handle.into(), cx),
Err(error) => log::error!("gallery: crash window failed: {error:#}"),
}),
)))
}
pub fn offline(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
+1 -9
View File
@@ -7,7 +7,7 @@ use gpui::{App, IntoElement, ParentElement, SharedString, Window};
use crate::{
probe::probe,
ui::{blocked, row, section, web_note},
ui::{blocked, row, section},
};
const ITEMS: [&str; 3] = ["Open gallery", "Toggle theme", "Quit"];
@@ -23,10 +23,6 @@ pub fn tray(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
"An SF Symbol in the menu bar with a menu. macOS only.",
cx,
)
.children(web_note(
"A browser page has no menu bar to hold an icon, so showing one fails and logs why.",
cx,
))
.child(
row()
.child(probe(
@@ -117,10 +113,6 @@ pub fn dock(cx: &mut App) -> impl IntoElement + use<> {
"A count on the app's Dock icon. macOS only.",
cx,
)
.children(web_note(
"A browser page has no Dock icon to badge, so setting one fails and logs why.",
cx,
))
.child(
row()
.child(probe(
+18 -16
View File
@@ -15,7 +15,7 @@ use gpui::{
use super::chrome::window_frame;
use crate::{
probe::{Opened, probe},
ui::{code, own_window, picture, row, section, specimen},
ui::{code, native_only, picture, row, section, specimen},
};
const DUNES: &str = asset!("dunes.jpg");
@@ -80,13 +80,14 @@ pub fn splash_screen(cx: &App) -> impl IntoElement + use<> {
.child(splash().progress(Some(0.62))),
cx,
))
.child(own_window(
trigger("splash-open", "Show splash window", |cx| {
.child(native_only(trigger(
"splash-open",
"Show splash window",
|cx| {
let result = splash().open(cx);
opened("splash", result, cx)
}),
cx,
))
},
)))
}
pub fn open_about(cx: &mut App) {
@@ -108,10 +109,11 @@ pub fn about_dialog(cx: &App) -> impl IntoElement + use<> {
.child(about()),
cx,
))
.child(own_window(
trigger("about-open", "Open About window", open_about),
cx,
))
.child(native_only(trigger(
"about-open",
"Open About window",
open_about,
)))
}
struct Managed {
@@ -192,10 +194,11 @@ pub fn window_manager(cx: &mut App) -> impl IntoElement + use<> {
"Each new window cascades from the last; the manager knows them by name.",
cx,
)
.child(own_window(
trigger("managed-open", "New window", open_managed),
cx,
))
.child(native_only(trigger(
"managed-open",
"New window",
open_managed,
)))
.child(
row().children(open.into_iter().enumerate().map(|(ix, (handle, title))| {
Button::new(("managed-focus", ix), title)
@@ -335,7 +338,7 @@ pub fn mini_windows(cx: &App) -> impl IntoElement + use<> {
"Small windows above the rest. Hover for the bar; expand returns to the app.",
cx,
)
.child(own_window(
.child(native_only(
row()
.child(trigger("mini-open", "Mini player", |cx| {
let view = cx.new(|_| Player { playing: true });
@@ -359,7 +362,6 @@ pub fn mini_windows(cx: &App) -> impl IntoElement + use<> {
);
opened("pip", result, cx)
})),
cx,
))
.child(code(
"AlwaysOnTop is gpui's WindowOptions { kind: WindowKind::PopUp, .. }",