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

EcrituresNumeriques / stylo / 15274413782

27 May 2025 11:46AM UTC coverage: 37.536% (-0.04%) from 37.572%
15274413782

push

github

web-flow
fix: Affiche les métadonnées de la version sélectionnée (#1535)

549 of 776 branches covered (70.75%)

Branch coverage included in aggregate %.

11 of 47 new or added lines in 3 files covered. (23.4%)

4 existing lines in 2 files now uncovered.

5319 of 14857 relevant lines covered (35.8%)

2.56 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 React, { useCallback } from 'react'
×
2
import clsx from 'clsx'
×
3
import { ArrowLeft, ChevronRight } from 'lucide-react'
×
4
import { useTranslation } from 'react-i18next'
×
5

6
import { usePreferenceItem } from '../../hooks/user.js'
×
7
import useFetchData from '../../hooks/graphql.js'
×
8

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

17
import { getArticleInfo } from '../Article.graphql'
×
18

19
import styles from './CollaborativeEditorMenu.module.scss'
×
20

21
export default function CollaborativeEditorMenu({ articleId, className, versionId }) {
×
22
  const { t } = useTranslation()
×
23
  const { value: opened, toggleValue: setOpened } = usePreferenceItem(
×
24
    'expandSidebarRight',
×
25
    'article'
×
26
  )
×
27
  const { value: activeMenu, setValue: setActiveMenu } = usePreferenceItem(
×
28
    'activePanel',
×
29
    'article'
×
30
  )
×
31

32
  const onBack = useCallback(() => setActiveMenu(null), [])
×
UNCOV
33
  const { data, isLoading } = useFetchData(
×
34
    { query: getArticleInfo, variables: { articleId } },
×
35
    {
×
36
      revalidateIfStale: false,
×
37
      revalidateOnFocus: false,
×
38
      revalidateOnReconnect: false,
×
39
    }
×
40
  )
×
41

42
  if (isLoading) {
×
43
    return <Loading />
×
44
  }
×
45

46
  return (
×
UNCOV
47
    <Sidebar
×
48
      className={clsx(className, opened && styles.opened)}
×
49
      opened={opened}
×
50
      setOpened={setOpened}
×
51
      labelOpened={t('editorMenu.open.label')}
×
52
      labelClosed={t('editorMenu.close.label')}
×
53
    >
54
      {!activeMenu && (
×
55
        <ul
×
56
          className={styles.entries}
×
57
          role="menubar"
×
58
          aria-orientation="vertical"
×
59
        >
60
          <li role="menuitem">
×
61
            <button onClick={() => setActiveMenu('toc')}>
×
62
              {t('toc.title')}
×
63
              <ChevronRight
×
64
                style={{ strokeWidth: 3 }}
×
65
                height={32}
×
66
                width={32}
×
67
                aria-hidden
×
68
              />
×
69
            </button>
×
70
          </li>
×
71

72
          <li role="menuitem">
×
73
            <button onClick={() => setActiveMenu('metadata')}>
×
74
              {t('metadata.title')}
×
75
              <ChevronRight
×
76
                style={{ strokeWidth: 3 }}
×
77
                height={32}
×
78
                width={32}
×
79
                aria-hidden
×
80
              />
×
81
            </button>
×
82
          </li>
×
83

84
          <li role="menuitem">
×
85
            <button onClick={() => setActiveMenu('bibliography')}>
×
86
              {t('bibliography.title')}
×
87
              <ChevronRight
×
88
                style={{ strokeWidth: 3 }}
×
89
                height={32}
×
90
                width={32}
×
91
                aria-hidden
×
92
              />
×
93
            </button>
×
94
          </li>
×
95

96
          <li role="menuitem">
×
97
            <button onClick={() => setActiveMenu('versions')}>
×
98
              {t('versions.title')}
×
99
              <ChevronRight
×
100
                style={{ strokeWidth: 3 }}
×
101
                height={32}
×
102
                width={32}
×
103
                aria-hidden
×
104
              />
×
105
            </button>
×
106
          </li>
×
107
          <li role="menuitem">
×
108
            <button
×
109
              onClick={() => setActiveMenu('export')}
×
110
              title="Download a printable version"
×
111
            >
112
              {t('export.title')}
×
113
              <ChevronRight
×
114
                style={{ strokeWidth: 3 }}
×
115
                height={32}
×
116
                width={32}
×
117
                aria-hidden
×
118
              />
×
119
            </button>
×
120
          </li>
×
121
          <li role="menuitem">
×
122
            <a
×
123
              href={`/article/${articleId}/annotate`}
×
124
              title="Preview (open a new window)"
×
125
              target="_blank"
×
126
              rel="noopener noreferrer"
×
127
              className={styles.external}
×
128
            >
129
              {t('annotate.title')}
×
130
            </a>
×
131
          </li>
×
132
        </ul>
×
133
      )}
134

135
      <div className={styles.content}>
×
136
        {activeMenu === 'metadata' && (
×
137
          <ArticleMetadata
×
138
            onBack={onBack}
×
NEW
139
            articleId={articleId}
×
NEW
140
            versionId={versionId}
×
UNCOV
141
          />
×
142
        )}
143
        {activeMenu === 'toc' && <ArticleTableOfContents onBack={onBack} />}
×
144
        {activeMenu === 'bibliography' && (
×
145
          <ArticleBibliography articleId={articleId} onBack={onBack} />
×
146
        )}
147
        {activeMenu === 'export' && (
×
148
          <>
×
149
            <h2
×
150
              className={styles.title}
×
151
              onClick={onBack}
×
152
              style={{ cursor: 'pointer', userSelect: 'none' }}
×
153
            >
154
              <span style={{ display: 'flex' }}>
×
155
                <ArrowLeft style={{ strokeWidth: 3 }} />
×
156
              </span>
×
157
              <span>{t('export.title')}</span>
×
158
            </h2>
×
159
            <Export
×
160
              articleId={articleId}
×
161
              name={data?.article?.title}
×
162
              bib={data?.article?.workingVersion?.bibPreview}
×
163
            />
×
164
          </>
×
165
        )}
166
        {activeMenu === 'versions' && (
×
167
          <CollaborativeVersions
×
168
            articleId={articleId}
×
169
            selectedVersion={versionId}
×
170
            showTitle={true}
×
171
            onBack={onBack}
×
172
          />
×
173
        )}
174
      </div>
×
175
    </Sidebar>
×
176
  )
177
}
×
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