Neighbourhood.omg.lol/Components/PicCard.razor

62 lines
1.8 KiB
Text
Raw Normal View History

2024-06-07 04:25:21 +00:00
@inject IJSRuntime JS
2024-07-02 02:55:07 +00:00
<article class="pic no-padding">
2024-07-02 00:29:50 +00:00
<img src="@Pic!.Url" loading="lazy">
2024-07-02 02:55:07 +00:00
<div class="padding row">
<div class="emoji" data-emoji="🖼️">🖼️</div>
<div class="max">
<nav>
<a class="author" href="/person/@Pic.Address#pics">
<i class="fa-solid fa-fw fa-at"></i>@Pic.Address
</a>
<span class="max"></span>
</nav>
@if(!string.IsNullOrWhiteSpace(Pic.Description)){
<p>@((MarkupString)Pic.DescriptionHtml)</p>
2024-06-07 04:25:21 +00:00
}
2024-07-02 02:55:07 +00:00
else {
<div class="padding padding yellow-2-bg yellow-9-fg">
<i class="fa-solid fa-triangle-exclamation"></i>
<span>This picture needs a description in order to be shared.</span>
</div>
}
<nav>
<a class="chip transparent-border">
<i class="fa fa-clock"></i> @Pic.RelativeTime
</a>
<div class="max"></div>
@if(Editable) {
<button @onclick="EditPic"><i class="fa-solid fa-pencil"></i> Edit</button>
}
<button class="transparent circle" @onclick="ShareClick">
<i class="fa-solid fa-share-nodes"></i>
</button>
</nav>
</div>
2024-06-07 04:25:21 +00:00
</div>
</article>
@code {
[Parameter]
2024-07-02 00:13:52 +00:00
public Pic? Pic {get; set;}
2024-06-13 10:02:51 +00:00
[Parameter]
2024-06-07 04:25:21 +00:00
public bool Editable { get; set; } = false;
[Parameter]
public EditPicDialog? Dialog { get; set; }
private async Task EditPic(EventArgs e){
2024-07-02 00:13:52 +00:00
Dialog!.Pic = Pic;
2024-06-20 05:48:51 +00:00
await InvokeAsync(StateHasChanged);
2024-06-07 04:25:21 +00:00
await JS.InvokeVoidAsync("ui", "#" + Dialog?.id);
}
public async Task ShareClick(EventArgs e){
await Share.Default.RequestAsync(new ShareTextRequest{
2024-07-02 00:13:52 +00:00
Uri = Pic!.Url,
Text = Pic!.Description,
2024-06-07 04:25:21 +00:00
Title = "I saw this on some.pics",
Subject = "I saw this on some.pics"
});
}
}