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

EcrituresNumeriques / stylo / 13141758304

04 Feb 2025 05:55PM UTC coverage: 26.581% (+0.8%) from 25.809%
13141758304

push

github

web-flow
Merge pull request #1188 from ggrossetie/fix-1171-hooks-usegraphql

342 of 546 branches covered (62.64%)

Branch coverage included in aggregate %.

54 of 303 new or added lines in 10 files covered. (17.82%)

2 existing lines in 2 files now uncovered.

3567 of 14160 relevant lines covered (25.19%)

1.66 hits per line

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

0.0
/front/src/components/workspace/CreateWorkspace.jsx
1
import { Button, useInput } from '@geist-ui/core'
×
2
import React, { useCallback, useRef } from 'react'
×
3
import { useTranslation } from 'react-i18next'
×
NEW
4
import { shallowEqual, useSelector } from 'react-redux'
×
NEW
5
import { useWorkspaceActions } from '../../hooks/workspace.js'
×
6

7
import Field from '../Field.jsx'
×
8

9
import styles from './createWorkspace.module.scss'
×
10
import { randomColor } from '../../helpers/colors.js'
×
11

NEW
12
export default function CreateWorkspace({ onSubmit }) {
×
13
  const { t } = useTranslation()
×
14
  const { state: name, bindings: nameBindings } = useInput('')
×
15
  const { state: description, bindings: descriptionBindings } = useInput('')
×
16
  const { state: color, bindings: colorBindings } = useInput(randomColor())
×
17
  const nameInputRef = useRef()
×
NEW
18
  const currentUser = useSelector((state) => state.activeUser, shallowEqual)
×
NEW
19
  const { addWorkspace } = useWorkspaceActions()
×
20

21
  const handleSubmit = useCallback(async () => {
×
NEW
22
    await addWorkspace({
×
NEW
23
      name,
×
NEW
24
      color,
×
NEW
25
      description,
×
NEW
26
      updatedAt: new Date().getTime(),
×
NEW
27
      createdAt: new Date().getTime(),
×
NEW
28
      stats: {
×
NEW
29
        membersCount: 1,
×
NEW
30
        articlesCount: 0,
×
NEW
31
      },
×
NEW
32
      creator: currentUser,
×
NEW
33
    })
×
NEW
34
    onSubmit()
×
UNCOV
35
  }, [name, color, description])
×
36

37
  return (
×
38
    <section>
×
NEW
39
      <form onSubmit={handleSubmit} className={styles.form}>
×
40
        <Field
×
41
          autoFocus={true}
×
42
          ref={nameInputRef}
×
43
          {...nameBindings}
×
44
          label={t('workspace.createForm.nameField')}
×
45
          type="text"
×
NEW
46
          className={styles.name}
×
47
        />
×
48
        <Field
×
49
          label={t('workspace.createForm.descriptionField')}
×
50
          type="text"
×
51
          {...descriptionBindings}
×
52
        />
×
53
        <Field
×
54
          label={t('workspace.createForm.colorField')}
×
55
          type="color"
×
56
          {...colorBindings}
×
57
        />
×
58
        <ul className={styles.actions}>
×
59
          <li>
×
60
            <Button
×
61
              type="secondary"
×
62
              className={styles.button}
×
63
              title={t('workspace.createForm.buttonTitle')}
×
64
              onClick={handleSubmit}
×
65
            >
66
              {t('workspace.createForm.buttonText')}
×
67
            </Button>
×
68
          </li>
×
69
        </ul>
×
70
      </form>
×
71
    </section>
×
72
  )
73
}
×
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