feat(postit): show a live published badge beside blog post titles

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Paul Schneider 2026-10-09 17:46:32 +01:00
commit e7721bc3ab
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
3 changed files with 40 additions and 3 deletions

View file

@ -5,6 +5,8 @@
### Added ### Added
* [PostIt] Badge « Publié » à côté du titre des billets publiés dans la
liste, mis à jour lors de la publication ou du retour en brouillon.
* [PostIt] Gestion native du compte inspirée de `/Manage` : modification * [PostIt] Gestion native du compte inspirée de `/Manage` : modification
du nom d'utilisateur, du nom complet et de l'adresse, téléversement du nom d'utilisateur, du nom complet et de l'adresse, téléversement
d'avatar, confirmation e-mail, préférence de courriel mensuel, d'avatar, confirmation e-mail, préférence de courriel mensuel,

View file

@ -126,7 +126,27 @@
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate x:DataType="models:BlogPostDto"> <DataTemplate x:DataType="models:BlogPostDto">
<StackPanel Spacing="4"> <StackPanel Spacing="4">
<TextBlock FontWeight="SemiBold" Text="{Binding Title}" /> <StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock
VerticalAlignment="Center"
FontWeight="SemiBold"
Text="{Binding Title}" />
<Border
x:Name="PublishedBadge"
VerticalAlignment="Center"
Padding="6,2"
Background="#F2F7F2"
BorderBrush="#2F6D2F"
BorderThickness="1"
CornerRadius="6"
IsVisible="{Binding IsPublished}">
<TextBlock
FontSize="10"
FontWeight="SemiBold"
Foreground="#2F6D2F"
Text="Publié" />
</Border>
</StackPanel>
<TextBlock <TextBlock
FontSize="10" FontSize="10"
Foreground="Gray" Foreground="Gray"

View file

@ -1,12 +1,16 @@
#nullable enable annotations #nullable enable annotations
using Yavsc.Abstract.Identity.Security; using Yavsc.Abstract.Identity.Security;
using System.ComponentModel;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Yavsc.Blogspot; namespace Yavsc.Blogspot;
public class BlogPostDto : IBlogPost public class BlogPostDto : IBlogPost, INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler? PropertyChanged;
private bool _isPublished;
public string AuthorId { get; set; } public string AuthorId { get; set; }
public BlogPostAuthorDto? Author { get; set; } public BlogPostAuthorDto? Author { get; set; }
@ -30,7 +34,18 @@ public class BlogPostDto : IBlogPost
/// follow-up request. Toggled via /// follow-up request. Toggled via
/// <c>PUT /api/BlogApi/{id}/publish</c>. /// <c>PUT /api/BlogApi/{id}/publish</c>.
/// </summary> /// </summary>
public bool IsPublished { get; set; } public bool IsPublished
{
get => _isPublished;
set
{
if (_isPublished == value)
return;
_isPublished = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsPublished)));
}
}
public virtual bool AuthorizeCircle(long circleId) public virtual bool AuthorizeCircle(long circleId)
{ {