Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Modal default to open #2157

Merged
merged 1 commit into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/app-accounts/src/modals/Backup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export default function ({ address, onClose }: Props): React.ReactElement<Props>
<Modal
className='app--accounts-Modal'
header={t('Backup account')}
open
>
<Content
address={address}
Expand Down
1 change: 0 additions & 1 deletion packages/app-accounts/src/modals/ChangePass.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class ChangePass extends TxComponent<Props, State> {
<Modal
className='app--accounts-Modal'
header={t('Change account password')}
open
>
{this.renderContent()}
{this.renderButtons()}
Expand Down
1 change: 0 additions & 1 deletion packages/app-accounts/src/modals/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, type: pr
<Modal
className={className}
header={t('Add an account via seed')}
open
>
{address && isConfirmationOpen && (
<CreateConfirmation
Expand Down
5 changes: 1 addition & 4 deletions packages/app-accounts/src/modals/CreateConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ export default function CreateConfirmation ({ address, name, onClose, onCommit }
const { t } = useTranslation();

return (
<Modal
header={t('Important notice')}
open
>
<Modal header={t('Important notice')}>
<Modal.Content>
<AddressRow
defaultName={name}
Expand Down
1 change: 0 additions & 1 deletion packages/app-accounts/src/modals/Derive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ export default function Derive ({ className, from, onClose }: Props): React.Reac
<Modal
className={className}
header={t('Derive account from pair')}
open
>
{address && isConfirmationOpen && (
<CreateConfirmation
Expand Down
1 change: 0 additions & 1 deletion packages/app-accounts/src/modals/Identity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function Identity ({ address, className, onClose }: Props): React.ReactElement<P
<Modal
className={className}
header={t('Register identity')}
open
>
<Modal.Content>
<Input
Expand Down
5 changes: 1 addition & 4 deletions packages/app-accounts/src/modals/Import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ class Import extends TxComponent<Props, State> {
const { isFileValid, isPassValid } = this.state;

return (
<Modal
header={t('Add via backup file')}
open
>
<Modal header={t('Add via backup file')}>
{this.renderInput()}
<Modal.Actions>
<Button.Group>
Expand Down
1 change: 0 additions & 1 deletion packages/app-accounts/src/modals/Qr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ function QrModal ({ className, onClose, onStatusChange }: Props): React.ReactEle
<Modal
className={className}
header={t('Add account via Qr')}
open
>
<Modal.Content>
{
Expand Down
1 change: 0 additions & 1 deletion packages/app-accounts/src/modals/Transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ function Transfer ({ className, onClose, recipientId: propRecipientId, senderId:
<Modal
className='app--accounts-Modal'
header={t('Send funds')}
open
>
<Modal.Content>
<div className={className}>
Expand Down
5 changes: 1 addition & 4 deletions packages/app-address-book/src/modals/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ export default function Create ({ onClose, onStatusChange }: Props): React.React
};

return (
<Modal
header={t('Add an address')}
open
>
<Modal header={t('Add an address')}>
<Modal.Content>
<AddressRow
defaultName={name}
Expand Down
1 change: 0 additions & 1 deletion packages/app-contracts/src/RemoveABI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default function RemoveABI ({ code, onClose, onRemove }: Props): React.Re
className='app--accounts-Modal'
header={t('Confirm ABI removal')}
onClose={onClose}
open
>
<Modal.Content>
<CodeRow
Expand Down
1 change: 0 additions & 1 deletion packages/app-council/src/Motions/Slashing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export default function Slashing ({ className, isMember }: Props): React.ReactEl
<Modal
className={className}
header={t('Revert pending slashes')}
open
>
<Modal.Content>
<InputAddress
Expand Down
1 change: 0 additions & 1 deletion packages/app-democracy/src/Overview/PreImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ function PreImage ({ className, onClose }: Props): React.ReactElement<Props> {
<Modal
className={className}
header={t('Submit preimage')}
open
>
<Modal.Content>
<InputAddress
Expand Down
1 change: 0 additions & 1 deletion packages/app-democracy/src/Overview/Propose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default function Propose ({ className, onClose }: Props): React.ReactElem
<Modal
className={className}
header={t('Submit proposal')}
open
>
<Modal.Content>
<InputAddress
Expand Down
1 change: 0 additions & 1 deletion packages/app-democracy/src/Overview/Seconding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default function Seconding ({ depositors, proposalId }: Props): React.Rea
{isSecondingOpen && (
<Modal
header={t('Second proposal')}
open
size='small'
>
<Modal.Content>
Expand Down
1 change: 0 additions & 1 deletion packages/app-democracy/src/Overview/Voting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default function Voting ({ referendumId }: Props): React.ReactElement<Pro
{isVotingOpen && (
<Modal
header={t('Vote on proposal')}
open
size='small'
>
<Modal.Content>
Expand Down
5 changes: 1 addition & 4 deletions packages/app-generic-asset/src/modals/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ function Create ({ onClose, onRegister, t }: Props): React.ReactElement<Props> {
};

return (
<Modal
header={t('Register an Asset')}
open
>
<Modal header={t('Register an Asset')}>
<Modal.Content>
<InputNumber
help={t('Enter the Asset ID of the token you want to manage.')}
Expand Down
1 change: 0 additions & 1 deletion packages/app-staking/src/Actions/Account/BondExtra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class BondExtra extends TxComponent<Props, State> {
<Modal
className='staking--BondExtra'
header= {t('Bond more funds')}
open
size='small'
>
{this.renderContent()}
Expand Down
1 change: 0 additions & 1 deletion packages/app-staking/src/Actions/Account/InjectKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ function InjectKeys ({ isOpen = true, onClose, t }: Props): React.ReactElement<P
return (
<Modal
header={t('Inject Keys')}
open
size='small'
>
<Modal.Content>
Expand Down
1 change: 0 additions & 1 deletion packages/app-staking/src/Actions/Account/Nominate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ function Nominate ({ className, controllerId, nominees, onClose, next, stakingOv
<Modal
className={`staking--Nominating ${className}`}
header={t('Nominate Validators')}
open
>
<Modal.Content className='ui--signer-Signer-Content'>
<InputAddress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class SetControllerAccount extends TxComponent<Props, State> {
<Modal
className='staking--SetControllerAccount'
header={t('Change controller account')}
open
size='small'
>
<Modal.Content className='ui--signer-Signer-Content'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class SetRewardDestination extends TxComponent<Props, State> {
<Modal
className='staking--Bonding'
header={t('Bonding Preferences')}
open
size='small'
>
{this.renderContent()}
Expand Down
1 change: 0 additions & 1 deletion packages/app-staking/src/Actions/Account/SetSessionKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function SetSessionKey ({ controllerId, isOpen, onClose, sessionIds, stashId, t
<Modal
className='staking--SetSessionAccount'
header={t('Set Session Key')}
open
size='small'
>
<Modal.Content className='ui--signer-Signer-Content'>
Expand Down
1 change: 0 additions & 1 deletion packages/app-staking/src/Actions/Account/Unbond.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class Unbond extends TxComponent<Props, State> {
<Modal
className='staking--Unbond'
header={t('Unbond funds')}
open
size='small'
>
{this.renderContent()}
Expand Down
1 change: 0 additions & 1 deletion packages/app-staking/src/Actions/Account/Validate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class Validate extends TxComponent<Props, State> {
<Modal
className='staking--Staking'
header={t('Set validator preferences')}
open
size='small'
>
{this.renderContent()}
Expand Down
1 change: 0 additions & 1 deletion packages/app-staking/src/Actions/NewStake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class NewStake extends TxComponent<Props, State> {
<Modal
className='staking--Bonding'
header={t('Bonding Preferences')}
open
size='small'
>
<Modal.Content className='ui--signer-Signer-Content'>
Expand Down
1 change: 0 additions & 1 deletion packages/app-tech-comm/src/Proposals/Voting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function Voting ({ hash, proposalId, t }: Props): React.ReactElement<Props> | nu
{isVotingOpen && (
<Modal
header={t('Vote on proposal')}
open
size='small'
>
<Modal.Content>
Expand Down
1 change: 0 additions & 1 deletion packages/app-toolbox/src/Unlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class Unlock extends TxComponent<Props, State> {
<Modal
className='toolbox--Unlock'
header={t('Unlock account')}
open
>
{this.renderContent()}
{this.renderActions()}
Expand Down
1 change: 0 additions & 1 deletion packages/app-treasury/src/Overview/Propose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default function Propose ({ className }: Props): React.ReactElement<Props
<Modal
className={className}
header={t('Submit treasury proposal')}
open
size='small'
>
<Modal.Content>
Expand Down
1 change: 0 additions & 1 deletion packages/app-treasury/src/Overview/Submission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default function Submission ({ councilProposals, id, isDisabled }: Props)
{isOpen && (
<Modal
header={t('Submit to council')}
open
size='small'
>
<Modal.Content>
Expand Down
1 change: 0 additions & 1 deletion packages/app-treasury/src/Overview/Voting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export default function Voting ({ councilProposals, isDisabled }: Props): React.
{isOpen && (
<Modal
header={t('Vote on proposal')}
open
size='small'
>
<Modal.Content>
Expand Down
1 change: 0 additions & 1 deletion packages/apps/src/modals/Network.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default function NetworkModal ({ className, onClose }: Props): React.Reac
<Modal
className={className}
header={t('Select Network')}
open
>
<Modal.Content>
<General
Expand Down
1 change: 0 additions & 1 deletion packages/react-components/src/AccountName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ function AccountName ({ children, className, defaultName, label, onClick, overri
{isJudgementOpen && (
<Modal
header={t('Provide judgement')}
open
size='small'
>
<Modal.Content>
Expand Down
1 change: 0 additions & 1 deletion packages/react-components/src/Forget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export default function Forget (props: Props): React.ReactElement<Props> {
className='app--accounts-Modal'
header={getHeaderText(mode, t)}
onClose={onClose}
open
>
<Modal.Content>{renderContent(props, t)}</Modal.Content>
<Modal.Actions>
Expand Down
4 changes: 3 additions & 1 deletion packages/react-components/src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ import { classes } from './util';
interface Props extends BareProps {
children: React.ReactNode;
header?: React.ReactNode;
open?: boolean;
[index: string]: any;
}

function Modal (props: Props): React.ReactElement<Props> {
const { className, children, header } = props;
const { className, children, header, open = true } = props;

return (
<SUIModal
{...props}
className={classes('theme--default', 'ui--Modal', className)}
dimmer='inverted'
header={undefined}
open={open}
>
{header && (
<SUIModal.Header>{header}</SUIModal.Header>
Expand Down
5 changes: 1 addition & 4 deletions packages/react-signer/src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ class Signer extends React.PureComponent<Props, State> {
}

return (
<Modal
className='ui--signer-Signer'
open
>
<Modal className='ui--signer-Signer'>
<ErrorBoundary onError={this.onRenderError}>
{this.renderContent()}
</ErrorBoundary>
Expand Down