Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDE-54 Walkthrough Implementation #22

Merged
merged 39 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
201bcd1
CDE-54 initial changes made
Aiga115 Feb 7, 2024
5163edc
CDE-54 changes made
Aiga115 Feb 8, 2024
82c882a
Merge branch 'develop' into feature/CDE-54
Aiga115 Feb 8, 2024
97897a2
CDE-54 small merge issue
Aiga115 Feb 8, 2024
f445603
CDE-54 changes made
Aiga115 Feb 12, 2024
f6b8129
CDE-54 changes made
Aiga115 Feb 15, 2024
375a891
Merge branch 'develop' into feature/CDE-54
Aiga115 Feb 15, 2024
d00892b
CDE-54 changes made
Aiga115 Feb 15, 2024
98e6cc9
CDE-54 changes made
Aiga115 Feb 15, 2024
e4d676a
Merge branch 'develop' into feature/CDE-54
Aiga115 Feb 15, 2024
cf3f35f
CDE-54 changes made
Aiga115 Feb 15, 2024
de0280b
CDE-54 changes made
Aiga115 Feb 19, 2024
baf1005
CDE-54 fix function update and naming
Aiga115 Feb 20, 2024
1d4b13e
CDE-54 feature: add tour to every step and change logic
Aiga115 Feb 21, 2024
e662449
Merge branch 'develop' into feature/CDE-54
Aiga115 Feb 21, 2024
250a81c
CDE-54 fix: fix merge issues
Feb 22, 2024
0e142d8
CDE-54 fix: fix eslint issues
Aiga115 Feb 26, 2024
edf4038
CDE-54 fix: fix eslint issue
Aiga115 Feb 26, 2024
30ea4e3
Merge branch 'develop' into feature/CDE-54
Aiga115 Feb 29, 2024
85eda49
CDE-54 fix: fix lint and build issues
Aiga115 Feb 29, 2024
23ec59c
Merge branch 'develop' into feature/CDE-54
Aiga115 Mar 4, 2024
9051d5f
CDE-54 fixing merge issues
Aiga115 Mar 5, 2024
47df2aa
CDE-54 fix: fix lint issue
Aiga115 Mar 5, 2024
b4f72c9
CDE-54 fix: fix search issue and make core more readable
Aiga115 Mar 7, 2024
83b99d1
CDE-54 deleted env file
Aiga115 Mar 10, 2024
66d2fa4
CDE-54 change: change naming of functions and tour variables
Aiga115 Mar 11, 2024
1546060
CDE-54 unnecessary code deleted
Aiga115 Mar 13, 2024
e499ce2
CDE-54 linting issue resolved
Aiga115 Mar 13, 2024
8197b70
Merge branch 'develop' into feature/CDE-54
Aiga115 Mar 13, 2024
6fb8d3d
CDE-54 fix: fix function change by using callback
Aiga115 Mar 13, 2024
c4b8c9b
CDE-54 small change
Aiga115 Mar 14, 2024
ad0fcdf
Merge remote-tracking branch 'origin/feature/CDE-54' into feature/CDE-54
Aiga115 Mar 14, 2024
f5220ae
Merge branch 'develop' into feature/CDE-54
Aiga115 Mar 14, 2024
4f8724a
Merge branch 'develop' into feature/CDE-54
Aiga115 Mar 19, 2024
1638c87
CDE-54 logic changes made
Aiga115 Mar 22, 2024
a00442e
CDE-54 add no suggestion tour content
Aiga115 Mar 26, 2024
d0236e9
Merge branch 'develop' into feature/CDE-54
Aiga115 Mar 27, 2024
8054c52
CDE-54 merge issues resolved
Aiga115 Mar 27, 2024
d830053
Merge branch 'develop' into feature/CDE-54
Aiga115 Mar 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/components/CdeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ import {useUIContext} from "../contexts/ui/UIContext.ts";
const CdeModal: FC = () => {
const [isModalOpen, setIsModalOpen] = useState(true);
const [isInfoOpen, setIsInfoOpen] = useState(false);
const [homeStepIndex, setHomeStepIndex] = useState(0);

const {step, errorMessage, setErrorMessage, loadingMessage, handleClose} = useUIContext();
const {step, errorMessage, setErrorMessage, loadingMessage, handleClose, isTourOpen, setIsTourOpen} = useUIContext();

const onClose = () => {
setIsModalOpen(false)
handleClose()
}

const updateHomeTourStep = () => isTourOpen && setHomeStepIndex(prevStepIndex => prevStepIndex + 1);

useEffect(() => {
if (errorMessage) {
const timer = setTimeout(() => {
Expand All @@ -32,19 +35,19 @@ const CdeModal: FC = () => {
const renderStepComponent = (): ReactElement => {
switch (step) {
case STEPS.HOME:
return <Home/>;
return <Home homeStepIndex={homeStepIndex} setHomeStepIndex={setHomeStepIndex}/>;
afonsobspinto marked this conversation as resolved.
Show resolved Hide resolved
case STEPS.COLLECTION:
return <MappingStep/>;
// Add cases for other steps
default:
return <TemplateStep/>
}
};

return (
<>
<Modal open={isModalOpen} onClose={onClose} maxWidth="xl" isInfoOpen={isInfoOpen}>
<Header onClose={onClose} isInfoOpen={isInfoOpen} setIsInfoOpen={setIsInfoOpen} step={step}/>
<Header onClose={onClose} isInfoOpen={isInfoOpen} setIsInfoOpen={setIsInfoOpen} step={step} setIsTourOpen={setIsTourOpen} onAfterSidebarToggle={updateHomeTourStep}/>
{loadingMessage ? <CommonCircularProgress label='Processing data...'/> : renderStepComponent()}
</Modal>
<Snackbar
Expand Down
9 changes: 7 additions & 2 deletions lib/components/common/CustomMappingDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ interface CustomEntitiesDropdownProps {
header?: Header;
collections: SelectableCollection[];
onCollectionSelect: (collection: SelectableCollection) => void;
onDropdownToggle?: () => void;
dropdownClassname?: string;
};
variableName: string
onCustomDictionaryFieldCreation: (option: Option, newIsSelectedState: boolean) => void;
Expand All @@ -203,6 +205,8 @@ export default function CustomEntitiesDropdown({
header,
collections,
onCollectionSelect,
onDropdownToggle = () => {},
dropdownClassname
},
variableName,
onCustomDictionaryFieldCreation,
Expand Down Expand Up @@ -283,10 +287,10 @@ export default function CustomEntitiesDropdown({
}
}
};

onDropdownToggle();
setIsLoading(true);
fetchOptions().then(() => setIsLoading(false));
}, [searchInput, onSearch, open]);
}, [searchInput, onSearch, open, onDropdownToggle]);

const groupedOptions = searchResults.reduce((grouped: GroupedOptions, option: Option) => {
const group = option.group;
Expand Down Expand Up @@ -392,6 +396,7 @@ export default function CustomEntitiesDropdown({
open={open}
placement='bottom-end'
anchorEl={anchorEl}
className={dropdownClassname}
sx={{
height: "21.875rem",
borderRadius: '0.5rem',
Expand Down
84 changes: 43 additions & 41 deletions lib/components/common/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,51 +36,53 @@ const Filters: React.FC<FiltersProps> = ({ anchorEl, handleClose, open, id, chec
horizontal: 'right',
}}
>
<Box sx={{
borderBottom: '0.0625rem solid #ECEDEE',
padding: '1rem',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center'
}}>
<Typography sx={{
fontSize: '0.75rem',
fontWeight: 500,
lineHeight: '150%',
color: '#676C74'
}}>Filter by</Typography>
<Button
variant="text"
onClick={onReset}
sx={{
p: 0,
<div className='mapping__filter-popover'>
<Box sx={{
borderBottom: '0.0625rem solid #ECEDEE',
padding: '1rem',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center'
}}>
<Typography sx={{
fontSize: '0.75rem',
'&:hover': {
background: 'transparent'
}
}}
>
Reset filters
</Button>
</Box>
fontWeight: 500,
lineHeight: '150%',
color: '#676C74'
}}>Filter by</Typography>
<Button
variant="text"
onClick={onReset}
sx={{
p: 0,
fontSize: '0.75rem',
'&:hover': {
background: 'transparent'
}
}}
>
Reset filters
</Button>
</Box>

<Box p='1rem' sx={{ borderBottom: '0.0625rem solid #ECEDEE' }}>
<Typography sx={{
fontSize: '0.75rem',
fontWeight: 500,
lineHeight: '150%',
color: '#676C74',
mb: '0.75rem'
}}>Status</Typography>
<Box p='1rem' sx={{ borderBottom: '0.0625rem solid #ECEDEE' }}>
<Typography sx={{
fontSize: '0.75rem',
fontWeight: 500,
lineHeight: '150%',
color: '#676C74',
mb: '0.75rem'
}}>Status</Typography>

<Box mt="0.75rem">
<FormGroup>
<Checkbox checked={checked[EntityType.CDE]} onChange={onChange} name={EntityType.CDE} label="Mapped to CDE" />
<Checkbox checked={checked[EntityType.CustomDictionaryField]} onChange={onChange} name={EntityType.CustomDictionaryField} label="Mapped to Data Dictionary field" />
<Checkbox checked={checked[EntityType.Unknown]} onChange={onChange} name={EntityType.Unknown} label="Unmapped" />
</FormGroup>
<Box mt="0.75rem">
<FormGroup>
<Checkbox checked={checked[EntityType.CDE]} onChange={onChange} name={EntityType.CDE} label="Mapped to CDE" />
<Checkbox checked={checked[EntityType.CustomDictionaryField]} onChange={onChange} name={EntityType.CustomDictionaryField} label="Mapped to Data Dictionary field" />
<Checkbox checked={checked[EntityType.Unknown]} onChange={onChange} name={EntityType.Unknown} label="Unmapped" />
</FormGroup>
</Box>
</Box>
</Box>
</div>
</Popover>
)
}
Expand Down
53 changes: 31 additions & 22 deletions lib/components/common/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Box, Button, Divider, IconButton, Typography} from "@mui/material";
import {vars} from "../../theme/variables";
import {CloseIcon, MapTriFold} from "../../icons";
import { Box, Button, Divider, IconButton, Typography } from "@mui/material";
import { vars } from "../../theme/variables";
import { CloseIcon, MapTriFold } from "../../icons";
import Info from "./Info";

const {baseWhite, gray100, gray700} = vars
const { baseWhite, gray100, gray700 } = vars

const styles = {
root: {
Expand All @@ -26,40 +26,49 @@ const styles = {
}
}

const Header = (props: { onClose: () => void, isInfoOpen: boolean, setIsInfoOpen: (b: boolean) => void, step: number }) => {
const {onClose, isInfoOpen, setIsInfoOpen, step} = props
const Header = (props: { onClose: () => void, isInfoOpen: boolean, setIsInfoOpen: (b: boolean) => void, step: number, setIsTourOpen: (b: boolean) => void, onAfterSidebarToggle?: () => void }) => {
const {onClose, isInfoOpen, setIsInfoOpen, step, setIsTourOpen, onAfterSidebarToggle = () => {}} = props

const handleInfoBtnClick = () => {
setIsInfoOpen(true)
onAfterSidebarToggle()
}

const handleClose = () => {
setIsInfoOpen(false);
onAfterSidebarToggle();
}
return (
<>
<Box sx={styles.root}>
<Box display='flex' alignItems='center' flex={1}>
<IconButton disableRipple onClick={onClose} sx={{
borderRadius: '0.5rem',
'&:hover': {
background: gray100
}
}}>
<CloseIcon />
</IconButton>
<Divider sx={{ borderRight: `0.0625rem solid ${gray100}`, height: '2.25rem', mx: '1rem' }} />
<Typography>
{step === -1 ? "Create template" : "Map selected dataset"}
</Typography>
</Box>
'&:hover': {
background: gray100
}
}}>
<CloseIcon />
</IconButton>
<Divider sx={{ borderRight: `0.0625rem solid ${gray100}`, height: '2.25rem', mx: '1rem' }} />
<Typography>
{step === -1 ? "Create template" : "Map selected dataset"}
</Typography>
</Box>

<Box display='flex' gap={1}>
{
step!==-1 && <IconButton sx={{borderRadius: '0.5rem'}}>
<MapTriFold/>
</IconButton>
step !== -1 && <IconButton sx={{ borderRadius: '0.5rem' }} onClick={() => setIsTourOpen(true)}>
<MapTriFold />
</IconButton>
}
<Button onClick={() => setIsInfoOpen(true)} disableRipple variant="outlined">
<Button onClick={handleInfoBtnClick} disableRipple variant="outlined" className="about-info__btn">
Info
</Button>
</Box>
</Box>

{isInfoOpen && <Info setIsInfoOpen={setIsInfoOpen}/>}
{isInfoOpen && <Info handleClose={handleClose}/>}
</>
)
};
Expand Down
16 changes: 6 additions & 10 deletions lib/components/common/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,13 @@ const styles = {
}
};

const Info = (props: { setIsInfoOpen: (b: boolean) => void }) => {
const {setIsInfoOpen} = props

const handleClose = () => {
setIsInfoOpen(false)
}
const Info = (props: { handleClose: () => void }) => {
const {handleClose} = props

const InfoContent = () => (
<>
<Box>
<Box sx={styles.header}>
<IconButton onClick={handleClose} sx={{p: 1, borderRadius: 2, ml: 'auto'}}>
<IconButton onClick={handleClose} sx={{p: 1, borderRadius: 2, ml: 'auto'}} className="sidebar__close-button">
<CloseIcon/>
</IconButton>
<Typography variant="h3">About CDE mapping</Typography>
Expand Down Expand Up @@ -192,13 +188,13 @@ const Info = (props: { setIsInfoOpen: (b: boolean) => void }) => {
</Typography>
</Box>
</Box>
</>
</Box>
)

return (
<>
<Box sx={styles.backdrop} onClick={handleClose}/>
<Box sx={styles.wrap}>
<Box sx={styles.wrap} className="about-info__sidebar">
{InfoContent()}
</Box>
</>
Expand Down
14 changes: 8 additions & 6 deletions lib/components/common/PreviewBox.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import React from "react";
import {Box, Typography, Chip, Button} from "@mui/material";
import {useDataContext} from "../../contexts/data/DataContext.ts";
import {ArrowDropDown, BulletIcon} from "../../icons";
import {StyledTable} from "./StyledTable";
import {useUIContext} from "../../contexts/ui/UIContext.ts";
import {useServicesContext} from "../../contexts/services/ServicesContext.ts";

interface PreviewBoxProps {
togglePreview: boolean;
onToggle: () => void;
}

const PreviewBox = () => {
const PreviewBox = ({togglePreview, onToggle}: PreviewBoxProps) => {
const {datasetSample} = useDataContext();
const {step, setStep} = useUIContext();
const {
getTotalRowsCount,
getUnmappedRowsCount,
getMappedRowsCount,
} = useServicesContext();
const [togglePreview, setTogglePreview] = React.useState(false);

const headers = datasetSample[0]

return (
<Box sx={{
<Box className="preview__toggle" sx={{
position: 'absolute',
background: '#fff',
zIndex: 9999999999,
Expand All @@ -30,8 +33,7 @@ const PreviewBox = () => {
borderRadius: '0.75rem 0.75rem 0 0',
border: '0.0625rem solid #ECEDEE',
}}>
<Box display='flex' gap={1.5} px={3} py={2} sx={{cursor: 'pointer'}} alignItems='center'
onClick={() => setTogglePreview(!togglePreview)}>
<Box display='flex' gap={1.5} px={3} py={2} sx={{ cursor: 'pointer' }} alignItems='center' onClick={onToggle} className="preview__toggle_false">
<Typography sx={{
flex: 1,
color: '#676C74',
Expand Down
10 changes: 4 additions & 6 deletions lib/components/common/StyledCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ interface StyledCardProps {
value: string;
isSuggested?: boolean;
selectedValue: string;
onChange: (value: string) => void;
onChange: (value: string, selectedValue: string) => void;
onAfterChange: () => void;
}

const StyledCard: React.FC<StyledCardProps> = ({value, isSuggested, selectedValue, onChange}) => {

const radioGroup = useRadioGroup();
let checked = false;

Expand All @@ -28,10 +28,8 @@ const StyledCard: React.FC<StyledCardProps> = ({value, isSuggested, selectedValu
}

const handleRadioChange = () => {
if (value !== selectedValue) {
onChange(value);
}
};
onChange(value, selectedValue);
}

return (
<Box sx={{minWidth: 320}}>
Expand Down
Loading