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

EcrituresNumeriques / stylo / 13547287365

26 Feb 2025 03:20PM UTC coverage: 12.024% (+0.3%) from 11.684%
13547287365

push

github

web-flow
Merge pull request #1255 from ggrossetie/fix-1171-hooks-renaming

157 of 305 branches covered (51.48%)

Branch coverage included in aggregate %.

67 of 264 new or added lines in 25 files covered. (25.38%)

10 existing lines in 4 files now uncovered.

1144 of 10515 relevant lines covered (10.88%)

1.83 hits per line

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

0.0
/front/src/components/workspace/WorkspaceSelectItem.jsx
1
import React, { useCallback } from 'react'
×
2
import { useSelector } from 'react-redux'
×
3
import clsx from 'clsx'
×
4
import PropTypes from 'prop-types'
×
5

6
import { removeArticle, addArticle } from './Workspaces.graphql'
×
7
import styles from './WorkspaceSelectItem.module.scss'
×
NEW
8
import { useGraphQLClient } from '../../helpers/graphQL.js'
×
9

10
export default function WorkspaceSelectItem({
×
11
  articleId,
×
12
  selected,
×
13
  id,
×
14
  color,
×
15
  name,
×
16
  onChange,
×
17
}) {
×
NEW
18
  const { query } = useGraphQLClient()
×
19
  const activeUser = useSelector((state) => state.activeUser)
×
20
  const toggleWorkspaceArticle = useCallback(
×
21
    async (event) => {
×
22
      event.preventDefault()
×
23
      const [id, checked] = [event.target.value, event.target.checked]
×
NEW
24
      const graphqlQuery = checked ? addArticle : removeArticle
×
NEW
25
      await query({
×
NEW
26
        query: graphqlQuery,
×
27
        variables: { articleId: articleId, workspaceId: id },
×
28
      })
×
29
      onChange({ workspaceId: id })
×
30
    },
×
31
    [articleId, id]
×
32
  )
×
33
  return (
×
34
    <>
×
35
      <li
×
36
        className={
×
37
          activeUser.activeWorkspaceId === id ? clsx(styles.active) : ''
×
38
        }
39
      >
40
        <label className={clsx(styles.workspace, selected && styles.selected)}>
×
41
          <input
×
42
            name={id}
×
43
            value={id}
×
44
            data-id={id}
×
45
            type="checkbox"
×
46
            checked={selected}
×
47
            onChange={toggleWorkspaceArticle}
×
48
          />
×
49
          <span>{name}</span>
×
50
          <span className={styles.chip} style={{ backgroundColor: color }} />
×
51
        </label>
×
52
      </li>
×
53
    </>
×
54
  )
55
}
×
56

57
WorkspaceSelectItem.propTypes = {
×
58
  name: PropTypes.string.isRequired,
×
59
  color: PropTypes.string.isRequired,
×
60
  id: PropTypes.string,
×
61
  selected: PropTypes.bool,
×
62
  articleId: PropTypes.string.isRequired,
×
63
  onChange: PropTypes.func,
×
64
}
×
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