diff --git a/PlaylistShared.Pwa/App.razor b/PlaylistShared.Pwa/App.razor index fa132d9..3b1229c 100644 --- a/PlaylistShared.Pwa/App.razor +++ b/PlaylistShared.Pwa/App.razor @@ -11,7 +11,7 @@ } else { -

You are not authorized to access this resource.

+

У вас нет прав доступа к этому ресурсу.

} diff --git a/PlaylistShared.Pwa/Components/Global/ContextualBarContent.razor b/PlaylistShared.Pwa/Components/Global/ContextualBarContent.razor new file mode 100644 index 0000000..26eeb80 --- /dev/null +++ b/PlaylistShared.Pwa/Components/Global/ContextualBarContent.razor @@ -0,0 +1,33 @@ +@implements IDisposable +@inject ContextualActionBarService ContextualActionBarService + +@code { + [Parameter] public bool Bottom { get; set; } = false; + [Parameter] public RenderFragment? ChildContent { get; set; } + + protected override void OnParametersSet() + { + bool isChanged = false; + + if (ContextualActionBarService.Content != ChildContent) + { + ContextualActionBarService.Content = ChildContent; + isChanged = true; + } + + if (ContextualActionBarService.Bottom != Bottom) + { + ContextualActionBarService.Bottom = Bottom; + isChanged = true; + } + + if (isChanged) ContextualActionBarService.ChangeParameters(); + } + + public void Dispose() + { + ContextualActionBarService.Content = null; + ContextualActionBarService.Bottom = null; + ContextualActionBarService.ChangeParameters(); + } +} \ No newline at end of file diff --git a/PlaylistShared.Pwa/Layout/MainLayout.razor b/PlaylistShared.Pwa/Layout/MainLayout.razor index e1e0be1..90db9b4 100644 --- a/PlaylistShared.Pwa/Layout/MainLayout.razor +++ b/PlaylistShared.Pwa/Layout/MainLayout.razor @@ -2,6 +2,7 @@ @inherits LayoutComponentBase @inject PwaUpdateService PwaUpdateService @inject IJSRuntime JSRuntime +@inject ContextualActionBarService ContextualActionBarService @@ -9,36 +10,40 @@ - + - - - - - Git - + @if (_actionBarContent != null) + { + @_actionBarContent + } + else + { + + + + + Git + + } - - - @Body - - - - - + + @Body @code { + private RenderFragment? _actionBarContent; + private bool _actionBarBottom = false; + private bool _drawerOpen = true; private bool _isDarkMode = true; private MudTheme? _theme; - + private DotNetObjectReference? _dotNetRef; protected override void OnInitialized() @@ -51,6 +56,8 @@ PaletteDark = _darkPalette, LayoutProperties = new LayoutProperties() }; + + ContextualActionBarService.OnChanged += OnContextualChangedHandler; } protected override async Task OnAfterRenderAsync(bool firstRender) @@ -62,6 +69,13 @@ } } + private void OnContextualChangedHandler() + { + _actionBarContent = ContextualActionBarService.Content; + _actionBarBottom = ContextualActionBarService.Bottom ?? false; + StateHasChanged(); + } + private void DrawerToggle() { _drawerOpen = !_drawerOpen; diff --git a/PlaylistShared.Pwa/Pages/SharedPlaylistView.razor b/PlaylistShared.Pwa/Pages/SharedPlaylistView.razor index d9bf5b7..08c11f7 100644 --- a/PlaylistShared.Pwa/Pages/SharedPlaylistView.razor +++ b/PlaylistShared.Pwa/Pages/SharedPlaylistView.razor @@ -2,6 +2,7 @@ @_playlist?.Title - Playlist Share @using PlaylistShared.Pwa.Components.Common +@using PlaylistShared.Pwa.Components.Global @using PlaylistShared.Pwa.Components.SharedPlaylist @using PlaylistShared.Pwa.Components.SharedPlaylist.Cards @using PlaylistShared.Shared.DTO @@ -16,60 +17,73 @@ @inject IDialogService DialogService - @* --- ВЕРСИЯ ДЛЯ ПК (сетка) --- *@ - - - - @PlaylistCardContent - + + @*Первый элемент растянется на всю высоту*@ + - @if (_canAdd) - { - - @AddTrackCardContent - - } - - - - @* --- ВЕРСИЯ ДЛЯ МОБИЛОК (вкладки внизу) --- *@ - -
- - @* Область контента: оба компонента здесь всегда *@ -
-
-
+ @* --- ВЕРСИЯ ДЛЯ ПК (сетка) --- *@ + + + @PlaylistCardContent -
-
- - @if (_canAdd) - { -
-
- @AddTrackCardContent -
-
- } -
+ - @* Кастомная панель навигации внизу *@ - @if (_canAdd) - { - - - + @if (_canAdd) + { + + @AddTrackCardContent + + } + + + + + @* --- ВЕРСИЯ ДЛЯ МОБИЛОК (вкладки внизу) --- *@ + +
+ + @* Область контента: оба компонента здесь всегда *@ +
+
+
+ @PlaylistCardContent +
+
+ + @if (_canAdd) + { +
+
+ @AddTrackCardContent +
+
+ } +
+ + @* Кастомная панель навигации внизу *@ + + + + @if (_canAdd) + { - - - } -
-
+ } +
+ + +
+
+ + + @*Второй элемент - плеер. Привязан к нижней части контейнера*@ + + + +