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

EcrituresNumeriques / stylo / 15066626824

16 May 2025 10:41AM UTC coverage: 37.574% (-0.02%) from 37.594%
15066626824

Pull #1517

github

web-flow
Merge e05a1c169 into 607ffe7f9
Pull Request #1517: Mise à jour vers react-router@7

549 of 776 branches covered (70.75%)

Branch coverage included in aggregate %.

13 of 373 new or added lines in 28 files covered. (3.49%)

5 existing lines in 4 files now uncovered.

5319 of 14841 relevant lines covered (35.84%)

2.56 hits per line

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

0.0
/front/src/components/workspace/WorkspaceMenuItem.jsx
1
import React from 'react'
×
2
import { useDispatch } from 'react-redux'
×
3
import { ChevronRight } from 'lucide-react'
×
4
import clsx from 'clsx'
×
5
import PropTypes from 'prop-types'
×
NEW
6
import { useLocation, useNavigate } from 'react-router'
×
7

8
import { useActiveWorkspaceId } from '../../hooks/workspace.js'
×
9

10
import styles from './WorkspaceMenuItem.module.scss'
×
11

12
export default function WorkspaceMenuItem({ color, name, id }) {
×
13
  const dispatch = useDispatch()
×
NEW
14
  const navigate = useNavigate()
×
15
  const location = useLocation()
×
16
  const activeWorkspaceId = useActiveWorkspaceId()
×
17

18
  const setActiveWorkspace = (workspaceId) => {
×
19
    const path = location.pathname
×
20
    if (path.endsWith('/corpus')) {
×
21
      if (id) {
×
NEW
22
        navigate(`/workspaces/${id}/corpus`)
×
23
      } else {
×
NEW
24
        navigate(`/corpus`)
×
25
      }
×
26
    } else {
×
27
      if (id) {
×
NEW
28
        navigate(`/workspaces/${id}/articles`)
×
29
      } else {
×
NEW
30
        navigate(`/articles`)
×
31
      }
×
32
    }
×
33
    dispatch({ type: 'SET_ACTIVE_WORKSPACE', workspaceId })
×
34
  }
×
35

36

37
  return (
×
38
    <>
×
39
      <li
×
40
        onClick={() => setActiveWorkspace(id)}
×
41
        className={
×
42
          activeWorkspaceId === id
×
43
            ? clsx(styles.item, styles.selected)
×
44
            : styles.item
×
45
        }
46
      >
47
        <span className={styles.chip} style={{ backgroundColor: color }} />
×
48
        <span className={styles.name}>{name}</span>
×
49
        <ChevronRight className={styles.chevron} />
×
50
      </li>
×
51
    </>
×
52
  )
53
}
×
54

55
WorkspaceMenuItem.propTypes = {
×
56
  name: PropTypes.string.isRequired,
×
57
  color: PropTypes.string.isRequired,
×
58
  id: PropTypes.string,
×
59
}
×
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

© 2025 Coveralls, Inc