@@ -4,12 +4,13 @@ import { isNonEmptyArray } from '@sniptt/guards';
4
4
import { useState } from 'react' ;
5
5
import { useRecoilValue , useSetRecoilState } from 'recoil' ;
6
6
import {
7
+ AppTooltip ,
7
8
Avatar ,
8
9
H2Title ,
9
10
IconMail ,
10
11
IconReload ,
11
12
IconTrash ,
12
- MOBILE_VIEWPORT ,
13
+ TooltipDelay ,
13
14
} from 'twenty-ui' ;
14
15
15
16
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState' ;
@@ -52,49 +53,20 @@ const StyledTable = styled(Table)`
52
53
margin-top: ${ ( { theme } ) => theme . spacing ( 0.5 ) } ;
53
54
` ;
54
55
55
- const StyledTableRow = styled ( TableRow ) `
56
- @media (max-width: ${ MOBILE_VIEWPORT } px) {
57
- display: grid;
58
- grid-template-columns: 3fr;
59
- }
60
- ` ;
61
- const StyledTableCell = styled ( TableCell ) `
62
- padding: ${ ( { theme } ) => theme . spacing ( 1 ) } ;
63
- @media (max-width: ${ MOBILE_VIEWPORT } px) {
64
- &:first-child {
65
- max-width: 100%;
66
- padding-top: 2px;
67
- white-space: nowrap;
68
- overflow: scroll;
69
- scroll-behavior: smooth;
70
- }
71
- }
56
+ const StyledTableHeaderRow = styled ( Table ) `
57
+ margin-bottom: ${ ( { theme } ) => theme . spacing ( 1.5 ) } ;
72
58
` ;
59
+
73
60
const StyledIconWrapper = styled . div `
74
- left: 2px;
61
+ display: flex;
62
+ align-items: center;
75
63
margin-right: ${ ( { theme } ) => theme . spacing ( 2 ) } ;
76
- position: relative;
77
- top: 1px;
78
- ` ;
79
-
80
- const StyledScrollableTextContainer = styled . div `
81
- max-width: 100%;
82
- overflow-x: auto;
83
- white-space: pre-line;
84
64
` ;
85
65
86
- const StyledTextContainer = styled . div `
87
- color: ${ ( { theme } ) => theme . font . color . secondary } ;
88
- max-width: max-content;
89
- overflow-x: auto;
90
- position: absolute;
91
- @media (min-width: 360px) and (max-width: 420px) {
92
- max-width: 150px;
93
- margin-top: ${ ( { theme } ) => theme . spacing ( 1 ) } ;
94
- }
95
- ` ;
96
- const StyledTableHeaderRow = styled ( Table ) `
97
- margin-bottom: ${ ( { theme } ) => theme . spacing ( 1.5 ) } ;
66
+ const StyledTextContainerWithEllipsis = styled . div `
67
+ overflow: hidden;
68
+ text-overflow: ellipsis;
69
+ white-space: nowrap;
98
70
` ;
99
71
100
72
export const SettingsWorkspaceMembers = ( ) => {
@@ -194,15 +166,21 @@ export const SettingsWorkspaceMembers = () => {
194
166
/>
195
167
< Table >
196
168
< StyledTableHeaderRow >
197
- < TableRow >
169
+ < TableRow
170
+ gridAutoColumns = "150px 1fr 1fr"
171
+ mobileGridAutoColumns = "100px 1fr 1fr"
172
+ >
198
173
< TableHeader > Name</ TableHeader >
199
174
< TableHeader > Email</ TableHeader >
200
175
< TableHeader align = { 'right' } > </ TableHeader >
201
176
</ TableRow >
202
177
</ StyledTableHeaderRow >
203
178
{ workspaceMembers ?. map ( ( workspaceMember ) => (
204
179
< StyledTable key = { workspaceMember . id } >
205
- < TableRow >
180
+ < TableRow
181
+ gridAutoColumns = "150px 1fr 1fr"
182
+ mobileGridAutoColumns = "100px 1fr 1fr"
183
+ >
206
184
< TableCell >
207
185
< StyledIconWrapper >
208
186
< Avatar
@@ -213,16 +191,26 @@ export const SettingsWorkspaceMembers = () => {
213
191
size = "sm"
214
192
/>
215
193
</ StyledIconWrapper >
216
- < StyledScrollableTextContainer >
194
+ < StyledTextContainerWithEllipsis
195
+ id = { `hover-text-${ workspaceMember . id } ` }
196
+ >
217
197
{ workspaceMember . name . firstName +
218
198
' ' +
219
199
workspaceMember . name . lastName }
220
- </ StyledScrollableTextContainer >
200
+ </ StyledTextContainerWithEllipsis >
201
+ < AppTooltip
202
+ anchorSelect = { `#hover-text-${ workspaceMember . id } ` }
203
+ content = { `${ workspaceMember . name . firstName } ${ workspaceMember . name . lastName } ` }
204
+ noArrow
205
+ place = "top"
206
+ positionStrategy = "fixed"
207
+ delay = { TooltipDelay . shortDelay }
208
+ />
221
209
</ TableCell >
222
210
< TableCell >
223
- < StyledTextContainer >
211
+ < StyledTextContainerWithEllipsis >
224
212
{ workspaceMember . userEmail }
225
- </ StyledTextContainer >
213
+ </ StyledTextContainerWithEllipsis >
226
214
</ TableCell >
227
215
< TableCell align = { 'right' } >
228
216
{ currentWorkspaceMember ?. id !== workspaceMember . id && (
@@ -253,35 +241,39 @@ export const SettingsWorkspaceMembers = () => {
253
241
{ isNonEmptyArray ( workspaceInvitations ) && (
254
242
< Table >
255
243
< StyledTableHeaderRow >
256
- < TableRow gridAutoColumns = { `1fr 1fr ${ theme . spacing ( 22 ) } ` } >
244
+ < TableRow
245
+ gridAutoColumns = "150px 1fr 1fr"
246
+ mobileGridAutoColumns = "100px 1fr 1fr"
247
+ >
257
248
< TableHeader > Email</ TableHeader >
258
249
< TableHeader align = { 'right' } > Expires in</ TableHeader >
259
250
< TableHeader > </ TableHeader >
260
251
</ TableRow >
261
252
</ StyledTableHeaderRow >
262
253
{ workspaceInvitations ?. map ( ( workspaceInvitation ) => (
263
254
< StyledTable key = { workspaceInvitation . id } >
264
- < StyledTableRow
265
- gridAutoColumns = { `1fr 1fr ${ theme . spacing ( 22 ) } ` }
255
+ < TableRow
256
+ gridAutoColumns = "150px 1fr 1fr"
257
+ mobileGridAutoColumns = "100px 1fr 1fr"
266
258
>
267
- < StyledTableCell >
259
+ < TableCell >
268
260
< StyledIconWrapper >
269
261
< IconMail
270
262
size = { theme . icon . size . md }
271
263
stroke = { theme . icon . stroke . sm }
272
264
/>
273
265
</ StyledIconWrapper >
274
- < StyledScrollableTextContainer >
266
+ < StyledTextContainerWithEllipsis >
275
267
{ workspaceInvitation . email }
276
- </ StyledScrollableTextContainer >
277
- </ StyledTableCell >
278
- < StyledTableCell align = { 'right' } >
268
+ </ StyledTextContainerWithEllipsis >
269
+ </ TableCell >
270
+ < TableCell align = { 'right' } >
279
271
< Status
280
272
color = { 'gray' }
281
273
text = { getExpiresAtText ( workspaceInvitation . expiresAt ) }
282
274
/>
283
- </ StyledTableCell >
284
- < StyledTableCell align = { 'right' } >
275
+ </ TableCell >
276
+ < TableCell align = { 'right' } >
285
277
< StyledButtonContainer >
286
278
< IconButton
287
279
onClick = { ( ) => {
@@ -304,8 +296,8 @@ export const SettingsWorkspaceMembers = () => {
304
296
Icon = { IconTrash }
305
297
/>
306
298
</ StyledButtonContainer >
307
- </ StyledTableCell >
308
- </ StyledTableRow >
299
+ </ TableCell >
300
+ </ TableRow >
309
301
</ StyledTable >
310
302
) ) }
311
303
</ Table >
0 commit comments