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

EcrituresNumeriques / stylo / 13547287365

26 Feb 2025 03:20PM UTC coverage: 12.024% (+0.3%) from 11.684%
13547287365

push

github

web-flow
Merge pull request #1255 from ggrossetie/fix-1171-hooks-renaming

157 of 305 branches covered (51.48%)

Branch coverage included in aggregate %.

67 of 264 new or added lines in 25 files covered. (25.38%)

10 existing lines in 4 files now uncovered.

1144 of 10515 relevant lines covered (10.88%)

1.83 hits per line

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

0.0
/front/src/components/workspace/WorkspaceItem.jsx
NEW
1
import React from 'react'
×
2
import { Slash, Users } from 'react-feather'
×
3
import { Button, useModal } from '@geist-ui/core'
×
4
import { useTranslation } from 'react-i18next'
×
5
import TimeAgo from '../TimeAgo.jsx'
×
6
import LeaveWorkspaceModal from './LeaveWorkspaceModal.jsx'
×
7

8
import styles from './workspaceItem.module.scss'
×
9
import WorkspaceManageMembersModal from './WorkspaceManageMembersModal.jsx'
×
10
import Field from '../Field.jsx'
×
11

12
/**
13
 * @typedef {Object} WorkspaceItemProps
14
 * @property {{
15
 *   color: string,
16
 *   name: string,
17
 *   description: string,
18
 *   personal: boolean,
19
 *   articlesCount: number,
20
 *   creator: {
21
 *     displayName: string,
22
 *     username: string
23
 *   },
24
 *   createdAt: string,
25
 *   updatedAt: string
26
 * }} workspace
27
 */
28

29
/**
30
 * @param {WorkspaceItemProps} props
31
 * @returns {React.ReactHTMLElement}
32
 */
33
export default function WorkspaceItem({ workspace }) {
×
34
  const { t } = useTranslation()
×
35
  const workspaceLeaveModal = useModal()
×
36
  const workspaceManageMembersModal = useModal()
×
37

38
  const workspaceTitle = (
×
39
    <>
×
40
      <h5 className={styles.title}>
×
41
        <span
×
42
          className={styles.chip}
×
43
          style={{ backgroundColor: workspace.color }}
×
44
        ></span>
×
45
        <span className={styles.name}>{workspace.name}</span>
×
46
      </h5>
×
47
    </>
×
48
  )
49

50
  return (
×
51
    <div className={styles.container}>
×
52
      {workspaceTitle}
×
53
      {workspace.personal && (
×
54
        <>
×
55
          <Field className={styles.field} label="Articles">
×
56
            <span>{workspace.articlesCount}</span>
×
57
          </Field>
×
58
        </>
×
59
      )}
60
      {!workspace.personal && (
×
61
        <>
×
62
          <div>
×
63
            {workspace.description && (
×
64
              <Field
×
65
                className={styles.field}
×
66
                label={t('workspace.description.label')}
×
67
              >
68
                <span>{workspace.description}</span>
×
69
              </Field>
×
70
            )}
71
            <Field
×
72
              className={styles.field}
×
73
              label={t('workspace.createdAt.label')}
×
74
            >
75
              <>
×
76
                <TimeAgo date={workspace.createdAt} />
×
77
                {workspace.creator && (
×
78
                  <>
×
79
                    {' '}
×
80
                    <span>{t('workspace.createdBy.label')}</span>{' '}
×
81
                    <span className={styles.creator}>
×
82
                      {workspace.creator.displayName ||
×
83
                        workspace.creator.username}
×
84
                    </span>
×
85
                  </>
×
86
                )}
87
              </>
×
88
            </Field>
×
89
            <Field
×
90
              className={styles.field}
×
91
              label={t('workspace.updatedAt.label')}
×
92
            >
93
              <TimeAgo date={workspace.updatedAt} />
×
94
            </Field>
×
95
            <Field
×
96
              className={styles.field}
×
97
              label={t('workspace.membersCount.label')}
×
98
            >
99
              <span>{workspace.stats.membersCount}</span>
×
100
            </Field>
×
101
            <Field
×
102
              className={styles.field}
×
103
              label={t('workspace.articlesCount.label')}
×
104
            >
105
              <span>{workspace.stats.articlesCount}</span>
×
106
            </Field>
×
107
          </div>
×
108
          <aside className={styles.actionButtons}>
×
109
            <Button
×
110
              className={styles.button}
×
111
              auto
×
112
              scale={0.8}
×
113
              icon={<Users />}
×
114
              title={t('workspace.manageMember.title')}
×
115
              onClick={() => workspaceManageMembersModal.setVisible(true)}
×
116
            >
117
              {t('workspace.manageMember.button')}
×
118
            </Button>
×
119
            <Button
×
120
              type="error-light"
×
121
              className={styles.button}
×
122
              ghost
×
123
              auto
×
124
              scale={0.5}
×
125
              icon={<Slash />}
×
126
              title={t('workspace.leave.title')}
×
127
              onClick={() => workspaceLeaveModal.setVisible(true)}
×
128
            >
129
              {t('workspace.leave.button')}
×
130
            </Button>
×
131
          </aside>
×
132

133
          <LeaveWorkspaceModal {...workspaceLeaveModal} workspace={workspace} />
×
134

135
          <WorkspaceManageMembersModal
×
136
            {...workspaceManageMembersModal}
×
137
            workspace={workspace}
×
138
          />
×
139
        </>
×
140
      )}
141
    </div>
×
142
  )
143
}
×
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