storybook: Wire up HTTP client (#18818)

This PR wires up the HTTP client in the Storybook.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-10-07 12:29:10 -04:00 committed by GitHub
parent d1a758708d
commit c83690ff14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 0 deletions

1
Cargo.lock generated
View file

@ -10998,6 +10998,7 @@ dependencies = [
"theme",
"title_bar",
"ui",
"ureq_client",
]
[[package]]

View file

@ -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"] }

View file

@ -4,6 +4,8 @@ mod assets;
mod stories;
mod story_selector;
use std::sync::Arc;
use clap::Parser;
use dialoguer::FuzzySelect;
use gpui::{
@ -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;
@ -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);