-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Git Integration Phase 3 (#12344)
- Loading branch information
1 parent
656977e
commit cf9cdca
Showing
12 changed files
with
499 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright (c) 2023 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
namespace Files.App.Data.Items | ||
{ | ||
public record BranchItem(string Name, bool IsRemote); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<!-- Copyright (c) 2023 Files Community. Licensed under the MIT License. See the LICENSE. --> | ||
<ContentDialog | ||
x:Class="Files.App.Dialogs.AddBranchDialog" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:helpers="using:Files.App.Helpers" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
x:Name="AddBranch" | ||
Title="{helpers:ResourceString Name=CreateNewBranch}" | ||
Closing="ContentDialog_Closing" | ||
CornerRadius="{StaticResource OverlayCornerRadius}" | ||
DefaultButton="Primary" | ||
IsPrimaryButtonEnabled="{x:Bind ViewModel.IsBranchValid, Mode=OneWay}" | ||
PrimaryButtonStyle="{StaticResource AccentButtonStyle}" | ||
PrimaryButtonText="{helpers:ResourceString Name=Create}" | ||
RequestedTheme="{x:Bind helpers:ThemeHelper.RootTheme}" | ||
SecondaryButtonText="{helpers:ResourceString Name=Cancel}" | ||
Style="{StaticResource DefaultContentDialogStyle}" | ||
mc:Ignorable="d"> | ||
|
||
<StackPanel Width="440" Spacing="4"> | ||
<!-- Branch Name --> | ||
<Grid | ||
Padding="12" | ||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" | ||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" | ||
BorderThickness="1" | ||
ColumnSpacing="8" | ||
CornerRadius="4"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
<TextBlock | ||
Grid.Column="0" | ||
VerticalAlignment="Center" | ||
Text="{helpers:ResourceString Name=Name}" /> | ||
<TextBox | ||
x:Name="BranchNameBox" | ||
Grid.Column="1" | ||
Width="260" | ||
PlaceholderText="{helpers:ResourceString Name=EnterName}" | ||
Text="{x:Bind ViewModel.NewBranchName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> | ||
<TextBox.Resources> | ||
<TeachingTip | ||
x:Name="InvalidNameWarning" | ||
Title="{helpers:ResourceString Name=InvalidBranchName}" | ||
IsOpen="{x:Bind ViewModel.ShowWarningTip, Mode=OneWay}" | ||
PreferredPlacement="Bottom" | ||
Target="{x:Bind BranchNameBox}" /> | ||
</TextBox.Resources> | ||
</TextBox> | ||
</Grid> | ||
|
||
<!-- Branch Options --> | ||
<Grid | ||
Padding="12" | ||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" | ||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" | ||
BorderThickness="1" | ||
ColumnSpacing="8" | ||
CornerRadius="4" | ||
RowSpacing="12"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
|
||
<!-- Based On --> | ||
<TextBlock | ||
Grid.Row="0" | ||
Grid.Column="0" | ||
VerticalAlignment="Center" | ||
Text="{helpers:ResourceString Name=BasedOn}" /> | ||
<ComboBox | ||
x:Name="BranchBox" | ||
Grid.Row="0" | ||
Grid.Column="1" | ||
Width="160" | ||
ItemsSource="{x:Bind ViewModel.Branches}" | ||
SelectedItem="{x:Bind ViewModel.BasedOn, Mode=TwoWay}" /> | ||
|
||
<!-- Switch To Branch --> | ||
<TextBlock | ||
Grid.Row="1" | ||
Grid.Column="0" | ||
VerticalAlignment="Center" | ||
Text="{helpers:ResourceString Name=SwitchToNewBranch}" /> | ||
<ToggleSwitch | ||
Grid.Row="1" | ||
Grid.Column="1" | ||
MinWidth="0" | ||
HorizontalAlignment="Right" | ||
IsOn="{x:Bind ViewModel.Checkout, Mode=TwoWay}" /> | ||
</Grid> | ||
</StackPanel> | ||
</ContentDialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) 2023 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
using Files.App.ViewModels.Dialogs; | ||
using Files.Backend.ViewModels.Dialogs; | ||
using Microsoft.UI.Xaml.Controls; | ||
|
||
// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 | ||
|
||
namespace Files.App.Dialogs | ||
{ | ||
public sealed partial class AddBranchDialog : ContentDialog, IDialog<AddBranchDialogViewModel> | ||
{ | ||
public AddBranchDialogViewModel ViewModel | ||
{ | ||
get => (AddBranchDialogViewModel)DataContext; | ||
set => DataContext = value; | ||
} | ||
|
||
public AddBranchDialog() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public new async Task<DialogResult> ShowAsync() => (DialogResult)await base.ShowAsync(); | ||
|
||
private void ContentDialog_Closing(ContentDialog _, ContentDialogClosingEventArgs e) | ||
{ | ||
InvalidNameWarning.IsOpen = false; | ||
Closing -= ContentDialog_Closing; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.