1- import React , { useCallback , useEffect , useState } from 'react' ;
1+ import { useCallback , useEffect , useState } from 'react' ;
22import { Button , Card , CardContent , CardHeader , Avatar , Typography , Badge , List , ListItem , ListItemText } from '@mui/material' ;
3- // import Snackbar from '@mui/material/Snackbar';
43import IconButton from '@mui/material/IconButton' ;
5- // import CloseIcon from '@mui/icons-material/Close';
64import ArrowForwardIosOutlinedIcon from '@mui/icons-material/ArrowForwardIosOutlined' ;
75import { useTheme } from '@mui/material/styles' ;
86import makeStyles from '@mui/styles/makeStyles' ;
@@ -82,12 +80,9 @@ function getID(assignment: any) {
8280
8381const useStyles = makeStyles ( theme => ( {
8482 root : {
85- // marginTop: theme.spacing(1),
8683 marginBottom : theme . spacing ( 2 ) ,
8784 paddingBottom : theme . spacing ( 1 ) ,
8885 borderRadius : '8px'
89- // borderLeft: '6px solid',
90- // borderLeftColor: theme.palette.primary.light
9186 } ,
9287 avatar : {
9388 backgroundColor : theme . palette . primary . light ,
@@ -141,10 +136,6 @@ export default function ToDo(props: ToDoProps) {
141136 const currentUserInitials = Utils . getInitials ( currentUser ) ;
142137 const assignmentsSource = datasource ?. source || myWorkList ?. source ;
143138
144- // const [bShowMore, setBShowMore] = useState(true);
145- // const [showSnackbar, setShowSnackbar] = useState(false);
146- // const [snackbarMessage, setSnackbarMessage]: any = useState('');
147-
148139 const [ assignments , setAssignments ] = useState < any [ ] > ( initAssignments ( ) ) ;
149140
150141 const thePConn = getPConnect ( ) ;
@@ -153,8 +144,6 @@ export default function ToDo(props: ToDoProps) {
153144 const isDesktop = useMediaQuery ( theme . breakpoints . up ( 'md' ) ) ;
154145 const localizedVal = PCore . getLocaleUtils ( ) . getLocaleValue ;
155146 const localeCategory = 'Todo' ;
156- // const showlessLocalizedValue = localizedVal('show_less', 'CosmosFields');
157- // const showMoreLocalizedValue = localizedVal('show_more', 'CosmosFields');
158147 const canPerform = assignments ?. [ 0 ] ?. canPerform === 'true' || assignments ?. [ 0 ] ?. canPerform === true ;
159148 const [ count , setCount ] = useState ( 0 ) ;
160149
@@ -200,35 +189,9 @@ export default function ToDo(props: ToDoProps) {
200189
201190 function showToast ( message : string ) {
202191 const theMessage = `Assignment: ${ message } ` ;
203-
204192 console . error ( theMessage ) ;
205- // setSnackbarMessage(message);
206- // setShowSnackbar(true);
207193 }
208194
209- // function handleSnackbarClose(event: React.SyntheticEvent<any> | Event, reason?: string) {
210- // if (reason === 'clickaway') {
211- // return;
212- // }
213- // setShowSnackbar(false);
214- // }
215-
216- // function _showMore() {
217- // setBShowMore(false);
218- // if (type === CONSTS.WORKLIST && count && count > assignments.length && !assignmentsSource) {
219- // fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, count, false, context).then(response => {
220- // setAssignments(response.data);
221- // });
222- // } else {
223- // setAssignments(assignmentsSource);
224- // }
225- // }
226-
227- // function _showLess() {
228- // setBShowMore(true);
229- // setAssignments(assignments => assignments.slice(0, 3));
230- // }
231-
232195 function clickGo ( assignment ) {
233196 const id = getAssignmentId ( assignment ) ;
234197 let { classname = '' } = assignment ;
@@ -335,17 +298,12 @@ export default function ToDo(props: ToDoProps) {
335298 </ List >
336299 </ >
337300 ) ;
338- console . log ( 'ToDo Rendered' , assignments ) ;
301+
339302 return (
340303 < >
341304 { type === CONSTS . WORKLIST && assignments ?. length > 0 && (
342305 < Card className = { classes . root } >
343- { showTodoList && (
344- < CardHeader
345- title = { < Typography variant = 'h6' > { headerText } </ Typography > }
346- // avatar={<Avatar className={classes.avatar}>{currentUserInitials}</Avatar>}
347- />
348- ) }
306+ { showTodoList && < CardHeader title = { < Typography variant = 'h6' > { headerText } </ Typography > } /> }
349307 < CardContent style = { { padding : 0 } } >
350308 < List >
351309 { assignments . map ( assignment => (
@@ -354,9 +312,6 @@ export default function ToDo(props: ToDoProps) {
354312 dense
355313 onClick = { ( ) => clickGo ( assignment ) }
356314 secondaryAction = {
357- // <IconButton onClick={() => clickGo(assignment)} size='large'>
358- // <ArrowForwardIosOutlinedIcon />
359- // </IconButton>
360315 < Button className = { classes . getStartedButton } color = 'primary' variant = 'contained' onClick = { ( ) => clickGo ( assignment ) } >
361316 Get started
362317 </ Button >
@@ -372,30 +327,6 @@ export default function ToDo(props: ToDoProps) {
372327
373328 { type === CONSTS . TODO && ! isConfirm && < Card className = { classes . todoWrapper } > { toDoContent } </ Card > }
374329 { type === CONSTS . TODO && isConfirm && < > { toDoContent } </ > }
375-
376- { /* {getCount() > 3 && (
377- <Box display='flex' justifyContent='center'>
378- {bShowMore ? (
379- <Button color='primary' onClick={_showMore}>
380- {showMoreLocalizedValue === 'show_more' ? 'Show more' : showMoreLocalizedValue}
381- </Button>
382- ) : (
383- <Button onClick={_showLess}>{showlessLocalizedValue === 'show_less' ? 'Show less' : showlessLocalizedValue}</Button>
384- )}
385- </Box>
386- )} */ }
387-
388- { /* <Snackbar
389- open={showSnackbar}
390- autoHideDuration={3000}
391- onClose={handleSnackbarClose}
392- message={snackbarMessage}
393- action={
394- <IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
395- <CloseIcon fontSize='small' />
396- </IconButton>
397- }
398- /> */ }
399330 </ >
400331 ) ;
401332}
0 commit comments