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

EcrituresNumeriques / stylo / 14472767041

15 Apr 2025 03:02PM UTC coverage: 33.491% (+2.1%) from 31.374%
14472767041

push

github

ggrossetie
fix: surcharge le style de liens externes pour ne pas afficher l'icone par défaut

515 of 777 branches covered (66.28%)

Branch coverage included in aggregate %.

5016 of 15738 relevant lines covered (31.87%)

2.3 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'
×
3
import React, { useState } from 'react'
×
4
import { useTranslation } from 'react-i18next'
×
5

6
import { useArticleWorkingCopy } from '../../hooks/article.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, versionId }) {
×
22
  const { t } = useTranslation()
×
23
  const [opened, setOpened] = useState(false)
×
24
  const [activeMenu, setActiveMenu] = useState('')
×
25
  const { article } = useArticleWorkingCopy({ articleId })
×
26
  const { data, isLoading } = useFetchData(
×
27
    { query: getArticleInfo, variables: { articleId } },
×
28
    {
×
29
      revalidateIfStale: false,
×
30
      revalidateOnFocus: false,
×
31
      revalidateOnReconnect: false,
×
32
    }
×
33
  )
×
34

35
  if (isLoading) {
×
36
    return <Loading />
×
37
  }
×
38

39
  const metadata = article?.workingVersion?.metadata
×
40

41
  return (
×
42
    <div className={styles.menu} role="menu">
×
43
      <Sidebar
×
44
        className={clsx(styles.container, opened && styles.opened)}
×
45
        opened={opened}
×
46
        setOpened={setOpened}
×
47
        labelOpened={t('editorMenu.open.label')}
×
48
        labelClosed={t('editorMenu.close.label')}
×
49
      >
50
        <section>
×
51
          {activeMenu === '' && (
×
52
            <div className={styles.entries}>
×
53
              <a href="#" onClick={() => setActiveMenu('toc')}>
×
54
                {t('toc.title')}
×
55
                <ChevronRight
×
56
                  style={{ strokeWidth: 3 }}
×
57
                  height={32}
×
58
                  width={32}
×
59
                />
×
60
              </a>
×
61
              <a href="#" onClick={() => setActiveMenu('metadata')}>
×
62
                {t('metadata.title')}
×
63
                <ChevronRight
×
64
                  style={{ strokeWidth: 3 }}
×
65
                  height={32}
×
66
                  width={32}
×
67
                />
×
68
              </a>
×
69
              <a href="#" onClick={() => setActiveMenu('bibliography')}>
×
70
                {t('bibliography.title')}
×
71
                <ChevronRight
×
72
                  style={{ strokeWidth: 3 }}
×
73
                  height={32}
×
74
                  width={32}
×
75
                />
×
76
              </a>
×
77

78
              <a onClick={() => setActiveMenu('versions')}>
×
79
                {t('versions.title')}
×
80
                <ChevronRight
×
81
                  style={{ strokeWidth: 3 }}
×
82
                  height={32}
×
83
                  width={32}
×
84
                />
×
85
              </a>
×
86
              <a
×
87
                href="#"
×
88
                onClick={() => setActiveMenu('export')}
×
89
                title="Download a printable version"
×
90
              >
91
                {t('export.title')}
×
92
                <ChevronRight
×
93
                  style={{ strokeWidth: 3 }}
×
94
                  height={32}
×
95
                  width={32}
×
96
                />
×
97
              </a>
×
98
              <a
×
99
                href={`/article/${articleId}/preview`}
×
100
                title="Preview (open a new window)"
×
101
                target="_blank"
×
102
                rel="noopener noreferrer"
×
103
                className={styles.external}
×
104
              >
105
                {t('annotate.title')}
×
106
              </a>
×
107
            </div>
×
108
          )}
109
          <div className={styles.content}>
×
110
            {activeMenu === 'metadata' && (
×
111
              <ArticleMetadata
×
112
                onBack={() => setActiveMenu('')}
×
113
                metadata={metadata}
×
114
                readOnly={true}
×
115
              />
×
116
            )}
117
            {activeMenu === 'toc' && (
×
118
              <ArticleTableOfContents onBack={() => setActiveMenu('')} />
×
119
            )}
120
            {activeMenu === 'bibliography' && (
×
121
              <ArticleBibliography
×
122
                articleId={articleId}
×
123
                onBack={() => setActiveMenu('')}
×
124
              />
×
125
            )}
126
            {activeMenu === 'export' && (
×
127
              <>
×
128
                <h2
×
129
                  className={styles.title}
×
130
                  onClick={() => setActiveMenu('')}
×
131
                  style={{ cursor: 'pointer', userSelect: 'none' }}
×
132
                >
133
                  <span style={{ display: 'flex' }}>
×
134
                    <ArrowLeft style={{ strokeWidth: 3 }} />
×
135
                  </span>
×
136
                  <span>{t('export.title')}</span>
×
137
                </h2>
×
138
                <Export
×
139
                  articleId={articleId}
×
140
                  name={data?.article?.title}
×
141
                  bib={data?.article?.workingVersion?.bibPreview}
×
142
                />
×
143
              </>
×
144
            )}
145
            {activeMenu === 'versions' && (
×
146
              <CollaborativeVersions
×
147
                articleId={articleId}
×
148
                selectedVersion={versionId}
×
149
                showTitle={true}
×
150
                onBack={() => setActiveMenu('')}
×
151
              />
×
152
            )}
153
          </div>
×
154
        </section>
×
155
      </Sidebar>
×
156
    </div>
×
157
  )
158
}
×
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