update ui

This commit is contained in:
2026-07-29 10:37:55 +07:00
parent 0faa8694f8
commit ef7698d248
24 changed files with 208 additions and 891 deletions

View File

@@ -24,6 +24,7 @@ gpui_platform.workspace = true
gpui_web = { git = "https://github.com/zed-industries/zed" }
log.workspace = true
instant = { workspace = true, features = ["wasm-bindgen"] }
console_error_panic_hook = "0.1"
tracing-wasm = "0.2"

View File

@@ -1,21 +1,19 @@
use gpui::*;
use ui::Root;
use universal_time::{
Duration, Instant, MonotonicClock, SystemTime, WallClock, define_time_provider,
};
use universal_time::{Instant, MonotonicClock, SystemTime, WallClock, define_time_provider};
use wasm_bindgen::prelude::*;
struct CustomTimeProvider;
impl WallClock for CustomTimeProvider {
fn system_time(&self) -> SystemTime {
SystemTime::from_unix_duration(Duration::from_secs(0))
SystemTime::from_unix_duration(instant::Duration::from_secs(0))
}
}
impl MonotonicClock for CustomTimeProvider {
fn instant(&self) -> Instant {
Instant::from_ticks(Duration::from_secs(0))
Instant::from_ticks(instant::Duration::from_secs(0))
}
}
@@ -34,21 +32,7 @@ pub fn run() -> Result<(), JsValue> {
#[cfg(target_family = "wasm")]
gpui_platform::web_init();
#[cfg(not(target_family = "wasm"))]
let app = gpui_platform::application();
#[cfg(target_family = "wasm")]
let app = {
let app = gpui_platform::single_threaded_web();
// Workaround: intentionally leak the `Rc<AppCell>` to keep the application alive
struct WasmApplication(std::rc::Rc<AppCell>);
let wasm_app = unsafe { std::mem::transmute::<Application, WasmApplication>(app) };
std::mem::forget(wasm_app.0.clone());
unsafe { std::mem::transmute::<WasmApplication, Application>(wasm_app) }
};
app.run(|cx| {
gpui_platform::application().run(|cx| {
// Open the root window
cx.open_window(WindowOptions::default(), |window, cx| {
// Initialize components