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

EcrituresNumeriques / stylo / 14886870075

07 May 2025 03:10PM UTC coverage: 37.615% (+0.03%) from 37.581%
14886870075

push

github

web-flow
Honore l'identifiant de workspace lors de l'initialisation de l'application (#1487)

Co-authored-by: Thomas Parisot <thom4parisot@users.noreply.github.com>

532 of 759 branches covered (70.09%)

Branch coverage included in aggregate %.

2 of 34 new or added lines in 10 files covered. (5.88%)

2 existing lines in 1 file now uncovered.

5240 of 14586 relevant lines covered (35.92%)

2.51 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'
×
NEW
2
import { useDispatch } from 'react-redux'
×
3
import { ChevronRight } from 'lucide-react'
×
4
import clsx from 'clsx'
×
5
import PropTypes from 'prop-types'
×
6
import { useLocation, useHistory } from 'react-router-dom'
×
7

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

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

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

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

36

UNCOV
37
  return (
×
38
    <>
×
39
      <li
×
40
        onClick={() => setActiveWorkspace(id)}
×
41
        className={
×
NEW
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

© 2026 Coveralls, Inc