Feature/wms 62 (#47)

* create warehouse
* edit warehouse changes
* Update: linted and formatted
* add warehouse button
* Update: linted
* Added: icons
* Update: Hidden pre decoration
* Updated: breadcrumbs logic

Co-authored-by: Llewellyn Dsouza <lledsouza2209@gmail.com>
This commit is contained in:
bluestreamlds
2022-02-07 22:53:05 +05:30
committed by GitHub
parent d32a8892e3
commit 27ff4e17db
6 changed files with 78 additions and 47 deletions

View File

@@ -0,0 +1,28 @@
import React from 'react';
export default function HomeIcon({ width = 24, height = 24, stroke = 'white' }) {
return (
<svg
width={width}
height={height}
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M17.79 22.75H6.21C3.47 22.75 1.25 20.52 1.25 17.78V10.37C1.25 9.00997 2.09 7.29997 3.17 6.45997L8.56 2.25997C10.18 0.999974 12.77 0.939974 14.45 2.11997L20.63 6.44997C21.82 7.27997 22.75 9.05997 22.75 10.51V17.79C22.75 20.52 20.53 22.75 17.79 22.75ZM9.48 3.43997L4.09 7.63997C3.38 8.19997 2.75 9.46997 2.75 10.37V17.78C2.75 19.69 4.3 21.25 6.21 21.25H17.79C19.7 21.25 21.25 19.7 21.25 17.79V10.51C21.25 9.54997 20.56 8.21997 19.77 7.67997L13.59 3.34997C12.45 2.54997 10.57 2.58997 9.48 3.43997Z"
fill={stroke}
/>
<path
d="M12 18.75C11.59 18.75 11.25 18.41 11.25 18V15C11.25 14.59 11.59 14.25 12 14.25C12.41 14.25 12.75 14.59 12.75 15V18C12.75 18.41 12.41 18.75 12 18.75Z"
fill={stroke}
/>
</svg>
);
}
HomeIcon.propTypes = {
width: Number,
height: Number,
stroke: String
};

View File

@@ -1,6 +1,6 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
const SearchInventoryIcon = ({ width = '78', height = '86', color = '#007AFF', ...props }) => ( const SearchInventoryIcon = ({ width = 78, height = 86, color = '#007AFF', ...props }) => (
<svg <svg
width={width} width={width}
height={height} height={height}

View File

@@ -16,13 +16,36 @@ import { Link } from 'react-router-dom';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
// @mui material components // @mui material components
import { Breadcrumbs as MuiBreadcrumbs } from '@mui/material'; import { Breadcrumbs as MuiBreadcrumbs, Grid } from '@mui/material';
import ArrowRight from 'assets/images/CarretArrowRightIcon'; import ArrowRight from 'assets/images/CarretArrowRightIcon';
// Material Dashboard 2 PRO React components // Material Dashboard 2 PRO React components
import MDBox from 'components/MDBox'; import MDBox from 'components/MDBox';
import MDTypography from 'components/MDTypography'; import MDTypography from 'components/MDTypography';
const buildBreadcrumbs = (route, light) => {
if (route[0] === 'home') route = [];
else if (route.length === 1) route = ['home'];
else {
route = ['home', ...route];
route.pop();
}
return route.map((el) => (
<Link to={`/${el}`} key={el}>
<MDTypography
component="span"
variant="button"
fontWeight="regular"
textTransform="capitalize"
color={light ? 'white' : 'dark'}
sx={{ lineHeight: 0 }}
>
{el}
</MDTypography>
</Link>
));
};
function Breadcrumbs({ title, route, light, children }) { function Breadcrumbs({ title, route, light, children }) {
return ( return (
<MDBox <MDBox
@@ -32,55 +55,33 @@ function Breadcrumbs({ title, route, light, children }) {
backgroundColor: '#fff' backgroundColor: '#fff'
}} }}
> >
<MuiBreadcrumbs <Grid container spacing={2} justifyContent="space-between" alignItems="center">
sx={{ <Grid item>
'& .MuiBreadcrumbs-separator': { <MuiBreadcrumbs
color: ({ palette: { white, grey } }) => (light ? white.main : grey[600]), sx={{
padding: '0 8px' '& .MuiBreadcrumbs-separator': {
} color: ({ palette: { white, grey } }) => (light ? white.main : grey[600]),
}} padding: '0 8px'
separator={<ArrowRight height={15} width={15} />} }
> }}
{route.map((el) => ( separator={<ArrowRight height={15} width={15} />}
<Link to={`/${el}`} key={el}> >
{buildBreadcrumbs(route, light)}
<MDTypography <MDTypography
component="span"
variant="button" variant="button"
fontWeight="regular" fontWeight="regular"
textTransform="capitalize" textTransform="capitalize"
color={light ? 'white' : 'dark'} color={light ? 'white' : 'dark'}
sx={{ lineHeight: 0 }} sx={{ lineHeight: 0 }}
> >
{el} {title.replace('-', ' ')}
</MDTypography> </MDTypography>
</Link> </MuiBreadcrumbs>
))} </Grid>
<MDTypography <Grid item md={4}>
variant="button"
fontWeight="regular"
textTransform="capitalize"
color={light ? 'white' : 'dark'}
sx={{ lineHeight: 0 }}
>
{title.replace('-', ' ')}
</MDTypography>
<MDTypography
component="span"
variant="button"
fontWeight="regular"
textTransform="capitalize"
color={light ? 'white' : 'dark'}
sx={{
lineHeight: 0,
position: 'absolute',
right: 0,
padding: '0px 20px',
marginTop: '-20px'
}}
>
{children} {children}
</MDTypography> </Grid>
</MuiBreadcrumbs> </Grid>
</MDBox> </MDBox>
); );
} }

View File

@@ -56,7 +56,7 @@ function SidenavItem({ color, name, active, nested, children, open, ...rest }) {
}) })
} }
> >
<ListItemText primary={name} /> <ListItemText primary={name} />
{children && ( {children && (
<Icon <Icon
component="i" component="i"

View File

@@ -62,7 +62,7 @@ function item(theme, ownerState) {
function itemContent(theme, ownerState) { function itemContent(theme, ownerState) {
const { palette, typography, transitions, functions } = theme; const { palette, typography, transitions, functions } = theme;
const { miniSidenav, name, active, transparentSidenav, whiteSidenav, darkMode } = ownerState; const { miniSidenav, /*name,*/ active, transparentSidenav, whiteSidenav, darkMode } = ownerState;
const { white, dark } = palette; const { white, dark } = palette;
const { size, fontWeightRegular, fontWeightLight } = typography; const { size, fontWeightRegular, fontWeightLight } = typography;
@@ -93,7 +93,7 @@ function itemContent(theme, ownerState) {
}, },
'&::before': { '&::before': {
content: `"${name[0]}"`, // content: `"${name[0]}"`,
color: color:
((transparentSidenav && !darkMode) || whiteSidenav) && (active === 'isParent' || !active) ((transparentSidenav && !darkMode) || whiteSidenav) && (active === 'isParent' || !active)
? dark.main ? dark.main

View File

@@ -55,6 +55,8 @@ import WarehouseDetailsTables from 'pages/warehouseDetailsTables';
import EditWarehouseDetails from 'pages/editWarehouseDetails'; import EditWarehouseDetails from 'pages/editWarehouseDetails';
import LabelingHome from 'pages/labellingHome'; import LabelingHome from 'pages/labellingHome';
import SetupInventory from 'pages/setupInventory'; import SetupInventory from 'pages/setupInventory';
import HomeIcon from 'assets/images/HomeIcon';
import SetupIcon from 'assets/images/SetupIcon';
// Images // Images
// import profilePicture from 'assets/images/team-3.jpg'; // import profilePicture from 'assets/images/team-3.jpg';
@@ -88,7 +90,7 @@ const protectedRoutes = [
type: 'collapse', type: 'collapse',
name: 'Home', name: 'Home',
key: 'Home', key: 'Home',
icon: <Icon fontSize="medium">dashboard</Icon>, icon: <HomeIcon width={24} height={24} color="white" />,
collapse: [ collapse: [
{ {
name: 'Home', name: 'Home',
@@ -118,7 +120,7 @@ const protectedRoutes = [
type: 'collapse', type: 'collapse',
name: 'Setup', name: 'Setup',
key: 'Setup', key: 'Setup',
icon: <Icon fontSize="medium">dashboard</Icon>, icon: <SetupIcon width={24} height={24} color="white" />,
collapse: [ collapse: [
{ {
name: 'Setup Home', name: 'Setup Home',