robosats/frontend/src/basic/NavBar/MoreTooltip.tsx
KoalaSat 293c0b604d Refactor contexts and models (#921)
* Add SVG icons for map pins

* Add federation basis and new coordinator form (#793)

* Add new coordinator entry issue form

* Add Federation basis

* Fix eslint errors from F2F and fix languages

* Redo eslint @typescript-eslint/strict-boolean-expressions

* Robot Page working

* Contexts Working

* Garage Working

* CurrentOrder working

* Federation model working

---------

Co-authored-by: Reckless_Satoshi <reckless.satoshi@protonmail.com>
Co-authored-by: Reckless_Satoshi <90936742+Reckless-Satoshi@users.noreply.github.com>
2023-12-02 10:40:59 +00:00

128 lines
4.2 KiB
TypeScript

import React, { useContext } from 'react';
import { useTranslation } from 'react-i18next';
import { useTheme, styled, Grid, IconButton } from '@mui/material';
import Tooltip, { type TooltipProps, tooltipClasses } from '@mui/material/Tooltip';
import { closeAll, type UseAppStoreType, AppContext } from '../../contexts/AppContext';
import { BubbleChart, Info, People, PriceChange, School } from '@mui/icons-material';
const StyledTooltip = styled(({ className, ...props }: TooltipProps) => (
<Tooltip {...props} classes={{ popper: className }} />
))(({ theme }) => ({
[`& .${tooltipClasses.tooltip}`]: {
backgroundColor: theme.palette.background.paper,
color: theme.palette.text.primary,
boxShadow: theme.shadows[1],
fontSize: theme.typography.fontSize,
borderRadius: '2em',
},
}));
interface MoreTooltipProps {
children: JSX.Element;
}
const MoreTooltip = ({ children }: MoreTooltipProps): JSX.Element => {
const { t } = useTranslation();
const { open, setOpen } = useContext<UseAppStoreType>(AppContext);
const theme = useTheme();
return (
<StyledTooltip
open={open.more}
title={
<Grid
container
direction='column'
padding={0}
sx={{ width: '2em', padding: '0em' }}
justifyContent='center'
>
<Grid item sx={{ position: 'relative', right: '0.4em' }}>
<Tooltip enterTouchDelay={250} placement='left' title={t('RoboSats information')}>
<IconButton
sx={{
color: open.info ? theme.palette.primary.main : theme.palette.text.secondary,
}}
onClick={() => {
setOpen({ ...closeAll, info: !open.info });
}}
>
<Info />
</IconButton>
</Tooltip>
</Grid>
<Grid item sx={{ position: 'relative', right: '0.4em' }}>
<Tooltip enterTouchDelay={250} placement='left' title={t('Learn RoboSats')}>
<IconButton
sx={{
color: open.learn ? theme.palette.primary.main : theme.palette.text.secondary,
}}
onClick={() => {
setOpen({ ...closeAll, learn: !open.learn });
}}
>
<School />
</IconButton>
</Tooltip>
</Grid>
<Grid item sx={{ position: 'relative', right: '0.4em' }}>
<Tooltip
enterTouchDelay={250}
placement='left'
title={t('Community and public support')}
>
<IconButton
sx={{
color: open.community ? theme.palette.primary.main : theme.palette.text.secondary,
}}
onClick={() => {
setOpen({ ...closeAll, community: !open.community });
}}
>
<People />
</IconButton>
</Tooltip>
</Grid>
<Grid item sx={{ position: 'relative', right: '0.4em' }}>
<Tooltip enterTouchDelay={250} placement='left' title={t('Exchange summary')}>
<IconButton
sx={{
color: open.exchange ? theme.palette.primary.main : theme.palette.text.secondary,
}}
onClick={() => {
setOpen({ ...closeAll, exchange: !open.exchange });
}}
>
<PriceChange />
</IconButton>
</Tooltip>
</Grid>
<Grid item sx={{ position: 'relative', right: '0.4em' }}>
<Tooltip enterTouchDelay={250} placement='left' title={t('client for nerds')}>
<IconButton
sx={{
color: open.client ? theme.palette.primary.main : theme.palette.text.secondary,
}}
onClick={() => {
setOpen({ ...closeAll, client: !open.client });
}}
>
<BubbleChart />
</IconButton>
</Tooltip>
</Grid>
</Grid>
}
>
{children}
</StyledTooltip>
);
};
export default MoreTooltip;