Neighbourhood.omg.lol/Components/StatusCard.razor

56 lines
1.7 KiB
Text
Raw Permalink Normal View History

2024-06-13 10:02:51 +00:00
@inject IJSRuntime JS
2024-06-14 00:45:31 +00:00
<article class="status gray-9-fg" style="background-color:@(Status.Background)">
<div class="row">
2024-06-13 10:02:51 +00:00
<div class="emoji" data-emoji="@Status.EmojiOrDefault">@Status.EmojiOrDefault</div>
<div class="max">
2024-06-14 00:45:31 +00:00
<div class="row">
<a class="author" href="/person/@Status.Address">
<i class="fa-solid fa-fw fa-at"></i>@Status.Address
</a>
<div class="max"></div>
<button class="transparent circle" @onclick="ShareClick">
<i class="fa-solid fa-share-nodes"></i>
</button>
@if (Editable) {
<button class="small circle small-elevate" @onclick="EditStatus">
<i class="fa-solid fa-pencil"></i>
</button>
}
</div>
2024-06-13 10:02:51 +00:00
@Status.HtmlContent
<nav class="no-margin">
<a class="chip transparent-border">
2024-06-13 10:02:51 +00:00
<i class="fa fa-clock"></i> @Status.RelativeTime
</a>
2024-06-13 10:02:51 +00:00
<a class="chip transparent-border" href="@Status.ExternalUrl" target="_blank">
<i class="fa fa-message-dots"></i> Respond
</a>
2024-06-14 00:45:31 +00:00
</nav>
</div>
</div>
</article>
@code {
[Parameter]
2024-06-13 10:02:51 +00:00
public Status Status { get; set; }
[Parameter]
public bool Editable { get; set; } = false;
[Parameter]
public EditStatusDialog? Dialog { get; set; }
private async Task EditStatus(EventArgs e) {
Dialog.Status = Status;
await InvokeAsync(StateHasChanged);
await JS.InvokeVoidAsync("ui", "#" + Dialog?.id);
}
2024-06-07 04:25:21 +00:00
public async Task ShareClick(EventArgs e){
await Share.Default.RequestAsync(new ShareTextRequest{
2024-06-13 10:02:51 +00:00
Text = $"{Status.Content}\n- from [@{Status.Address}]({Status.Url})",
2024-06-07 04:25:21 +00:00
Title = "I saw this on status.lol",
Subject = "I saw this on status.lol"
});
}
}