chore(cleanup) delete dead code
This commit is contained in:
parent
9eca9e2243
commit
a96fc2fc17
|
@ -40,48 +40,3 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.knocking-participants-container {
|
||||
list-style-type: none;
|
||||
padding: 0 15px 15px 15px;
|
||||
}
|
||||
|
||||
.knocking-participant {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin: 8px 0;
|
||||
|
||||
.details {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
margin: 0 30px 0 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
align-self: unset;
|
||||
margin: 0 5px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 300px) {
|
||||
#knocking-participant-list {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
|
||||
.avatar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.knocking-participant {
|
||||
flex-direction: column;
|
||||
|
||||
.details {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
// @flow
|
||||
|
||||
import React, { useCallback } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
|
||||
type Props = {
|
||||
|
||||
/**
|
||||
* Action to be dispatched on click.
|
||||
*/
|
||||
action: Function,
|
||||
|
||||
/**
|
||||
* The text of the button.
|
||||
*/
|
||||
children: React$Node,
|
||||
|
||||
/**
|
||||
* CSS class of the button.
|
||||
*/
|
||||
className: string,
|
||||
|
||||
/**
|
||||
* CSS id of the button.
|
||||
*/
|
||||
id?: string,
|
||||
|
||||
/**
|
||||
* The participant.
|
||||
*/
|
||||
participant: Object,
|
||||
|
||||
/**
|
||||
* The `data-testid` used for the button.
|
||||
*/
|
||||
testId: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Component used to display an approve/reject button.
|
||||
*
|
||||
* @returns {React$Element<'button'>}
|
||||
*/
|
||||
export default function({ action, children, className, participant, id, testId }: Props) {
|
||||
const dispatch = useDispatch();
|
||||
const onClick = useCallback(() => dispatch(action(participant.id)), [ dispatch, participant ]);
|
||||
|
||||
return (
|
||||
<button
|
||||
className = { className }
|
||||
data-testid = { testId }
|
||||
id = { id }
|
||||
onClick = { onClick }
|
||||
type = 'button'>
|
||||
{ children }
|
||||
</button>
|
||||
);
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { Avatar } from '../../../base/avatar';
|
||||
import { HIDDEN_EMAILS } from '../../../lobby/constants';
|
||||
|
||||
import NotificationButton from './NotificationButton';
|
||||
|
||||
type Props = {
|
||||
|
||||
/**
|
||||
* Text used for button which triggeres `onApprove` action.
|
||||
*/
|
||||
approveButtonText: string,
|
||||
|
||||
/**
|
||||
* Callback used when clicking the ok/approve button.
|
||||
*/
|
||||
onApprove: Function,
|
||||
|
||||
/**
|
||||
* Callback used when clicking the reject button.
|
||||
*/
|
||||
onReject: Function,
|
||||
|
||||
/**
|
||||
* Array of participants to be displayed.
|
||||
*/
|
||||
participants: Array<Object>,
|
||||
|
||||
/**
|
||||
* Text for button which triggeres the `reject` action.
|
||||
*/
|
||||
rejectButtonText: string,
|
||||
|
||||
|
||||
/**
|
||||
* String prefix used for button `test-id`.
|
||||
*/
|
||||
testIdPrefix: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Component used to display a list of notifications based on a list of participants.
|
||||
* This is visible only to moderators.
|
||||
*
|
||||
* @returns {React$Element<'div'> | null}
|
||||
*/
|
||||
export default function({
|
||||
approveButtonText,
|
||||
onApprove,
|
||||
onReject,
|
||||
participants,
|
||||
testIdPrefix,
|
||||
rejectButtonText
|
||||
}: Props): React$Element<'ul'> {
|
||||
return (
|
||||
<ul className = 'knocking-participants-container'>
|
||||
{ participants.map(p => (
|
||||
<li
|
||||
className = 'knocking-participant'
|
||||
data-testid = { p.id }
|
||||
key = { p.id }>
|
||||
<Avatar
|
||||
displayName = { p.name }
|
||||
size = { 48 }
|
||||
testId = { `${testIdPrefix}.avatar` }
|
||||
url = { p.loadableAvatarUrl } />
|
||||
|
||||
<div className = 'details'>
|
||||
<span data-testid = { `${testIdPrefix}.name` }>
|
||||
{ p.name }
|
||||
</span>
|
||||
{ p.email && !HIDDEN_EMAILS.includes(p.email) && (
|
||||
<span data-testid = { `${testIdPrefix}.email` }>
|
||||
{ p.email }
|
||||
</span>
|
||||
) }
|
||||
</div>
|
||||
{ <NotificationButton
|
||||
action = { onApprove }
|
||||
className = 'primary'
|
||||
id = 'unmute-button'
|
||||
participant = { p }
|
||||
testId = { `${testIdPrefix}.allow` }>
|
||||
{ approveButtonText }
|
||||
</NotificationButton> }
|
||||
{ <NotificationButton
|
||||
action = { onReject }
|
||||
className = 'borderLess'
|
||||
id = 'dismiss-button'
|
||||
participant = { p }
|
||||
testId = { `${testIdPrefix}.reject` }>
|
||||
{ rejectButtonText }
|
||||
</NotificationButton>}
|
||||
</li>
|
||||
)) }
|
||||
</ul>);
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Avatar } from '../../../base/avatar';
|
||||
import { HIDDEN_EMAILS } from '../../../lobby/constants';
|
||||
|
||||
import NotificationButton from './NotificationButton';
|
||||
|
||||
type Props = {
|
||||
|
||||
/**
|
||||
* Callback used when clicking the ok/approve button.
|
||||
*/
|
||||
onApprove: Function,
|
||||
|
||||
/**
|
||||
* Callback used when clicking the reject button.
|
||||
*/
|
||||
onReject: Function,
|
||||
|
||||
/**
|
||||
* Array of participants to be displayed.
|
||||
*/
|
||||
participants: Array<Object>,
|
||||
|
||||
/**
|
||||
* String prefix used for button `test-id`.
|
||||
*/
|
||||
testIdPrefix: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Component used to display a list of notifications based on a list of participants.
|
||||
* This is visible only to moderators.
|
||||
*
|
||||
* @returns {React$Element<'div'> | null}
|
||||
*/
|
||||
export default function({ onApprove, onReject, participants, testIdPrefix }: Props): React$Element<'ul'> {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<ul className = 'knocking-participants-container'>
|
||||
{ participants.map(p => (
|
||||
<li
|
||||
className = 'knocking-participant'
|
||||
key = { p.id }>
|
||||
<Avatar
|
||||
displayName = { p.name }
|
||||
size = { 48 }
|
||||
testId = { `${testIdPrefix}.avatar` }
|
||||
url = { p.loadableAvatarUrl } />
|
||||
|
||||
<div className = 'details'>
|
||||
<span data-testid = { `${testIdPrefix}.name` }>
|
||||
{ p.name }
|
||||
</span>
|
||||
{ p.email && !HIDDEN_EMAILS.includes(p.email) && (
|
||||
<span data-testid = { `${testIdPrefix}.email` }>
|
||||
{ p.email }
|
||||
</span>
|
||||
) }
|
||||
</div>
|
||||
<NotificationButton
|
||||
action = { onApprove }
|
||||
className = 'primary'
|
||||
participant = { p }
|
||||
testId = { `${testIdPrefix}.allow` }>
|
||||
{ t('lobby.allow') }
|
||||
</NotificationButton>
|
||||
<NotificationButton
|
||||
action = { onReject }
|
||||
className = 'borderLess'
|
||||
participant = { p }
|
||||
testId = { `${testIdPrefix}.reject` }>
|
||||
{ t('lobby.reject') }
|
||||
</NotificationButton>
|
||||
</li>
|
||||
)) }
|
||||
</ul>);
|
||||
}
|
Loading…
Reference in New Issue