Neighbourhood.omg.lol/Components/Layout/AvatarMenu.razor
Gordon Pedersen d0ac64e1be Added in the address directory
(except for actually rendering the list)
2024-06-18 17:11:28 +10:00

82 lines
No EOL
3.3 KiB
Text

@inject CustomAuthenticationStateProvider AuthStateProvider;
@inject State State;
<AuthorizeView>
<Authorized>
<NavLink>
<button class="transparent circle small large">
<img class="responsive avatar" src="https://profiles.cache.lol/@State.SelectedAddressName/picture" alt="@State.SelectedAddressName">
<menu class="no-wrap">
<a class="m s row">
<i class="emoji medium" data-emoji="👋">👋</i>
<span>Hey, @State.Name.</span>
</a>
<a class="m s row" href="/directory">
<i class="fa-duotone fa-address-book"></i>
<span>Address Directory</span>
</a>
@foreach (AddressResponseData address in State.AddressList ?? new List<AddressResponseData>()) {
<a class="row @(address == State.SelectedAddress ? "active" : "")" @onclick="() => changeAddress(address)">
<img class="tiny circle avatar" src="https://profiles.cache.lol/@address.Address/picture" alt="@address.Address" />
<span class="address"><i class="fa-solid fa-fw fa-at tiny"></i>@address.Address</span>
</a>
if (address.Address == State.SelectedAddressName) {
<a class="indent row" href="/person/@State.SelectedAddressName#profile">
<i class="fa-solid fa-id-card"></i>
<span>Profile</span>
</a>
<a class="indent row" href="/person/@State.SelectedAddressName#statuses">
<i class="fa-solid fa-message-smile"></i>
<span>Statuslog</span>
</a>
<a class="indent row" href="/person/@State.SelectedAddressName#pics">
<i class="fa-solid fa-images"></i>
<span>Pics</span>
</a>
<a class="indent row" href="/person/@State.SelectedAddressName#now">
<i class="fa-duotone fa-seedling"></i>
<span>/Now</span>
</a>
}
}
<a class="row" @onclick='() => AuthStateProvider.Logout()'>
<i class="fa-solid fa-door-open"></i>
<span>Logout</span>
</a>
</menu>
</button>
<small class="s m address"><i class="fa-solid fa-fw fa-at tiny"></i>@State.SelectedAddressName</small>
</NavLink>
<div class="l">
Hey, @State.Name. <br />
<a class="address" href="/person/@State.SelectedAddressName"><i class="fa-solid fa-fw fa-at tiny"></i>@State.SelectedAddressName</a>
</div>
</Authorized>
<NotAuthorized>
<NavLink>
<button class="transparent square small large">
<img class="responsive" src="/img/prami-neighbourhood.svg">
<menu class="no-wrap">
<a class="m s row">
<i class="emoji medium" data-emoji="👋">👋</i>
<span>Hey there.</span>
</a>
<a class="row" href="/login">
<i class="fa-solid fa-door-closed"></i>
<span>Login</span>
</a>
</menu>
</button>
<small class="s m address">Omg.lol</small>
</NavLink>
<div class="l">
Hey there. <br />
<a href="/login">Login?</a>
</div>
</NotAuthorized>
</AuthorizeView>
@code {
public void changeAddress(AddressResponseData address) {
State.SelectedAddress = address;
}
}