update sidebar

This commit is contained in:
2026-08-29 20:47:30 +07:00
parent c76ebfb8f6
commit ae2938112f
10 changed files with 225 additions and 280 deletions
+61 -32
View File
@@ -7,8 +7,9 @@ use dock::{
};
use gpui::prelude::*;
use gpui::{
AnyElement, App, ClickEvent, Context, ElementId, Entity, EventEmitter, FocusHandle, Focusable,
Render, SharedString, StyleRefinement, Subscription, WeakEntity, Window, div, px, uniform_list,
AnyElement, App, ClickEvent, Context, Div, ElementId, Entity, EventEmitter, FocusHandle,
Focusable, ObjectFit, Render, SharedString, StyleRefinement, Subscription, WeakEntity, Window,
div, img, px, uniform_list,
};
use gpui_component::avatar::Avatar;
use gpui_component::button::{Button, ButtonVariants};
@@ -287,6 +288,63 @@ impl SidebarPanel {
cx,
)
}
/// Sign-in placeholder shown while logged out: the banner artwork fills the
/// panel behind a scrim that fades into the theme's sidebar color, keeping
/// the CTA buttons readable on a clean surface.
fn render_sign_in(&self, cx: &mut Context<Self>) -> Div {
const HEADLINE: &str = "Forge together. Ship anything.";
const SUBHEADLINE: &str = "An open forge for humans and agents";
v_flex()
.size_full()
.relative()
.bg(cx.theme().sidebar)
.text_color(cx.theme().sidebar_foreground)
.child(
div().absolute().inset_0().child(
img("backgrounds/banner.jpg")
.size_full()
.object_fit(ObjectFit::Cover),
),
)
.child(
v_flex()
.size_full()
.items_center()
.justify_end()
.p_4()
.mb_4()
.gap_4()
.child(
v_flex()
.text_color(gpui::white())
.child(div().text_sm().font_semibold().child(HEADLINE))
.child(div().text_xs().child(SUBHEADLINE)),
)
.child(
v_flex()
.gap_1()
.w_full()
.child(
Button::new("onboarding")
.label("Join now")
.primary()
.on_click(cx.listener(|this, _ev, window, cx| {
this.open_onboarding(window, cx)
})),
)
.child(
Button::new("import")
.label("Import identity")
.ghost()
.on_click(cx.listener(|this, _ev, window, cx| {
this.open_import(window, cx)
})),
),
),
)
}
}
impl BasePanel for SidebarPanel {
@@ -316,36 +374,7 @@ impl Focusable for SidebarPanel {
impl Render for SidebarPanel {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
if !self.logged_in {
return v_flex()
.p_4()
.size_full()
.items_center()
.justify_center()
.gap_2()
.child(
div()
.text_sm()
.text_color(cx.theme().muted_foreground)
.child("Sign in to continue"),
)
.child(
Button::new("onboarding")
.label("Join now")
.primary()
.w_full()
.on_click(
cx.listener(|this, _ev, window, cx| this.open_onboarding(window, cx)),
),
)
.child(
Button::new("import-identity")
.label("Import identity")
.secondary()
.w_full()
.on_click(
cx.listener(|this, _ev, window, cx| this.open_import(window, cx)),
),
);
return self.render_sign_in(cx);
}
let backend = Backend::global(cx);