|
@@ -1,13 +1,35 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
|
-import React from 'react';
|
|
3
|
+import { makeStyles } from '@material-ui/core/styles';
|
|
4
|
+import React, { useCallback } from 'react';
|
4
|
5
|
import { useTranslation } from 'react-i18next';
|
5
|
|
-import { useSelector } from 'react-redux';
|
|
6
|
+import { useSelector, useDispatch } from 'react-redux';
|
6
|
7
|
|
|
8
|
+import { withPixelLineHeight } from '../../base/styles/functions.web';
|
|
9
|
+import { admitMultiple } from '../../lobby/actions.web';
|
7
|
10
|
import { getLobbyState } from '../../lobby/functions';
|
8
|
11
|
|
9
|
12
|
import { LobbyParticipantItem } from './LobbyParticipantItem';
|
10
|
|
-import { Heading } from './styled';
|
|
13
|
+
|
|
14
|
+const useStyles = makeStyles(theme => {
|
|
15
|
+ return {
|
|
16
|
+ headingContainer: {
|
|
17
|
+ alignItems: 'center',
|
|
18
|
+ display: 'flex',
|
|
19
|
+ justifyContent: 'space-between'
|
|
20
|
+ },
|
|
21
|
+ heading: {
|
|
22
|
+ ...withPixelLineHeight(theme.typography.heading7),
|
|
23
|
+ color: theme.palette.text02
|
|
24
|
+ },
|
|
25
|
+ link: {
|
|
26
|
+ ...withPixelLineHeight(theme.typography.labelBold),
|
|
27
|
+ color: theme.palette.link01,
|
|
28
|
+ cursor: 'pointer'
|
|
29
|
+ }
|
|
30
|
+ };
|
|
31
|
+});
|
|
32
|
+
|
11
|
33
|
|
12
|
34
|
export const LobbyParticipantList = () => {
|
13
|
35
|
const {
|
|
@@ -15,6 +37,11 @@ export const LobbyParticipantList = () => {
|
15
|
37
|
knockingParticipants: participants
|
16
|
38
|
} = useSelector(getLobbyState);
|
17
|
39
|
const { t } = useTranslation();
|
|
40
|
+ const classes = useStyles();
|
|
41
|
+ const dispatch = useDispatch();
|
|
42
|
+ const admitAll = useCallback(() => {
|
|
43
|
+ dispatch(admitMultiple(participants));
|
|
44
|
+ }, [ dispatch, participants ]);
|
18
|
45
|
|
19
|
46
|
if (!lobbyEnabled || !participants.length) {
|
20
|
47
|
return null;
|
|
@@ -22,7 +49,14 @@ export const LobbyParticipantList = () => {
|
22
|
49
|
|
23
|
50
|
return (
|
24
|
51
|
<>
|
25
|
|
- <Heading>{t('participantsPane.headings.lobby', { count: participants.length })}</Heading>
|
|
52
|
+ <div className = { classes.headingContainer }>
|
|
53
|
+ <div className = { classes.heading }>
|
|
54
|
+ {t('participantsPane.headings.lobby', { count: participants.length })}
|
|
55
|
+ </div>
|
|
56
|
+ <div
|
|
57
|
+ className = { classes.link }
|
|
58
|
+ onClick = { admitAll }>{t('lobby.admitAll')}</div>
|
|
59
|
+ </div>
|
26
|
60
|
<div>
|
27
|
61
|
{participants.map(p => (
|
28
|
62
|
<LobbyParticipantItem
|