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

EcrituresNumeriques / stylo / 13987938500

21 Mar 2025 08:48AM UTC coverage: 31.659% (+0.6%) from 31.087%
13987938500

push

github

web-flow
chore: remplace les modales Geist (#1358)

Remplace aussi <Loading> par notre composant.

464 of 686 branches covered (67.64%)

Branch coverage included in aggregate %.

42 of 569 new or added lines in 36 files covered. (7.38%)

27 existing lines in 18 files now uncovered.

4396 of 14665 relevant lines covered (29.98%)

2.26 hits per line

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

0.0
/front/src/components/workspace/Workspaces.jsx
1
import React, { useEffect, useState } from 'react'
×
2
import { Search } from 'react-feather'
×
3
import { useTranslation } from 'react-i18next'
×
4
import { shallowEqual, useSelector } from 'react-redux'
×
5
import { Helmet } from 'react-helmet'
×
6

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

9
import WorkspaceItem from '../../components/workspace/WorkspaceItem.jsx'
×
10

11
import { useGraphQLClient } from '../../helpers/graphQL.js'
×
NEW
12
import { useModal } from '../../hooks/modal.js'
×
13
import { useWorkspaces } from '../../hooks/workspace.js'
×
NEW
14
import Button from '../Button.jsx'
×
15
import Loading from '../molecules/Loading.jsx'
×
16
import CreateWorkspaceModal from './CreateWorkspaceModal.jsx'
×
17
import { getUserStats } from './Workspaces.graphql'
×
18

19
import styles from './workspaces.module.scss'
×
20

21
export default function Workspaces() {
×
22
  const { t } = useTranslation()
×
23
  const activeUser = useSelector((state) => state.activeUser, shallowEqual)
×
24
  const [filter, setFilter] = useState('')
×
25
  const { workspaces, error, isLoading } = useWorkspaces()
×
26
  const workspaceCreateModal = useModal()
×
27

28
  const [personalWorkspace, setPersonalWorkspace] = useState({
×
29
    _id: activeUser._id,
×
30
    personal: true,
×
31
    members: [],
×
32
  })
×
33
  const { query } = useGraphQLClient()
×
34

35
  useEffect(() => {
×
36
    ;(async () => {
×
37
      try {
×
38
        const getUserStatsResponse = await query({ query: getUserStats })
×
39
        const userStats = getUserStatsResponse.user.stats
×
40
        setPersonalWorkspace({
×
41
          _id: activeUser._id,
×
42
          personal: true,
×
43
          name: t('workspace.myspace'),
×
44
          description: '',
×
45
          color: '#D9D9D9',
×
46
          createdAt: activeUser.createdAt,
×
47
          updatedAt: activeUser.updatedAt,
×
48
          members: [],
×
49
          articlesCount:
×
50
            userStats.myArticlesCount + userStats.contributedArticlesCount,
×
51
        })
×
52
      } catch (err) {
×
53
        alert(err)
×
54
      }
×
55
    })()
×
56
  }, [activeUser._id, t])
×
57

58
  if (error) {
×
59
    return <div>Unable to load the workspaces</div>
×
60
  }
×
61
  if (isLoading) {
×
62
    return <Loading />
×
63
  }
×
64

65
  return (
×
66
    <section className={styles.section}>
×
67
      <Helmet>
×
68
        <title>{t('workspace.title')}</title>
×
69
      </Helmet>
×
70

71
      <h1>{t('workspace.title')}</h1>
×
72
      <div>
×
73
        <Field
×
74
          className={styles.searchField}
×
75
          type="text"
×
76
          icon={Search}
×
77
          value={filter}
×
78
          placeholder={t('search.placeholder')}
×
79
          onChange={(e) => setFilter(e.target.value)}
×
80
        />
×
81
      </div>
×
NEW
82
      <Button primary onClick={() => workspaceCreateModal.show()}>
×
83
        {t('workspace.createNew.button')}
×
84
      </Button>
×
85

86
      <CreateWorkspaceModal {...workspaceCreateModal} />
×
87

88
      <ul className={styles.workspacesList}>
×
89
        {[personalWorkspace, ...workspaces].map((workspace) => (
×
90
          <li key={`workspace-${workspace._id}`}>
×
91
            <WorkspaceItem workspace={workspace} />
×
92
          </li>
×
93
        ))}
×
94
      </ul>
×
95
    </section>
×
96
  )
97
}
×
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