Skip to content

Commit

Permalink
CDE-54 fix: fix merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Sana authored and Sana committed Feb 22, 2024
1 parent e662449 commit 250a81c
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 32 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_KEY=I0FJ8VwuqLSVxfW586ICMpgzdT1m7miU
31 changes: 16 additions & 15 deletions lib/components/common/tutorial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const tutorial: TutorialType = {
title: 'Most suitable mapping',
content: 'Based on previous mappings, the first suggestion is the one that is the most suitable mapping. Browse other suggestions if you don’t think this is the most suitable.',
target: '.suggestion-details',
placement: 'bottom'
},
{
target: '.suggestions__expand-btn',
Expand Down Expand Up @@ -172,21 +173,21 @@ export const tutorial: TutorialType = {
content: 'Dealing with possibly hundreds of column headers, simply search the name of a column header or mapped CDEs here.',
target: '.mapping__search-input'
},
{
target: '.mapping__filter-btn',
title: 'Click to open filter options',
content: 'Filter through column headers and only showing those that are relevant to you.',
spotlightClicks: true,
hideFooter: true,
placement: 'bottom-end'
},
{
content: 'Filter through column headers and only showing those that are relevant to you.',
title: 'Filter',
target: '.mapping__filter-popover',
placement: 'right',
hideBackButton: true
},
// {
// target: '.mapping__filter-btn',
// title: 'Click to open filter options',
// content: 'Filter through column headers and only showing those that are relevant to you.',
// spotlightClicks: true,
// hideFooter: true,
// placement: 'bottom-end'
// },
// {
// content: 'Filter through column headers and only showing those that are relevant to you.',
// title: 'Filter',
// target: '.mapping__filter-popover',
// placement: 'right',
// hideBackButton: true
// },
{
title: 'Sort by Unmapped or Mapped first',
content: <Box display="flex" flexDirection="column">
Expand Down
2 changes: 1 addition & 1 deletion lib/components/steps/mapping/CollectionsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function CollectionsTab({ changeToNextTab, setDefaultCollection }: CollectionsPr
This can be changed at any time during the process.
</Typography>
</Stack>
<Stack direction="row" spacing={1.5}>
<Stack direction="row" spacing={1.5} className='repository-cards'>
{collectionKeys.map(key => (
<StyledCard
key={key}
Expand Down
10 changes: 7 additions & 3 deletions lib/components/steps/mapping/MappingSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import Filters from "../../common/Filters.tsx";

interface MappingSearchProps {
onChange: () => void;
handleTourNextStepClick?: () => void;
}

export default function MappingSearch({onChange}: MappingSearchProps) {
export default function MappingSearch({onChange, handleTourNextStepClick}: MappingSearchProps) {

const [searchString, setSearchString] = useState('');

Expand All @@ -20,9 +21,10 @@ export default function MappingSearch({onChange}: MappingSearchProps) {
onChange()
};

const handleFiltersClose = () => {
setAnchorEl(null);
const handleFiltersClose = (event: React.MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget);
onChange()
handleTourNextStepClick?.()
};
const open = Boolean(anchorEl);
const id = open ? 'filter-popover' : undefined;
Expand All @@ -33,6 +35,7 @@ export default function MappingSearch({onChange}: MappingSearchProps) {
fullWidth
variant="outlined"
placeholder="Search column headers or mapped CDEs..."
className="mapping__search-input"
InputProps={{
startAdornment: <InputAdornment position="start"><SearchIcon/></InputAdornment>
}}
Expand All @@ -42,6 +45,7 @@ export default function MappingSearch({onChange}: MappingSearchProps) {
<Button
variant="outlined"
onClick={handleFiltersClose}
className="mapping__filter-btn"
>
<FilterIcon/>
Filter
Expand Down
7 changes: 4 additions & 3 deletions lib/components/steps/mapping/MappingStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const tabsArr = [
{
label: 'Suggestions',
heading: 'Accept or decline suggestions',
description: 'suggestions are based on what was previously mapped before.'
description: 'suggestions are based on what was previously mapped before.',
className: 'suggestions-tab'
},
{
label: 'Map the rest of the dataset',
Expand Down Expand Up @@ -129,10 +130,10 @@ function MappingStep() {

<Box display='flex' gap='0.625rem' alignItems='center'>
{tabIndex === TabsEnum.Suggestions ? (
<Button variant='text' onClick={() => setTabIndex(TabsEnum.Mapping)}>
<Button variant='text' onClick={() => setTabIndex(TabsEnum.Mapping)} className='suggestions__cancel-btn'>
Continue without suggestions
</Button>) : tabIndex === TabsEnum.Mapping && (<>
<Typography sx={{
<Typography className='mapping-header__indicator' sx={{
color: gray500,
fontSize: '0.75rem',
fontWeight: 500,
Expand Down
35 changes: 26 additions & 9 deletions lib/components/steps/mapping/MappingTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {PairingTooltip} from "./PairingTooltip.tsx";
import {PairingSuggestion} from "./PairingSuggestion.tsx";
import {EntityType, Option, SelectableCollection} from "../../../models.ts";
import {getId, getType} from "../../../helpers/getters.ts";
import Tour from "../../common/Tour.tsx";
import { tutorial, TourSteps } from "../../common/tutorial.tsx";

const styles = {
root: {
Expand Down Expand Up @@ -92,10 +94,12 @@ interface MappingProps {

const MappingTab = ({defaultCollection}: MappingProps) => {

const {datasetMapping, headerIndexes, collections, handleUpdateDatasetMappingRow} = useCdeContext();
const {datasetMapping, headerIndexes, collections, handleUpdateDatasetMappingRow, isTourOpen} = useCdeContext();
const [visibleRows, setVisibleRows] = useState([]);
const [selectableCollections, setSelectableCollections] = useState<SelectableCollection[]>([]);
const [searchResultsDictionary, setSearchResultsDictionary] = useState<{ [id: string]: Option }>({});
const [stepIndex, setStepIndex] = useState(0);
const [togglePreview, setTogglePreview] = useState(false);


useEffect(() => {
Expand All @@ -109,6 +113,11 @@ const MappingTab = ({defaultCollection}: MappingProps) => {
setSelectableCollections(initialSelectedCollections);
}, [collections, defaultCollection]);

const handleTourNextStepClick = () => {
if(isTourOpen){
setStepIndex((prevStepIndex) => prevStepIndex + 1)
}
};

const handleCollectionSelect = (selectedCollection: SelectableCollection) => {
setSelectableCollections(prevCollections =>
Expand Down Expand Up @@ -218,15 +227,15 @@ const MappingTab = ({defaultCollection}: MappingProps) => {
const searchText = "Search in " + (selectableCollections.length === 1 ? `${selectableCollections[0].name} collection` : 'multiple collections');

return (
<>
<Box className='mapping-step'>
<ModalHeightWrapper pb={10} height='15rem'>
<MappingSearch onChange={handleFiltering}/>
<MappingSearch onChange={handleFiltering} handleTourNextStepClick={handleTourNextStepClick}/>

<Box px={1.5}>
<Box sx={styles.root}>
<Box sx={styles.head}>
<Box sx={styles.col}>
<SortIcon/>
<SortIcon className="mapping__sort-icon"/>
</Box>
<Box sx={styles.col}>
<Typography>Column headers from dataset</Typography>
Expand All @@ -241,10 +250,10 @@ const MappingTab = ({defaultCollection}: MappingProps) => {
<Box sx={styles.wrap}>
{Object.keys(datasetMapping).map((variableName, index) => (
<Box key={index} sx={styles.row}>
<Box sx={styles.col}>
<Box sx={styles.col} className="mapping-chip">
{getChipComponent(variableName)}
</Box>
<Box sx={styles.col}>
<Box sx={styles.col} className="mapping__column-header">
<TextField
disabled
fullWidth
Expand All @@ -254,9 +263,10 @@ const MappingTab = ({defaultCollection}: MappingProps) => {
<Box sx={styles.col}>
<ArrowIcon/>
</Box>
<Box sx={styles.col}>
<Box sx={styles.col} className="cde-fields__item-first">
<CustomEntitiesDropdown
placeholder={"Choose CDE or Data Dictionary fields... "}
handleTourNextStepClick={handleTourNextStepClick}
options={{
searchPlaceholder: searchText,
noResultReason: "We couldn’t find any results.",
Expand Down Expand Up @@ -306,8 +316,15 @@ const MappingTab = ({defaultCollection}: MappingProps) => {
</Box>
</ModalHeightWrapper>

<PreviewBox/>
</>
<PreviewBox togglePreview={togglePreview} setTogglePreview={setTogglePreview} handleTourNextStepClick={handleTourNextStepClick}/>
<Tour
steps={tutorial[TourSteps.Mapping]}
stepIndex={stepIndex}
setStepIndex={setStepIndex}
// isSpotlightOpen={togglePreview}
// handleSpotlightClose={() => setTogglePreview(false)}
/>
</Box>
)
}

Expand Down
2 changes: 1 addition & 1 deletion lib/components/steps/suggestions/SuggestionDetailUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function SuggestionDetailUI({row, header, headerIndexes}: SuggestionDetailUIProp
}));

return (
<Box gap='1.5rem' display='flex' alignItems='start'>
<Box gap='1.5rem' display='flex' alignItems='start' className='suggestion-details'>
<Box height='2.625rem' display='flex' alignItems='center' sx={{"& .MuiRadio-root": {
padding: 0,
color: gray300
Expand Down

0 comments on commit 250a81c

Please sign in to comment.