wip: segmented control

This commit is contained in:
2026-05-25 18:43:26 +01:00
parent ecf09d992d
commit 91a57cbc0f
5 changed files with 30 additions and 17 deletions

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-braces-corner-icon lucide-file-braces-corner"><path d="M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1"/><path d="M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1"/></svg>

After

Width:  |  Height:  |  Size: 562 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-circle-more-icon lucide-message-circle-more"><path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/><path d="M8 12h.01"/><path d="M12 12h.01"/><path d="M16 12h.01"/></svg>

After

Width:  |  Height:  |  Size: 462 B

View File

@@ -43,6 +43,8 @@ define_font_icons!(
Eye,
RefreshCw,
Star,
MessageCircleMore,
FileBracesCorner,
);
#[derive(gpui::IntoElement)]

View File

@@ -2,7 +2,7 @@ use std::sync::Arc;
use gpui::{
AppContext, InteractiveElement, IntoElement, ParentElement, StatefulInteractiveElement, Styled,
div, img, prelude::FluentBuilder,
div, img, linear_gradient, prelude::FluentBuilder,
};
use crate::{
@@ -284,10 +284,7 @@ impl gpui::Render for PullRequestView {
) -> impl gpui::IntoElement {
div().size_full().child(match &self.pull_request_query {
| Some(q) => match read_query(q, cx) {
| QueryStatus::Loaded(pr) => match &self.diff_view {
| Some(v) => v.clone().into_any_element(),
| None => self.pr_content(pr, cx),
},
| QueryStatus::Loaded(pr) => self.pr_content(pr, cx),
| QueryStatus::Err(e) => div()
.size_full()
@@ -331,17 +328,29 @@ impl gpui::RenderOnce for Toolbar {
.border_b_1()
.border_color(theme.colors.border_muted)
.child(
toolbar_button("pr-review-btn")
.leading(font_icon(FontIcon::Eye))
.mr_1(),
div()
.flex()
.flex_row()
.items_center()
.justify_center()
.border_t_1()
.border_color(theme.colors.border_strong)
.rounded_sm()
.child(
div()
.px_2()
.py_1()
.bg(theme.colors.surface_elevated)
.child(font_icon(FontIcon::MessageCircleMore).size_3p5()),
)
.child(
div()
.px_2()
.py_1()
.bg(theme.colors.surface_elevated)
.child(font_icon(FontIcon::FileBracesCorner).size_3p5()),
),
)
.child(
toolbar_button("pr-review-btn")
.leading(font_icon(FontIcon::RefreshCw))
.mr_1(),
)
.child(divider().bg(theme.colors.border).mr_1())
.child(toolbar_button("pr-review-btn").leading(font_icon(FontIcon::Star)))
.child(div().flex_1())
.child(
toolbar_button("pr-close-btn")

View File

@@ -43,7 +43,7 @@ pub(crate) fn latte() -> Theme {
colors: ThemeColors {
background: hex(0xeff1f5),
surface: hex(0xe6e9ef),
surface_elevated: hex(0xdce0e8),
surface_elevated: hex(0xeff1f5),
surface_chrome: hex(0xdce0e8),
surface_hover: hex(0xdce0e8),
surface_active: hex(0xccd0da),
@@ -152,7 +152,7 @@ pub(crate) fn mocha() -> Theme {
colors: ThemeColors {
background: hex(0x1e1e2e),
surface: hex(0x181825),
surface_elevated: hex(0x313244),
surface_elevated: hex(0x45475a),
surface_chrome: hex(0x11111b),
surface_hover: hex(0x313244),
surface_active: hex(0x45475a),