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

EcrituresNumeriques / stylo / 12925854411

23 Jan 2025 09:11AM UTC coverage: 25.831% (-4.7%) from 30.523%
12925854411

push

github

web-flow
Merge pull request #1192 from EcrituresNumeriques/feat/vite6

322 of 518 branches covered (62.16%)

Branch coverage included in aggregate %.

3448 of 14077 relevant lines covered (24.49%)

1.66 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, useSelector } from 'react-redux'
×
3
import { ChevronRight } from 'react-feather'
×
4
import clsx from 'clsx'
×
5
import PropTypes from 'prop-types'
×
6
import { useLocation, useHistory } from 'react-router-dom'
×
7

8
import styles from './WorkspaceMenuItem.module.scss'
×
9

10
export default function WorkspaceMenuItem({ color, name, id }) {
×
11
  const dispatch = useDispatch()
×
12
  const history = useHistory()
×
13
  const location = useLocation()
×
14
  const setActiveWorkspace = (workspaceId) => {
×
15
    const path = location.pathname
×
16
    if (path.endsWith('/books')) {
×
17
      if (id) {
×
18
        history.push(`/workspaces/${id}/books`)
×
19
      } else {
×
20
        history.push(`/books`)
×
21
      }
×
22
    } else {
×
23
      if (id) {
×
24
        history.push(`/workspaces/${id}/articles`)
×
25
      } else {
×
26
        history.push(`/articles`)
×
27
      }
×
28
    }
×
29
    dispatch({ type: 'SET_ACTIVE_WORKSPACE', workspaceId })
×
30
  }
×
31

32
  const activeUser = useSelector((state) => state.activeUser)
×
33

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

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