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