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

EcrituresNumeriques / stylo / 15066626824

16 May 2025 10:41AM UTC coverage: 37.574% (-0.02%) from 37.594%
15066626824

Pull #1517

github

web-flow
Merge e05a1c169 into 607ffe7f9
Pull Request #1517: Mise à jour vers react-router@7

549 of 776 branches covered (70.75%)

Branch coverage included in aggregate %.

13 of 373 new or added lines in 28 files covered. (3.49%)

5 existing lines in 4 files now uncovered.

5319 of 14841 relevant lines covered (35.84%)

2.56 hits per line

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

0.0
/front/src/components/corpus/CorpusArticles.jsx
1
import React, { useCallback, useMemo } from 'react'
×
2
import { DndProvider } from 'react-dnd'
×
3
import { HTML5Backend } from 'react-dnd-html5-backend'
×
4
import { Trans, useTranslation } from 'react-i18next'
×
NEW
5
import { Link } from 'react-router'
×
6
import useFetchData from '../../hooks/graphql.js'
×
7
import { useActiveWorkspaceId } from '../../hooks/workspace.js'
×
8
import Alert from '../molecules/Alert.jsx'
×
9
import Loading from '../molecules/Loading.jsx'
×
10
import CorpusArticleItems from './CorpusArticleItems.jsx'
×
11

12
import styles from './corpusItem.module.scss'
×
13

14
import { getCorpus } from './Corpus.graphql'
×
15

16
export default function CorpusArticles({ corpusId }) {
×
17
  const { t } = useTranslation()
×
18
  const activeWorkspaceId = useActiveWorkspaceId()
×
19
  const { data, isLoading, mutate } = useFetchData(
×
20
    {
×
21
      query: getCorpus,
×
22
      variables: { filter: { corpusId: corpusId }, includeArticles: true },
×
23
    },
×
24
    {
×
25
      revalidateOnFocus: false,
×
26
      revalidateOnReconnect: false,
×
27
    }
×
28
  )
×
29
  const corpusArticles = useMemo(
×
30
    () => data?.corpus?.[0]?.articles || [],
×
31
    [data]
×
32
  )
×
33

34
  const handleUpdate = useCallback(() => {
×
35
    mutate()
×
36
  }, [mutate])
×
37

38
  return (
×
39
    <>
×
40
      <h5 className={styles.partsTitle}>{t('corpus.parts.label')}</h5>
×
41
      {isLoading && <Loading />}
×
42
      {!isLoading && corpusArticles.length > 0 && (
×
43
        <ul>
×
44
          <DndProvider backend={HTML5Backend}>
×
45
            <CorpusArticleItems
×
46
              corpusId={corpusId}
×
47
              articles={corpusArticles}
×
48
              onUpdate={handleUpdate}
×
49
            />
×
50
          </DndProvider>
×
51
        </ul>
×
52
      )}
53
      {!isLoading && corpusArticles.length === 0 && (
×
54
        <Alert
×
55
          className={styles.message}
×
56
          type={'info'}
×
57
          message={
×
58
            <Trans i18nKey="corpus.addPart.note">
×
59
              To add a new chapter, go to the
60
              <Link
×
61
                to={
×
62
                  activeWorkspaceId
×
63
                    ? `/workspaces/${activeWorkspaceId}/articles`
×
64
                    : '/articles'
×
65
                }
66
              >
×
67
                articles page
68
              </Link>
×
69
              and select this corpus.
70
            </Trans>
×
71
          }
72
        />
×
73
      )}
74
    </>
×
75
  )
76
}
×
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

© 2025 Coveralls, Inc