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;
9mod commit_modal;
10pub mod git_panel;
11mod git_panel_settings;
12pub mod picker_prompt;
13pub mod project_diff;
14mod remote_output_toast;
15pub mod repository_selector;
16
17pub fn init(cx: &mut App) {
18 GitPanelSettings::register(cx);
19 branch_picker::init(cx);
20 cx.observe_new(ProjectDiff::register).detach();
21 commit_modal::init(cx);
22}
23
24// TODO: Add updated status colors to theme
25pub fn git_status_icon(status: FileStatus, cx: &App) -> impl IntoElement {
26 let (icon_name, color) = if status.is_conflicted() {
27 (
28 IconName::Warning,
29 cx.theme().colors().version_control_conflict,
30 )
31 } else if status.is_deleted() {
32 (
33 IconName::SquareMinus,
34 cx.theme().colors().version_control_deleted,
35 )
36 } else if status.is_modified() {
37 (
38 IconName::SquareDot,
39 cx.theme().colors().version_control_modified,
40 )
41 } else {
42 (
43 IconName::SquarePlus,
44 cx.theme().colors().version_control_added,
45 )
46 };
47 Icon::new(icon_name).color(Color::Custom(color))
48}