diff --git a/webapp/components/form/TextInput.js b/webapp/components/form/TextInput.js index 9bb290e740..419b96288b 100644 --- a/webapp/components/form/TextInput.js +++ b/webapp/components/form/TextInput.js @@ -3,6 +3,8 @@ import PropTypes from 'prop-types' import { TextField as MuiTextField } from '@mui/material' import classNames from 'classnames' +import { useI18n } from '@webapp/store/system' + export const TextInput = (props) => { const { autoComplete, @@ -11,10 +13,10 @@ export const TextInput = (props) => { disabled, endAdornment, id, - label, + label: labelProp, name, onChange: onChangeProp, - placeholder, + placeholder: placeholderProp, readOnly, startAdornment, textTransformFunction, @@ -22,6 +24,8 @@ export const TextInput = (props) => { value, } = props + const i18n = useI18n() + const onChange = useCallback( (e) => { const value = e.target.value @@ -31,6 +35,9 @@ export const TextInput = (props) => { [onChangeProp, textTransformFunction] ) + const label = labelProp ? i18n.t(labelProp) : labelProp + const placeholder = placeholderProp ? i18n.t(placeholderProp) : placeholderProp + return ( (
onClose()}> @@ -20,7 +21,9 @@ export const ModalBody = ({ children }) =>
{children export const ModalFooter = ({ children }) =>
{children}
export const Modal = (props) => { - const { children, className, closeOnEsc, onClose: onCloseProp } = props + const { children, className, closeOnEsc, onClose: onCloseProp, showCloseButton, title, titleParams } = props + + const i18n = useI18n() const onClose = useCallback( (event) => { @@ -38,7 +41,15 @@ export const Modal = (props) => { open > -
{children}
+
+ {(title || showCloseButton) && ( + + {title && {i18n.t(title, titleParams)}} + {showCloseButton && } + + )} + {children} +
) @@ -49,9 +60,13 @@ Modal.propTypes = { className: PropTypes.string, closeOnEsc: PropTypes.bool, onClose: PropTypes.func, + title: PropTypes.string, + titleParams: PropTypes.object, + showCloseButton: PropTypes.bool, } Modal.defaultProps = { className: '', closeOnEsc: true, + showCloseButton: false, } diff --git a/webapp/components/survey/CategoryDetails/ImportSummary/ImportSummary.js b/webapp/components/survey/CategoryDetails/ImportSummary/ImportSummary.js index 8c1cc6570d..a3697f3d48 100644 --- a/webapp/components/survey/CategoryDetails/ImportSummary/ImportSummary.js +++ b/webapp/components/survey/CategoryDetails/ImportSummary/ImportSummary.js @@ -5,9 +5,8 @@ import PropTypes from 'prop-types' import * as CategoryImportSummary from '@core/survey/categoryImportSummary' -import { Modal, ModalBody, ModalClose, ModalFooter, ModalHeader } from '@webapp/components/modal' +import { Modal, ModalBody, ModalFooter } from '@webapp/components/modal' import { Button } from '@webapp/components/buttons' -import { useI18n } from '@webapp/store/system' import TableHeader from './TableHeader' import TableRow from './TableRow' @@ -17,18 +16,18 @@ import { State, useActions } from '../store' const ImportSummary = (props) => { const { state, setState } = props - const i18n = useI18n() const Actions = useActions({ setState }) const importSummary = State.getImportSummary(state) const items = CategoryImportSummary.getItems(importSummary) return ( - - - {i18n.t('categoryEdit.importSummary.title')} - - +
diff --git a/webapp/components/survey/CategoryDetails/ImportSummary/ImportSummary.scss b/webapp/components/survey/CategoryDetails/ImportSummary/ImportSummary.scss index 6cc5772409..c47d500a49 100644 --- a/webapp/components/survey/CategoryDetails/ImportSummary/ImportSummary.scss +++ b/webapp/components/survey/CategoryDetails/ImportSummary/ImportSummary.scss @@ -1,7 +1,4 @@ .category__import-summary { - display: grid; - grid-template-rows: 1fr 50px; - .modal-header { display: grid; grid-template-columns: 1fr auto; diff --git a/webapp/components/survey/SurveyForm/nodeDefs/components/nodeDefEntitySelectorDialog.js b/webapp/components/survey/SurveyForm/nodeDefs/components/nodeDefEntitySelectorDialog.js index 21a53862bd..72f9e03f1a 100644 --- a/webapp/components/survey/SurveyForm/nodeDefs/components/nodeDefEntitySelectorDialog.js +++ b/webapp/components/survey/SurveyForm/nodeDefs/components/nodeDefEntitySelectorDialog.js @@ -8,7 +8,7 @@ import { useI18n } from '@webapp/store/system' import { useSurvey } from '@webapp/store/survey' import { Button } from '@webapp/components/buttons' -import { Modal, ModalBody, ModalFooter, ModalHeader } from '@webapp/components/modal' +import { Modal, ModalBody, ModalFooter } from '@webapp/components/modal' import { EntitySelector } from '@webapp/components/survey/NodeDefsSelector' import { FormItem } from '@webapp/components/form/Input' @@ -45,9 +45,12 @@ export const NodeDefEntitySelectorDialog = (props) => { !selectedEntityDefUuid || (isEntitySelectable && !isEntitySelectable?.(selectedEntityDefUuid)) return ( - - {i18n.t(title, { nodeDefName: NodeDef.getName(currentNodeDef) })} - + { const i18n = useI18n() return ( - - {label} - + {React.createElement(NodeDefUiProps.getComponent(nodeDef), props)} diff --git a/webapp/components/survey/Surveys/HeaderLeft/HeaderLeft.js b/webapp/components/survey/Surveys/HeaderLeft/HeaderLeft.js index d3743da42a..002337324d 100644 --- a/webapp/components/survey/Surveys/HeaderLeft/HeaderLeft.js +++ b/webapp/components/survey/Surveys/HeaderLeft/HeaderLeft.js @@ -4,6 +4,7 @@ import PropTypes from 'prop-types' import { useI18n } from '@webapp/store/system' import { FormItem } from '@webapp/components/form/Input' +import { TextInput } from '@webapp/components/form' const HeaderLeft = (props) => { const { handleSearch, search } = props @@ -11,16 +12,18 @@ const HeaderLeft = (props) => { const i18n = useI18n() return ( -
+
- handleSearch(e.target.value)} + onChange={(val) => { + handleSearch(val) + }} + placeholder="surveysView.filterPlaceholder" /> -
+
) } diff --git a/webapp/components/survey/Surveys/Surveys.scss b/webapp/components/survey/Surveys/Surveys.scss index 5ffec5591f..ccc60d30b1 100644 --- a/webapp/components/survey/Surveys/Surveys.scss +++ b/webapp/components/survey/Surveys/Surveys.scss @@ -1,9 +1,10 @@ .table.surveys { - header { + .table__header { column-gap: 5rem; input { - width: 20rem; + width: 25rem; + padding: 0.5rem; } } } diff --git a/webapp/style/table.scss b/webapp/style/table.scss index b45325dbcf..496bba72fe 100644 --- a/webapp/style/table.scss +++ b/webapp/style/table.scss @@ -1,6 +1,6 @@ @import 'webapp/style/vars'; -$tableHeaderHeight: 40px; +$tableHeaderHeight: 50px; $tableFooterHeight: 30px; .table { @@ -13,6 +13,7 @@ $tableFooterHeight: 30px; display: flex; align-items: center; justify-content: space-between; + height: $tableHeaderHeight; } .table__content { diff --git a/webapp/views/App/JobMonitor/JobMonitor.js b/webapp/views/App/JobMonitor/JobMonitor.js index 452a176cef..615ab5140b 100644 --- a/webapp/views/App/JobMonitor/JobMonitor.js +++ b/webapp/views/App/JobMonitor/JobMonitor.js @@ -5,11 +5,10 @@ import { useDispatch } from 'react-redux' import * as JobSerialized from '@common/job/jobSerialized' -import { useI18n } from '@webapp/store/system' import { useJob, JobActions } from '@webapp/store/app' import { Button } from '@webapp/components/buttons' -import { Modal, ModalBody, ModalFooter, ModalHeader } from '@webapp/components/modal' +import { Modal, ModalBody, ModalFooter } from '@webapp/components/modal' import InnerJobs from './InnerJobs' import JobErrors from './JobErrors' @@ -24,7 +23,6 @@ const getCustomCloseButtonComponent = ({ closeButton, job }) => { const JobMonitor = () => { const dispatch = useDispatch() - const i18n = useI18n() const { job, closeButton, errorKeyHeaderName, errorsExportFileName } = useJob() if (!job || JobSerialized.isCanceled(job)) return null @@ -34,9 +32,7 @@ const JobMonitor = () => { const jobEnded = JobSerialized.isEnded(job) return ( - - {i18n.t(`jobs.${JobSerialized.getType(job)}`)} - + { } return ( - - - {i18n.t('dataView.recordsClone.title')} - - + {cycleFromLabel} diff --git a/webapp/views/Arena/Routes/DialogConfirm/DialogConfirm.js b/webapp/views/Arena/Routes/DialogConfirm/DialogConfirm.js index c401f2dd50..eab26f8f75 100644 --- a/webapp/views/Arena/Routes/DialogConfirm/DialogConfirm.js +++ b/webapp/views/Arena/Routes/DialogConfirm/DialogConfirm.js @@ -6,7 +6,7 @@ import classNames from 'classnames' import { DialogConfirmActions, useDialogConfirm } from '@webapp/store/ui' -import { Modal, ModalBody, ModalFooter, ModalHeader } from '@webapp/components/modal' +import { Modal, ModalBody, ModalFooter } from '@webapp/components/modal' import { useI18n } from '@webapp/store/system' import Markdown from '@webapp/components/markdown' import { TestId } from '@webapp/utils/testId' @@ -29,12 +29,11 @@ const DialogConfirm = () => { } = useDialogConfirm() return key ? ( - dispatch(DialogConfirmActions.onDialogConfirmCancel())}> - {headerText && ( - -
{i18n.t(headerText)}
-
- )} + dispatch(DialogConfirmActions.onDialogConfirmCancel())} + title={headerText} + >