11import React , { useCallback , useEffect , useMemo , useRef , useState } from 'react' ;
22import { Box , ListItemText , IconButton , ListItem , ListItemAvatar , Avatar , ListItemButton , Link , Button , ButtonBase , Typography , CircularProgress , Accordion , AccordionDetails , AccordionSummary , Slider , Stack , Tooltip , TextField , MenuItem , Collapse , Chip } from '@mui/material' ;
33import RouteIcon from '@mui/icons-material/Route' ;
4- import ZoomInIcon from '@mui/icons-material/ZoomIn' ;
54import ErrorIcon from '@mui/icons-material/Error' ;
5+ import ZoomInIcon from '@mui/icons-material/ZoomIn' ;
66import VisibilityIcon from '@mui/icons-material/Visibility' ;
77import VisibilityOffIcon from '@mui/icons-material/VisibilityOff' ;
88import RefreshIcon from '@mui/icons-material/Refresh' ;
@@ -13,12 +13,12 @@ import { useMeshery } from '../contexts/Meshery.jsx';
1313import CurveEditDialog from '../dialogs/CurveEditDialog.jsx' ;
1414import SurfaceSettings from './SurfaceSettings.jsx' ;
1515
16-
1716export default function LayerSettings ( {
1817 layer,
1918 selectedLayer,
2019 onClick,
2120 onExpand,
21+ onShowHide,
2222 onZoom,
2323 onCurveEdit,
2424} ) {
@@ -82,45 +82,66 @@ export default function LayerSettings({
8282
8383
8484 const isDisabled = useMemo ( ( ) => {
85- return layer . error || ! layer . mesh || layer . pending || ! layer . conformed ;
85+ return layer . error || layer . pending ;
8686 } , [ layer ] ) ;
87+
88+ const handleShowHide = ( event ) => {
89+ event . preventDefault ( ) ;
90+ console . log ( 'show' ) ;
91+ if ( onShowHide ) onShowHide ( ) ;
92+ }
93+ const handleZoom = ( event ) => {
94+ event . preventDefault ( ) ;
95+ console . log ( 'hide' ) ;
96+ if ( onZoom ) onZoom ( ) ;
97+ }
8798
8899 return (
89- < >
90- < Box >
91- < Box sx = { { p : 2 , opacity : layer . visible ? 1 : 0.6 } } >
92- < ButtonBase
93- sx = { {
94- width : '100%' ,
95- display : 'flex' ,
96- flexDirection : 'row' ,
97- gap : 3 ,
98- textAlign : 'left'
99- } }
100- onClick = { handleClick }
101- >
102- { layer . error ? (
103- < Tooltip title = { layer . error } >
104- < ErrorIcon color = "error" />
105- </ Tooltip >
106- ) : (
107- isDisabled ? (
108- < CircularProgress size = { 15 } />
109- ) : (
110- < Avatar sx = { { backgroundColor : `#${ layer . color } ` , width : 15 , height : 15 } } > { ' ' } </ Avatar >
111- )
112- ) }
113- < Box sx = { { flex : 1 } } >
114- < Typography component = "span" > { layer . surface } </ Typography > { ' ' }
115- < Typography color = "textSecondary" component = "span" > { layer . name } </ Typography >
116-
117- </ Box >
118- < Box >
119- { expanded ? < ExpandLessIcon /> : < ExpandMoreIcon /> }
120- </ Box >
121- </ ButtonBase >
122- </ Box >
123- </ Box >
124- </ >
100+ < ListItemButton
101+ onClick = { handleClick }
102+ sx = { { opacity : layer . visible ? 1 : 0.6 } }
103+ >
104+ { /* <ButtonBase
105+ sx={{
106+ width: '100%',
107+ display: 'flex',
108+ flexDirection: 'row',
109+ gap: 3,
110+ textAlign: 'left'
111+ }}
112+ onClick={handleClick}
113+ > */ }
114+
115+ { /* {layer.error ? (
116+ <Tooltip title={layer.error}>
117+ <ErrorIcon color="error" />
118+ </Tooltip>
119+ ) : (
120+ isDisabled ? (
121+ <CircularProgress size={15} />
122+ ) : (
123+ <Avatar sx={{ backgroundColor: `#${layer.color}`, width: 15, height: 15 }}>{' '}</Avatar>
124+ )
125+ )} */ }
126+ < ListItemAvatar sx = { { minWidth : 30 } } >
127+ { isDisabled ? (
128+ < CircularProgress size = { 15 } />
129+ ) : (
130+ < Avatar sx = { { backgroundColor : `#${ layer . color } ` , width : 15 , height : 15 } } > { ' ' } </ Avatar >
131+ ) }
132+ </ ListItemAvatar >
133+ < ListItemText primary = { layer . name } />
134+ { /* <Box sx={{ flex: 1 }}>
135+ <Typography component="span">{layer.name}</Typography>
136+ <Typography color="textSecondary" component="span">{layer.name}</Typography>
137+ </Box> */ }
138+ { /* <Box>
139+ <IconButton onClick={handleZoom} size="small"><ZoomInIcon /></IconButton>
140+ <IconButton onClick={handleShowHide} size="small">
141+ {layer.visible ? <VisibilityOffIcon /> : <VisibilityIcon />}
142+ </IconButton>
143+ </Box> */ }
144+ { /* </ButtonBase> */ }
145+ </ ListItemButton >
125146 )
126147}
0 commit comments