1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/apps/experimental/components/AppToolbar/index.tsx

73 lines
2.2 KiB
TypeScript
Raw Normal View History

import SearchIcon from '@mui/icons-material/Search';
import IconButton from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';
import React, { FC } from 'react';
2022-11-28 16:39:13 -05:00
import { Link, useLocation } from 'react-router-dom';
import AppToolbar from 'components/toolbar/AppToolbar';
import globalize from 'scripts/globalize';
2022-11-28 16:39:13 -05:00
import AppTabs from '../tabs/AppTabs';
import RemotePlayButton from './RemotePlayButton';
2022-11-28 16:39:13 -05:00
import SyncPlayButton from './SyncPlayButton';
2023-10-28 22:40:13 +03:00
import { isTabPath } from '../tabs/tabRoutes';
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
}
const PUBLIC_PATHS = [
'/addserver.html',
'/selectserver.html',
'/login.html',
'/forgotpassword.html',
'/forgotpasswordpin.html'
];
const ExperimentalAppToolbar: 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
const location = useLocation();
// The video osd does not show the standard toolbar
if (location.pathname === '/video') return null;
2023-10-28 22:40:13 +03:00
const isTabsAvailable = isTabPath(location.pathname);
const isPublicPath = PUBLIC_PATHS.includes(location.pathname);
return (
<AppToolbar
buttons={!isPublicPath && (
<>
<SyncPlayButton />
<RemotePlayButton />
<Tooltip title={globalize.translate('Search')}>
<IconButton
size='large'
aria-label={globalize.translate('Search')}
color='inherit'
component={Link}
to='/search.html'
>
<SearchIcon />
</IconButton>
</Tooltip>
</>
)}
isDrawerAvailable={isDrawerAvailable}
isDrawerOpen={isDrawerOpen}
onDrawerButtonClick={onDrawerButtonClick}
isUserMenuAvailable={!isPublicPath}
>
2023-10-28 22:40:13 +03:00
{isTabsAvailable && (<AppTabs isDrawerOpen={isDrawerOpen} />)}
</AppToolbar>
);
};
export default ExperimentalAppToolbar;