git_ui.rs

 1use ::settings::Settings;
 2use git::status::FileStatus;
 3use git_panel_settings::GitPanelSettings;
 4use gpui::App;
 5use ui::{ActiveTheme, Color, Icon, IconName, IntoElement};
 6
 7pub mod git_panel;
 8mod git_panel_settings;
 9pub mod repository_selector;
10
11pub fn init(cx: &mut App) {
12    GitPanelSettings::register(cx);
13}
14
15// TODO: Add updated status colors to theme
16pub fn git_status_icon(status: FileStatus, cx: &App) -> impl IntoElement {
17    let (icon_name, color) = if status.is_conflicted() {
18        (
19            IconName::Warning,
20            cx.theme().colors().version_control_conflict,
21        )
22    } else if status.is_deleted() {
23        (
24            IconName::SquareMinus,
25            cx.theme().colors().version_control_deleted,
26        )
27    } else if status.is_modified() {
28        (
29            IconName::SquareDot,
30            cx.theme().colors().version_control_modified,
31        )
32    } else {
33        (
34            IconName::SquarePlus,
35            cx.theme().colors().version_control_added,
36        )
37    };
38    Icon::new(icon_name).color(Color::Custom(color))
39}