Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Re-arrange buttons as per transfer dialog design
Browse files Browse the repository at this point in the history
Tab style is still wrong though
  • Loading branch information
dbkr committed Jun 11, 2021
1 parent 6d07d5d commit a85420b
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions src/components/views/dialogs/InviteDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1265,11 +1265,14 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
let helpText;
let buttonText;
let goButtonFn;
let consultSection;
let consultConnectSection;
let keySharingWarning = <span />;

const identityServersEnabled = SettingsStore.getValue(UIFeature.IdentityServer);

const hasSelection = this.state.targets.length > 0
|| (this.state.filterText && this.state.filterText.includes('@'));

const cli = MatrixClientPeg.get();
const userId = cli.getUserId();
if (this.props.kind === KIND_DM) {
Expand Down Expand Up @@ -1387,33 +1390,39 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
}
} else if (this.props.kind === KIND_CALL_TRANSFER) {
title = _t("Transfer");
buttonText = _t("Transfer");
goButtonFn = this.transferCall;
consultSection = <div>
consultConnectSection = <div>
<label>
<input type="checkbox" checked={this.state.consultFirst} onChange={this.onConsultFirstChange} />
{_t("Consult first")}
</label>
<AccessibleButton
kind="primary"
onClick={this.transferCall}
className='mx_InviteDialog_goButton'
disabled={!hasSelection && this.state.dialPadValue === ''}
>
{_t("Transfer")}
</AccessibleButton>
</div>;
} else {
console.error("Unknown kind of InviteDialog: " + this.props.kind);
}

const hasSelection = this.state.targets.length > 0
|| (this.state.filterText && this.state.filterText.includes('@'));
const goButton = this.props.kind == KIND_CALL_TRANSFER ? null : <AccessibleButton
kind="primary"
onClick={goButtonFn}
className='mx_InviteDialog_goButton'
disabled={this.state.busy || !hasSelection}
>
{buttonText}
</AccessibleButton>;

const usersSection = <React.Fragment>
<p className='mx_InviteDialog_helpText'>{helpText}</p>
<div className='mx_InviteDialog_addressBar'>
{this.renderEditor()}
<div className='mx_InviteDialog_buttonAndSpinner'>
<AccessibleButton
kind="primary"
onClick={goButtonFn}
className='mx_InviteDialog_goButton'
disabled={this.state.busy || !hasSelection}
>
{buttonText}
</AccessibleButton>
{goButton}
{spinner}
</div>
</div>
Expand All @@ -1424,7 +1433,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
{this.renderSection('recents')}
{this.renderSection('suggestions')}
</div>
{consultSection}
{consultConnectSection}
</React.Fragment>;

let dialogContent;
Expand All @@ -1446,7 +1455,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
onDialPress={this.onDialPress}
/>
</div>
{consultSection}
{consultConnectSection}
</React.Fragment>;
tabs.push(new Tab('DialPadTab', _td("Dial pad"), null, dialPadSection));
dialogContent = <TabbedView tabs={tabs} initialTabId={'byMatrixID'} />;
Expand Down

0 comments on commit a85420b

Please sign in to comment.