Neighbourhood.omg.lol/Components/Pages/Person.razor

112 lines
3.1 KiB
Text
Raw Normal View History

2024-05-30 01:06:08 +00:00
@page "/person/{Address}"
2024-06-06 05:20:09 +00:00
@inject State State
2024-06-11 00:36:48 +00:00
@inject IJSRuntime JS
2024-06-06 05:20:09 +00:00
<div class="row center-align">
<h3><i class="fa-solid fa-fw fa-at"></i>@Address</h3>
</div>
<div class="row center-align">
<img class="profile avatar" src="https://profiles.cache.lol/@Address/picture" alt="@Address" />
</div>
2024-05-30 01:06:08 +00:00
<div id="bio" class="center-align max">
@if (bio == null)
{
<p><em>Getting Bio...</em></p>
}
else {
@bio
}
</div>
2024-05-30 01:06:08 +00:00
2024-06-05 12:41:08 +00:00
<div class="responsive">
<div class="tabs">
2024-06-11 00:36:48 +00:00
<a data-ui="#profile" @onclick="ReloadProfile">
<i class="fa-solid fa-id-card"></i>
<span>@(Address).omg.lol</span>
</a>
2024-06-05 12:41:08 +00:00
<a data-ui="#statuses" class="active">
<i class="fa-solid fa-message-smile"></i>
<span>Status.lol</span>
</a>
<a data-ui="#pics">
<i class="fa-solid fa-images"></i>
<span>Some.pics</span>
</a>
2024-06-11 00:36:48 +00:00
@if(now != null){
<a data-ui="#now" @onclick="ReloadNow">
<i class="fa-duotone fa-seedling"></i>
<span>/Now</span>
</a>
}
</div>
</div>
<div class="responsive page-container">
<div id="profile" class="page no-padding">
<a href="@ProfileUrl" target="_blank" class="hover absolute top right chip fill large-elevate">Open in browser <i class="fa-solid fa-arrow-up-right-from-square tiny"></i></a>
<ExternalPageComponent id="profile_page" @ref="ProfilePage" Url="@ProfileUrl"></ExternalPageComponent>
2024-05-30 01:06:08 +00:00
</div>
2024-06-11 00:36:48 +00:00
2024-06-05 12:41:08 +00:00
<div id="statuses" class="page padding active">
2024-06-06 05:20:09 +00:00
<StatusList StatusFunc="@State.VirtualStatusesFunc(Address)"></StatusList>
2024-06-05 12:41:08 +00:00
</div>
<div id="pics" class="page padding">
2024-06-07 04:25:21 +00:00
@if(Editable){
<EditPicDialog @ref="editPicDialog" id="EditPicModal"></EditPicDialog>
}
<PicList PicsFunc="@State.VirtualPicsFunc(Address)" Editable="@Editable" Dialog="@editPicDialog"></PicList>
2024-06-05 12:41:08 +00:00
</div>
2024-06-11 00:36:48 +00:00
@if(now != null){
<div id="now" class="page no-padding">
<a href="@now.Url" target="_blank" class="hover absolute top right chip fill large-elevate">Open in browser <i class="fa-solid fa-arrow-up-right-from-square tiny"></i></a>
<ExternalPageComponent id="now_page" @ref="NowPage" Url="@now.Url"></ExternalPageComponent>
</div>
}
2024-06-05 12:41:08 +00:00
</div>
2024-05-30 01:06:08 +00:00
@code {
[Parameter]
public string Address { get; set; }
2024-06-11 00:36:48 +00:00
public string ProfileUrl {
get => $"https://{Address}.omg.lol/";
}
2024-05-30 01:06:08 +00:00
2024-06-07 04:25:21 +00:00
private EditPicDialog? editPicDialog { get; set; }
2024-06-11 00:36:48 +00:00
public ExternalPageComponent? NowPage { get; set; }
public ExternalPageComponent? ProfilePage { get; set; }
2024-06-07 04:25:21 +00:00
private bool Editable {
get => Address == State.SelectedAddressName;
}
private MarkupString? bio;
2024-05-30 01:06:08 +00:00
2024-06-11 00:36:48 +00:00
private NowData? now;
2024-05-30 01:06:08 +00:00
protected override async Task OnInitializedAsync() {
2024-06-06 05:20:09 +00:00
bio = await State.GetBio(Address);
2024-06-11 00:36:48 +00:00
List<NowData> garden = await State.GetNowGarden();
now = garden.FirstOrDefault(n => n.Address == Address);
}
private async Task ReloadNow() {
if(NowPage != null) {
await NowPage.Reload();
await ResizeIframes();
}
}
private async Task ReloadProfile() {
if (ProfilePage != null) {
await ProfilePage.Reload();
await ResizeIframes();
}
}
private async Task ResizeIframes() {
await JS.InvokeVoidAsync("iframeResize", new { license = "GPLv3" });
2024-06-05 12:41:08 +00:00
}
2024-05-30 01:06:08 +00:00
}