Compare commits

..

No commits in common. "2346082228e0ce4fafd9de862624bf47fdbd3b4c" and "bcc43e167cff2afd759d8a80561b282009f6411f" have entirely different histories.

5 changed files with 100 additions and 65 deletions

View file

@ -1,15 +0,0 @@
# build
> [!WARNING]
> The files under the `build` folder is used for `Github Action` only, **NOT** for end users.
## How to build this project manually
1. Make sure [.NET SDK 8](https://dotnet.microsoft.com/en-us/download) is installed on your machine.
2. Clone this project
3. Run the follow command under the project root dir
```sh
dotnet publish -c Release -r $RUNTIME_IDENTIFIER -o $DESTINATION_FOLDER src/SourceGit.csproj
```
> [!NOTE]
> Please replace the `$RUNTIME_IDENTIFIER` with one of `win-x64`,`win-arm64`,`linux-x64`,`linux-arm64`,`osx-x64`,`osx-arm64`, and replece the `$DESTINATION_FOLDER` with the real path that will store the output executable files.

View file

@ -962,13 +962,12 @@
</Style> </Style>
</Style> </Style>
<Style Selector="RadioButton.switch_button"> <Style Selector="RadioButton.icon_button">
<Setter Property="Height" Value="24"/>
<Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border CornerRadius="12" Background="{TemplateBinding Background}"> <Border Background="Transparent">
<ContentPresenter x:Name="PART_ContentPresenter" <ContentPresenter x:Name="PART_ContentPresenter"
Margin="0" Margin="0"
HorizontalAlignment="Center" HorizontalAlignment="Center"
@ -981,17 +980,9 @@
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^:checked">
<Setter Property="Background" Value="{DynamicResource Brush.Accent}"/>
</Style>
<Style Selector="^:checked Path"> <Style Selector="^:checked Path">
<Setter Property="Fill" Value="White"/> <Setter Property="Fill" Value="{DynamicResource Brush.Accent}"/>
</Style> <Setter Property="Opacity" Value="0.65"/>
<Style Selector="^ TextBlock">
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
</Style>
<Style Selector="^:checked TextBlock">
<Setter Property="Foreground" Value="White"/>
</Style> </Style>
</Style> </Style>

View file

@ -41,12 +41,12 @@ namespace SourceGit.ViewModels
} }
} }
public bool IsViewContent public int ViewMode
{ {
get => _isViewContent; get => _viewMode;
set set
{ {
if (SetProperty(ref _isViewContent, value)) if (SetProperty(ref _viewMode, value))
RefreshViewContent(); RefreshViewContent();
} }
} }
@ -93,10 +93,10 @@ namespace SourceGit.ViewModels
return; return;
} }
if (_isViewContent) if (_viewMode == 0)
SetViewContentAsRevisionFile();
else
SetViewContentAsDiff(); SetViewContentAsDiff();
else
SetViewContentAsRevisionFile();
} }
private void SetViewContentAsRevisionFile() private void SetViewContentAsRevisionFile()
@ -197,7 +197,7 @@ namespace SourceGit.ViewModels
private bool _isLoading = true; private bool _isLoading = true;
private List<Models.Commit> _commits = null; private List<Models.Commit> _commits = null;
private Models.Commit _selectedCommit = null; private Models.Commit _selectedCommit = null;
private bool _isViewContent = false; private int _viewMode = 0;
private object _viewContent = null; private object _viewContent = null;
} }
} }

View file

@ -115,19 +115,75 @@
IsVisible="{Binding IsLoading}"/> IsVisible="{Binding IsLoading}"/>
<Grid Grid.Column="2" RowDefinitions="Auto,*,Auto" IsVisible="{Binding !IsLoading}"> <Grid Grid.Column="2" RowDefinitions="Auto,*,Auto" IsVisible="{Binding !IsLoading}">
<StackPanel Grid.Row="0" Margin="0,8" Height="28" HorizontalAlignment="Center" Orientation="Horizontal"> <ListBox Grid.Row="0"
<RadioButton Classes="switch_button" Margin="0,8"
GroupName="SearchGroup" SelectedIndex="{Binding ViewMode, Mode=TwoWay}"
IsChecked="{Binding !IsViewContent, Mode=OneWay}"> HorizontalAlignment="Center"
<TextBlock Margin="16,0" Text="{DynamicResource Text.FileHistory.FileChange}" FontWeight="Bold"/> VerticalAlignment="Center"
</RadioButton> Background="Transparent"
BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border2}"
CornerRadius="14"
Padding="3,0">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<RadioButton Classes="switch_button" <ListBox.Styles>
GroupName="SearchGroup" <Style Selector="ListBoxItem">
IsChecked="{Binding IsViewContent, Mode=TwoWay}"> <Setter Property="Height" Value="28"/>
<TextBlock Margin="16,0" Text="{DynamicResource Text.FileHistory.FileContent}" FontWeight="Bold"/> <Setter Property="Padding" Value="0"/>
</RadioButton> <Setter Property="Background" Value="Transparent"/>
</StackPanel> </Style>
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="ListBoxItem:selected /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="ListBoxItem Border.switcher_bg">
<Setter Property="Height" Value="22"/>
<Setter Property="CornerRadius" Value="11"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="16,0"/>
</Style>
<Style Selector="ListBoxItem:selected Border.switcher_bg">
<Setter Property="Background" Value="{DynamicResource Brush.Accent}"/>
</Style>
<Style Selector="TextBlock.view_mode_switcher">
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
</Style>
<Style Selector="ListBoxItem:pointerover TextBlock.view_mode_switcher">
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
</Style>
<Style Selector="ListBoxItem:selected TextBlock.view_mode_switcher">
<Setter Property="Foreground" Value="White"/>
</Style>
</ListBox.Styles>
<ListBoxItem>
<Border Classes="switcher_bg">
<TextBlock Classes="view_mode_switcher" Text="{DynamicResource Text.FileHistory.FileChange}"/>
</Border>
</ListBoxItem>
<ListBoxItem>
<Border Classes="switcher_bg">
<TextBlock Classes="view_mode_switcher" Text="{DynamicResource Text.FileHistory.FileContent}"/>
</Border>
</ListBoxItem>
</ListBox>
<ContentControl Grid.Row="1" Margin="4,4,8,8" Content="{Binding ViewContent}"> <ContentControl Grid.Row="1" Margin="4,4,8,8" Content="{Binding ViewContent}">
<ContentControl.DataTemplates> <ContentControl.DataTemplates>

View file

@ -19,22 +19,31 @@
<!-- Left Panel --> <!-- Left Panel -->
<Grid Grid.Column="0" RowDefinitions="Auto,*"> <Grid Grid.Column="0" RowDefinitions="Auto,*">
<!-- Page Switcher for Left Contents (Dashboard or CommitSearch) --> <!-- Page Switcher for Left Contents (Dashboard or CommitSearch) -->
<StackPanel Grid.Row="0" Margin="0,6" Height="24" HorizontalAlignment="Center" Orientation="Horizontal"> <Grid Grid.Row="0" Height="24" Margin="0,6" HorizontalAlignment="Center" ColumnDefinitions="48,1,48">
<RadioButton Classes="switch_button" <Border Grid.Column="0" Grid.ColumnSpan="3"
Height="24"
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
CornerRadius="12"/>
<RadioButton Grid.Column="0"
Classes="icon_button"
Width="48" Width="48"
GroupName="SearchGroup" GroupName="SearchGroup"
IsChecked="{Binding !IsSearching, Mode=OneWay}"> IsChecked="{Binding !IsSearching, Mode=OneWay}">
<Path Width="12" Height="12" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Home}"/> <Path Width="14" Height="14" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Home}"/>
</RadioButton> </RadioButton>
<RadioButton Classes="switch_button" <Rectangle Grid.Column="1" Width="0.65" HorizontalAlignment="Center" VerticalAlignment="Stretch" Fill="{DynamicResource Brush.Border2}"/>
<RadioButton Grid.Column="2"
Width="48" Width="48"
Classes="icon_button"
GroupName="SearchGroup" GroupName="SearchGroup"
IsChecked="{Binding IsSearching, Mode=TwoWay}"> IsChecked="{Binding IsSearching, Mode=TwoWay}">
<Path Width="12" Height="12" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Search}"/> <Path Width="14" Height="14" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Search}"/>
</RadioButton> </RadioButton>
</StackPanel> </Grid>
<!-- Dashboard --> <!-- Dashboard -->
<Grid Grid.Row="1" Margin="0,0,0,8" RowDefinitions="Auto,Auto,*" IsVisible="{Binding !IsSearching}"> <Grid Grid.Row="1" Margin="0,0,0,8" RowDefinitions="Auto,Auto,*" IsVisible="{Binding !IsSearching}">
<!-- Page Switcher for Right Panel --> <!-- Page Switcher for Right Panel -->
@ -129,12 +138,6 @@
Watermark="{DynamicResource Text.Repository.Filter}" Watermark="{DynamicResource Text.Repository.Filter}"
Text="{Binding Filter, Mode=TwoWay}" Text="{Binding Filter, Mode=TwoWay}"
VerticalContentAlignment="Center"> VerticalContentAlignment="Center">
<TextBox.Styles>
<Style Selector="TextBox /template/ TextBlock#PART_Watermark">
<Setter Property="FontSize" Value="12"/>
</Style>
</TextBox.Styles>
<TextBox.InnerLeftContent> <TextBox.InnerLeftContent>
<Path Width="14" Height="14" <Path Width="14" Height="14"
Margin="6,0,0,0" Margin="6,0,0,0"
@ -340,9 +343,9 @@
</Grid> </Grid>
<!-- Commit Search Panel --> <!-- Commit Search Panel -->
<Grid Grid.Row="1" RowDefinitions="Auto,26,*" Margin="8,0,4,8" IsVisible="{Binding IsSearching}" PropertyChanged="OnSearchCommitPanelPropertyChanged"> <Grid Grid.Row="1" RowDefinitions="26,26,*" Margin="8,0,4,8" IsVisible="{Binding IsSearching}" PropertyChanged="OnSearchCommitPanelPropertyChanged">
<!-- Search Input Box --> <!-- Search Input Box -->
<Grid Grid.Row="0" Height="26" Margin="0,4,0,0"> <Grid Grid.Row="0">
<TextBox x:Name="TxtSearchCommitsBox" <TextBox x:Name="TxtSearchCommitsBox"
Height="24" Height="24"
BorderThickness="1" BorderThickness="1"
@ -443,10 +446,10 @@
<CheckBox Height="24" <CheckBox Height="24"
Margin="4,0,0,0" Margin="4,0,0,0"
FontSize="12"
Content="{DynamicResource Text.Repository.Search.InCurrentBranch}"
IsChecked="{Binding OnlySearchCommitsInCurrentBranch, Mode=TwoWay}" IsChecked="{Binding OnlySearchCommitsInCurrentBranch, Mode=TwoWay}"
IsVisible="{Binding SearchCommitFilterType, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"> IsVisible="{Binding SearchCommitFilterType, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/>
<TextBlock Text="{DynamicResource Text.Repository.Search.InCurrentBranch}" FontSize="12"/>
</CheckBox>
</StackPanel> </StackPanel>
<ListBox Grid.Row="2" <ListBox Grid.Row="2"