Fix bug with enable setting, clean up sign in UIs

This commit is contained in:
Mikayla Maki 2023-03-29 21:51:07 -07:00
parent cc7c5b416c
commit a8033b266d
3 changed files with 17 additions and 47 deletions

View file

@ -66,6 +66,7 @@ pub fn init(cx: &mut MutableAppContext) {
.detach();
// Modal theming test:
// use gpui::geometry::vector::vec2f;
// let window_size = cx.global::<Settings>().theme.copilot.modal.dimensions();
// let window_options = WindowOptions {
// bounds: gpui::WindowBounds::Fixed(RectF::new(Default::default(), window_size)),
@ -326,52 +327,17 @@ impl CopilotCodeVerification {
.aligned()
.boxed(),
Self::render_device_code(data, &style, cx),
// match &self.prompt {
// SignInContents::PromptingUser(data) => {
// }
// SignInContents::Unauthorized => Self::render_not_authorized_warning(&style),
// SignInContents::Enabled => Self::render_copilot_enabled(&style),
// },
Flex::column()
.with_child(
theme::ui::cta_button_with_click(
"Connect to GitHub",
style.auth.content_width,
&style.auth.cta_button,
cx,
{
let verification_uri = data.verification_uri.clone();
move |_, cx| cx.platform().open_url(&verification_uri)
},
),
// {
// match &self.prompt {
// SignInContents::PromptingUser(data) => {
// }
// // SignInContents::Unauthorized => theme::ui::cta_button_with_click(
// // "Close",
// // style.auth.content_width,
// // &style.auth.cta_button,
// // cx,
// // |_, cx| {
// // let window_id = cx.window_id();
// // cx.remove_window(window_id)
// // },
// // ),
// // SignInContents::Enabled => theme::ui::cta_button_with_click(
// // "Done",
// // style.auth.content_width,
// // &style.auth.cta_button,
// // cx,
// // |_, cx| {
// // let window_id = cx.window_id();
// // cx.remove_window(window_id)
// // },
// // ),
// }
)
.with_child(theme::ui::cta_button_with_click(
"Connect to GitHub",
style.auth.content_width,
&style.auth.cta_button,
cx,
{
let verification_uri = data.verification_uri.clone();
move |_, cx| cx.platform().open_url(&verification_uri)
},
))
.align_children_center()
.contained()
.with_style(style.auth.github_group)

View file

@ -11,7 +11,7 @@ use workspace::{
item::ItemHandle, notifications::simple_message_notification::OsOpen, StatusItemView,
};
use copilot::{Copilot, SignOut, Status};
use copilot::{Copilot, SignIn, SignOut, Status};
const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot";
@ -140,7 +140,7 @@ impl View for CopilotButton {
if authorized {
cx.dispatch_action(DeployCopilotMenu);
} else {
cx.dispatch_action(DeployCopilotModal);
cx.dispatch_action(SignIn);
}
})
.with_tooltip::<Self, _>(

View file

@ -567,6 +567,10 @@ impl Settings {
merge(&mut self.autosave, data.autosave);
merge(&mut self.default_dock_anchor, data.default_dock_anchor);
merge(&mut self.base_keymap, data.base_keymap);
merge(
&mut self.enable_copilot_integration,
data.enable_copilot_integration,
);
self.editor_overrides = data.editor;
self.git_overrides = data.git.unwrap_or_default();