Compare commits

...

4 commits

Author SHA1 Message Date
leo
2346082228
ux: style of tab switch in file histories view
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions
2024-09-27 18:23:55 +08:00
leo
699bfe8208
code_style: remove unnecessary margins 2024-09-27 17:14:29 +08:00
leo
a78cf611c0
ux: style for left panel of repository view 2024-09-27 17:12:13 +08:00
leo
a7f609d479
readme: add description for build 2024-09-27 13:52:39 +08:00
5 changed files with 65 additions and 100 deletions

15
build/README.md Normal file
View file

@ -0,0 +1,15 @@
# 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,12 +962,13 @@
</Style> </Style>
</Style> </Style>
<Style Selector="RadioButton.icon_button"> <Style Selector="RadioButton.switch_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 Background="Transparent"> <Border CornerRadius="12" Background="{TemplateBinding Background}">
<ContentPresenter x:Name="PART_ContentPresenter" <ContentPresenter x:Name="PART_ContentPresenter"
Margin="0" Margin="0"
HorizontalAlignment="Center" HorizontalAlignment="Center"
@ -980,9 +981,17 @@
</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="{DynamicResource Brush.Accent}"/> <Setter Property="Fill" Value="White"/>
<Setter Property="Opacity" Value="0.65"/> </Style>
<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 int ViewMode public bool IsViewContent
{ {
get => _viewMode; get => _isViewContent;
set set
{ {
if (SetProperty(ref _viewMode, value)) if (SetProperty(ref _isViewContent, value))
RefreshViewContent(); RefreshViewContent();
} }
} }
@ -93,10 +93,10 @@ namespace SourceGit.ViewModels
return; return;
} }
if (_viewMode == 0) if (_isViewContent)
SetViewContentAsDiff();
else
SetViewContentAsRevisionFile(); SetViewContentAsRevisionFile();
else
SetViewContentAsDiff();
} }
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 int _viewMode = 0; private bool _isViewContent = false;
private object _viewContent = null; private object _viewContent = null;
} }
} }

View file

@ -115,75 +115,19 @@
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}">
<ListBox Grid.Row="0" <StackPanel Grid.Row="0" Margin="0,8" Height="28" HorizontalAlignment="Center" Orientation="Horizontal">
Margin="0,8" <RadioButton Classes="switch_button"
SelectedIndex="{Binding ViewMode, Mode=TwoWay}" GroupName="SearchGroup"
HorizontalAlignment="Center" IsChecked="{Binding !IsViewContent, Mode=OneWay}">
VerticalAlignment="Center" <TextBlock Margin="16,0" Text="{DynamicResource Text.FileHistory.FileChange}" FontWeight="Bold"/>
Background="Transparent" </RadioButton>
BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border2}"
CornerRadius="14"
Padding="3,0">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.Styles> <RadioButton Classes="switch_button"
<Style Selector="ListBoxItem"> GroupName="SearchGroup"
<Setter Property="Height" Value="28"/> IsChecked="{Binding IsViewContent, Mode=TwoWay}">
<Setter Property="Padding" Value="0"/> <TextBlock Margin="16,0" Text="{DynamicResource Text.FileHistory.FileContent}" FontWeight="Bold"/>
<Setter Property="Background" Value="Transparent"/> </RadioButton>
</Style> </StackPanel>
<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,30 +19,21 @@
<!-- 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) -->
<Grid Grid.Row="0" Height="24" Margin="0,6" HorizontalAlignment="Center" ColumnDefinitions="48,1,48"> <StackPanel Grid.Row="0" Margin="0,6" Height="24" HorizontalAlignment="Center" Orientation="Horizontal">
<Border Grid.Column="0" Grid.ColumnSpan="3" <RadioButton Classes="switch_button"
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="14" Height="14" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Home}"/> <Path Width="12" Height="12" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Home}"/>
</RadioButton> </RadioButton>
<Rectangle Grid.Column="1" Width="0.65" HorizontalAlignment="Center" VerticalAlignment="Stretch" Fill="{DynamicResource Brush.Border2}"/> <RadioButton Classes="switch_button"
<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="14" Height="14" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Search}"/> <Path Width="12" Height="12" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Search}"/>
</RadioButton> </RadioButton>
</Grid> </StackPanel>
<!-- 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}">
@ -138,6 +129,12 @@
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"
@ -343,9 +340,9 @@
</Grid> </Grid>
<!-- Commit Search Panel --> <!-- Commit Search Panel -->
<Grid Grid.Row="1" RowDefinitions="26,26,*" Margin="8,0,4,8" IsVisible="{Binding IsSearching}" PropertyChanged="OnSearchCommitPanelPropertyChanged"> <Grid Grid.Row="1" RowDefinitions="Auto,26,*" Margin="8,0,4,8" IsVisible="{Binding IsSearching}" PropertyChanged="OnSearchCommitPanelPropertyChanged">
<!-- Search Input Box --> <!-- Search Input Box -->
<Grid Grid.Row="0"> <Grid Grid.Row="0" Height="26" Margin="0,4,0,0">
<TextBox x:Name="TxtSearchCommitsBox" <TextBox x:Name="TxtSearchCommitsBox"
Height="24" Height="24"
BorderThickness="1" BorderThickness="1"
@ -446,10 +443,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"