• 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/collaborative/CollaborativeEditor.jsx
1
import { Loading } from '@geist-ui/core'
×
2
import React, { useCallback } from 'react'
×
3
import { useParams } from 'react-router-dom'
×
4
import useGraphQL from '../../hooks/graphql.js'
×
5
import ArticleStats from '../ArticleStats.jsx'
×
6

7
import { getCollaborativeSession } from './CollaborativeSession.graphql'
×
8

9
import CollaborativeEditorArticleHeader from './CollaborativeEditorArticleHeader.jsx'
×
10
import CollaborativeSessionError from './CollaborativeSessionError.jsx'
×
11
import CollaborativeTextEditor from './CollaborativeTextEditor.jsx'
×
12

13
import styles from './CollaborativeEditor.module.scss'
×
14

15
export default function CollaborativeEditor() {
×
16
  const { sessionId: collaborativeSessionId, articleId } = useParams()
×
17

18
  const {
×
19
    data: collaborativeSessionData,
×
20
    isLoading: collaborativeSessionLoading,
×
21
    mutate: mutateCollaborativeSession,
×
22
  } = useGraphQL({ query: getCollaborativeSession, variables: { articleId } })
×
23

24
  const handleCollaborativeSessionStateUpdated = useCallback(({ state }) => {
×
25
    if (state === 'ended') {
×
26
      mutateCollaborativeSession()
×
27
    }
×
28
  }, [])
×
29

30
  if (collaborativeSessionLoading) {
×
31
    return <Loading />
×
32
  }
×
33

34
  if (
×
35
    collaborativeSessionData?.article?.collaborativeSession?.id !==
×
36
    collaborativeSessionId
×
37
  ) {
×
38
    return (
×
39
      <div className={styles.errorContainer}>
×
40
        <CollaborativeSessionError error="notFound" />
×
41
      </div>
×
42
    )
43
  }
×
44

45
  const collaborativeSessionCreatorId =
×
46
    collaborativeSessionData?.article?.collaborativeSession?.creator?._id
×
47

48
  return (
×
49
    <div className={styles.container}>
×
50
      <CollaborativeEditorArticleHeader articleId={articleId} />
×
51
      <CollaborativeTextEditor
×
52
        articleId={articleId}
×
53
        collaborativeSessionCreatorId={collaborativeSessionCreatorId}
×
54
        collaborativeSessionId={collaborativeSessionId}
×
55
        onCollaborativeSessionStateUpdated={
×
56
          handleCollaborativeSessionStateUpdated
×
57
        }
58
      />
×
59
      <ArticleStats />
×
60
    </div>
×
61
  )
62
}
×
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