Neighbourhood.omg.lol/Components/StatusCard.razor

59 lines
1.8 KiB
Text
Raw 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>
@if (!string.IsNullOrWhiteSpace(Status.ExternalUrl))
{
<a class="chip transparent-border" href="@Status.ExternalUrl" target="_blank">
<i class="fa fa-message-dots"></i> @(new Uri(Status.ExternalUrl).Host)
</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"
});
}
}