Skip to content

Commit

Permalink
feat: Add success message when confirming editing
Browse files Browse the repository at this point in the history
  • Loading branch information
Merkur39 committed Nov 18, 2024
1 parent 3d04b8d commit 5a68d29
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/ModelSteps/widgets/SubmitButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ const SubmitButton = ({ onSubmit, disabled, formData }) => {
})
}

showAlert({
message: t('common.saveFile.success'),
severity: 'success',
variant: 'filled'
})

return onSubmit()
}

Expand Down
9 changes: 9 additions & 0 deletions src/components/Views/ContactEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { updateReferencedContact } from 'src/components/ModelSteps/Edit/helpers'
import { useClient } from 'cozy-client'
import Backdrop from 'cozy-ui/transpiled/react/Backdrop'
import Spinner from 'cozy-ui/transpiled/react/Spinner'
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
import { makeStyles } from 'cozy-ui/transpiled/react/styles'

const useStyles = makeStyles({
Expand All @@ -21,6 +23,8 @@ const ContactEdit = () => {
const navigate = useNavigate()
const client = useClient()
const classes = useStyles()
const { t } = useI18n()
const { showAlert } = useAlert()

const currentEditInformation = useCurrentEditInformations(fileId, 'contact')
const { isLoadingContacts, contacts } = useReferencedContact([
Expand Down Expand Up @@ -62,6 +66,11 @@ const ContactEdit = () => {
currentFile: currentEditInformation.file,
contactIdsSelected
})
showAlert({
message: t('common.saveFile.success'),
severity: 'success',
variant: 'filled'
})
onClose()
}
const isLoading = currentEditInformation.isLoading || isLoadingContacts
Expand Down
7 changes: 7 additions & 0 deletions src/components/Views/InformationEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { isIOS } from 'cozy-device-helper'
import Button from 'cozy-ui/transpiled/react/Buttons'
import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
import Spinner from 'cozy-ui/transpiled/react/Spinner'
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

Expand All @@ -30,6 +31,7 @@ const InformationEdit = () => {
const { isMobile } = useBreakpoints()
const scannerT = useScannerI18n()
const navigate = useNavigate()
const { showAlert } = useAlert()

const [value, setValue] = useState({})
const [validInput, setValidInput] = useState({})
Expand Down Expand Up @@ -85,6 +87,11 @@ const InformationEdit = () => {
.collection(FILES_DOCTYPE)
.updateMetadataAttribute(fileId, newMetadata)
}
showAlert({
message: t('common.saveFile.success'),
severity: 'success',
variant: 'filled'
})

navigate('..')
}
Expand Down

0 comments on commit 5a68d29

Please sign in to comment.