<helper:NavigablePage
    x:Class="Microsoft.PowerToys.Settings.UI.Views.NewPlusPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:helper="using:Microsoft.PowerToys.Settings.UI.Helpers"
    xmlns:local="clr-namespace:Microsoft.PowerToys.Settings.UI.ViewModels"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
    xmlns:ui="using:CommunityToolkit.WinUI"
    AutomationProperties.LandmarkType="Main"
    mc:Ignorable="d">

    <controls:SettingsPageControl x:Uid="NewPlus" ModuleImageSource="ms-appx:///Assets/Settings/Modules/NewPlus.png">
        <controls:SettingsPageControl.ModuleContent>
            <StackPanel
                ChildrenTransitions="{StaticResource SettingsCardsAnimations}"
                Orientation="Vertical"
                Spacing="2">
                <controls:GPOInfoControl ShowWarning="{x:Bind ViewModel.IsEnabledGpoConfigured, Mode=OneWay}">
                    <tkcontrols:SettingsCard
                        Name="NewPlusEnableToggle"
                        x:Uid="NewPlus_Enable_Toggle"
                        HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/NewPlus.png}">
                        <ToggleSwitch
                            x:Uid="ToggleSwitch"
                            AutomationProperties.Name="{Binding ElementName=NewPlusEnableToggle, Path=Header}"
                            IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
                    </tkcontrols:SettingsCard>
                </controls:GPOInfoControl>
                <controls:SettingsGroup x:Uid="NewPlus_Templates" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                    <tkcontrols:SettingsCard
                        Name="NewPlusTemplatesLocation"
                        x:Uid="NewPlus_Templates_Location"
                        ActionIcon="{ui:FontIcon Glyph=&#xE8A7;}"
                        Command="{x:Bind ViewModel.OpenCurrentNewTemplateFolder}"
                        HeaderIcon="{ui:FontIcon Glyph=&#xF12B;}"
                        IsClickEnabled="True">
                        <Button
                            x:Uid="NewPlus_Templates_Location_Change"
                            Command="{x:Bind ViewModel.PickAnotherNewTemplateFolder}"
                            Style="{ThemeResource AccentButtonStyle}" />

                        <tkcontrols:SettingsCard.Description>
                            <StackPanel>
                                <TextBlock Text="{x:Bind ViewModel.TemplateLocation, Mode=OneWay}" />
                                <HyperlinkButton x:Uid="NewPlus_Templates_Location_Learn_More" NavigateUri="https://aka.ms/PowerToysOverview_NewPlus_TemplatesLocation" />
                            </StackPanel>
                        </tkcontrols:SettingsCard.Description>
                    </tkcontrols:SettingsCard>

                    <InfoBar
                        x:Uid="NewPlus_TemplatesNotBackupAndRestoreWarning"
                        IsClosable="False"
                        IsOpen="{x:Bind ViewModel.IsEnabled, Mode=OneWay}"
                        IsTabStop="{x:Bind ViewModel.IsEnabled, Mode=OneWay}"
                        Severity="Informational" />
                </controls:SettingsGroup>
                <controls:SettingsGroup x:Uid="NewPlus_Display_Options" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                    <controls:GPOInfoControl ShowWarning="{x:Bind ViewModel.IsHideFileExtSettingGPOConfigured, Mode=OneWay}">
                        <tkcontrols:SettingsCard
                            Name="NewPlusHideFileExtensionToggle"
                            x:Uid="NewPlus_Hide_File_Extension_Toggle"
                            IsEnabled="{x:Bind ViewModel.IsHideFileExtSettingsCardEnabled, Mode=OneWay}">
                            <ToggleSwitch
                                x:Uid="HideFileExtensionToggle"
                                AutomationProperties.Name="{Binding ElementName=NewPlusHideFileExtensionToggle, Path=Header}"
                                IsOn="{x:Bind ViewModel.HideFileExtension, Mode=TwoWay}" />
                        </tkcontrols:SettingsCard>
                    </controls:GPOInfoControl>

                    <tkcontrols:SettingsCard Name="NewPlusHideStartingDigitsToggle" x:Uid="NewPlus_Hide_Starting_Digits_Toggle">
                        <ToggleSwitch
                            x:Uid="HideStartingDigitsToggle"
                            AutomationProperties.Name="{Binding ElementName=NewPlusHideStartingDigitsToggle, Path=Header}"
                            IsOn="{x:Bind ViewModel.HideStartingDigits, Mode=TwoWay}" />
                        <tkcontrols:SettingsCard.Description>
                            <TextBlock x:Uid="NewPlus_Hide_Starting_Digits_Description" />
                        </tkcontrols:SettingsCard.Description>
                    </tkcontrols:SettingsCard>

                    <controls:GPOInfoControl ShowWarning="{x:Bind ViewModel.IsNewPlusHideBuiltInNewToggleSettingGPOConfigured, Mode=OneWay}">
                        <tkcontrols:SettingsCard x:Uid="NewPlusHideBuiltInNewToggle" IsEnabled="{x:Bind ViewModel.IsDisableBuiltInNewSettingsCardEnabled, Mode=OneWay}">
                            <ToggleSwitch
                                x:Uid="HideBuiltInNewToggle"
                                AutomationProperties.Name="{Binding ElementName=NewPlusHideBuiltInNewToggle, Path=Header}"
                                IsOn="{x:Bind ViewModel.HideBuiltInNew, Mode=TwoWay}" />
                        </tkcontrols:SettingsCard>
                    </controls:GPOInfoControl>
                </controls:SettingsGroup>

                <controls:SettingsGroup x:Uid="NewPlus_behavior" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
                    <controls:GPOInfoControl ShowWarning="{x:Bind ViewModel.IsReplaceVariablesSettingGPOConfigured, Mode=OneWay}">
                        <tkcontrols:SettingsCard
                            Name="NewPlusBehaviourReplaceVariablesToggle"
                            x:Uid="NewPlus_Behaviour_Replace_Variables_Toggle"
                            IsEnabled="{x:Bind ViewModel.IsReplaceVariablesSettingsCardEnabled, Mode=OneWay}">
                            <StackPanel Orientation="Horizontal" Spacing="4">
                                <ToggleSwitch
                                    x:Uid="ReplaceVariablesToggle"
                                    AutomationProperties.Name="{Binding ElementName=NewPlusBehaviourReplaceVariablesToggle, Path=Header}"
                                    IsOn="{x:Bind ViewModel.ReplaceVariables, Mode=TwoWay}" />
                                <Button
                                    x:Uid="FileCreationButton"
                                    Width="28"
                                    Height="40"
                                    Margin="0,0,-4,0"
                                    Padding="0"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center"
                                    Background="Transparent"
                                    BorderBrush="Transparent"
                                    Content="&#xE946;"
                                    FontFamily="{ThemeResource SymbolThemeFontFamily}">
                                    <Button.Flyout>
                                        <Flyout x:Name="VariableExamplesFlyout" ShouldConstrainToRootBounds="False">
                                            <Grid>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                </Grid.RowDefinitions>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="62" />
                                                    <ColumnDefinition Width="300" />
                                                </Grid.ColumnDefinitions>
                                                <TextBlock
                                                    Grid.Row="0"
                                                    Grid.Column="0"
                                                    Text="$YYYY" />
                                                <TextBlock
                                                    Grid.Row="0"
                                                    Grid.Column="1"
                                                    Margin="0,0,0,5"
                                                    TextWrapping="Wrap"><Run x:Uid="NewPlus_Year_YYYY_Variable_Description" /></TextBlock>

                                                <TextBlock
                                                    Grid.Row="1"
                                                    Grid.Column="0"
                                                    Text="$MM" />
                                                <TextBlock
                                                    Grid.Row="1"
                                                    Grid.Column="1"
                                                    Margin="0,0,0,5"
                                                    TextWrapping="Wrap"><Run x:Uid="NewPlus_Month_MM_Variable_Description" /></TextBlock>

                                                <TextBlock
                                                    Grid.Row="2"
                                                    Grid.Column="0"
                                                    Text="$DD" />
                                                <TextBlock
                                                    Grid.Row="2"
                                                    Grid.Column="1"
                                                    Margin="0,0,0,5"
                                                    TextWrapping="Wrap"><Run x:Uid="NewPlus_Day_DD_Variable_Description" /></TextBlock>

                                                <TextBlock
                                                    Grid.Row="3"
                                                    Grid.Column="0"
                                                    Text="$hh" />
                                                <TextBlock
                                                    Grid.Row="3"
                                                    Grid.Column="1"
                                                    Margin="0,0,0,5"
                                                    TextWrapping="Wrap"><Run x:Uid="NewPlus_Hour_hh_Variable_Description" /></TextBlock>

                                                <TextBlock
                                                    Grid.Row="4"
                                                    Grid.Column="0"
                                                    Text="$mm" />
                                                <TextBlock
                                                    Grid.Row="4"
                                                    Grid.Column="1"
                                                    Margin="0,0,0,5"
                                                    TextWrapping="Wrap"><Run x:Uid="NewPlus_Minute_mm_Variable_Description" /></TextBlock>

                                                <TextBlock
                                                    Grid.Row="5"
                                                    Grid.Column="0"
                                                    Text="$ss" />
                                                <TextBlock
                                                    Grid.Row="5"
                                                    Grid.Column="1"
                                                    Margin="0,0,0,0"
                                                    TextWrapping="Wrap"><Run x:Uid="NewPlus_Second_ss_Variable_Description" /></TextBlock>
                                            </Grid>
                                        </Flyout>
                                    </Button.Flyout>
                                </Button>
                            </StackPanel>
                            <tkcontrols:SettingsCard.Description>
                                <StackPanel>
                                    <HyperlinkButton x:Uid="NewPlus_Behaviour_Replace_Variables_Learn_More" NavigateUri="https://aka.ms/PowerToysOverview_NewPlus" />
                                </StackPanel>
                            </tkcontrols:SettingsCard.Description>
                        </tkcontrols:SettingsCard>
                    </controls:GPOInfoControl>
                </controls:SettingsGroup>
            </StackPanel>
        </controls:SettingsPageControl.ModuleContent>

        <controls:SettingsPageControl.PrimaryLinks>
            <controls:PageLink x:Uid="NewPlus_Learn_More" Link="https://aka.ms/PowerToysOverview_NewPlus" />
        </controls:SettingsPageControl.PrimaryLinks>
        <controls:SettingsPageControl.SecondaryLinks>
            <controls:PageLink Link="https://www.linkedin.com/in/christian-gaardmark/" Text="Christian Gaardmark" />
        </controls:SettingsPageControl.SecondaryLinks>
    </controls:SettingsPageControl>

</helper:NavigablePage>
