- CirclesPage: drop VisualRoot/MainWindow hack, switch to App.PushPageAsync(vm) - CirclesPageViewModel: make OpenAddMemberAsync public so Avalonia XAML trampoline can call it - AddCircleMemberDialog: bind SearchAsync/Add (drop Command suffix) - UserSearchApiController: route under Constants.APIPrefix (= api/v1/user-search), matching the rest of Yavsc.Blogs controllers and the PostIt client's BlogsApiUrl default
111 lines
5.8 KiB
XML
111 lines
5.8 KiB
XML
<ContentPage
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
x:Class="PostIt.Views.CirclesPage"
|
|
xmlns:vm="using:PostIt.ViewModels"
|
|
xmlns:dtos="using:Yavsc.Api.Client.Dtos"
|
|
x:DataType="vm:CirclesPageViewModel"
|
|
>
|
|
<Grid RowDefinitions="Auto,*,Auto">
|
|
|
|
<!-- Toolbar: refresh + new -->
|
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Spacing="8" Margin="12">
|
|
<Button Content="Rafraîchir"
|
|
Command="{Binding RefreshCommand}"/>
|
|
<Button Content="Nouveau"
|
|
Command="{Binding StartCreateCommand}"/>
|
|
</StackPanel>
|
|
|
|
<!-- Two-pane body: circles (left) + members (right) -->
|
|
<Grid Grid.Row="1" Margin="12,0,12,12"
|
|
ColumnDefinitions="*,16,*"
|
|
RowDefinitions="*,Auto">
|
|
|
|
<!-- Left column: list of circles + editor -->
|
|
<Grid Grid.Row="0" Grid.Column="0"
|
|
RowDefinitions="*,Auto">
|
|
<ListBox Grid.Row="0"
|
|
ItemsSource="{Binding Circles}"
|
|
SelectedItem="{Binding SelectedCircle, Mode=TwoWay}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate x:DataType="dtos:CircleDto">
|
|
<Grid ColumnDefinitions="*,Auto,Auto">
|
|
<StackPanel Grid.Column="0" Spacing="2">
|
|
<TextBlock Text="{Binding Name}" FontWeight="Bold"/>
|
|
<TextBlock Text="{Binding Public, StringFormat='Public : {0}'}"
|
|
FontSize="11" Opacity="0.6"/>
|
|
</StackPanel>
|
|
<Button Grid.Column="1" Content="Éditer"
|
|
Command="{Binding $parent[ContentPage].((vm:CirclesPageViewModel)DataContext).StartEditCommand}"
|
|
CommandParameter="{Binding}"/>
|
|
<Button Grid.Column="2" Content="Supprimer"
|
|
Command="{Binding $parent[ContentPage].((vm:CirclesPageViewModel)DataContext).DeleteCommand}"
|
|
CommandParameter="{Binding}"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
|
|
<!-- Editor -->
|
|
<Grid Grid.Row="1" Margin="0,12,0,0" RowDefinitions="Auto,Auto,Auto"
|
|
ColumnDefinitions="Auto,*" IsEnabled="{Binding !IsBusy}">
|
|
<TextBlock Grid.Row="0" Grid.Column="0" Text="Nom :"
|
|
VerticalAlignment="Center" Margin="0,0,8,0"/>
|
|
<TextBox Grid.Row="0" Grid.Column="1"
|
|
Text="{Binding DraftName, Mode=TwoWay}"/>
|
|
<CheckBox Grid.Row="1" Grid.Column="1"
|
|
Content="Public"
|
|
IsChecked="{Binding DraftPublic, Mode=TwoWay}"/>
|
|
<Button Grid.Row="2" Grid.Column="1" Content="Enregistrer"
|
|
Command="{Binding SaveCommand}"
|
|
HorizontalAlignment="Right" Margin="0,8,0,0"/>
|
|
</Grid>
|
|
</Grid>
|
|
|
|
<!-- Right column: members of the selected circle -->
|
|
<Grid Grid.Row="0" Grid.Column="2"
|
|
RowDefinitions="Auto,*,Auto">
|
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Spacing="8" Margin="0,0,0,8">
|
|
<TextBlock Text="Membres"
|
|
FontWeight="Bold"
|
|
VerticalAlignment="Center"/>
|
|
<Button Content="Ajouter un membre"
|
|
Command="{Binding OpenAddMemberAsync}"/>
|
|
</StackPanel>
|
|
<ListBox Grid.Row="1"
|
|
ItemsSource="{Binding Members}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate x:DataType="dtos:CircleMemberDto">
|
|
<Grid ColumnDefinitions="*,Auto">
|
|
<StackPanel Grid.Column="0" Spacing="2">
|
|
<TextBlock Text="{Binding FullName}"
|
|
FontWeight="Bold"/>
|
|
<TextBlock Text="{Binding UserName}"
|
|
FontSize="11" Opacity="0.6"/>
|
|
</StackPanel>
|
|
<Button Grid.Column="1" Content="Retirer"
|
|
Command="{Binding $parent[ContentPage].((vm:CirclesPageViewModel)DataContext).RemoveMemberCommand}"
|
|
CommandParameter="{Binding}"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
<!-- Empty-state hint -->
|
|
<TextBlock Grid.Row="2"
|
|
Text="Sélectionnez un cercle pour voir ses membres."
|
|
IsVisible="{Binding SelectedCircle, Converter={x:Static ObjectConverters.IsNull}}"
|
|
FontSize="11" Opacity="0.6"
|
|
Margin="0,8,0,0"/>
|
|
</Grid>
|
|
</Grid>
|
|
|
|
<!-- Status bar -->
|
|
<Grid Grid.Row="2" ColumnDefinitions="*,Auto" Margin="12,0,12,12">
|
|
<TextBlock Grid.Column="0" Text="{Binding StatusMessage}"
|
|
VerticalAlignment="Center"/>
|
|
<ProgressBar Grid.Column="1" IsIndeterminate="True"
|
|
IsVisible="{Binding IsBusy}"
|
|
Width="120"/>
|
|
</Grid>
|
|
</Grid>
|
|
</ContentPage>
|