Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion crates/component_preview/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ uuid.workspace = true
workspace.workspace = true

[dev-dependencies]
gpui_platform = { workspace = true, features = ["screen-capture"] }
assets.workspace = true
editor.workspace = true
env_logger.workspace = true
gpui_platform = { workspace = true, features = ["screen-capture", "font-kit", "wayland", "x11"] }

[[example]]
name = "component_preview"
Expand Down
14 changes: 12 additions & 2 deletions crates/component_preview/examples/component_preview.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Component Preview Example
//!
//! Run with: `cargo run -p component_preview --example component_preview"`
use assets::Assets;
use fs::RealFs;
use gpui::{AppContext as _, Bounds, KeyBinding, WindowBounds, WindowOptions, actions, size};

Expand All @@ -16,20 +17,28 @@ use workspace::{AppState, Workspace, WorkspaceStore};

use component_preview::{ComponentPreview, init};

actions!(zed, [Quit]);
actions!(component_preview, [Quit]);

fn quit(_: &Quit, cx: &mut App) {
cx.quit();
}

fn main() {
gpui_platform::application().run(|cx| {
env_logger::builder()
.filter_level(log::LevelFilter::Warn)
.init();

gpui_platform::application().with_assets(Assets).run(|cx| {
component::init();

cx.on_action(quit);
cx.bind_keys([KeyBinding::new("cmd-q", Quit, None)]);
let version = release_channel::AppVersion::load(env!("CARGO_PKG_VERSION"), None, None);
release_channel::init(version, cx);
cx.set_global(db::AppDatabase::new());
Assets
.load_fonts(cx)
.expect("Failed to load embedded fonts");

let http_client =
ReqwestClient::user_agent("component_preview").expect("Failed to create HTTP client");
Expand Down Expand Up @@ -68,6 +77,7 @@ fn main() {
AppState::set_global(app_state.clone(), cx);

workspace::init(app_state.clone(), cx);
editor::init(cx);
init(app_state.clone(), cx);

let size = size(px(1200.), px(800.));
Expand Down
Loading