Nav changes, new feed page

Still need to actually hook up following people and such.
This commit is contained in:
Gordon Pedersen 2024-06-27 17:26:43 +10:00
parent 039fa52955
commit 2b1a6f203f
6 changed files with 103 additions and 61 deletions

View file

@ -6,46 +6,7 @@
<button class="transparent circle small large"> <button class="transparent circle small large">
<img class="responsive avatar" src="https://profiles.cache.lol/@State.SelectedAddressName/picture" alt="@State.SelectedAddressName"> <img class="responsive avatar" src="https://profiles.cache.lol/@State.SelectedAddressName/picture" alt="@State.SelectedAddressName">
<menu class="no-wrap"> <menu class="no-wrap">
<a class="m s row"> <AvatarMenuLinks></AvatarMenuLinks>
<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>
<a class="row medium-opacity">
<i class="fa-solid fa-circle-info tiny"></i>
<small>@App.Name - @App.Version</small>
</a>
</menu> </menu>
</button> </button>
<small class="s m address"><i class="fa-solid fa-fw fa-at tiny"></i>@State.SelectedAddressName</small> <small class="s m address"><i class="fa-solid fa-fw fa-at tiny"></i>@State.SelectedAddressName</small>
@ -60,18 +21,7 @@
<button class="transparent square small large"> <button class="transparent square small large">
<img class="responsive" src="/img/prami-neighbourhood.svg"> <img class="responsive" src="/img/prami-neighbourhood.svg">
<menu class="no-wrap"> <menu class="no-wrap">
<a class="m s row"> <AvatarMenuLinks></AvatarMenuLinks>
<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>
<a class="row medium-opacity">
<i class="fa-solid fa-circle-info tiny"></i>
<small>@App.Name - @App.Version</small>
</a>
</menu> </menu>
</button> </button>
<small class="s m address">Omg.lol</small> <small class="s m address">Omg.lol</small>
@ -81,10 +31,4 @@
<a href="/login">Login?</a> <a href="/login">Login?</a>
</div> </div>
</NotAuthorized> </NotAuthorized>
</AuthorizeView> </AuthorizeView>
@code {
public void changeAddress(AddressResponseData address) {
State.SelectedAddress = address;
}
}

View file

@ -0,0 +1,56 @@
@inject CustomAuthenticationStateProvider AuthStateProvider;
@inject State State;
<a class="m s row">
<i class="emoji medium" data-emoji="👋">👋</i>
<span>Hey, @(State.Name ?? "there").</span>
</a>
<a class="m s row" href="/directory">
<i class="square fa-duotone fa-address-book"></i>
<span>Address Directory</span>
</a>
@if (State.IsAuthorized) {
<a class="m s row" href="/feed">
<i class="square fa-solid fa-list-timeline"></i>
<span>Feed</span>
</a>
}
@foreach (AddressResponseData address in State.AddressList ?? new List<AddressResponseData>()) {
<a class="row @(address == State.SelectedAddress ? "active" : "")" @onclick="() => State.SelectedAddress = 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>
}
}
@if (State.IsAuthorized) {
<a class="row" @onclick='() => AuthStateProvider.Logout()'>
<i class="fa-solid fa-door-open"></i>
<span>Logout</span>
</a>
}
else {
<a class="row" href="/login">
<i class="fa-solid fa-door-closed"></i>
<span>Login</span>
</a>
}
<a class="row medium-opacity">
<i class="fa-solid fa-circle-info tiny"></i>
<small>@App.Name - @App.Version</small>
</a>

View file

@ -14,7 +14,17 @@
<i class="square fa-duotone fa-seedling"></i> <i class="square fa-duotone fa-seedling"></i>
<div class="label">Now.garden</div> <div class="label">Now.garden</div>
</NavLink> </NavLink>
<NavLink class="l nav-link" href="/directory"> <NavLink class="l nav-link" href="/directory">
<i class="square fa-duotone fa-address-book"></i> <i class="square fa-duotone fa-address-book"></i>
<div class="label">Address Directory</div> <div class="label">Address Directory</div>
</NavLink> </NavLink>
<AuthorizeView>
<Authorized>
<NavLink class="l nav-link" href="/feed">
<i class="square fa-solid fa-list-timeline"></i>
<div class="label">Feed</div>
</NavLink>
</Authorized>
</AuthorizeView>

View file

@ -0,0 +1,8 @@
@page "/feed"
<h3>Feed</h3>
WIP
@code {
}

View file

@ -16,12 +16,32 @@ namespace Neighbourhood.omg.lol.Models {
public AccountResponseData? AccountInfo { get; set; } public AccountResponseData? AccountInfo { get; set; }
public AddressResponseList? AddressList { get; set; } public AddressResponseList? AddressList { get; set; }
public bool IsAuthorized { get => AccountInfo != null; }
public string? Name { get => AccountInfo?.Name; } public string? Name { get => AccountInfo?.Name; }
public string? Email { get => AccountInfo?.Email; } public string? Email { get => AccountInfo?.Email; }
public IEnumerable<string>? AddressNames { get => AddressList?.Select(a => a.Address); } public IEnumerable<string>? AddressNames { get => AddressList?.Select(a => a.Address); }
// Selected Address // Selected Address
public AddressResponseData? SelectedAddress { get; set; } private AddressResponseData? _selectedAddress;
public AddressResponseData? SelectedAddress {
get {
if (_selectedAddress == null) {
string selectedAddressJson = Preferences.Default.Get("selectedaddress", string.Empty);
if (!string.IsNullOrEmpty(selectedAddressJson)) _selectedAddress = JsonSerializer.Deserialize<AddressResponseData>(selectedAddressJson);
}
return _selectedAddress;
}
set {
if (_selectedAddress != value) {
_selectedAddress = value;
if (_selectedAddress == null) Preferences.Default.Remove("selectedaddress");
else {
string selectedAddressJson = JsonSerializer.Serialize(_selectedAddress);
Preferences.Default.Set("selectedaddress", selectedAddressJson);
}
}
}
}
public string? SelectedAddressName { get => SelectedAddress?.Address; } public string? SelectedAddressName { get => SelectedAddress?.Address; }
// data for selected address // data for selected address

View file

@ -57,7 +57,11 @@
<ApplicationId>au.death.lol.omg.neighbourhood</ApplicationId> <ApplicationId>au.death.lol.omg.neighbourhood</ApplicationId>
<ApplicationDisplayVersion>0.9.0</ApplicationDisplayVersion> <ApplicationDisplayVersion>0.9.0</ApplicationDisplayVersion>
<AndroidKeyStore>True</AndroidKeyStore> <AndroidKeyStore>True</AndroidKeyStore>
<AndroidSigningKeyStore>D:\Neighbourhood.omg.lol\neighbourhood.omg.lol.keystore</AndroidSigningKeyStore>
<ApplicationVersion>2</ApplicationVersion> <ApplicationVersion>2</ApplicationVersion>
<AndroidSigningStorePass>a!zobzizl</AndroidSigningStorePass>
<AndroidSigningKeyAlias>neighbourhood.omg.lol</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>a!zobzizl</AndroidSigningKeyPass>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'">