remote projects per user (#10594)

Release Notes:

- Made remote projects per-user instead of per-channel. If you'd like to
be part of the remote development alpha, please email hi@zed.dev.

---------

Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
Co-authored-by: Bennet <bennetbo@gmx.de>
Co-authored-by: Nate Butler <1714999+iamnbutler@users.noreply.github.com>
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
This commit is contained in:
Conrad Irwin 2024-04-23 15:33:09 -06:00 committed by GitHub
parent 8ae4c3277f
commit e0c83a1d32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 2807 additions and 1625 deletions

View file

@ -1,7 +1,7 @@
use gpui::{svg, IntoElement, Rems, Transformation};
use gpui::{svg, Hsla, IntoElement, Rems, Transformation};
use strum::EnumIter;
use crate::prelude::*;
use crate::{prelude::*, Indicator};
#[derive(Default, PartialEq, Copy, Clone)]
pub enum IconSize {
@ -283,3 +283,63 @@ impl RenderOnce for Icon {
.text_color(self.color.color(cx))
}
}
#[derive(IntoElement)]
pub struct IconWithIndicator {
icon: Icon,
indicator: Option<Indicator>,
indicator_border_color: Option<Hsla>,
}
impl IconWithIndicator {
pub fn new(icon: Icon, indicator: Option<Indicator>) -> Self {
Self {
icon,
indicator,
indicator_border_color: None,
}
}
pub fn indicator(mut self, indicator: Option<Indicator>) -> Self {
self.indicator = indicator;
self
}
pub fn indicator_color(mut self, color: Color) -> Self {
if let Some(indicator) = self.indicator.as_mut() {
indicator.color = color;
}
self
}
pub fn indicator_border_color(mut self, color: Option<Hsla>) -> Self {
self.indicator_border_color = color;
self
}
}
impl RenderOnce for IconWithIndicator {
fn render(self, cx: &mut WindowContext) -> impl IntoElement {
let indicator_border_color = self
.indicator_border_color
.unwrap_or_else(|| cx.theme().colors().elevated_surface_background);
div()
.relative()
.child(self.icon)
.when_some(self.indicator, |this, indicator| {
this.child(
div()
.absolute()
.w_2()
.h_2()
.border()
.border_color(indicator_border_color)
.rounded_full()
.neg_bottom_0p5()
.neg_right_1()
.child(indicator),
)
})
}
}

View file

@ -1,12 +1,16 @@
use gpui::*;
use gpui::{prelude::FluentBuilder, *};
use smallvec::SmallVec;
use crate::{h_flex, IconButton, IconButtonShape, IconName, Label, LabelCommon, LabelSize};
use crate::{
h_flex, Clickable, IconButton, IconButtonShape, IconName, Label, LabelCommon, LabelSize,
};
#[derive(IntoElement)]
pub struct ModalHeader {
id: ElementId,
children: SmallVec<[AnyElement; 2]>,
show_dismiss_button: bool,
show_back_button: bool,
}
impl ModalHeader {
@ -14,8 +18,20 @@ impl ModalHeader {
Self {
id: id.into(),
children: SmallVec::new(),
show_dismiss_button: false,
show_back_button: false,
}
}
pub fn show_dismiss_button(mut self, show: bool) -> Self {
self.show_dismiss_button = show;
self
}
pub fn show_back_button(mut self, show: bool) -> Self {
self.show_back_button = show;
self
}
}
impl ParentElement for ModalHeader {
@ -31,9 +47,28 @@ impl RenderOnce for ModalHeader {
.w_full()
.px_2()
.py_1p5()
.when(self.show_back_button, |this| {
this.child(
div().pr_1().child(
IconButton::new("back", IconName::ArrowLeft)
.shape(IconButtonShape::Square)
.on_click(|_, cx| {
cx.dispatch_action(menu::Cancel.boxed_clone());
}),
),
)
})
.child(div().flex_1().children(self.children))
.justify_between()
.child(IconButton::new("dismiss", IconName::Close).shape(IconButtonShape::Square))
.when(self.show_dismiss_button, |this| {
this.child(
IconButton::new("dismiss", IconName::Close)
.shape(IconButtonShape::Square)
.on_click(|_, cx| {
cx.dispatch_action(menu::Cancel.boxed_clone());
}),
)
})
}
}