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

EcrituresNumeriques / stylo / 13673346615

05 Mar 2025 10:02AM UTC coverage: 28.524% (+0.03%) from 28.496%
13673346615

push

github

web-flow
fix(write): évite le re-rendering dû à la biblio (#1313)

Co-authored-by: Thomas Parisot <thom4parisot@users.noreply.github.com>

402 of 602 branches covered (66.78%)

Branch coverage included in aggregate %.

0 of 32 new or added lines in 2 files covered. (0.0%)

56 existing lines in 5 files now uncovered.

3914 of 14529 relevant lines covered (26.94%)

1.92 hits per line

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

0.0
/front/src/components/Write/Reference.jsx
NEW
1
import React, { memo, useCallback } from 'react'
×
NEW
2
import copy from 'copy-to-clipboard'
×
UNCOV
3
import { useTranslation } from 'react-i18next'
×
NEW
4
import { useToasts } from '@geist-ui/core'
×
5

6
import { Clipboard } from 'react-feather'
×
7
import styles from './reference.module.scss'
×
8
import ReferenceTypeIcon from '../ReferenceTypeIcon'
×
9
import Button from '../Button'
×
10

NEW
11
const CopyButton = memo(function ReferenceCopyButton({ text }) {
×
12
  const { t } = useTranslation()
×
NEW
13
  const { setToast } = useToasts()
×
14

NEW
15
  const handleCopy = useCallback(() => {
×
NEW
16
    copy(text)
×
NEW
17
    setToast({
×
NEW
18
      type: 'default',
×
NEW
19
      text: t('write.copyReferenceToClipboard.successToast', { text }),
×
NEW
20
    })
×
NEW
21
  })
×
22

NEW
23
  return (
×
NEW
24
    <Button
×
NEW
25
      title={t('write.copyReferenceToClipboard.Button', { text })}
×
NEW
26
      className={styles.copyToClipboard}
×
NEW
27
      onClick={handleCopy}
×
NEW
28
      icon
×
29
    >
NEW
30
      <Clipboard />
×
NEW
31
    </Button>
×
32
  )
NEW
33
})
×
34

NEW
35
export default function BibliographyReference({ entry }) {
×
NEW
36
  const { key, title, type, date, authorName } = entry
×
NEW
37
  const text = `[@${key}]`
×
38

39
  return (
×
40
    <div className={styles.reference}>
×
41
      <ReferenceTypeIcon type={type} className={styles.referenceTypeIcon} />
×
42

43
      <div className={styles.referenceInfo}>
×
44
        <p
×
45
          className={styles.referencePrimaryInfo}
×
46
          title={authorName + ' | ' + title}
×
47
        >
48
          {authorName && (
×
49
            <span className={styles.referenceAuthor}>{authorName}</span>
×
50
          )}
51
          <span className={styles.referenceTitle} title={title}>
×
52
            {title}
×
53
          </span>
×
54
          <span className={styles.referenceDate}>{date}</span>
×
55
        </p>
×
56
        <p className={styles.referenceSecondaryInfo}>
×
57
          <span className={styles.referenceKey} title={'@' + key}>
×
58
            @{key}
×
59
          </span>
×
60
        </p>
×
61
      </div>
×
62

NEW
63
      <CopyButton text={text} />
×
UNCOV
64
    </div>
×
65
  )
NEW
66
}
×
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