Skip to content

Commit

Permalink
fix: Workaround for Posts page
Browse files Browse the repository at this point in the history
  • Loading branch information
Soap-141 committed May 15, 2024
1 parent 6801a91 commit 673d6dc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,17 @@ namespace ApplicationTemplate.Presentation;
/// <summary>
/// Post item view model.
/// </summary>
/// <remarks>
/// This was created as a workaround for an Uno issue.
/// See https://github.com/unoplatform/uno/issues/13996 for more details.
/// </remarks>
public sealed class PostItemViewModel : ViewModel
{
/// <summary>
/// Initializes a new instance of the <see cref="PostItemViewModel"/> class.
/// </summary>
/// <param name="parent">The parent view model.</param>
/// <param name="post">The post.</param>
public PostItemViewModel(IViewModel parent, Post post)
public PostItemViewModel(Post post)
{
Parent = parent;
Post = post;
}

/// <summary>
/// The parent view model.
/// </summary>
public IViewModel Parent { get; }

/// <summary>
/// The post.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private async Task<ImmutableList<PostItemViewModel>> GetPosts(CancellationToken
var posts = await this.GetService<IPostService>().GetPosts(ct);

return posts
.Select(p => this.GetChild(() => new PostItemViewModel(this, p), p.Id.ToString(CultureInfo.InvariantCulture)))
.Select(p => this.GetChild(() => new PostItemViewModel(p), p.Id.ToString(CultureInfo.InvariantCulture)))
.ToImmutableList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
Padding="16">

<!-- Title -->
<TextBlock Text="{Binding Title}"
<TextBlock Text="{Binding Post.Title}"
Style="{StaticResource TitleMedium}" />

<!-- Body -->
<TextBlock Text="{Binding Body}"
<TextBlock Text="{Binding Post.Body}"
Foreground="{ThemeResource OnSurfaceBrush}"
Style="{StaticResource BodyMedium}"
Opacity="{StaticResource MediumOpacity}"
Expand Down

0 comments on commit 673d6dc

Please sign in to comment.