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

This commit is contained in:
leo 2024-09-27 18:23:55 +08:00
parent 699bfe8208
commit 2346082228
No known key found for this signature in database
4 changed files with 27 additions and 76 deletions

View file

@ -963,7 +963,6 @@
</Style>
<Style Selector="RadioButton.switch_button">
<Setter Property="Width" Value="48"/>
<Setter Property="Height" Value="24"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
@ -988,6 +987,12 @@
<Style Selector="^:checked Path">
<Setter Property="Fill" Value="White"/>
</Style>
<Style Selector="^ TextBlock">
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
</Style>
<Style Selector="^:checked TextBlock">
<Setter Property="Foreground" Value="White"/>
</Style>
</Style>
<Style Selector="ToggleButton.group_expander">

View file

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

View file

@ -115,75 +115,19 @@
IsVisible="{Binding IsLoading}"/>
<Grid Grid.Column="2" RowDefinitions="Auto,*,Auto" IsVisible="{Binding !IsLoading}">
<ListBox Grid.Row="0"
Margin="0,8"
SelectedIndex="{Binding ViewMode, Mode=TwoWay}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border2}"
CornerRadius="14"
Padding="3,0">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<StackPanel Grid.Row="0" Margin="0,8" Height="28" HorizontalAlignment="Center" Orientation="Horizontal">
<RadioButton Classes="switch_button"
GroupName="SearchGroup"
IsChecked="{Binding !IsViewContent, Mode=OneWay}">
<TextBlock Margin="16,0" Text="{DynamicResource Text.FileHistory.FileChange}" FontWeight="Bold"/>
</RadioButton>
<ListBox.Styles>
<Style Selector="ListBoxItem">
<Setter Property="Height" Value="28"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
</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>
<RadioButton Classes="switch_button"
GroupName="SearchGroup"
IsChecked="{Binding IsViewContent, Mode=TwoWay}">
<TextBlock Margin="16,0" Text="{DynamicResource Text.FileHistory.FileContent}" FontWeight="Bold"/>
</RadioButton>
</StackPanel>
<ContentControl Grid.Row="1" Margin="4,4,8,8" Content="{Binding ViewContent}">
<ContentControl.DataTemplates>

View file

@ -21,12 +21,14 @@
<!-- Page Switcher for Left Contents (Dashboard or CommitSearch) -->
<StackPanel Grid.Row="0" Margin="0,6" Height="24" HorizontalAlignment="Center" Orientation="Horizontal">
<RadioButton Classes="switch_button"
Width="48"
GroupName="SearchGroup"
IsChecked="{Binding !IsSearching, Mode=OneWay}">
<Path Width="12" Height="12" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Home}"/>
</RadioButton>
<RadioButton Classes="switch_button"
Width="48"
GroupName="SearchGroup"
IsChecked="{Binding IsSearching, Mode=TwoWay}">
<Path Width="12" Height="12" Stretch="Fill" HorizontalAlignment="Center" Data="{StaticResource Icons.Search}"/>