[frontend/components] Add open about page button to note and profile menus

This commit is contained in:
pancakes 2025-03-29 15:54:49 +10:00
parent 46d86fd960
commit f9fb6194c7
No known key found for this signature in database
2 changed files with 14 additions and 0 deletions

View file

@ -9,6 +9,7 @@
@inject SessionService Session; @inject SessionService Session;
@inject GlobalComponentSvc GlobalComponentSvc @inject GlobalComponentSvc GlobalComponentSvc
@inject MetadataService MetadataSvc; @inject MetadataService MetadataSvc;
@inject NavigationManager Nav;
@inject NoteActions NoteActions; @inject NoteActions NoteActions;
<div class="note-footer"> <div class="note-footer">
@ -103,6 +104,9 @@
<Text>@Loc["Mute thread"]</Text> <Text>@Loc["Mute thread"]</Text>
</MenuElement> </MenuElement>
<hr class="rule"/> <hr class="rule"/>
<MenuElement Icon="Icons.Info" OnSelect="OpenAbout">
<Text>@Loc["About"]</Text>
</MenuElement>
<MenuElement Icon="Icons.ArrowSquareOut" OnSelect="OpenOriginal"> <MenuElement Icon="Icons.ArrowSquareOut" OnSelect="OpenOriginal">
<Text>@Loc["Open original page"]</Text> <Text>@Loc["Open original page"]</Text>
</MenuElement> </MenuElement>
@ -156,6 +160,8 @@
private void Delete() => _ = NoteActions.DeleteAsync(Note); private void Delete() => _ = NoteActions.DeleteAsync(Note);
private void OpenAbout() => Nav.NavigateTo($"/notes/{Note.Id}/about");
private void OpenOriginal() => Js.InvokeVoidAsync("open", Note.Url, "_blank"); private void OpenOriginal() => Js.InvokeVoidAsync("open", Note.Url, "_blank");
private async Task CopyLink() private async Task CopyLink()

View file

@ -81,6 +81,9 @@
</MenuElement> </MenuElement>
} }
<hr class="rule"/> <hr class="rule"/>
<MenuElement Icon="Icons.Info" OnSelect="OpenAbout">
<Text>@Loc["About"]</Text>
</MenuElement>
@if (UserResponse.Host != null && Profile?.Url != null) @if (UserResponse.Host != null && Profile?.Url != null)
{ {
<MenuElement Icon="Icons.ArrowSquareOut" OnSelect="OpenOriginal"> <MenuElement Icon="Icons.ArrowSquareOut" OnSelect="OpenOriginal">
@ -396,6 +399,11 @@
} }
} }
private void OpenAbout()
{
Nav.NavigateTo($"{Nav.Uri}/about");
}
private void OpenOriginal() private void OpenOriginal()
{ {
if (Profile?.Url != null) if (Profile?.Url != null)