From 88452bd74d4b6210837e785454424ec1d0521e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernat=20Borr=C3=A0s=20Civil?= <70479573+BernatBC@users.noreply.github.com> Date: Sun, 12 Jan 2025 18:47:27 +0100 Subject: [PATCH] Add CommitInfo hardcoded line counter --- src/Resources/Locales/en_US.axaml | 1 + src/Views/CommitBaseInfo.axaml | 10 +++++--- src/Views/LinesChanged.axaml | 22 +++++++++++++++++ src/Views/LinesChanged.axaml.cs | 41 +++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 src/Views/LinesChanged.axaml create mode 100644 src/Views/LinesChanged.axaml.cs diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index cc32cc4a..218be9a3 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -137,6 +137,7 @@ PARENTS REFS SHA + STATS Open in Browser Enter commit subject Description diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index 96d40383..55342d18 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -51,7 +51,7 @@ - + @@ -182,9 +182,13 @@ UseGraphColor="False"/> + + + + - - + + + + + + + + + + + + + + + + + diff --git a/src/Views/LinesChanged.axaml.cs b/src/Views/LinesChanged.axaml.cs new file mode 100644 index 00000000..aa2c8a60 --- /dev/null +++ b/src/Views/LinesChanged.axaml.cs @@ -0,0 +1,41 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace SourceGit.Views +{ + public partial class LinesChanged : UserControl + { + public static readonly DirectProperty AddedLinesProperty = + AvaloniaProperty.RegisterDirect(nameof(AddedLines), o => o.AddedLines); + + public static readonly DirectProperty RemovedLinesProperty = + AvaloniaProperty.RegisterDirect(nameof(RemovedLines), o => o.RemovedLines); + + private int _addedLines; + private int _removedLines; + + public int AddedLines + { + get => _addedLines; + set => SetAndRaise(AddedLinesProperty, ref _addedLines, value); + } + + public int RemovedLines + { + get => _removedLines; + set => SetAndRaise(RemovedLinesProperty, ref _removedLines, value); + } + + public LinesChanged() + { + InitializeComponent(); + this.DataContext = this; + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } + } +}