Skip to content

Commit

Permalink
storybook: Wire up HTTP client (zed-industries#18818)
Browse files Browse the repository at this point in the history
This PR wires up the HTTP client in the Storybook.

Release Notes:

- N/A
  • Loading branch information
maxdeviant authored Oct 7, 2024
1 parent d1a7587 commit c83690f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/storybook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ strum = { workspace = true, features = ["derive"] }
theme.workspace = true
title_bar = { workspace = true, features = ["stories"] }
ui = { workspace = true, features = ["stories"] }
ureq_client.workspace = true

[dev-dependencies]
gpui = { workspace = true, features = ["test-support"] }
10 changes: 10 additions & 0 deletions crates/storybook/src/storybook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ mod assets;
mod stories;
mod story_selector;

use std::sync::Arc;

use clap::Parser;
use dialoguer::FuzzySelect;
use gpui::{
Expand All @@ -17,6 +19,7 @@ use simplelog::SimpleLogger;
use strum::IntoEnumIterator;
use theme::{ThemeRegistry, ThemeSettings};
use ui::prelude::*;
use ureq_client::UreqClient;

use crate::app_menus::app_menus;
use crate::assets::Assets;
Expand Down Expand Up @@ -65,6 +68,13 @@ fn main() {
gpui::App::new().with_assets(Assets).run(move |cx| {
load_embedded_fonts(cx).unwrap();

let http_client = UreqClient::new(
None,
"zed_storybook".to_string(),
cx.background_executor().clone(),
);
cx.set_http_client(Arc::new(http_client));

settings::init(cx);
theme::init(theme::LoadThemes::All(Box::new(Assets)), cx);

Expand Down

0 comments on commit c83690f

Please sign in to comment.