[frontend] Use renote endpoint, disable renotes where they aren't possible, add lock icon
This commit is contained in:
parent
d6c3fb028f
commit
56d5ff9e93
3 changed files with 39 additions and 19 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
@using AngleSharp.Dom
|
||||||
@using Iceshrimp.Frontend.Core.Services
|
@using Iceshrimp.Frontend.Core.Services
|
||||||
@using Iceshrimp.Shared.Schemas
|
@using Iceshrimp.Shared.Schemas
|
||||||
@inject ApiService ApiService;
|
@inject ApiService ApiService;
|
||||||
|
@ -26,7 +27,14 @@
|
||||||
}
|
}
|
||||||
@if (!AsQuote)
|
@if (!AsQuote)
|
||||||
{
|
{
|
||||||
<NoteFooter Reactions="Note.Reactions" Likes="Note.Likes" IsLiked="Note.Liked"/>
|
@* FIXME: Allow renotes when the post is from the current user *@
|
||||||
|
<NoteFooter
|
||||||
|
Reactions="Note.Reactions"
|
||||||
|
Likes="Note.Likes"
|
||||||
|
IsLiked="Note.Liked"
|
||||||
|
Renotes="Note.Renotes"
|
||||||
|
RenotePossible="@(Note.Visibility == NoteVisibility.Public || Note.Visibility == NoteVisibility.Home)"
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
</CascadingValue>
|
</CascadingValue>
|
||||||
@code {
|
@code {
|
||||||
|
@ -94,17 +102,9 @@
|
||||||
|
|
||||||
public void Renote()
|
public void Renote()
|
||||||
{
|
{
|
||||||
var renote = new NoteCreateRequest
|
ApiService.Notes.RenoteNote(Note.Id);
|
||||||
{
|
Note.Renotes++;
|
||||||
Text = "",
|
StateHasChanged();
|
||||||
Cw = null,
|
|
||||||
ReplyId = null,
|
|
||||||
RenoteId = Note.Id,
|
|
||||||
MediaIds = null,
|
|
||||||
Visibility = Note.Visibility,
|
|
||||||
IdempotencyKey = null
|
|
||||||
};
|
|
||||||
ApiService.Notes.CreateNote(renote);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoQuote()
|
public void DoQuote()
|
||||||
|
|
|
@ -14,13 +14,26 @@
|
||||||
<Icon Name="Icons.ArrowUUpLeft" Size="1.3em"/>
|
<Icon Name="Icons.ArrowUUpLeft" Size="1.3em"/>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn" @onclick="Renote" @onclick:stopPropagation="true">
|
<button class="btn" @onclick="Renote" @onclick:stopPropagation="true">
|
||||||
|
@if (RenotePossible)
|
||||||
|
{
|
||||||
<Icon Name="Icons.Repeat" Size="1.3em"/>
|
<Icon Name="Icons.Repeat" Size="1.3em"/>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<Icon Name="Icons.Lock" Size="1.3em"/>
|
||||||
|
}
|
||||||
|
@if (Renotes > 0)
|
||||||
|
{
|
||||||
|
<span class="renote-count">@Renotes</span>
|
||||||
|
}
|
||||||
</button>
|
</button>
|
||||||
<button @onclick="Like" @onclick:stopPropagation="true" class="btn">
|
<button @onclick="Like" @onclick:stopPropagation="true" class="btn">
|
||||||
@if (IsLiked)
|
@if (IsLiked)
|
||||||
{
|
{
|
||||||
<Icon Name="Icons.Heart" Pack="IconStyle.Fill" Size="1.3em"/>
|
<Icon Name="Icons.Heart" Pack="IconStyle.Fill" Size="1.3em"/>
|
||||||
}else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
<Icon Name="Icons.Heart" Size="1.3em"/>
|
<Icon Name="Icons.Heart" Size="1.3em"/>
|
||||||
}
|
}
|
||||||
@if (Likes > 0)
|
@if (Likes > 0)
|
||||||
|
@ -38,10 +51,13 @@
|
||||||
<Icon Name="Icons.DotsThreeOutline" Size="1.3em"/>
|
<Icon Name="Icons.DotsThreeOutline" Size="1.3em"/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] [EditorRequired] public required List<NoteReactionSchema> Reactions { get; set; }
|
[Parameter] [EditorRequired] public required List<NoteReactionSchema> Reactions { get; set; }
|
||||||
[Parameter] [EditorRequired] public required int Likes { get; set; }
|
[Parameter] [EditorRequired] public required int Likes { get; set; }
|
||||||
[Parameter] [EditorRequired] public required bool IsLiked { get; set; }
|
[Parameter] [EditorRequired] public required bool IsLiked { get; set; }
|
||||||
|
[Parameter] [EditorRequired] public required int Renotes { get; set; }
|
||||||
|
[Parameter] public bool RenotePossible { get; set; }
|
||||||
|
|
||||||
[CascadingParameter] NoteComponent NoteComponent { get; set; }
|
[CascadingParameter] NoteComponent NoteComponent { get; set; }
|
||||||
|
|
||||||
|
@ -57,11 +73,12 @@
|
||||||
|
|
||||||
private void Renote()
|
private void Renote()
|
||||||
{
|
{
|
||||||
NoteComponent.Renote();
|
if (RenotePossible) NoteComponent.Renote();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Quote()
|
private void Quote()
|
||||||
{
|
{
|
||||||
NoteComponent.DoQuote();
|
NoteComponent.DoQuote();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -14,3 +14,6 @@
|
||||||
.like-count{
|
.like-count{
|
||||||
margin-left: 0.3em;
|
margin-left: 0.3em;
|
||||||
}
|
}
|
||||||
|
.renote-count {
|
||||||
|
margin-left: 0.3em;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue