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

EcrituresNumeriques / stylo / 13987938500

21 Mar 2025 08:48AM UTC coverage: 31.659% (+0.6%) from 31.087%
13987938500

push

github

web-flow
chore: remplace les modales Geist (#1358)

Remplace aussi <Loading> par notre composant.

464 of 686 branches covered (67.64%)

Branch coverage included in aggregate %.

42 of 569 new or added lines in 36 files covered. (7.38%)

27 existing lines in 18 files now uncovered.

4396 of 14665 relevant lines covered (29.98%)

2.26 hits per line

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

0.0
/front/src/components/collaborative/CollaborativeEditorArticleHeader.jsx
NEW
1
import { Link as GeistLink, Popover } from '@geist-ui/core'
×
UNCOV
2
import clsx from 'clsx'
×
3
import React, { useCallback } from 'react'
×
4
import { AlignLeft, Eye, Printer } from 'react-feather'
×
5
import { useDispatch, useSelector } from 'react-redux'
×
NEW
6
import { Link } from 'react-router-dom'
×
7

8
import useFetchData from '../../hooks/graphql.js'
×
NEW
9
import { useModal } from '../../hooks/modal.js'
×
10

11
import { getArticleInfo } from '../Article.graphql'
×
12

13
import Button from '../Button.jsx'
×
14

15
import buttonStyles from '../button.module.scss'
×
16
import Export from '../Export.jsx'
×
NEW
17
import Modal from '../Modal.jsx'
×
NEW
18
import Loading from '../molecules/Loading.jsx'
×
UNCOV
19
import styles from './CollaborativeEditorArticleHeader.module.scss'
×
20

21
/**
22
 * @param props
23
 * @param {string} props.articleId
24
 * @return {Element}
25
 */
26
export default function CollaborativeEditorArticleHeader({ articleId }) {
×
27
  const dispatch = useDispatch()
×
28
  const articleStructure = useSelector((state) => state.articleStructure)
×
29
  const { data, isLoading } = useFetchData(
×
30
    { query: getArticleInfo, variables: { articleId } },
×
31
    {
×
32
      revalidateIfStale: false,
×
33
      revalidateOnFocus: false,
×
34
      revalidateOnReconnect: false,
×
35
    }
×
36
  )
×
NEW
37
  const exportModal = useModal()
×
38

39
  const handleTableOfContentsEntryClicked = useCallback(({ target }) => {
×
40
    dispatch({
×
41
      type: 'UPDATE_EDITOR_CURSOR_POSITION',
×
42
      lineNumber: parseInt(target.dataset.index, 10),
×
43
      column: 0,
×
44
    })
×
45
  }, [])
×
46

47
  if (isLoading) {
×
48
    return <Loading />
×
49
  }
×
50

51
  const content = () => {
×
52
    if (articleStructure.length === 0) {
×
53
      return <></>
×
54
    }
×
55
    return (
×
56
      <>
×
57
        <Popover.Item title>
×
58
          <span>Table Of Contents</span>
×
59
        </Popover.Item>
×
60
        {articleStructure.map((item) => (
×
61
          <Popover.Item key={`line-${item.index}-${item.line}`} tabIndex={0}>
×
62
            <GeistLink
×
63
              href="#"
×
64
              data-index={item.index}
×
65
              onClick={handleTableOfContentsEntryClicked}
×
66
            >
67
              {item.title}
×
68
            </GeistLink>
×
69
          </Popover.Item>
×
70
        ))}
×
71
      </>
×
72
    )
73
  }
×
74

75
  return (
×
76
    <header className={styles.header}>
×
77
      <h1 className={styles.title}>
×
78
        <Popover
×
79
          className={clsx(
×
80
            styles.tocTooltip,
×
81
            articleStructure.length === 0 && styles.empty
×
82
          )}
×
83
          placement="bottomStart"
×
84
          content={content}
×
85
          hideArrow={articleStructure.length === 0}
×
86
        >
87
          <AlignLeft />
×
88
        </Popover>
×
89
        {data?.article?.title}
×
90
      </h1>
×
91

NEW
92
      <div>
×
93
        <Button
×
94
          icon
×
95
          title="Download a printable version"
×
NEW
96
          onClick={() => exportModal.show()}
×
97
        >
98
          <Printer />
×
99
        </Button>
×
100
        <Link
×
101
          to={`/article/${articleId}/preview`}
×
102
          title="Preview (open a new window)"
×
103
          target="_blank"
×
104
          rel="noopener noreferrer"
×
105
          className={buttonStyles.icon}
×
106
        >
107
          <Eye />
×
108
        </Link>
×
109
      </div>
×
110

NEW
111
      <Modal
×
NEW
112
        {...exportModal.bindings}
×
NEW
113
        title={
×
NEW
114
          <>
×
NEW
115
            <Printer /> Export
×
NEW
116
          </>
×
117
        }
118
      >
NEW
119
        <Export
×
NEW
120
          articleId={articleId}
×
NEW
121
          name={data?.article?.title}
×
NEW
122
          bib={data?.article?.workingVersion?.bibPreview}
×
NEW
123
          onCancel={() => exportModal.close()}
×
NEW
124
        />
×
NEW
125
      </Modal>
×
UNCOV
126
    </header>
×
127
  )
128
}
×
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