• 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/ArticleVersionLinks.jsx
1
import clsx from 'clsx'
×
2
import React, { useMemo } from 'react'
×
3
import { useTranslation } from 'react-i18next'
×
NEW
4
import { Link } from 'react-router'
×
5
import useFetchData from '../hooks/graphql.js'
×
6
import styles from './articleVersionLinks.module.scss'
×
7

8
import { getArticleVersions } from './Article.graphql'
×
9
import Loading from './molecules/Loading.jsx'
×
10
import TimeAgo from './TimeAgo.jsx'
×
11

12
export default function ArticleVersionLinks({ articleId, article }) {
×
13
  const { t } = useTranslation()
×
14
  const { data, isLoading } = useFetchData(
×
15
    {
×
16
      query: getArticleVersions,
×
17
      variables: { articleId },
×
18
    },
×
19
    {
×
20
      fallbackData: {
×
21
        article,
×
22
      },
×
23
      revalidateOnFocus: false,
×
24
      revalidateOnReconnect: false,
×
25
    }
×
26
  )
×
27
  const getVersions = () =>
×
28
    (data?.article?.versions || []).map((v) => {
×
29
      let title
×
30
      if (v.type === 'editingSessionEnded') {
×
31
        title = t('versions.editingSessionEnded.text')
×
32
      } else if (v.type === 'collaborativeSessionEnded') {
×
33
        title = t('versions.collaborativeSessionEnded.text')
×
34
      } else {
×
35
        title = `v${v.version}.${v.revision} ${v.message}`
×
36
      }
×
37
      return {
×
38
        ...v,
×
39
        type: v.type || 'userAction',
×
40
        title,
×
41
      }
×
42
    })
×
43
  const versions = useMemo(getVersions, [data])
×
44

45
  if (isLoading) {
×
46
    return <Loading />
×
47
  }
×
48

49
  return (
×
50
    <>
×
51
      {versions && versions.length > 0 && (
×
52
        <>
×
53
          <h4>{t('article.versions.title')}</h4>
×
54
          <ul className={styles.versions}>
×
55
            {versions.map((v) => (
×
56
              <li
×
57
                key={`version-${v._id}`}
×
58
                className={clsx(
×
59
                  v.type === 'userAction'
×
60
                    ? styles.userVersion
×
61
                    : styles.automaticVersion
×
62
                )}
×
63
              >
64
                <Link to={`/article/${article._id}/version/${v._id}`}>
×
65
                  <span>{v.title}</span> <TimeAgo date={v.createdAt} />
×
66
                </Link>
×
67
              </li>
×
68
            ))}
×
69
          </ul>
×
70
        </>
×
71
      )}
72
    </>
×
73
  )
74
}
×
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