2024-09-16 14:16:34 -04:00
|
|
|
import Stack from '@mui/material/Stack';
|
2024-05-21 00:19:28 +03:00
|
|
|
import React, { type FC } from 'react';
|
|
|
|
|
import { useLocation } from 'react-router-dom';
|
2024-09-16 14:16:34 -04:00
|
|
|
|
2026-01-16 13:25:35 -05:00
|
|
|
import { appRouter, PUBLIC_PATHS } from 'components/router/appRouter';
|
2026-06-30 12:17:22 -04:00
|
|
|
import BaseToolbar from 'components/toolbar/AppToolbar';
|
2024-09-16 14:16:34 -04:00
|
|
|
import ServerButton from 'components/toolbar/ServerButton';
|
|
|
|
|
|
2022-11-28 16:39:13 -05:00
|
|
|
import RemotePlayButton from './RemotePlayButton';
|
2022-11-28 16:39:13 -05:00
|
|
|
import SyncPlayButton from './SyncPlayButton';
|
2024-05-21 00:19:28 +03:00
|
|
|
import SearchButton from './SearchButton';
|
2024-09-16 14:16:34 -04:00
|
|
|
import UserViewNav from './userViews/UserViewNav';
|
2022-11-28 16:39:13 -05:00
|
|
|
|
|
|
|
|
interface AppToolbarProps {
|
2023-11-28 10:26:14 -05:00
|
|
|
isDrawerAvailable: boolean
|
2022-11-28 16:39:13 -05:00
|
|
|
isDrawerOpen: boolean
|
|
|
|
|
onDrawerButtonClick: (event: React.MouseEvent<HTMLElement>) => void
|
2022-11-28 16:39:13 -05:00
|
|
|
}
|
|
|
|
|
|
2026-06-30 12:17:22 -04:00
|
|
|
const AppToolbar: FC<AppToolbarProps> = ({
|
2023-11-28 10:26:14 -05:00
|
|
|
isDrawerAvailable,
|
2022-11-28 16:39:13 -05:00
|
|
|
isDrawerOpen,
|
2022-11-28 16:39:13 -05:00
|
|
|
onDrawerButtonClick
|
2022-11-28 16:39:13 -05:00
|
|
|
}) => {
|
2022-11-28 16:39:13 -05:00
|
|
|
const location = useLocation();
|
2024-05-17 13:52:45 -04:00
|
|
|
|
|
|
|
|
// The video osd does not show the standard toolbar
|
|
|
|
|
if (location.pathname === '/video') return null;
|
|
|
|
|
|
2026-01-16 13:25:35 -05:00
|
|
|
// 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
|
2024-05-17 13:52:45 -04:00
|
|
|
const isPublicPath = PUBLIC_PATHS.includes(location.pathname);
|
2022-11-28 16:39:13 -05:00
|
|
|
|
|
|
|
|
return (
|
2026-06-30 12:17:22 -04:00
|
|
|
<BaseToolbar
|
2024-05-17 13:52:45 -04:00
|
|
|
buttons={!isPublicPath && (
|
2022-11-28 16:39:13 -05:00
|
|
|
<>
|
2023-09-27 02:07:40 -04:00
|
|
|
<SyncPlayButton />
|
|
|
|
|
<RemotePlayButton />
|
2024-09-16 14:16:34 -04:00
|
|
|
<SearchButton />
|
2022-11-28 16:39:13 -05:00
|
|
|
</>
|
2024-05-17 13:52:45 -04:00
|
|
|
)}
|
2023-09-27 02:07:40 -04:00
|
|
|
isDrawerAvailable={isDrawerAvailable}
|
|
|
|
|
isDrawerOpen={isDrawerOpen}
|
|
|
|
|
onDrawerButtonClick={onDrawerButtonClick}
|
2026-01-16 13:25:35 -05:00
|
|
|
isBackButtonAvailable={isBackButtonAvailable}
|
2024-05-17 13:52:45 -04:00
|
|
|
isUserMenuAvailable={!isPublicPath}
|
2026-07-10 14:57:27 -04:00
|
|
|
className='padded-left padded-right'
|
2023-09-27 02:07:40 -04:00
|
|
|
>
|
2024-09-16 14:16:34 -04:00
|
|
|
{!isDrawerAvailable && (
|
|
|
|
|
<Stack
|
|
|
|
|
direction='row'
|
|
|
|
|
spacing={0.5}
|
|
|
|
|
>
|
|
|
|
|
<ServerButton />
|
|
|
|
|
|
|
|
|
|
{!isPublicPath && (
|
|
|
|
|
<UserViewNav />
|
|
|
|
|
)}
|
|
|
|
|
</Stack>
|
|
|
|
|
)}
|
2026-06-30 12:17:22 -04:00
|
|
|
</BaseToolbar>
|
2022-11-28 16:39:13 -05:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2026-06-30 12:17:22 -04:00
|
|
|
export default AppToolbar;
|