From 1b1403615f7e0da954811cd68961c4e1dfa39e5f Mon Sep 17 00:00:00 2001 From: Aiga115 Date: Wed, 23 Apr 2025 22:54:11 +0200 Subject: [PATCH 1/6] ILEX-106 make intitial UI changes --- .../EditBulkTerms/EditBulkTermsDialog.jsx | 5 + .../Dashboard/EditBulkTerms/SearchTerms.jsx | 186 ++++++++++-------- src/theme/index.jsx | 1 + 3 files changed, 105 insertions(+), 87 deletions(-) diff --git a/src/components/Dashboard/EditBulkTerms/EditBulkTermsDialog.jsx b/src/components/Dashboard/EditBulkTerms/EditBulkTermsDialog.jsx index 47eeeb14..4fc33571 100644 --- a/src/components/Dashboard/EditBulkTerms/EditBulkTermsDialog.jsx +++ b/src/components/Dashboard/EditBulkTerms/EditBulkTermsDialog.jsx @@ -87,6 +87,11 @@ const EditBulkTermsDialog = ({ open, handleClose, activeStep, setActiveStep }) = isAllFieldsFilled={isAllFieldsFilled(searchConditions)} /> } + sx={{ + '& .MuiDialogContent-root': { + padding: 0 + } + }} > <> { diff --git a/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx b/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx index d63e13af..082bd0d9 100644 --- a/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx +++ b/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx @@ -5,7 +5,8 @@ import AddOutlinedIcon from "@mui/icons-material/AddOutlined"; import CustomSingleSelect from "../../common/CustomSingleSelect"; import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline"; import SearchTermsData from "../../../static/SearchTermsData.json"; -import {Button, Grid, Typography, Box, ToggleButton, ToggleButtonGroup} from "@mui/material"; +import {Button, Grid, Typography, Box, ToggleButton, ToggleButtonGroup, Divider, Stack, FormControlLabel} from "@mui/material"; +import CustomizedRadio from "../../common/CustomizedRadio"; import { vars } from "../../../theme/variables"; const { gray800 } = vars; @@ -43,96 +44,107 @@ const SearchTerms = ({searchConditions, setSearchConditions, initialSearchCondit })); return ( - - + + Search terms, selecting their attributes and values. - {searchConditions.map((term, index) => ( - - - {index === 0 ? ( - - - Where - - - ) : ( - handleConditionChange(event, value, index)} - sx={{ - height: '2.5rem', - }} - > - - And - - - Or - - + + + Do you want to edit a specific ontology? + + } label="Yes" sx={{ "& .MuiFormControlLabel-label": {color: "#313534", fontWeight: 500} }} /> + } label="No" sx={{ "& .MuiFormControlLabel-label": {color: "#313534", fontWeight: 500} }} /> + + + + + Add filters + {searchConditions.map((term, index) => ( + + + {index === 0 ? ( + + + Where + + + ) : ( + handleConditionChange(event, value, index)} + sx={{ + height: '2.5rem', + }} + > + + And + + + Or + + + )} + + + + Search for attribute + + handleTermChange(index, 'attribute', v)} + options={updatedColumnsArray} + placeholder='Choose an attribute' + /> + + + handleTermChange(index, 'relation', value)} + index={index} + handleTermChange={handleTermChange} + /> + + 1 ? 3 : 4}> + handleTermChange(index, 'value', e.target.value)} + /> + + {searchConditions.length > 1 && ( + 1 ? 1 : 0}> + + )} - - - Search for attribute - - handleTermChange(index, 'attribute', v)} - options={updatedColumnsArray} - placeholder='Choose an attribute' - /> - - - handleTermChange(index, 'relation', value)} - index={index} - handleTermChange={handleTermChange} - /> - - 1 ? 3 : 4}> - handleTermChange(index, 'value', e.target.value)} - /> - - {searchConditions.length > 1 && ( - 1 ? 1 : 0}> - - - )} - - ))} - - - + ))} + + + + ); diff --git a/src/theme/index.jsx b/src/theme/index.jsx index 29af2c1c..b166478a 100644 --- a/src/theme/index.jsx +++ b/src/theme/index.jsx @@ -494,6 +494,7 @@ const theme = createTheme({ textPrimary: { color: gray600, background: white, + padding: "0.625rem 0.875rem", "&:hover": { background: gray100, color: gray700, From bc31e031bf0aaedd9a3eb332b749f3a15926d1f1 Mon Sep 17 00:00:00 2001 From: Aiga115 Date: Thu, 24 Apr 2025 13:56:51 +0200 Subject: [PATCH 2/6] ILEX-106 make ui changes --- .../Dashboard/EditBulkTerms/SearchTerms.jsx | 65 ++++++++++++++----- src/components/common/CustomizedRadio.jsx | 4 +- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx b/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx index 082bd0d9..faff1d91 100644 --- a/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx +++ b/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx @@ -1,17 +1,38 @@ import PropTypes from "prop-types"; +import { useState } from "react"; +import { Button, Grid, Typography, Box, ToggleButton, ToggleButtonGroup, Divider, Stack, FormControlLabel, RadioGroup } from "@mui/material"; import DropDownConditions from "./DropDownConditions"; import CustomizedInput from "../../common/CustomizedInput"; import AddOutlinedIcon from "@mui/icons-material/AddOutlined"; import CustomSingleSelect from "../../common/CustomSingleSelect"; import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline"; import SearchTermsData from "../../../static/SearchTermsData.json"; -import {Button, Grid, Typography, Box, ToggleButton, ToggleButtonGroup, Divider, Stack, FormControlLabel} from "@mui/material"; import CustomizedRadio from "../../common/CustomizedRadio"; +import OntologySearch from "../../SingleTermView/OntologySearch"; import { vars } from "../../../theme/variables"; -const { gray800 } = vars; +const { gray800, gray700 } = vars; + +const styles = { + title: { + color: gray800, + fontWeight: 600 + }, + subtitle: { + color: gray800, + fontWeight: 500 + }, + radioLabel: { + "& .MuiFormControlLabel-label": { + color: gray700, + fontWeight: 500 + } + } +} + +const SearchTerms = ({ searchConditions, setSearchConditions, initialSearchConditions }) => { + const [ontologyEditOption, setOntologyEditOption] = useState("no"); -const SearchTerms = ({searchConditions, setSearchConditions, initialSearchConditions}) => { const handleTermChange = (index, field, value) => { const newTerms = [...searchConditions]; newTerms[index][field] = value; @@ -38,6 +59,10 @@ const SearchTerms = ({searchConditions, setSearchConditions, initialSearchCondit setSearchConditions([initialSearchConditions]); }; + const handleOntologyEditOptionChange = (event) => { + setOntologyEditOption((event.target).value); + } + const updatedColumnsArray = SearchTermsData.termsColumns.map(item => ({ ...item, value: item.id @@ -45,26 +70,35 @@ const SearchTerms = ({searchConditions, setSearchConditions, initialSearchCondit return ( - + Search terms, selecting their attributes and values. - - Do you want to edit a specific ontology? - - } label="Yes" sx={{ "& .MuiFormControlLabel-label": {color: "#313534", fontWeight: 500} }} /> - } label="No" sx={{ "& .MuiFormControlLabel-label": {color: "#313534", fontWeight: 500} }} /> + + + Do you want to edit a specific ontology? + + } value="yes" label="Yes" sx={styles.radioLabel}/> + } value="no" label="No" sx={styles.radioLabel} /> + + {ontologyEditOption === "yes" && } - - Add filters + + Add filters {searchConditions.map((term, index) => ( {index === 0 ? ( - + Where @@ -87,12 +121,7 @@ const SearchTerms = ({searchConditions, setSearchConditions, initialSearchCondit )} - + Search for attribute { +const CustomizedRadio = ({ checked, ...rest }) => { return ( - + ); } From 31d386baed1b083cfdb8d2ff8388c421e822d488 Mon Sep 17 00:00:00 2001 From: Aiga115 Date: Thu, 24 Apr 2025 18:52:21 +0200 Subject: [PATCH 3/6] ILEX-106 fix ui of ontology search --- .../Dashboard/EditBulkTerms/SearchTerms.jsx | 65 ++++++++++++++++--- .../SingleTermView/OntologySearch.jsx | 7 +- 2 files changed, 62 insertions(+), 10 deletions(-) diff --git a/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx b/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx index faff1d91..04e214d8 100644 --- a/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx +++ b/src/components/Dashboard/EditBulkTerms/SearchTerms.jsx @@ -1,6 +1,17 @@ import PropTypes from "prop-types"; import { useState } from "react"; -import { Button, Grid, Typography, Box, ToggleButton, ToggleButtonGroup, Divider, Stack, FormControlLabel, RadioGroup } from "@mui/material"; +import { + Button, + Grid, + Typography, + Box, + ToggleButton, + ToggleButtonGroup, + Divider, + Stack, + FormControlLabel, + RadioGroup +} from "@mui/material"; import DropDownConditions from "./DropDownConditions"; import CustomizedInput from "../../common/CustomizedInput"; import AddOutlinedIcon from "@mui/icons-material/AddOutlined"; @@ -9,10 +20,15 @@ import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline"; import SearchTermsData from "../../../static/SearchTermsData.json"; import CustomizedRadio from "../../common/CustomizedRadio"; import OntologySearch from "../../SingleTermView/OntologySearch"; - import { vars } from "../../../theme/variables"; + const { gray800, gray700 } = vars; +const Confirmation = { + Yes: "Yes", + No: "No" +} + const styles = { title: { color: gray800, @@ -27,11 +43,16 @@ const styles = { color: gray700, fontWeight: 500 } + }, + ontologySearch: { + '& .MuiOutlinedInput-root': { + width: "100%" + } } } const SearchTerms = ({ searchConditions, setSearchConditions, initialSearchConditions }) => { - const [ontologyEditOption, setOntologyEditOption] = useState("no"); + const [ontologyEditOption, setOntologyEditOption] = useState(Confirmation.No); const handleTermChange = (index, field, value) => { const newTerms = [...searchConditions]; @@ -73,8 +94,18 @@ const SearchTerms = ({ searchConditions, setSearchConditions, initialSearchCondi Search terms, selecting their attributes and values. + - + + Do you want to edit a specific ontology? - } value="yes" label="Yes" sx={styles.radioLabel}/> - } value="no" label="No" sx={styles.radioLabel} /> + } value={Confirmation.Yes} label="Yes" sx={styles.radioLabel}/> + } value={Confirmation.No} label="No" sx={styles.radioLabel} /> - {ontologyEditOption === "yes" && } + + {ontologyEditOption === Confirmation.Yes && ( + + )} + + Add filters + {searchConditions.map((term, index) => ( - + {index === 0 ? ( @@ -120,6 +164,7 @@ const SearchTerms = ({ searchConditions, setSearchConditions, initialSearchCondi )} + Search for attribute @@ -131,6 +176,7 @@ const SearchTerms = ({ searchConditions, setSearchConditions, initialSearchCondi placeholder='Choose an attribute' /> + + 1 ? 3 : 4}> handleTermChange(index, 'value', e.target.value)} /> + {searchConditions.length > 1 && ( 1 ? 1 : 0}> + + + ); + Component.displayName = 'PaperComponent'; + return Component; + }, [onSetActive]); + + const renderOption = useCallback((props, option) => { + const { key, ...otherProps } = props; + return ( + + + + } + label={option.label} + /> + + + + ); + }, [selectedValue]); + + const renderInput = useCallback((params) => ( + + + + ), + endAdornment: selectedValue?.selected && ( + + + + ), + }} + /> + ), [handleInputChange, placeholder, selectedValue]); return ( -
+
{ - setSearchTerm(''); - setSelectedValue(value); - }} + onChange={handleChange} isOptionEqualToValue={isOptionEqualToValue} - sx={{ - '& .MuiOutlinedInput-root': { - minWidth: selectedValue ? '21.75rem' : '11.75rem', - width: 'fit-content', - borderRadius: openList ? '0.5rem 0.5rem 0 0' : '0.5rem', - }, - '&.Mui-focused': { - transition: 'width 0.100s ease-in-out', - '& .MuiOutlinedInput-root': { - minWidth: '21.75rem', - border: `2px solid ${brand600}`, - background: gray50, - boxShadow: '0px 1px 2px 0px rgba(16, 24, 40, 0.05)', - borderRadius: '.5rem', - }, - '& .MuiOutlinedInput-notchedOutline': { - border: 0, - }, - } - }} + sx={styles.autocomplete(fullWidth, selectedValue, openList)} autoHighlight={false} componentsProps={{ - popper: { - sx: { - width: '21.75rem !important', - backgroundColor: 'white', - }, - ref: popperRef - }, - paper: { - sx: { - borderRadius: '0.5rem', - '& .MuiAutocomplete-option': { - padding: '.06rem .38rem', - height: 'initial', - '& .MuiFormControlLabel-root': { - margin: 0, - '& .MuiTypography-root': { - fontSize: '0.875rem', - }, - '& .MuiButtonBase-root': { - padding: 0, - marginRight: '.5rem', - }, - }, - '&:hover': { - backgroundColor: gray50, - }, - '&[aria-selected="true"]': { - backgroundColor: 'transparent !important', - }, - }, - }, - }, + popper: popperProps, + paper: { sx: styles.paper }, }} inputValue={searchTerm ? searchTerm : selectedValue?.selected ? selectedValue?.label : ''} - renderOption={(props, option) => { - const { key, ...otherProps } = props; - return ( - - - - } - label={option.label} - /> - - - - ); - }} - renderInput={(params) => ( - - - - ), - endAdornment: selectedValue?.selected && ( - - - - ), - }} - /> - )} - PaperComponent={({ children }) => ( - - {children} - - - - - - )} + renderOption={renderOption} + renderInput={renderInput} + PaperComponent={PaperComponent} />
); }; OntologySearch.propTypes = { + placeholder: PropTypes.string, + fullWidth: PropTypes.bool, key: PropTypes.string, - placeholder: PropTypes.string + children: PropTypes.node, }; -export default OntologySearch; +export default OntologySearch; \ No newline at end of file