@@ -2,19 +2,14 @@ use futures::Future;
use git::blame::BlameEntry;
use git::Oid;
use gpui::{
- Asset, Element, ParentElement, Render, ScrollHandle, StatefulInteractiveElement, WeakView,
- WindowContext,
+ Asset, ClipboardItem, Element, ParentElement, Render, ScrollHandle, StatefulInteractiveElement,
+ WeakView, WindowContext,
};
use settings::Settings;
use std::hash::Hash;
-use theme::{ActiveTheme, ThemeSettings};
+use theme::ThemeSettings;
use time::UtcOffset;
-use ui::{
- div, h_flex, tooltip_container, v_flex, Avatar, Button, ButtonStyle, Clickable as _, Color,
- FluentBuilder, Icon, IconName, IconPosition, InteractiveElement as _, IntoElement,
- SharedString, Styled as _, ViewContext,
-};
-use ui::{ButtonCommon, Disableable as _};
+use ui::{prelude::*, tooltip_container, Avatar};
use workspace::Workspace;
use crate::git::blame::{CommitDetails, GitRemote};
@@ -130,6 +125,7 @@ impl Render for BlameEntryTooltip {
let author_email = self.blame_entry.author_mail.clone();
let short_commit_id = self.blame_entry.sha.display_short();
+ let full_sha = self.blame_entry.sha.to_string().clone();
let absolute_timestamp = blame_entry_absolute_timestamp(&self.blame_entry);
let message = self
@@ -240,6 +236,16 @@ impl Render for BlameEntryTooltip {
})
},
),
+ )
+ .child(
+ IconButton::new("copy-sha-button", IconName::Copy)
+ .icon_color(Color::Muted)
+ .on_click(move |_, cx| {
+ cx.stop_propagation();
+ cx.write_to_clipboard(ClipboardItem::new(
+ full_sha.clone(),
+ ))
+ }),
),
),
),