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

EcrituresNumeriques / stylo / 15922807606

27 Jun 2025 09:18AM UTC coverage: 39.241% (+0.04%) from 39.201%
15922807606

push

github

web-flow
Crée des requêtes de prévisualisation d'articles/corpus (#1592)

Co-authored-by: Thomas Parisot <thom4parisot@users.noreply.github.com>
Co-authored-by: Guillaume Grossetie <ggrossetie@yuzutech.fr>

570 of 800 branches covered (71.25%)

Branch coverage included in aggregate %.

90 of 250 new or added lines in 17 files covered. (36.0%)

137 existing lines in 8 files now uncovered.

5638 of 15020 relevant lines covered (37.54%)

2.66 hits per line

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

0.0
/front/src/components/collaborative/CollaborativeEditorArticleHeader.jsx
1
import React, { useEffect, useState } from 'react'
×
2
import { useTranslation } from 'react-i18next'
×
3
import { useMatch, useNavigate } from 'react-router'
×
4

5
import { Toggle } from '@geist-ui/core'
×
6

7
import useFetchData from '../../hooks/graphql.js'
×
8

9
import Loading from '../molecules/Loading.jsx'
×
10
import CollaborativeEditorActiveVersion from './CollaborativeEditorActiveVersion.jsx'
×
11
import CollaborativeEditorWriters from './CollaborativeEditorWriters.jsx'
×
12

13
import { getArticleInfo } from '../Article.graphql'
×
14

15
import styles from './CollaborativeEditorArticleHeader.module.scss'
×
16

17
/**
18
 * @param props
19
 * @param {string} props.articleId
20
 * @param {string?} props.versionId
21
 * @returns {import('react').ReactElementElement}
22
 */
23
export default function CollaborativeEditorArticleHeader({
×
24
  articleId,
×
25
  versionId,
×
26
}) {
×
27
  const { t } = useTranslation()
×
28
  const match = useMatch(
×
29
    versionId ? `/article/:id/version/:versionId/*` : `/article/:id/*`
×
30
  )
×
31
  const [mode, setMode] = useState('edit')
×
32
  const navigate = useNavigate()
×
33

34
  const { data, isLoading } = useFetchData(
×
35
    { query: getArticleInfo, variables: { articleId } },
×
36
    {
×
37
      revalidateIfStale: false,
×
38
      revalidateOnFocus: false,
×
39
      revalidateOnReconnect: false,
×
40
      fallbackData: {
×
41
        article: {},
×
42
      },
×
43
    }
×
44
  )
×
45

46
  useEffect(() => {
×
47
    if (mode === 'preview' && match.params['*'] === '') {
×
NEW
48
      navigate(`${match.pathnameBase}?mode=preview`)
×
49
    } else if (match.params['*'] !== '') {
×
50
      navigate(match.pathnameBase)
×
51
    }
×
52
  }, [mode])
×
53

54
  if (isLoading) {
×
55
    return <Loading />
×
56
  }
×
57

58
  return (
×
59
    <header className={styles.header}>
×
60
      <h1 className={styles.title}>{data.article.title}</h1>
×
61

62
      <div className={styles.row}>
×
63
        <div
×
64
          className={styles.mode}
×
65
          onClick={() => setMode(mode === 'preview' ? 'edit' : 'preview')}
×
66
        >
67
          <Toggle
×
68
            id="preview-mode"
×
69
            checked={mode === 'preview'}
×
70
            title={t('article.editor.preview')}
×
71
            onChange={(e) => setMode(e.target.checked ? 'preview' : 'edit')}
×
72
          />
×
73
          <label htmlFor="preview-mode">{t('article.editor.preview')}</label>
×
74
        </div>
×
75

76
        <div className={styles.writers}>
×
77
          <CollaborativeEditorWriters />
×
78
        </div>
×
79
      </div>
×
80
      <CollaborativeEditorActiveVersion versionId={versionId} />
×
81
    </header>
×
82
  )
83
}
×
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