genres list on header menu
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
@using System.Net
|
@using System.Net
|
||||||
|
@using WatchIt.Common.Model.Genres
|
||||||
@using WatchIt.Common.Model.Photos
|
@using WatchIt.Common.Model.Photos
|
||||||
@using WatchIt.Website.Services.Client.Photos
|
@using WatchIt.Website.Services.Client.Photos
|
||||||
|
|
||||||
@@ -35,9 +36,18 @@
|
|||||||
<Dropdown>
|
<Dropdown>
|
||||||
<DropdownToggle Color="Color.Default" Size="Size.Small" ToggleIconVisible="false">Database</DropdownToggle>
|
<DropdownToggle Color="Color.Default" Size="Size.Small" ToggleIconVisible="false">Database</DropdownToggle>
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownItem Clicked="@(() => NavigationManager.NavigateTo("/database/movies"))">Movies</DropdownItem>
|
<DropdownItem Clicked="@(() => NavigationManager.NavigateTo("/database/movies", true))">Movies</DropdownItem>
|
||||||
<DropdownItem Clicked="@(() => NavigationManager.NavigateTo("/database/series"))">TV Series</DropdownItem>
|
<DropdownItem Clicked="@(() => NavigationManager.NavigateTo("/database/series", true))">TV Series</DropdownItem>
|
||||||
<DropdownItem Clicked="@(() => NavigationManager.NavigateTo("/database/people"))">People</DropdownItem>
|
<DropdownItem Clicked="@(() => NavigationManager.NavigateTo("/database/people", true))">People</DropdownItem>
|
||||||
|
</DropdownMenu>
|
||||||
|
</Dropdown>
|
||||||
|
<Dropdown>
|
||||||
|
<DropdownToggle Color="Color.Default" Size="Size.Small" ToggleIconVisible="false">Genres</DropdownToggle>
|
||||||
|
<DropdownMenu MaxMenuHeight="250px">
|
||||||
|
@foreach (GenreResponse genre in _genres)
|
||||||
|
{
|
||||||
|
<DropdownItem Clicked="@(() => NavigationManager.NavigateTo($"/genre/{genre.Id}", true))">@(genre.Name)</DropdownItem>
|
||||||
|
}
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
<button type="button" class="btn btn-sm" @onclick="@(() => _searchbarVisible = true)">⌕</button>
|
<button type="button" class="btn btn-sm" @onclick="@(() => _searchbarVisible = true)">⌕</button>
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using WatchIt.Common.Model.Accounts;
|
using WatchIt.Common.Model.Accounts;
|
||||||
|
using WatchIt.Common.Model.Genres;
|
||||||
using WatchIt.Common.Model.Photos;
|
using WatchIt.Common.Model.Photos;
|
||||||
using WatchIt.Website.Components.Common.Subcomponents;
|
using WatchIt.Website.Components.Common.Subcomponents;
|
||||||
using WatchIt.Website.Services.Authentication;
|
using WatchIt.Website.Services.Authentication;
|
||||||
using WatchIt.Website.Services.Tokens;
|
using WatchIt.Website.Services.Tokens;
|
||||||
using WatchIt.Website.Services.Client.Accounts;
|
using WatchIt.Website.Services.Client.Accounts;
|
||||||
|
using WatchIt.Website.Services.Client.Genres;
|
||||||
using WatchIt.Website.Services.Client.Media;
|
using WatchIt.Website.Services.Client.Media;
|
||||||
using WatchIt.Website.Services.Client.Photos;
|
using WatchIt.Website.Services.Client.Photos;
|
||||||
|
|
||||||
@@ -22,6 +24,7 @@ public partial class MainLayout : LayoutComponentBase
|
|||||||
[Inject] public IMediaClientService MediaClientService { get; set; } = default!;
|
[Inject] public IMediaClientService MediaClientService { get; set; } = default!;
|
||||||
[Inject] public IPhotosClientService PhotosClientService { get; set; } = default!;
|
[Inject] public IPhotosClientService PhotosClientService { get; set; } = default!;
|
||||||
[Inject] public IAccountsClientService AccountsClientService { get; set; } = default!;
|
[Inject] public IAccountsClientService AccountsClientService { get; set; } = default!;
|
||||||
|
[Inject] public IGenresClientService GenresClientService { get; set; } = default!;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -39,6 +42,8 @@ public partial class MainLayout : LayoutComponentBase
|
|||||||
|
|
||||||
private bool _searchbarVisible;
|
private bool _searchbarVisible;
|
||||||
private string _searchbarText = string.Empty;
|
private string _searchbarText = string.Empty;
|
||||||
|
|
||||||
|
private List<GenreResponse> _genres = [];
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -86,7 +91,8 @@ public partial class MainLayout : LayoutComponentBase
|
|||||||
await Task.WhenAll(
|
await Task.WhenAll(
|
||||||
[
|
[
|
||||||
Task.Run(async () => _user = await AuthenticationService.GetUserAsync()),
|
Task.Run(async () => _user = await AuthenticationService.GetUserAsync()),
|
||||||
PhotosClientService.GetPhotoRandomBackground(data => _defaultBackgroundPhoto = data)
|
PhotosClientService.GetPhotoRandomBackground(data => _defaultBackgroundPhoto = data),
|
||||||
|
GenresClientService.GetGenres(successAction: _genres.AddRange)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (_user is not null)
|
if (_user is not null)
|
||||||
|
|||||||
Reference in New Issue
Block a user