First Commit

This commit is contained in:
cesnimda
2026-03-21 11:55:27 +01:00
commit 2e8a29b4d0
1757 changed files with 166084 additions and 0 deletions
@@ -0,0 +1,114 @@
import PropTypes from 'prop-types';
// @mui
import { styled } from '@mui/material/styles';
import Fade from '@mui/material/Fade';
import Grow from '@mui/material/Grow';
import Slide from '@mui/material/Slide';
import Zoom from '@mui/material/Zoom';
// @third-party
import { SnackbarProvider } from 'notistack';
// @project
import { useGetSnackbar } from '@/states/snackbar';
import Loader from '@/components/Loader';
// @assets
import { IconAlertTriangle, IconBug, IconChecks, IconInfoCircle, IconSpeakerphone } from '@tabler/icons-react';
// custom styles
const StyledSnackbarProvider = styled(SnackbarProvider)(({ theme }) => ({
'&.notistack-MuiContent': {
color: theme.vars.palette.background.default
},
'&.notistack-MuiContent-default': {
backgroundColor: theme.vars.palette.primary.main
},
'&.notistack-MuiContent-error': {
backgroundColor: theme.vars.palette.error.main
},
'&.notistack-MuiContent-success': {
backgroundColor: theme.vars.palette.success.main
},
'&.notistack-MuiContent-info': {
backgroundColor: theme.vars.palette.info.main
},
'&.notistack-MuiContent-warning': {
backgroundColor: theme.vars.palette.warning.main
},
'& #notistack-snackbar': {
gap: 8
}
}));
/*************************** SNACKBAR - ANIMATION ***************************/
function TransitionSlideLeft(props) {
return <Slide {...props} direction="left" />;
}
function TransitionSlideUp(props) {
return <Slide {...props} direction="up" />;
}
function TransitionSlideRight(props) {
return <Slide {...props} direction="right" />;
}
function TransitionSlideDown(props) {
return <Slide {...props} direction="down" />;
}
function GrowTransition(props) {
return <Grow {...props} />;
}
function ZoomTransition(props) {
return <Zoom {...props} />;
}
const animation = {
SlideLeft: TransitionSlideLeft,
SlideUp: TransitionSlideUp,
SlideRight: TransitionSlideRight,
SlideDown: TransitionSlideDown,
Grow: GrowTransition,
Zoom: ZoomTransition,
Fade
};
const iconSX = { fontSize: '1.15rem' };
/*************************** SNACKBAR - NOTISTACK ***************************/
export default function Notistack({ children }) {
const { snackbar } = useGetSnackbar();
if (snackbar === undefined) return <Loader />;
return (
<StyledSnackbarProvider
maxSnack={snackbar.maxStack}
dense={snackbar.dense}
anchorOrigin={snackbar.anchorOrigin}
TransitionComponent={animation[snackbar.transition]}
iconVariant={
snackbar.iconVariant === 'useemojis'
? {
default: <IconSpeakerphone style={iconSX} />,
success: <IconChecks style={iconSX} />,
error: <IconBug style={iconSX} />,
warning: <IconAlertTriangle style={iconSX} />,
info: <IconInfoCircle style={iconSX} />
}
: undefined
}
hideIconVariant={snackbar.iconVariant === 'hide' ? true : false}
>
{children}
</StyledSnackbarProvider>
);
}
Notistack.propTypes = { children: PropTypes.node };
@@ -0,0 +1,51 @@
'use client';
import PropTypes from 'prop-types';
// @mui
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
// @third-party
import MainSimpleBar from 'simplebar-react';
import { BrowserView, MobileView } from 'react-device-detect';
// @project
import { withAlpha } from '@/utils/colorUtils';
// root style
const RootStyle = styled(BrowserView)({ flexGrow: 1, height: '100%', overflow: 'hidden' });
// scroll bar wrapper
const SimpleBarStyle = styled(MainSimpleBar)(({ theme }) => ({
maxHeight: '100%',
'& .simplebar-scrollbar': {
'&:before': {
background: withAlpha(theme.vars.palette.grey[500], 0.48)
},
'&.simplebar-visible:before': { opacity: 1 }
},
'& .simplebar-track.simplebar-vertical': { width: 10 },
'& .simplebar-track.simplebar-horizontal .simplebar-scrollbar': { height: 6 },
'& .simplebar-mask': { zIndex: 'inherit' }
}));
/*************************** SIMPLE SCROLL BAR ***************************/
export default function SimpleBar({ children, sx, ...other }) {
return (
<>
<RootStyle>
<SimpleBarStyle clickOnTrack={false} sx={sx} data-simplebar-direction="ltr" {...other}>
{children}
</SimpleBarStyle>
</RootStyle>
<MobileView>
<Box sx={{ overflowX: 'auto', ...sx }} {...other}>
{children}
</Box>
</MobileView>
</>
);
}
SimpleBar.propTypes = { children: PropTypes.any, sx: PropTypes.any, other: PropTypes.any };
@@ -0,0 +1,24 @@
import PropTypes from 'prop-types';
// @mui
import Stack from '@mui/material/Stack';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
/*************************** CHART - LEGEND ***************************/
export default function Legend({ items, onToggle }) {
return (
<Stack direction="row" sx={{ justifyContent: 'flex-end', gap: 1.5 }}>
{items.map((item) => (
<Stack key={item.id} direction="row" sx={{ alignItems: 'center', gap: 0.5, cursor: 'pointer' }} onClick={() => onToggle(item.id)}>
<Box sx={{ width: 15, height: 15, bgcolor: item.visible ? item.color : 'grey.600', borderRadius: '50%' }} />
<Typography variant="caption" color="text.secondary">
{item.label}
</Typography>
</Stack>
))}
</Stack>
);
}
Legend.propTypes = { items: PropTypes.object, onToggle: PropTypes.func };