Fix comments having too much padding at the bottom

This commit is contained in:
Joseph Madamba 2023-02-03 00:47:10 -08:00
parent 2ba90b5447
commit 94d2799b90

View File

@ -76,6 +76,7 @@ namespace osu.Game.Overlays.Comments
private GridContainer content = null!; private GridContainer content = null!;
private VotePill votePill = null!; private VotePill votePill = null!;
private Container<CommentEditor> replyEditorContainer = null!; private Container<CommentEditor> replyEditorContainer = null!;
private Container repliesButtonContainer = null!;
[Resolved] [Resolved]
private IDialogOverlay? dialogOverlay { get; set; } private IDialogOverlay? dialogOverlay { get; set; }
@ -239,10 +240,12 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Top = 10 }, Padding = new MarginPadding { Top = 10 },
Alpha = 0,
}, },
new Container repliesButtonContainer = new Container
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Alpha = 0,
Children = new Drawable[] Children = new Drawable[]
{ {
showRepliesButton = new ShowRepliesButton(Comment.RepliesCount) showRepliesButton = new ShowRepliesButton(Comment.RepliesCount)
@ -449,6 +452,7 @@ namespace osu.Game.Overlays.Comments
{ {
if (replyEditorContainer.Count == 0) if (replyEditorContainer.Count == 0)
{ {
replyEditorContainer.Show();
replyEditorContainer.Add(new ReplyCommentEditor(Comment) replyEditorContainer.Add(new ReplyCommentEditor(Comment)
{ {
OnPost = comments => OnPost = comments =>
@ -462,6 +466,7 @@ namespace osu.Game.Overlays.Comments
else else
{ {
replyEditorContainer.Clear(true); replyEditorContainer.Clear(true);
replyEditorContainer.Hide();
} }
} }
@ -513,9 +518,11 @@ namespace osu.Game.Overlays.Comments
int loadedRepliesCount = loadedReplies.Count; int loadedRepliesCount = loadedReplies.Count;
bool hasUnloadedReplies = loadedRepliesCount != Comment.RepliesCount; bool hasUnloadedReplies = loadedRepliesCount != Comment.RepliesCount;
loadRepliesButton.FadeTo(hasUnloadedReplies && loadedRepliesCount == 0 ? 1 : 0);
showMoreButton.FadeTo(hasUnloadedReplies && loadedRepliesCount > 0 ? 1 : 0);
showRepliesButton.FadeTo(loadedRepliesCount != 0 ? 1 : 0); showRepliesButton.FadeTo(loadedRepliesCount != 0 ? 1 : 0);
loadRepliesButton.FadeTo(hasUnloadedReplies && loadedRepliesCount == 0 ? 1 : 0);
repliesButtonContainer.FadeTo(showRepliesButton.IsPresent || loadRepliesButton.IsPresent ? 1 : 0);
showMoreButton.FadeTo(hasUnloadedReplies && loadedRepliesCount > 0 ? 1 : 0);
if (Comment.IsTopLevel) if (Comment.IsTopLevel)
chevronButton.FadeTo(loadedRepliesCount != 0 ? 1 : 0); chevronButton.FadeTo(loadedRepliesCount != 0 ? 1 : 0);