yavsc/src/PostIt/PostIt/Views/Layout/HomePage.axaml
Paul Schneider 0ac6970e9d
All checks were successful
Forgejo Release / release (push) Successful in 10m4s
Dotnet build and test / build (pull_request) Successful in 15m16s
feat(postit): keep sessions online and replace banner with auth modal
Remove the sticky session banner, keep the app connected when possible, restore sessions silently on startup, and show a blocking authentication modal with login, register, and forgot-password actions when auto-reconnect cannot resume the session. Add targeted auth and responsive-layout regressions and update the architecture notes to match the session lifecycle.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-13 12:32:58 +00:00

174 lines
6.4 KiB
XML

<ContentPage
x:Class="PostIt.Views.HomePage"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lang="using:Yavsc.Lang"
xmlns:messaging="using:Yavsc.Abstract.Models.Messaging"
xmlns:vm="using:PostIt.ViewModels"
x:DataType="vm:HomePageViewModel"
Header="Home">
<Design.DataContext>
<vm:HomePageViewModel />
</Design.DataContext>
<NavigationPage.TopCommandBar>
<CommandBar x:Name="CommandBar" IsDynamicOverflowEnabled="True">
<CommandBar.PrimaryCommands>
<CommandBarButton
Command="{Binding OpenBlogs}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Blogs" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenPodcasts}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
IsVisible="{Binding SupportsPodcasts}"
Label="Podcasts : directs et replays" />
</CommandBar.PrimaryCommands>
<CommandBar.SecondaryCommands>
<CommandBarButton
Command="{Binding SessionStatus.OpenSettingsCommand}"
Label="Paramètres" />
<CommandBarButton
Command="{Binding SessionStatus.OpenAboutCommand}"
Label="À propos" />
<CommandBarButton
Command="{Binding SessionStatus.LogoutCommand}"
Label="Se déconnecter" />
<CommandBarButton
Command="{Binding OpenContacts}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Contacts" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenChat}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Les Salons de discussion" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenActivities}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Parcourir les activités" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenProviderRequests}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Mes demandes en cours" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenClientEstimates}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Devis en attente de signature client" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenProviderEstimates}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Devis en attente de signature fournisseur" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenMyFiles}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Mes fichiers" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenProfile}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Mon profil" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenPerformerConfiguration}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Mon activité / performer" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenSubscriptions}"
IsEnabled="{Binding SessionStatus.IsLoggedIn}"
Label="Mon abonnement PayPal" />
<CommandBarButton
HorizontalAlignment="Center"
Command="{Binding OpenAdministration}"
IsVisible="{Binding SessionStatus.IsAdministrator}"
Label="Administration" />
</CommandBar.SecondaryCommands>
</CommandBar>
</NavigationPage.TopCommandBar>
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<StackPanel
MaxWidth="720"
Margin="16"
HorizontalAlignment="Stretch"
Spacing="12">
<TextBlock
HorizontalAlignment="Center"
FontSize="22"
FontWeight="SemiBold"
Text="{x:Static lang:Resources.GreetingText}" />
<TextBlock
Foreground="{DynamicResource SystemControlErrorTextForegroundBrush}"
Text="{Binding SessionStatus.ProfileError}"
TextWrapping="Wrap" />
<Grid ColumnDefinitions="*,Auto">
<TextBlock
VerticalAlignment="Center"
FontSize="20"
FontWeight="SemiBold"
Text="Notifications" />
<Button
Grid.Column="1"
Command="{Binding RefreshNotificationsCommand}"
Content="Actualiser"
IsEnabled="{Binding !IsLoadingNotifications}" />
</Grid>
<ProgressBar
Height="4"
IsIndeterminate="True"
IsVisible="{Binding IsLoadingNotifications}" />
<TextBlock
Foreground="{DynamicResource SystemControlErrorTextForegroundBrush}"
Text="{Binding NotificationsError}"
TextWrapping="Wrap" />
<TextBlock
IsVisible="{Binding HasNoNotifications}"
Text="Aucune notification pour le moment."
TextWrapping="Wrap" />
<ItemsControl x:Name="NotificationsList" ItemsSource="{Binding Notifications}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="messaging:Notification">
<Border
Margin="0,0,0,8"
Padding="12"
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
BorderThickness="1"
CornerRadius="6">
<StackPanel Spacing="6">
<Grid ColumnDefinitions="*,Auto">
<TextBlock
VerticalAlignment="Center"
FontWeight="SemiBold"
Text="{Binding title}"
TextWrapping="Wrap" />
<Button
Grid.Column="1"
Margin="8,0,0,0"
Command="{Binding $parent[ItemsControl].((vm:HomePageViewModel)DataContext).DismissNotificationCommand}"
CommandParameter="{Binding}"
Content="{Binding click_action, TargetNullValue=Fermer}"
ToolTip.Tip="Masquer cette notification" />
</Grid>
<TextBlock Text="{Binding body}" TextWrapping="Wrap" />
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
</ContentPage>