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

EcrituresNumeriques / stylo / 16138063255

08 Jul 2025 08:28AM UTC coverage: 39.419% (-0.09%) from 39.506%
16138063255

push

github

web-flow
feat: Ajout d'événements Matomo sur la navigation dans le menu d'un article (#1655)

571 of 803 branches covered (71.11%)

Branch coverage included in aggregate %.

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

1 existing line in 1 file now uncovered.

5703 of 15113 relevant lines covered (37.74%)

2.58 hits per line

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

0.0
/front/src/components/collaborative/CollaborativeEditorMenu.jsx
1
import clsx from 'clsx'
×
2
import { ArrowLeft, ChevronRight } from 'lucide-react'
×
NEW
3
import React, { useCallback } from 'react'
×
UNCOV
4
import { useTranslation } from 'react-i18next'
×
NEW
5
import { useRouteLoaderData } from 'react-router'
×
6

NEW
7
import { trackEvent } from '../../helpers/analytics.js'
×
8
import useFetchData from '../../hooks/graphql.js'
×
NEW
9
import { usePreferenceItem } from '../../hooks/user.js'
×
10

11
import Export from '../Export.jsx'
×
12
import Sidebar from '../Sidebar.jsx'
×
13
import ArticleMetadata from '../Write/ArticleMetadata.jsx'
×
NEW
14
import ArticleBibliography from '../bibliography/ArticleBibliography.jsx'
×
NEW
15
import Loading from '../molecules/Loading.jsx'
×
16
import ArticleTableOfContents from './ArticleTableOfContents.jsx'
×
17
import CollaborativeVersions from './CollaborativeVersions.jsx'
×
18

19
import { getArticleInfo } from '../Article.graphql'
×
20

21
import styles from './CollaborativeEditorMenu.module.scss'
×
22

NEW
23
export default function CollaborativeEditorMenu({
×
NEW
24
  articleId,
×
NEW
25
  className,
×
NEW
26
  versionId,
×
NEW
27
}) {
×
NEW
28
  const { user } = useRouteLoaderData('app')
×
29
  const { t } = useTranslation()
×
30
  const { value: opened, toggleValue: setOpened } = usePreferenceItem(
×
31
    'expandSidebarRight',
×
32
    'article'
×
33
  )
×
34
  const { value: activeMenu, setValue: setActiveMenu } = usePreferenceItem(
×
35
    'activePanel',
×
36
    'article'
×
37
  )
×
38

39
  const { data, isLoading } = useFetchData(
×
40
    { query: getArticleInfo, variables: { articleId } },
×
41
    {
×
42
      revalidateIfStale: false,
×
43
      revalidateOnFocus: false,
×
44
      revalidateOnReconnect: false,
×
45
    }
×
46
  )
×
47

NEW
48
  const handleNavigateBack = useCallback(() => {
×
NEW
49
    trackEvent('ArticleMenuNavigation', 'back', '', '', {
×
NEW
50
      articleId,
×
NEW
51
      userId: user._id,
×
NEW
52
    })
×
NEW
53
    setActiveMenu(null)
×
NEW
54
  }, [setActiveMenu])
×
55

NEW
56
  const handleNavigateTo = useCallback(
×
NEW
57
    (name) => {
×
NEW
58
      trackEvent('ArticleMenuNavigation', 'goto', name, '', {
×
NEW
59
        articleId,
×
NEW
60
        userId: user._id,
×
NEW
61
      })
×
NEW
62
      setActiveMenu(name)
×
NEW
63
    },
×
NEW
64
    [setActiveMenu]
×
NEW
65
  )
×
66

67
  if (isLoading) {
×
68
    return <Loading />
×
69
  }
×
70

71
  return (
×
72
    <Sidebar
×
73
      className={clsx(className, opened && styles.opened)}
×
74
      opened={opened}
×
75
      setOpened={setOpened}
×
76
      labelOpened={t('editorMenu.open.label')}
×
77
      labelClosed={t('editorMenu.close.label')}
×
78
    >
79
      {!activeMenu && (
×
80
        <ul
×
81
          className={styles.entries}
×
82
          role="menubar"
×
83
          aria-orientation="vertical"
×
84
        >
85
          <li role="menuitem">
×
NEW
86
            <button onClick={() => handleNavigateTo('toc')}>
×
87
              {t('toc.title')}
×
88
              <ChevronRight
×
89
                style={{ strokeWidth: 3 }}
×
90
                height={32}
×
91
                width={32}
×
92
                aria-hidden
×
93
              />
×
94
            </button>
×
95
          </li>
×
96

97
          <li role="menuitem">
×
NEW
98
            <button onClick={() => handleNavigateTo('metadata')}>
×
99
              {t('metadata.title')}
×
100
              <ChevronRight
×
101
                style={{ strokeWidth: 3 }}
×
102
                height={32}
×
103
                width={32}
×
104
                aria-hidden
×
105
              />
×
106
            </button>
×
107
          </li>
×
108

109
          <li role="menuitem">
×
NEW
110
            <button onClick={() => handleNavigateTo('bibliography')}>
×
111
              {t('bibliography.title')}
×
112
              <ChevronRight
×
113
                style={{ strokeWidth: 3 }}
×
114
                height={32}
×
115
                width={32}
×
116
                aria-hidden
×
117
              />
×
118
            </button>
×
119
          </li>
×
120

121
          <li role="menuitem">
×
NEW
122
            <button onClick={() => handleNavigateTo('versions')}>
×
123
              {t('versions.title')}
×
124
              <ChevronRight
×
125
                style={{ strokeWidth: 3 }}
×
126
                height={32}
×
127
                width={32}
×
128
                aria-hidden
×
129
              />
×
130
            </button>
×
131
          </li>
×
132
          <li role="menuitem">
×
133
            <button
×
NEW
134
              onClick={() => handleNavigateTo('export')}
×
135
              title={t('write.title.buttonExport')}
×
136
            >
137
              {t('export.title')}
×
138
              <ChevronRight
×
139
                style={{ strokeWidth: 3 }}
×
140
                height={32}
×
141
                width={32}
×
142
                aria-hidden
×
143
              />
×
144
            </button>
×
145
          </li>
×
146
          <li role="menuitem">
×
147
            <a
×
148
              href={`/article/${articleId}/annotate`}
×
149
              title={t('article.annotate.button')}
×
150
              target="_blank"
×
151
              rel="noopener noreferrer"
×
152
              className={styles.external}
×
153
            >
154
              {t('annotate.title')}
×
155
            </a>
×
156
          </li>
×
157
        </ul>
×
158
      )}
159

160
      <div className={styles.content}>
×
161
        {activeMenu === 'metadata' && (
×
162
          <ArticleMetadata
×
NEW
163
            onBack={handleNavigateBack}
×
164
            articleId={articleId}
×
165
            versionId={versionId}
×
166
          />
×
167
        )}
NEW
168
        {activeMenu === 'toc' && (
×
NEW
169
          <ArticleTableOfContents onBack={handleNavigateBack} />
×
170
        )}
171
        {activeMenu === 'bibliography' && (
×
NEW
172
          <ArticleBibliography
×
NEW
173
            articleId={articleId}
×
NEW
174
            onBack={handleNavigateBack}
×
NEW
175
          />
×
176
        )}
177
        {activeMenu === 'export' && (
×
178
          <>
×
179
            <h2
×
180
              className={styles.title}
×
NEW
181
              onClick={handleNavigateBack}
×
182
              style={{ cursor: 'pointer', userSelect: 'none' }}
×
183
            >
184
              <span style={{ display: 'flex' }}>
×
185
                <ArrowLeft style={{ strokeWidth: 3 }} />
×
186
              </span>
×
187
              <span>{t('export.title')}</span>
×
188
            </h2>
×
189
            <Export
×
190
              articleId={articleId}
×
191
              name={data?.article?.title}
×
192
              bib={data?.article?.workingVersion?.bibPreview}
×
193
            />
×
194
          </>
×
195
        )}
196
        {activeMenu === 'versions' && (
×
197
          <CollaborativeVersions
×
198
            articleId={articleId}
×
199
            selectedVersion={versionId}
×
200
            showTitle={true}
×
NEW
201
            onBack={handleNavigateBack}
×
202
          />
×
203
        )}
204
      </div>
×
205
    </Sidebar>
×
206
  )
207
}
×
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