Backport pull request #7500 from jellyfin-web/release-10.11.z

Restore back button in experimental layout for apps

Original-merge: 6d8c8c0566a7e3cbf96aeb98800b11c6f5c7a332

Merged-by: thornbill <thornbill@users.noreply.github.com>

Backported-by: thornbill <thornbill@users.noreply.github.com>
This commit is contained in:
thornbill
2026-01-16 13:25:35 -05:00
parent 6683c73929
commit d0270d5f65
2 changed files with 8 additions and 12 deletions
@@ -2,6 +2,7 @@ import Stack from '@mui/material/Stack';
import React, { type FC } from 'react';
import { useLocation } from 'react-router-dom';
import { appRouter, PUBLIC_PATHS } from 'components/router/appRouter';
import AppToolbar from 'components/toolbar/AppToolbar';
import ServerButton from 'components/toolbar/ServerButton';
@@ -16,14 +17,6 @@ interface AppToolbarProps {
onDrawerButtonClick: (event: React.MouseEvent<HTMLElement>) => void
}
const PUBLIC_PATHS = [
'/addserver',
'/selectserver',
'/login',
'/forgotpassword',
'/forgotpasswordpin'
];
const ExperimentalAppToolbar: FC<AppToolbarProps> = ({
isDrawerAvailable,
isDrawerOpen,
@@ -34,6 +27,10 @@ const ExperimentalAppToolbar: FC<AppToolbarProps> = ({
// The video osd does not show the standard toolbar
if (location.pathname === '/video') return null;
// Only show the back button in apps when appropriate
const isBackButtonAvailable = window.NativeShell && appRouter.canGoBack(location.pathname);
// Check if the current path is a public path to hide user content
const isPublicPath = PUBLIC_PATHS.includes(location.pathname);
return (
@@ -48,6 +45,7 @@ const ExperimentalAppToolbar: FC<AppToolbarProps> = ({
isDrawerAvailable={isDrawerAvailable}
isDrawerOpen={isDrawerOpen}
onDrawerButtonClick={onDrawerButtonClick}
isBackButtonAvailable={isBackButtonAvailable}
isUserMenuAvailable={!isPublicPath}
>
{!isDrawerAvailable && (
+2 -4
View File
@@ -17,7 +17,7 @@ import { history } from 'RootAppRouter';
const START_PAGE_PATHS = ['/home', '/login', '/selectserver'];
/** Pages that do not require a user to be logged in to view. */
const PUBLIC_PATHS = [
export const PUBLIC_PATHS = [
'/addserver',
'/selectserver',
'/login',
@@ -122,9 +122,7 @@ class AppRouter {
return this.baseRoute;
}
canGoBack() {
const path = history.location.pathname;
canGoBack(path = history.location.pathname) {
if (
!document.querySelector('.dialogContainer')
&& START_PAGE_PATHS.includes(path)