• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EcrituresNumeriques / stylo / 18501994804

14 Oct 2025 03:37PM UTC coverage: 39.609%. Remained the same
18501994804

push

github

ggrossetie
fix: formMetadata peut ĂȘtre null au chargement

610 of 860 branches covered (70.93%)

Branch coverage included in aggregate %.

0 of 2 new or added lines in 1 file covered. (0.0%)

5981 of 15780 relevant lines covered (37.9%)

2.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/front/src/components/workspace/WorkspaceUpdateFormMetadata.jsx
1
import React, { useCallback } from 'react'
×
2
import { useTranslation } from 'react-i18next'
×
3
import { toast } from 'react-toastify'
×
4

5
import { fromFormData } from '../../helpers/forms.js'
×
6
import { useWorkspaceActions } from '../../hooks/workspace.js'
×
7

8
import FormActions from '../molecules/FormActions.jsx'
×
9

10
import buttonStyles from '../button.module.scss'
×
11
import styles from './createWorkspace.module.scss'
×
12

13
/**
14
 * @param {Object} props
15
 * @param {Function} props.onSubmit
16
 * @param {Function} props.onCancel
17
 * @param {Object} props.workspace
18
 * @return {JSX.Element}
19
 */
20
export default function WorkspaceUpdateFormMetadata({
×
21
  onSubmit,
×
22
  onCancel,
×
23
  workspace,
×
24
}) {
×
25
  const { t } = useTranslation()
×
26
  const { updateFormMetadata } = useWorkspaceActions()
×
27

28
  const handleSubmit = useCallback(async (event) => {
×
29
    event.preventDefault()
×
30
    try {
×
31
      const updateFormMetadataInput = fromFormData(event.target)
×
32
      await updateFormMetadata(workspace._id, updateFormMetadataInput)
×
33
      toast(t('workspace.updateFormMetadata.successNotification'), {
×
34
        type: 'info',
×
35
      })
×
36

37
      onSubmit()
×
38
    } catch (err) {
×
39
      toast(
×
40
        t('workspace.updateFormMetadata.errorNotification', {
×
41
          errMessage: err,
×
42
        }),
×
43
        {
×
44
          type: 'error',
×
45
        }
×
46
      )
×
47
    }
×
48
  }, [])
×
49

50
  return (
×
51
    <section>
×
52
      <form onSubmit={handleSubmit} className={styles.form}>
×
53
        <label htmlFor="data">{t('workspace.formMetadata.data')}</label>
×
54
        <div>
×
55
          <textarea
×
56
            id="data"
×
57
            name="data"
×
58
            className={buttonStyles.textarea}
×
59
            style={{ width: '100%' }}
×
60
            rows="12"
×
61
          >
NEW
62
            {workspace.formMetadata?.data}
×
63
          </textarea>
×
64
        </div>
×
65
        <label htmlFor="ui">{t('workspace.formMetadata.ui')}</label>
×
66
        <div>
×
67
          <textarea
×
68
            id="ui"
×
69
            name="ui"
×
70
            className={buttonStyles.textarea}
×
71
            style={{ width: '100%' }}
×
72
            rows="10"
×
73
          >
NEW
74
            {workspace.formMetadata?.ui}
×
75
          </textarea>
×
76
        </div>
×
77

78
        <FormActions
×
79
          onCancel={onCancel}
×
80
          submitButton={{
×
81
            text: t('workspace.updateFormMetadata.buttonText'),
×
82
            title: t('workspace.updateFormMetadata.buttonTitle'),
×
83
          }}
×
84
        />
×
85
      </form>
×
86
    </section>
×
87
  )
88
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc