diff --git a/Components/Layout/AvatarMenu.razor b/Components/Layout/AvatarMenu.razor index a03f03d..347c645 100644 --- a/Components/Layout/AvatarMenu.razor +++ b/Components/Layout/AvatarMenu.razor @@ -6,46 +6,7 @@ @State.SelectedAddressName @@ -60,18 +21,7 @@ Omg.lol @@ -81,10 +31,4 @@ Login? - - -@code { - public void changeAddress(AddressResponseData address) { - State.SelectedAddress = address; - } -} \ No newline at end of file + \ No newline at end of file diff --git a/Components/Layout/AvatarMenuLinks.razor b/Components/Layout/AvatarMenuLinks.razor new file mode 100644 index 0000000..8423806 --- /dev/null +++ b/Components/Layout/AvatarMenuLinks.razor @@ -0,0 +1,56 @@ +@inject CustomAuthenticationStateProvider AuthStateProvider; +@inject State State; + + 👋 + Hey, @(State.Name ?? "there"). + + + + Address Directory + +@if (State.IsAuthorized) { + + + Feed + +} +@foreach (AddressResponseData address in State.AddressList ?? new List()) { + + @address.Address + @address.Address + + if (address.Address == State.SelectedAddressName) { + + + Profile + + + + Statuslog + + + + Pics + + + + /Now + + } +} +@if (State.IsAuthorized) { + + + Logout + +} +else { + + + Login + +} + + + @App.Name - @App.Version + \ No newline at end of file diff --git a/Components/Layout/NavLinks.razor b/Components/Layout/NavLinks.razor index 5fabb20..b376b33 100644 --- a/Components/Layout/NavLinks.razor +++ b/Components/Layout/NavLinks.razor @@ -14,7 +14,17 @@
Now.garden
+ +
Address Directory
-
\ No newline at end of file + + + + + +
Feed
+
+
+
\ No newline at end of file diff --git a/Components/Pages/Feed.razor b/Components/Pages/Feed.razor new file mode 100644 index 0000000..8416ec0 --- /dev/null +++ b/Components/Pages/Feed.razor @@ -0,0 +1,8 @@ +@page "/feed" +

Feed

+ +WIP + +@code { + +} diff --git a/Models/State.cs b/Models/State.cs index 49fc9e4..bddd409 100644 --- a/Models/State.cs +++ b/Models/State.cs @@ -16,12 +16,32 @@ namespace Neighbourhood.omg.lol.Models { public AccountResponseData? AccountInfo { get; set; } public AddressResponseList? AddressList { get; set; } + public bool IsAuthorized { get => AccountInfo != null; } public string? Name { get => AccountInfo?.Name; } public string? Email { get => AccountInfo?.Email; } public IEnumerable? AddressNames { get => AddressList?.Select(a => a.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(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; } // data for selected address diff --git a/Neighbourhood.omg.lol.csproj b/Neighbourhood.omg.lol.csproj index ab82278..1f4a93b 100644 --- a/Neighbourhood.omg.lol.csproj +++ b/Neighbourhood.omg.lol.csproj @@ -57,7 +57,11 @@ au.death.lol.omg.neighbourhood 0.9.0 True + D:\Neighbourhood.omg.lol\neighbourhood.omg.lol.keystore 2 + a!zobzizl + neighbourhood.omg.lol + a!zobzizl