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

EcrituresNumeriques / stylo / 12925854411

23 Jan 2025 09:11AM UTC coverage: 25.831% (-4.7%) from 30.523%
12925854411

push

github

web-flow
Merge pull request #1192 from EcrituresNumeriques/feat/vite6

322 of 518 branches covered (62.16%)

Branch coverage included in aggregate %.

3448 of 14077 relevant lines covered (24.49%)

1.66 hits per line

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

0.0
/front/src/components/workspace/WorkspaceSelectionItems.jsx
1
import { Loading } from '@geist-ui/core'
×
2
import React, { useCallback, useMemo } from 'react'
×
3
import PropTypes from 'prop-types'
×
4
import { useSelector } from 'react-redux'
×
5

6
import { getArticleWorkspaces } from './Workspaces.graphql'
×
7
import useGraphQL from '../../hooks/graphql.js'
×
8
import WorkspaceSelectItem from './WorkspaceSelectItem.jsx'
×
9

10
export default function WorkspaceSelectionItems({ articleId }) {
×
11
  const userWorkspaces = useSelector((state) => state.activeUser.workspaces)
×
12
  const { data, isLoading, mutate } = useGraphQL(
×
13
    { query: getArticleWorkspaces, variables: { articleId } },
×
14
    {
×
15
      revalidateOnFocus: false,
×
16
      revalidateOnReconnect: false,
×
17
    }
×
18
  )
×
19

20
  const articleWorkspaces = useMemo(
×
21
    () => data?.article?.workspaces || [],
×
22
    [data]
×
23
  )
×
24

25
  const handleWorkspaceUpdate = useCallback(() => {
×
26
    mutate()
×
27
  }, [mutate])
×
28

29
  if (isLoading) {
×
30
    return <Loading />
×
31
  }
×
32

33
  return (
×
34
    <>
×
35
      {userWorkspaces.map((workspace) => (
×
36
        <WorkspaceSelectItem
×
37
          key={workspace._id}
×
38
          id={workspace._id}
×
39
          color={workspace.color}
×
40
          name={workspace.name}
×
41
          articleId={articleId}
×
42
          selected={articleWorkspaces.map((w) => w._id).includes(workspace._id)}
×
43
          onChange={handleWorkspaceUpdate}
×
44
        />
×
45
      ))}
×
46
    </>
×
47
  )
48
}
×
49

50
WorkspaceSelectionItems.propTypes = {
×
51
  articleId: PropTypes.string,
×
52
}
×
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