mirror of
https://github.com/osukey/osukey.git
synced 2025-07-25 04:10:03 +09:00
Add placeholder for no comments case in CommentsContainer
This commit is contained in:
@ -48,6 +48,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("Airman comments", () => comments.ShowComments(CommentableType.Beatmapset, 24313));
|
AddStep("Airman comments", () => comments.ShowComments(CommentableType.Beatmapset, 24313));
|
||||||
AddStep("Lazer build comments", () => comments.ShowComments(CommentableType.Build, 4772));
|
AddStep("Lazer build comments", () => comments.ShowComments(CommentableType.Build, 4772));
|
||||||
AddStep("News comments", () => comments.ShowComments(CommentableType.NewsPost, 715));
|
AddStep("News comments", () => comments.ShowComments(CommentableType.NewsPost, 715));
|
||||||
|
AddStep("Beatmap with no comments", () => comments.ShowComments(CommentableType.Beatmapset, 1291));
|
||||||
AddStep("Idle state", () =>
|
AddStep("Idle state", () =>
|
||||||
{
|
{
|
||||||
scroll.Clear();
|
scroll.Clear();
|
||||||
|
@ -12,6 +12,7 @@ using osu.Game.Online.API.Requests.Responses;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Comments
|
namespace osu.Game.Overlays.Comments
|
||||||
{
|
{
|
||||||
@ -34,6 +35,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
private DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
private DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
||||||
private CommentsShowMoreButton moreButton;
|
private CommentsShowMoreButton moreButton;
|
||||||
private TotalCommentsCounter commentCounter;
|
private TotalCommentsCounter commentCounter;
|
||||||
|
private Container noCommentsPlaceholder;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
@ -60,6 +62,27 @@ namespace osu.Game.Overlays.Comments
|
|||||||
Sort = { BindTarget = Sort },
|
Sort = { BindTarget = Sort },
|
||||||
ShowDeleted = { BindTarget = ShowDeleted }
|
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
|
content = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -68,6 +91,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
Name = @"Footer",
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -154,12 +178,21 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
currentPage = 1;
|
currentPage = 1;
|
||||||
deletedChildrenPlaceholder.DeletedCount.Value = 0;
|
deletedChildrenPlaceholder.DeletedCount.Value = 0;
|
||||||
|
moreButton.Show();
|
||||||
moreButton.IsLoading = true;
|
moreButton.IsLoading = true;
|
||||||
content.Clear();
|
content.Clear();
|
||||||
|
noCommentsPlaceholder.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSuccess(CommentBundle response)
|
private void onSuccess(CommentBundle response)
|
||||||
{
|
{
|
||||||
|
if (!response.Comments.Any())
|
||||||
|
{
|
||||||
|
noCommentsPlaceholder.Show();
|
||||||
|
moreButton.Hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
loadCancellation = new CancellationTokenSource();
|
loadCancellation = new CancellationTokenSource();
|
||||||
|
|
||||||
var page = new FillFlowContainer
|
var page = new FillFlowContainer
|
||||||
|
Reference in New Issue
Block a user