• 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/collaborative/CollaborativeSessionAction.jsx
NEW
1
import { Badge } from '@geist-ui/core'
×
2
import React, { useCallback, useEffect, useMemo } from 'react'
×
3
import { Users } from 'react-feather'
×
4
import { useTranslation } from 'react-i18next'
×
5
import { useHistory } from 'react-router-dom'
×
6

NEW
7
import { useGraphQLClient } from '../../helpers/graphQL.js'
×
NEW
8
import { useModal } from '../../hooks/modal.js'
×
9

10
import { startCollaborativeSession } from '../Article.graphql'
×
11

12
import Button from '../Button.jsx'
×
NEW
13
import Modal from '../Modal.jsx'
×
NEW
14
import FormActions from '../molecules/FormActions.jsx'
×
15

16
/**
17
 * @param props
18
 * @param {{id: string}} props.collaborativeSession
19
 * @param {string} props.articleId
20
 * @return {Element}
21
 */
22
export default function CollaborativeSessionAction({
×
23
  collaborativeSession,
×
24
  articleId,
×
25
}) {
×
26
  const { t } = useTranslation()
×
27
  const history = useHistory()
×
28
  const { query } = useGraphQLClient()
×
NEW
29
  const collaborativeEditingModal = useModal()
×
30

31
  const handleStartCollaborativeEditing = useCallback(async () => {
×
32
    // try to start a collaborative editing
33
    if (collaborativeSession && collaborativeSession.id) {
×
34
      // join existing collaborative session
35
      history.push(`/article/${articleId}/session/${collaborativeSession.id}`)
×
36
    } else {
×
37
      // start a new collaborative session
38
      const data = await query({
×
39
        query: startCollaborativeSession,
×
40
        variables: { articleId },
×
41
      })
×
42
      history.push(
×
43
        `/article/${articleId}/session/${data.article.startCollaborativeSession.id}`
×
44
      )
×
45
    }
×
46
  }, [collaborativeSession])
×
47

48
  const collaborativeSessionDialogTitle = useMemo(
×
49
    () =>
×
50
      collaborativeSession
×
51
        ? t('article.collaborativeEditingJoin.title')
×
52
        : t('article.collaborativeEditingStart.title'),
×
53
    [collaborativeSession]
×
54
  )
×
55

56
  const collaborativeSessionDialogMessage = useMemo(
×
57
    () =>
×
58
      collaborativeSession
×
59
        ? t('article.collaborativeEditingJoin.confirmMessage')
×
60
        : t('article.collaborativeEditingStart.confirmMessage'),
×
61
    [collaborativeSession]
×
62
  )
×
63

64
  return (
×
65
    <>
×
66
      <Button
×
67
        title={t(
×
68
          'collaborativeSessionAction.launchCollaborativeSessionButton.title'
×
69
        )}
×
70
        icon={true}
×
NEW
71
        onClick={() => collaborativeEditingModal.show()}
×
72
      >
73
        <Users />
×
74
        {collaborativeSession && collaborativeSession.id && (
×
75
          <Badge type="error">Live</Badge>
×
76
        )}
77
      </Button>
×
NEW
78
      <Modal
×
NEW
79
        {...collaborativeEditingModal.bindings}
×
NEW
80
        title={
×
NEW
81
          <>
×
NEW
82
            <Users /> {collaborativeSessionDialogTitle}
×
NEW
83
          </>
×
84
        }
85
      >
NEW
86
        <p style={{ textAlign: 'start' }}>
×
87
          {collaborativeSessionDialogMessage}
×
NEW
88
        </p>
×
NEW
89
        <FormActions
×
NEW
90
          onCancel={() => collaborativeEditingModal.close()}
×
NEW
91
          onSubmit={handleStartCollaborativeEditing}
×
NEW
92
        />
×
NEW
93
      </Modal>
×
UNCOV
94
    </>
×
95
  )
96
}
×
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