Finish device code flow for copilot
This commit is contained in:
+32
-17
@@ -126,28 +126,43 @@ pub struct Copilot {
|
||||
|
||||
#[derive(Deserialize, Default, Clone)]
|
||||
pub struct CopilotAuth {
|
||||
pub enable_group: ContainerStyle,
|
||||
pub enable_text: TextStyle,
|
||||
pub instruction_text: TextStyle,
|
||||
pub cta_button: ButtonStyle,
|
||||
pub content_width: f32,
|
||||
pub copilot_plus_zed_icon: SvgStyle,
|
||||
pub device_code_group: ContainerStyle,
|
||||
pub github_group: ContainerStyle,
|
||||
pub header_group: ContainerStyle,
|
||||
pub device_code: TextStyle,
|
||||
pub device_code_cta: ButtonStyle,
|
||||
pub device_code_left: f32,
|
||||
pub device_code_left_container: ContainerStyle,
|
||||
pub device_code_right: f32,
|
||||
pub device_code_right_container: ContainerStyle,
|
||||
pub device_code_seperator_height: f32,
|
||||
pub prompting: CopilotAuthPrompting,
|
||||
pub not_authorized: CopilotAuthNotAuthorized,
|
||||
pub authorized: CopilotAuthAuthorized,
|
||||
pub cta_button: ButtonStyle,
|
||||
pub header: IconStyle,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Clone)]
|
||||
pub struct CopilotAuthPrompting {
|
||||
pub subheading: ContainedText,
|
||||
pub hint: ContainedText,
|
||||
pub enabled_hint: ContainerStyle,
|
||||
pub not_authorized_hint: ContainerStyle,
|
||||
pub device_code: DeviceCode,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Clone)]
|
||||
pub struct DeviceCode {
|
||||
pub text: TextStyle,
|
||||
pub cta: ButtonStyle,
|
||||
pub left: f32,
|
||||
pub left_container: ContainerStyle,
|
||||
pub right: f32,
|
||||
pub right_container: Interactive<ContainerStyle>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Clone)]
|
||||
pub struct CopilotAuthNotAuthorized {
|
||||
pub subheading: ContainedText,
|
||||
pub warning: ContainedText,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Clone)]
|
||||
pub struct CopilotAuthAuthorized {
|
||||
pub subheading: ContainedText,
|
||||
pub hint: ContainedText,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
pub struct ContactsPopover {
|
||||
#[serde(flatten)]
|
||||
|
||||
+16
-8
@@ -186,6 +186,7 @@ where
|
||||
cta_button_with_click(label, max_width, style, cx, move |_, cx| {
|
||||
cx.dispatch_action(action.clone())
|
||||
})
|
||||
.boxed()
|
||||
}
|
||||
|
||||
pub fn cta_button_with_click<L, V, F>(
|
||||
@@ -194,7 +195,7 @@ pub fn cta_button_with_click<L, V, F>(
|
||||
style: &ButtonStyle,
|
||||
cx: &mut RenderContext<V>,
|
||||
f: F,
|
||||
) -> ElementBox
|
||||
) -> MouseEventHandler<F>
|
||||
where
|
||||
L: Into<Cow<'static, str>>,
|
||||
V: View,
|
||||
@@ -212,7 +213,6 @@ where
|
||||
})
|
||||
.on_click(MouseButton::Left, f)
|
||||
.with_cursor_style(gpui::CursorStyle::PointingHand)
|
||||
.boxed()
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Default)]
|
||||
@@ -241,7 +241,8 @@ where
|
||||
I: Into<Cow<'static, str>>,
|
||||
F: FnOnce(&mut gpui::RenderContext<V>) -> ElementBox,
|
||||
{
|
||||
let active = cx.window_is_active(cx.window_id());
|
||||
const TITLEBAR_HEIGHT: f32 = 28.;
|
||||
// let active = cx.window_is_active(cx.window_id());
|
||||
|
||||
Flex::column()
|
||||
.with_child(
|
||||
@@ -251,13 +252,13 @@ where
|
||||
title,
|
||||
style
|
||||
.title_text
|
||||
.style_for(&mut MouseState::default(), active)
|
||||
.style_for(&mut MouseState::default(), false)
|
||||
.clone(),
|
||||
)
|
||||
.boxed(),
|
||||
// FIXME: Get a better tag type
|
||||
MouseEventHandler::<V>::new(999999, cx, |state, _cx| {
|
||||
let style = style.close_icon.style_for(state, active);
|
||||
let style = style.close_icon.style_for(state, false);
|
||||
icon(style).boxed()
|
||||
})
|
||||
.on_click(gpui::MouseButton::Left, move |_, cx| {
|
||||
@@ -271,11 +272,18 @@ where
|
||||
])
|
||||
.contained()
|
||||
.with_style(style.titlebar)
|
||||
.constrained()
|
||||
.with_height(TITLEBAR_HEIGHT)
|
||||
.boxed(),
|
||||
)
|
||||
.with_child(
|
||||
Container::new(build_modal(cx))
|
||||
.with_style(style.container)
|
||||
.constrained()
|
||||
.with_width(style.dimensions().x())
|
||||
.with_height(style.dimensions().y() - TITLEBAR_HEIGHT)
|
||||
.boxed(),
|
||||
)
|
||||
.with_child(build_modal(cx))
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
.constrained()
|
||||
.with_height(style.dimensions().y())
|
||||
.boxed()
|
||||
|
||||
Reference in New Issue
Block a user