Initial push

This commit is contained in:
Henry
2023-04-06 22:17:34 +01:00
commit 05c86ff9c5
162 changed files with 9112 additions and 0 deletions
@@ -0,0 +1,72 @@
import PropTypes from 'prop-types'
// material-ui
import { useTheme } from '@mui/material/styles'
import MuiAvatar from '@mui/material/Avatar'
// ==============================|| AVATAR ||============================== //
const Avatar = ({ color, outline, size, sx, ...others }) => {
const theme = useTheme()
const colorSX = color && !outline && { color: theme.palette.background.paper, bgcolor: `${color}.main` }
const outlineSX = outline && {
color: color ? `${color}.main` : `primary.main`,
bgcolor: theme.palette.background.paper,
border: '2px solid',
borderColor: color ? `${color}.main` : `primary.main`
}
let sizeSX = {}
switch (size) {
case 'badge':
sizeSX = {
width: theme.spacing(3.5),
height: theme.spacing(3.5)
}
break
case 'xs':
sizeSX = {
width: theme.spacing(4.25),
height: theme.spacing(4.25)
}
break
case 'sm':
sizeSX = {
width: theme.spacing(5),
height: theme.spacing(5)
}
break
case 'lg':
sizeSX = {
width: theme.spacing(9),
height: theme.spacing(9)
}
break
case 'xl':
sizeSX = {
width: theme.spacing(10.25),
height: theme.spacing(10.25)
}
break
case 'md':
sizeSX = {
width: theme.spacing(7.5),
height: theme.spacing(7.5)
}
break
default:
sizeSX = {}
}
return <MuiAvatar sx={{ ...colorSX, ...outlineSX, ...sizeSX, ...sx }} {...others} />
}
Avatar.propTypes = {
className: PropTypes.string,
color: PropTypes.string,
outline: PropTypes.bool,
size: PropTypes.string,
sx: PropTypes.object
}
export default Avatar
@@ -0,0 +1,184 @@
import PropTypes from 'prop-types'
import { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
// material-ui
import { useTheme } from '@mui/material/styles'
import { Box, Card, Divider, Grid, Typography } from '@mui/material'
import MuiBreadcrumbs from '@mui/material/Breadcrumbs'
// project imports
import config from 'config'
import { gridSpacing } from 'store/constant'
// assets
import { IconTallymark1 } from '@tabler/icons'
import AccountTreeTwoToneIcon from '@mui/icons-material/AccountTreeTwoTone'
import HomeIcon from '@mui/icons-material/Home'
import HomeTwoToneIcon from '@mui/icons-material/HomeTwoTone'
const linkSX = {
display: 'flex',
color: 'grey.900',
textDecoration: 'none',
alignContent: 'center',
alignItems: 'center'
}
// ==============================|| BREADCRUMBS ||============================== //
const Breadcrumbs = ({ card, divider, icon, icons, maxItems, navigation, rightAlign, separator, title, titleBottom, ...others }) => {
const theme = useTheme()
const iconStyle = {
marginRight: theme.spacing(0.75),
marginTop: `-${theme.spacing(0.25)}`,
width: '1rem',
height: '1rem',
color: theme.palette.secondary.main
}
const [main, setMain] = useState()
const [item, setItem] = useState()
// set active item state
const getCollapse = (menu) => {
if (menu.children) {
menu.children.filter((collapse) => {
if (collapse.type && collapse.type === 'collapse') {
getCollapse(collapse)
} else if (collapse.type && collapse.type === 'item') {
if (document.location.pathname === config.basename + collapse.url) {
setMain(menu)
setItem(collapse)
}
}
return false
})
}
}
useEffect(() => {
navigation?.items?.map((menu) => {
if (menu.type && menu.type === 'group') {
getCollapse(menu)
}
return false
})
})
// item separator
const SeparatorIcon = separator
const separatorIcon = separator ? <SeparatorIcon stroke={1.5} size='1rem' /> : <IconTallymark1 stroke={1.5} size='1rem' />
let mainContent
let itemContent
let breadcrumbContent = <Typography />
let itemTitle = ''
let CollapseIcon
let ItemIcon
// collapse item
if (main && main.type === 'collapse') {
CollapseIcon = main.icon ? main.icon : AccountTreeTwoToneIcon
mainContent = (
<Typography component={Link} to='#' variant='subtitle1' sx={linkSX}>
{icons && <CollapseIcon style={iconStyle} />}
{main.title}
</Typography>
)
}
// items
if (item && item.type === 'item') {
itemTitle = item.title
ItemIcon = item.icon ? item.icon : AccountTreeTwoToneIcon
itemContent = (
<Typography
variant='subtitle1'
sx={{
display: 'flex',
textDecoration: 'none',
alignContent: 'center',
alignItems: 'center',
color: 'grey.500'
}}
>
{icons && <ItemIcon style={iconStyle} />}
{itemTitle}
</Typography>
)
// main
if (item.breadcrumbs !== false) {
breadcrumbContent = (
<Card
sx={{
border: 'none'
}}
{...others}
>
<Box sx={{ p: 2, pl: card === false ? 0 : 2 }}>
<Grid
container
direction={rightAlign ? 'row' : 'column'}
justifyContent={rightAlign ? 'space-between' : 'flex-start'}
alignItems={rightAlign ? 'center' : 'flex-start'}
spacing={1}
>
{title && !titleBottom && (
<Grid item>
<Typography variant='h3' sx={{ fontWeight: 500 }}>
{item.title}
</Typography>
</Grid>
)}
<Grid item>
<MuiBreadcrumbs
sx={{ '& .MuiBreadcrumbs-separator': { width: 16, ml: 1.25, mr: 1.25 } }}
aria-label='breadcrumb'
maxItems={maxItems || 8}
separator={separatorIcon}
>
<Typography component={Link} to='/' color='inherit' variant='subtitle1' sx={linkSX}>
{icons && <HomeTwoToneIcon sx={iconStyle} />}
{icon && <HomeIcon sx={{ ...iconStyle, mr: 0 }} />}
{!icon && 'Dashboard'}
</Typography>
{mainContent}
{itemContent}
</MuiBreadcrumbs>
</Grid>
{title && titleBottom && (
<Grid item>
<Typography variant='h3' sx={{ fontWeight: 500 }}>
{item.title}
</Typography>
</Grid>
)}
</Grid>
</Box>
{card === false && divider !== false && <Divider sx={{ borderColor: theme.palette.primary.main, mb: gridSpacing }} />}
</Card>
)
}
}
return breadcrumbContent
}
Breadcrumbs.propTypes = {
card: PropTypes.bool,
divider: PropTypes.bool,
icon: PropTypes.bool,
icons: PropTypes.bool,
maxItems: PropTypes.number,
navigation: PropTypes.object,
rightAlign: PropTypes.bool,
separator: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
title: PropTypes.bool,
titleBottom: PropTypes.bool
}
export default Breadcrumbs
@@ -0,0 +1,22 @@
import logo from 'assets/images/flowise_logo.png'
import logoDark from 'assets/images/flowise_logo_dark.png'
import { useSelector } from 'react-redux'
// ==============================|| LOGO ||============================== //
const Logo = () => {
const customization = useSelector((state) => state.customization)
return (
<div style={{ alignItems: 'center', display: 'flex', flexDirection: 'row' }}>
<img
style={{ objectFit: 'contain', height: 'auto', width: 150 }}
src={customization.isDarkMode ? logoDark : logo}
alt='Flowise'
/>
</div>
)
}
export default Logo
@@ -0,0 +1,107 @@
import PropTypes from 'prop-types'
import { forwardRef } from 'react'
// material-ui
import { Collapse, Fade, Box, Grow, Slide, Zoom } from '@mui/material'
// ==============================|| TRANSITIONS ||============================== //
const Transitions = forwardRef(function Transitions({ children, position, type, direction, ...others }, ref) {
let positionSX = {
transformOrigin: '0 0 0'
}
switch (position) {
case 'top-right':
positionSX = {
transformOrigin: 'top right'
}
break
case 'top':
positionSX = {
transformOrigin: 'top'
}
break
case 'bottom-left':
positionSX = {
transformOrigin: 'bottom left'
}
break
case 'bottom-right':
positionSX = {
transformOrigin: 'bottom right'
}
break
case 'bottom':
positionSX = {
transformOrigin: 'bottom'
}
break
case 'top-left':
default:
positionSX = {
transformOrigin: '0 0 0'
}
break
}
return (
<Box ref={ref}>
{type === 'grow' && (
<Grow {...others}>
<Box sx={positionSX}>{children}</Box>
</Grow>
)}
{type === 'collapse' && (
<Collapse {...others} sx={positionSX}>
{children}
</Collapse>
)}
{type === 'fade' && (
<Fade
{...others}
timeout={{
appear: 500,
enter: 600,
exit: 400
}}
>
<Box sx={positionSX}>{children}</Box>
</Fade>
)}
{type === 'slide' && (
<Slide
{...others}
timeout={{
appear: 0,
enter: 400,
exit: 200
}}
direction={direction}
>
<Box sx={positionSX}>{children}</Box>
</Slide>
)}
{type === 'zoom' && (
<Zoom {...others}>
<Box sx={positionSX}>{children}</Box>
</Zoom>
)}
</Box>
)
})
Transitions.propTypes = {
children: PropTypes.node,
type: PropTypes.oneOf(['grow', 'fade', 'collapse', 'slide', 'zoom']),
position: PropTypes.oneOf(['top-left', 'top-right', 'top', 'bottom-left', 'bottom-right', 'bottom']),
direction: PropTypes.oneOf(['up', 'down', 'left', 'right'])
}
Transitions.defaultProps = {
type: 'grow',
position: 'top-left',
direction: 'up'
}
export default Transitions