<commit_before>﻿<Page
    x:Class="Zermelo.App.UWP.Views.AnnouncementsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Zermelo.App.UWP.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:t10c="using:Template10.Controls"
    xmlns:t10conv="using:Template10.Converters"
    xmlns:c="using:Zermelo.App.UWP.Controls"
    xmlns:z="using:Zermelo.API.Models"
    mc:Ignorable="d">

    <Page.Resources>

        <t10conv:ChangeTypeConverter x:Key="TypeConverter"/>

        <ControlTemplate TargetType="ToggleButton" x:Key="ModalCloseButton">
            <Grid x:Name="RootGrid">
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal">
                            <Storyboard>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="PointerOver">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames 
                                    Storyboard.TargetName="RootGrid" 
                                    Storyboard.TargetProperty="Background">
                                    <DiscreteObjectKeyFrame 
                                        KeyTime="0" 
                                        Value="{ThemeResource CustomLighterColor}" />
                                </ObjectAnimationUsingKeyFrames>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Pressed">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames 
                                    Storyboard.TargetName="RootGrid" 
                                    Storyboard.TargetProperty="Background">
                                    <DiscreteObjectKeyFrame 
                                        KeyTime="0" 
                                        Value="{ThemeResource CustomColor}" />
                                </ObjectAnimationUsingKeyFrames>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
                            </Storyboard>
                        </VisualState>

                        <VisualState x:Name="Checked">
                            <Storyboard>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="CheckedPointerOver">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames 
                                    Storyboard.TargetName="RootGrid" 
                                    Storyboard.TargetProperty="Background">
                                    <DiscreteObjectKeyFrame 
                                        KeyTime="0" 
                                        Value="{ThemeResource CustomLighterColor}" />
                                </ObjectAnimationUsingKeyFrames>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="CheckedPressed">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames 
                                    Storyboard.TargetName="RootGrid" 
                                    Storyboard.TargetProperty="Background">
                                    <DiscreteObjectKeyFrame 
                                        KeyTime="0" 
                                        Value="{ThemeResource CustomColor}" />
                                </ObjectAnimationUsingKeyFrames>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>

                <Border BorderThickness="12" BorderBrush="Transparent">
                    <SymbolIcon Symbol="Clear"/>
                </Border>
            </Grid>
        </ControlTemplate>

        <DataTemplate x:Key="AnnouncementModalTemplate" x:DataType="z:Announcement">
            <StackPanel
                Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
                Padding="12">

                <TextBlock 
                    Text="{x:Bind Title, Mode=OneWay}"
                    FontSize="{ThemeResource TextStyleExtraLargeFontSize}"
                    TextWrapping="WrapWholeWords"/>
                
                <TextBlock 
                    Text="{x:Bind Text, Mode=OneWay}"
                    TextWrapping="WrapWholeWords"/>
            </StackPanel>
        </DataTemplate>
        
    </Page.Resources>

    <RelativePanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <t10c:PageHeader
            x:Name="Header"
            Text="Mededelingen"
            EllipsisVisibility="Collapsed"
            RelativePanel.AlignTopWithPanel="True"
            RelativePanel.AlignLeftWithPanel="True"
            RelativePanel.AlignRightWithPanel="True">

            <t10c:PageHeader.PrimaryCommands>
                <AppBarButton
                    Icon="Refresh"
                    Label="Vernieuwen"
                    Command="{x:Bind ViewModel.Refresh}"/>
            </t10c:PageHeader.PrimaryCommands>

        </t10c:PageHeader>

        <Grid
            RelativePanel.Below="Header"
            RelativePanel.AlignBottomWithPanel="True"
            RelativePanel.AlignLeftWithPanel="True"
            RelativePanel.AlignRightWithPanel="True"
            EntranceNavigationTransitionInfo.IsTargetElement="True">

            <t10c:ModalDialog x:Name="Modal" CanBackButtonDismiss="True">
                <t10c:ModalDialog.Content>
                    <ListView
                        x:Name="AnnouncementsListView"
                        SelectionMode="None"
                        IsItemClickEnabled="True"
                        ItemsSource="{x:Bind ViewModel.Announcements, Mode=OneWay}"
                        ItemContainerStyle="{StaticResource ListViewItemStyle}"
                        Padding="0,0,0,12"
                        ItemClick="AnnouncementsListView_ItemClick">

                        <ListView.ItemTemplate>
                            <DataTemplate x:DataType="z:Announcement">
                                <TextBlock Text="{x:Bind Title, Mode=OneWay}"/>
                            </DataTemplate>
                        </ListView.ItemTemplate>

                    </ListView>
                </t10c:ModalDialog.Content>

                <t10c:ModalDialog.ModalContent>
                    <Grid>
                        <ScrollViewer>
                            <ContentControl
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Margin="12"
                            Content="{x:Bind ViewModel.SelectedAnnouncement, Mode=OneWay}"
                            ContentTemplate="{StaticResource AnnouncementModalTemplate}"/>
                        </ScrollViewer>

                        <ToggleButton
                            Template="{StaticResource ModalCloseButton}"
                            IsChecked="{x:Bind Modal.IsModal, Mode=TwoWay, Converter={StaticResource TypeConverter}}"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top"/>
                    </Grid>
                </t10c:ModalDialog.ModalContent>
            </t10c:ModalDialog>
        </Grid>

        <ProgressBar
            RelativePanel.Below="Header"
            RelativePanel.AlignLeftWithPanel="True"
            RelativePanel.AlignRightWithPanel="True"
            Margin="0,4,0,0"
            Background="Transparent"
            IsIndeterminate="{x:Bind ViewModel.IsLoading, Mode=OneWay}" />

    </RelativePanel>
</Page>
<commit_msg>Show a message when there are no Announcements<commit_after>﻿<Page
    x:Class="Zermelo.App.UWP.Views.AnnouncementsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Zermelo.App.UWP.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:t10c="using:Template10.Controls"
    xmlns:t10conv="using:Template10.Converters"
    xmlns:col="using:System.Collections.Generic"
    xmlns:z="using:Zermelo.API.Models"
    mc:Ignorable="d">

    <Page.Resources>

        <t10conv:ChangeTypeConverter x:Key="TypeConverter"/>

        <t10conv:ValueWhenConverter x:Key="VisibleWhenZeroConverter">
            <t10conv:ValueWhenConverter.When>
                <x:Int32>0</x:Int32>
            </t10conv:ValueWhenConverter.When>
            <t10conv:ValueWhenConverter.Value>
                <Visibility>Visible</Visibility>
            </t10conv:ValueWhenConverter.Value>
            <t10conv:ValueWhenConverter.Otherwise>
                <Visibility>Collapsed</Visibility>
            </t10conv:ValueWhenConverter.Otherwise>
        </t10conv:ValueWhenConverter>

        <ControlTemplate TargetType="ToggleButton" x:Key="ModalCloseButton">
            <Grid x:Name="RootGrid">
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal">
                            <Storyboard>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="PointerOver">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames 
                                    Storyboard.TargetName="RootGrid" 
                                    Storyboard.TargetProperty="Background">
                                    <DiscreteObjectKeyFrame 
                                        KeyTime="0" 
                                        Value="{ThemeResource CustomLighterColor}" />
                                </ObjectAnimationUsingKeyFrames>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Pressed">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames 
                                    Storyboard.TargetName="RootGrid" 
                                    Storyboard.TargetProperty="Background">
                                    <DiscreteObjectKeyFrame 
                                        KeyTime="0" 
                                        Value="{ThemeResource CustomColor}" />
                                </ObjectAnimationUsingKeyFrames>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
                            </Storyboard>
                        </VisualState>

                        <VisualState x:Name="Checked">
                            <Storyboard>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="CheckedPointerOver">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames 
                                    Storyboard.TargetName="RootGrid" 
                                    Storyboard.TargetProperty="Background">
                                    <DiscreteObjectKeyFrame 
                                        KeyTime="0" 
                                        Value="{ThemeResource CustomLighterColor}" />
                                </ObjectAnimationUsingKeyFrames>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="CheckedPressed">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames 
                                    Storyboard.TargetName="RootGrid" 
                                    Storyboard.TargetProperty="Background">
                                    <DiscreteObjectKeyFrame 
                                        KeyTime="0" 
                                        Value="{ThemeResource CustomColor}" />
                                </ObjectAnimationUsingKeyFrames>
                                <PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>

                <Border BorderThickness="12" BorderBrush="Transparent">
                    <SymbolIcon Symbol="Clear"/>
                </Border>
            </Grid>
        </ControlTemplate>

        <DataTemplate x:Key="AnnouncementModalTemplate" x:DataType="z:Announcement">
            <StackPanel
                Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
                Padding="12">

                <TextBlock 
                    Text="{x:Bind Title, Mode=OneWay}"
                    FontSize="{ThemeResource TextStyleExtraLargeFontSize}"
                    TextWrapping="WrapWholeWords"/>
                
                <TextBlock 
                    Text="{x:Bind Text, Mode=OneWay}"
                    TextWrapping="WrapWholeWords"/>
            </StackPanel>
        </DataTemplate>
        
    </Page.Resources>

    <RelativePanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <t10c:PageHeader
            x:Name="Header"
            Text="Mededelingen"
            EllipsisVisibility="Collapsed"
            RelativePanel.AlignTopWithPanel="True"
            RelativePanel.AlignLeftWithPanel="True"
            RelativePanel.AlignRightWithPanel="True">

            <t10c:PageHeader.PrimaryCommands>
                <AppBarButton
                    Icon="Refresh"
                    Label="Vernieuwen"
                    Command="{x:Bind ViewModel.Refresh}"/>
            </t10c:PageHeader.PrimaryCommands>

        </t10c:PageHeader>

        <Grid
            RelativePanel.Below="Header"
            RelativePanel.AlignBottomWithPanel="True"
            RelativePanel.AlignLeftWithPanel="True"
            RelativePanel.AlignRightWithPanel="True"
            EntranceNavigationTransitionInfo.IsTargetElement="True">

            <t10c:ModalDialog x:Name="Modal" CanBackButtonDismiss="True">
                <t10c:ModalDialog.Content>
                    <ListView
                        x:Name="AnnouncementsListView"
                        SelectionMode="None"
                        IsItemClickEnabled="True"
                        ItemsSource="{x:Bind ViewModel.Announcements, Mode=OneWay}"
                        ItemContainerStyle="{StaticResource ListViewItemStyle}"
                        Padding="0,0,0,12"
                        ItemClick="AnnouncementsListView_ItemClick">

                        <ListView.ItemTemplate>
                            <DataTemplate x:DataType="z:Announcement">
                                <TextBlock Text="{x:Bind Title, Mode=OneWay}"/>
                            </DataTemplate>
                        </ListView.ItemTemplate>

                        <ListView.HeaderTemplate>
                            <DataTemplate x:DataType="local:AnnouncementsView">
                                <TextBlock
                                    Visibility="{Binding ItemsSource.Count, 
                                        ElementName=AnnouncementsListView,
                                        Converter={StaticResource VisibleWhenZeroConverter}}"
                                    Margin="12"
                                    FontSize="{ThemeResource TextStyleLargeFontSize}"
                                    Text="Er zijn geen mededelingen"/>
                            </DataTemplate>
                        </ListView.HeaderTemplate>

                    </ListView>
                </t10c:ModalDialog.Content>

                <t10c:ModalDialog.ModalContent>
                    <Grid>
                        <ScrollViewer>
                            <ContentControl
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Margin="12"
                            Content="{x:Bind ViewModel.SelectedAnnouncement, Mode=OneWay}"
                            ContentTemplate="{StaticResource AnnouncementModalTemplate}"/>
                        </ScrollViewer>

                        <ToggleButton
                            Template="{StaticResource ModalCloseButton}"
                            IsChecked="{x:Bind Modal.IsModal, Mode=TwoWay, Converter={StaticResource TypeConverter}}"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top"/>
                    </Grid>
                </t10c:ModalDialog.ModalContent>
            </t10c:ModalDialog>
        </Grid>

        <ProgressBar
            RelativePanel.Below="Header"
            RelativePanel.AlignLeftWithPanel="True"
            RelativePanel.AlignRightWithPanel="True"
            Margin="0,4,0,0"
            Background="Transparent"
            IsIndeterminate="{x:Bind ViewModel.IsLoading, Mode=OneWay}" />

    </RelativePanel>
</Page>

{'fraction_non_alphanumeric': 0.08491686460807601, 'fraction_numerical': 0.008259555171669186, 'mean_word_length': 1.2413793103448276, 'pattern_counts': {'":': 0, '<': 208, '<?xml version=': 0, '>': 208, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 46, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5206821', 'n_tokens_mistral': 4319, 'n_tokens_neox': 3827, 'n_words': 471}