chore: move some components to custom ui crate (#10)

Reviewed-on: https://git.reya.su/reya/signed/pulls/10
This commit was merged in pull request #10.
This commit is contained in:
2026-09-01 04:18:23 +00:00
parent 05ab543fa0
commit 5c6ab88710
33 changed files with 954 additions and 938 deletions
+53
View File
@@ -0,0 +1,53 @@
use assets::CustomIconName;
use gpui::prelude::*;
use gpui::{AnyElement, App};
use gpui_component::tooltip::Tooltip;
use gpui_component::{ActiveTheme, Icon, Sizable, v_flex};
use signed_core::RepoStatus;
/// The status badge shown next to an issue or pull request: icon + colored square,
/// with a tooltip describing the status.
pub fn status_badge(status: RepoStatus, cx: &App) -> AnyElement {
let (icon, label, tooltip, bg, fg) = match status {
RepoStatus::Open => (
CustomIconName::GitIssueDone,
"open",
"Issue is open",
cx.theme().primary,
cx.theme().primary_foreground,
),
RepoStatus::Closed => (
CustomIconName::GitIssueClosed,
"closed",
"Issue is closed",
cx.theme().danger,
cx.theme().danger_foreground,
),
RepoStatus::Draft => (
CustomIconName::GitIssueOngoing,
"draft",
"Issue is draft",
cx.theme().accent,
cx.theme().accent_foreground,
),
RepoStatus::Applied => (
CustomIconName::GitIssueOpen,
"applied",
"Issue is completed",
cx.theme().secondary,
cx.theme().secondary_foreground,
),
};
v_flex()
.id(label)
.flex_shrink_0()
.size_7()
.items_center()
.justify_center()
.rounded(cx.theme().radius)
.bg(bg)
.child(Icon::new(icon).small().text_color(fg))
.tooltip(move |window, cx| Tooltip::new(tooltip).build(window, cx))
.into_any_element()
}