refactor: rewrite & redesign the ux for AddWorktree popup (#205)

This commit is contained in:
leo 2024-06-28 12:07:33 +08:00
parent a260c89c0d
commit db8e534a0a
No known key found for this signature in database
5 changed files with 100 additions and 54 deletions

View file

@ -13,7 +13,7 @@
<TextBlock FontSize="18"
Classes="bold"
Text="{DynamicResource Text.AddWorktree}"/>
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto" ColumnDefinitions="120,*">
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,32" ColumnDefinitions="150,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
@ -30,20 +30,47 @@
</Button>
</TextBox.InnerRightContent>
</TextBox>
<TextBlock Grid.Row="1" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Text="{DynamicResource Text.AddWorktree.WhatToCheckout}"/>
<StackPanel Grid.Row="1" Grid.Column="1" Height="32" Orientation="Horizontal">
<RadioButton Content="{DynamicResource Text.AddWorktree.WhatToCheckout.Existing}"
GroupName="LocalChanges"
IsChecked="{Binding UseExistingBranch, Mode=TwoWay}" />
<RadioButton Content="{DynamicResource Text.AddWorktree.WhatToCheckout.CreateNew}"
GroupName="LocalChanges"
Margin="8,0,0,0" />
</StackPanel>
<TextBlock Grid.Row="2" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Text="{DynamicResource Text.AddWorktree.Name}"/>
<TextBox Grid.Row="1" Grid.Column="1"
<ComboBox Grid.Row="2" Grid.Column="1"
Height="28" Padding="8,0"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
ItemsSource="{Binding LocalBranches}"
SelectedItem="{Binding SelectedBranch, Mode=TwoWay}"
IsEnabled="{Binding UseExistingBranch, Mode=OneWay}"
IsVisible="{Binding UseExistingBranch, Mode=OneWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="20" VerticalAlignment="Center">
<Path Margin="0,0,8,0" Width="14" Height="14" Fill="{DynamicResource Brush.FG1}" Data="{StaticResource Icons.Branch}"/>
<TextBlock Text="{Binding}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBox Grid.Row="2" Grid.Column="1"
Height="28"
CornerRadius="3"
Text="{Binding CustomName, Mode=TwoWay}"
Watermark="{DynamicResource Text.AddWorktree.Name.Placeholder}"/>
<CheckBox Grid.Row="2" Grid.Column="1"
Content="{DynamicResource Text.AddWorktree.Tracking.Toggle}"
IsChecked="{Binding SetTrackingBranch, Mode=TwoWay}"/>
Text="{Binding SelectedBranch, Mode=TwoWay}"
Watermark="{DynamicResource Text.AddWorktree.Name.Placeholder}"
IsEnabled="{Binding !UseExistingBranch, Mode=OneWay}"
IsVisible="{Binding !UseExistingBranch, Mode=OneWay}"/>
<Border Grid.Row="3" Grid.Column="0"
Height="32"
@ -55,7 +82,7 @@
<ComboBox Grid.Row="3" Grid.Column="1"
Height="28" Padding="8,0"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
ItemsSource="{Binding TrackingBranches}"
ItemsSource="{Binding RemoteBranches}"
SelectedItem="{Binding SelectedTrackingBranch, Mode=TwoWay}"
IsVisible="{Binding SetTrackingBranch, Mode=OneWay}">
<ComboBox.ItemTemplate>
@ -67,6 +94,10 @@
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<CheckBox Grid.Row="4" Grid.Column="1"
Content="{DynamicResource Text.AddWorktree.Tracking.Toggle}"
IsChecked="{Binding SetTrackingBranch, Mode=TwoWay}"/>
</Grid>
</StackPanel>
</UserControl>