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

EcrituresNumeriques / stylo / 14111391563

27 Mar 2025 04:09PM UTC coverage: 31.772% (-0.04%) from 31.811%
14111391563

push

github

web-flow
chore: déplace les actions exporter et annoter dans le menu (#1375)

* chore: déplace les actions exporter et annoter dans le menu

* chore: affiche le formulaire d'export dans le menu

470 of 703 branches covered (66.86%)

Branch coverage included in aggregate %.

0 of 84 new or added lines in 4 files covered. (0.0%)

4 existing lines in 3 files now uncovered.

4483 of 14886 relevant lines covered (30.12%)

2.26 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'
×
NEW
2
import { ArrowLeft, ChevronRight, ExternalLink, Printer } from 'lucide-react'
×
3
import React, { useState } from 'react'
×
4
import { useTranslation } from 'react-i18next'
×
NEW
5
import { useHistory } from 'react-router-dom'
×
6
import { useArticleWorkingCopy } from '../../hooks/article.js'
×
NEW
7
import useFetchData from '../../hooks/graphql.js'
×
NEW
8
import { useModal } from '../../hooks/modal.js'
×
9

NEW
10
import { getArticleInfo } from '../Article.graphql'
×
NEW
11
import Export from '../Export.jsx'
×
NEW
12
import Modal from '../Modal.jsx'
×
NEW
13
import Loading from '../molecules/Loading.jsx'
×
14
import Sidebar from '../Sidebar.jsx'
×
15
import ArticleMetadata from '../Write/ArticleMetadata.jsx'
×
16
import ArticleTableOfContents from './ArticleTableOfContents.jsx'
×
17

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

20
export default function CollaborativeEditorMenu({ articleId }) {
×
21
  const { t } = useTranslation()
×
22
  const [opened, setOpened] = useState(false)
×
23
  const [activeMenu, setActiveMenu] = useState('')
×
NEW
24
  const exportModal = useModal()
×
25
  const { article } = useArticleWorkingCopy({ articleId })
×
NEW
26
  const history = useHistory()
×
NEW
27
  const { data, isLoading } = useFetchData(
×
NEW
28
    { query: getArticleInfo, variables: { articleId } },
×
NEW
29
    {
×
NEW
30
      revalidateIfStale: false,
×
NEW
31
      revalidateOnFocus: false,
×
NEW
32
      revalidateOnReconnect: false,
×
NEW
33
    }
×
NEW
34
  )
×
35

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

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

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

NEW
71
              <a
×
NEW
72
                href="#"
×
NEW
73
                onClick={() => setActiveMenu('export')}
×
NEW
74
                title="Download a printable version"
×
75
              >
NEW
76
                {t('export.title')}
×
NEW
77
                <ChevronRight
×
NEW
78
                  style={{ strokeWidth: 3 }}
×
NEW
79
                  height={32}
×
NEW
80
                  width={32}
×
NEW
81
                />
×
NEW
82
              </a>
×
83

NEW
84
              <a
×
NEW
85
                href={`/article/${articleId}/preview`}
×
NEW
86
                title="Preview (open a new window)"
×
NEW
87
                target="_blank"
×
NEW
88
                rel="noopener noreferrer"
×
NEW
89
                className={styles.external}
×
90
              >
NEW
91
                {t('annotate.title')}
×
NEW
92
              </a>
×
NEW
93
            </div>
×
94
          )}
95
          <div className={styles.content}>
×
96
            {activeMenu === 'metadata' && (
×
97
              <ArticleMetadata
×
98
                onBack={() => setActiveMenu('')}
×
99
                metadata={metadata}
×
100
                readOnly={true}
×
101
              />
×
102
            )}
103
            {activeMenu === 'toc' && (
×
104
              <ArticleTableOfContents onBack={() => setActiveMenu('')} />
×
105
            )}
NEW
106
            {activeMenu === 'export' && (
×
NEW
107
              <>
×
NEW
108
                <h2
×
NEW
109
                  className={styles.title}
×
NEW
110
                  onClick={() => setActiveMenu('')}
×
NEW
111
                  style={{ cursor: 'pointer', userSelect: 'none' }}
×
112
                >
NEW
113
                  <span style={{ display: 'flex' }}>
×
NEW
114
                    <ArrowLeft style={{ strokeWidth: 3 }} />
×
NEW
115
                  </span>
×
NEW
116
                  <span>{t('export.title')}</span>
×
NEW
117
                </h2>
×
NEW
118
                <Export
×
NEW
119
                  articleId={articleId}
×
NEW
120
                  name={data?.article?.title}
×
NEW
121
                  bib={data?.article?.workingVersion?.bibPreview}
×
NEW
122
                />
×
NEW
123
              </>
×
124
            )}
125
          </div>
×
126
        </section>
×
127
      </Sidebar>
×
128
    </div>
×
129
  )
130
}
×
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