mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-20 00:18:45 +01:00
Use the new Select component everywhere
This commit is contained in:
@@ -9,6 +9,7 @@ import { LocalizerType } from '../../../types/Util';
|
||||
import { PanelRow } from './PanelRow';
|
||||
import { PanelSection } from './PanelSection';
|
||||
import { AccessControlClass } from '../../../textsecure.d';
|
||||
import { Select } from '../../Select';
|
||||
|
||||
export type PropsType = {
|
||||
accessEnum: typeof AccessControlClass.AccessRequired;
|
||||
@@ -36,8 +37,8 @@ export const GroupLinkManagement: React.ComponentType<PropsType> = ({
|
||||
}
|
||||
|
||||
const createEventHandler = (handleEvent: (x: boolean) => void) => {
|
||||
return (event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
handleEvent(event.target.value === 'true');
|
||||
return (value: string) => {
|
||||
handleEvent(value === 'true');
|
||||
};
|
||||
};
|
||||
|
||||
@@ -57,19 +58,20 @@ export const GroupLinkManagement: React.ComponentType<PropsType> = ({
|
||||
label={i18n('ConversationDetails--group-link')}
|
||||
right={
|
||||
isAdmin ? (
|
||||
<div className="module-conversation-details-select">
|
||||
<select
|
||||
onChange={createEventHandler(changeHasGroupLink)}
|
||||
value={String(Boolean(hasGroupLink))}
|
||||
>
|
||||
<option value="true" aria-label={i18n('on')}>
|
||||
{i18n('on')}
|
||||
</option>
|
||||
<option value="false" aria-label={i18n('off')}>
|
||||
{i18n('off')}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<Select
|
||||
onChange={createEventHandler(changeHasGroupLink)}
|
||||
options={[
|
||||
{
|
||||
text: i18n('on'),
|
||||
value: i18n('on'),
|
||||
},
|
||||
{
|
||||
text: i18n('off'),
|
||||
value: i18n('off'),
|
||||
},
|
||||
]}
|
||||
value={String(Boolean(hasGroupLink))}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
/>
|
||||
@@ -112,21 +114,22 @@ export const GroupLinkManagement: React.ComponentType<PropsType> = ({
|
||||
info={i18n('GroupLinkManagement--approve-info')}
|
||||
label={i18n('GroupLinkManagement--approve-label')}
|
||||
right={
|
||||
<div className="module-conversation-details-select">
|
||||
<select
|
||||
onChange={createEventHandler(
|
||||
setAccessControlAddFromInviteLinkSetting
|
||||
)}
|
||||
value={String(membersNeedAdminApproval)}
|
||||
>
|
||||
<option value="true" aria-label={i18n('on')}>
|
||||
{i18n('on')}
|
||||
</option>
|
||||
<option value="false" aria-label={i18n('off')}>
|
||||
{i18n('off')}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<Select
|
||||
onChange={createEventHandler(
|
||||
setAccessControlAddFromInviteLinkSetting
|
||||
)}
|
||||
options={[
|
||||
{
|
||||
text: i18n('on'),
|
||||
value: i18n('on'),
|
||||
},
|
||||
{
|
||||
text: i18n('off'),
|
||||
value: i18n('off'),
|
||||
},
|
||||
]}
|
||||
value={String(membersNeedAdminApproval)}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</PanelSection>
|
||||
|
||||
Reference in New Issue
Block a user