mirror of
https://github.com/ppy/osu
synced 2025-02-02 19:32:19 +00:00
Add placeholder for no comments case in CommentsContainer
This commit is contained in:
parent
99d5398262
commit
b947e89a6b
@ -48,6 +48,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddStep("Airman comments", () => comments.ShowComments(CommentableType.Beatmapset, 24313));
|
||||
AddStep("Lazer build comments", () => comments.ShowComments(CommentableType.Build, 4772));
|
||||
AddStep("News comments", () => comments.ShowComments(CommentableType.NewsPost, 715));
|
||||
AddStep("Beatmap with no comments", () => comments.ShowComments(CommentableType.Beatmapset, 1291));
|
||||
AddStep("Idle state", () =>
|
||||
{
|
||||
scroll.Clear();
|
||||
|
@ -12,6 +12,7 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
using System.Threading;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
@ -34,6 +35,7 @@ namespace osu.Game.Overlays.Comments
|
||||
private DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
||||
private CommentsShowMoreButton moreButton;
|
||||
private TotalCommentsCounter commentCounter;
|
||||
private Container noCommentsPlaceholder;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
@ -60,6 +62,27 @@ namespace osu.Game.Overlays.Comments
|
||||
Sort = { BindTarget = Sort },
|
||||
ShowDeleted = { BindTarget = ShowDeleted }
|
||||
},
|
||||
noCommentsPlaceholder = new Container
|
||||
{
|
||||
Height = 80,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Alpha = 0,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background4
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Margin = new MarginPadding { Left = 50 },
|
||||
Text = @"No comments yet."
|
||||
}
|
||||
}
|
||||
},
|
||||
content = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
@ -68,6 +91,7 @@ namespace osu.Game.Overlays.Comments
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Name = @"Footer",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
@ -154,12 +178,21 @@ namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
currentPage = 1;
|
||||
deletedChildrenPlaceholder.DeletedCount.Value = 0;
|
||||
moreButton.Show();
|
||||
moreButton.IsLoading = true;
|
||||
content.Clear();
|
||||
noCommentsPlaceholder.Hide();
|
||||
}
|
||||
|
||||
private void onSuccess(CommentBundle response)
|
||||
{
|
||||
if (!response.Comments.Any())
|
||||
{
|
||||
noCommentsPlaceholder.Show();
|
||||
moreButton.Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
loadCancellation = new CancellationTokenSource();
|
||||
|
||||
var page = new FillFlowContainer
|
||||
|
Loading…
Reference in New Issue
Block a user