Skip to content

Commit 21aff2a

Browse files
committed
feat: MediaCo Todo component override added
1 parent a1d7e51 commit 21aff2a

File tree

4 files changed

+4
-74
lines changed

4 files changed

+4
-74
lines changed

packages/react-sdk-components/src/samples/mediacoOverrides/ToDo/ToDo.css renamed to packages/react-sdk-components/src/samples/mediaco/ToDo/ToDo.css

File renamed without changes.

packages/react-sdk-components/src/samples/mediacoOverrides/ToDo/ToDo.tsx renamed to packages/react-sdk-components/src/samples/mediaco/ToDo/ToDo.tsx

Lines changed: 3 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import React, { useCallback, useEffect, useState } from 'react';
1+
import { useCallback, useEffect, useState } from 'react';
22
import { Button, Card, CardContent, CardHeader, Avatar, Typography, Badge, List, ListItem, ListItemText } from '@mui/material';
3-
// import Snackbar from '@mui/material/Snackbar';
43
import IconButton from '@mui/material/IconButton';
5-
// import CloseIcon from '@mui/icons-material/Close';
64
import ArrowForwardIosOutlinedIcon from '@mui/icons-material/ArrowForwardIosOutlined';
75
import { useTheme } from '@mui/material/styles';
86
import makeStyles from '@mui/styles/makeStyles';
@@ -82,12 +80,9 @@ function getID(assignment: any) {
8280

8381
const 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}&nbsp;&nbsp;&nbsp;</Typography>}
346-
// avatar={<Avatar className={classes.avatar}>{currentUserInitials}</Avatar>}
347-
/>
348-
)}
306+
{showTodoList && <CardHeader title={<Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</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
}

packages/react-sdk-components/src/samples/mediacoOverrides/ToDo/index.tsx renamed to packages/react-sdk-components/src/samples/mediaco/ToDo/index.tsx

File renamed without changes.

packages/react-sdk-components/src/sdk-pega-component-map.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ import TextArea from './components/field/TextArea';
101101
import TextContent from './components/field/TextContent';
102102
import TextInput from './components/field/TextInput/TextInput';
103103
import Time from './components/field/Time';
104-
// import ToDo from './components/widget/ToDo';
104+
import ToDo from './components/widget/ToDo';
105105
import TwoColumn from './components/template/TwoColumn/TwoColumn';
106106
import TwoColumnPage from './components/template/TwoColumn/TwoColumnPage';
107107
import TwoColumnTab from './components/template/TwoColumn/TwoColumnTab';
@@ -116,7 +116,6 @@ import WideNarrowForm from './components/template/WideNarrow/WideNarrowForm';
116116
import WideNarrowPage from './components/template/WideNarrow/WideNarrowPage';
117117
import WssNavBar from './components/template/WssNavBar/WssNavBar';
118118
import WssQuickCreate from './components/designSystemExtension/WssQuickCreate';
119-
import ToDo from './samples/mediacoOverrides/ToDo';
120119

121120
// pegaSdkComponentMap is the JSON object where we'll store the components that are
122121
// the default implementations provided by the SDK. These will be used if there isn't

0 commit comments

Comments
 (0)