Skip to content

Commit afb24b0

Browse files
authored
Merge pull request #2907 from input-output-hk/fix/ddw-931-add-disabled-state-to-selects
2 parents efeec3d + f3f7ecb commit afb24b0

File tree

17 files changed

+65
-36
lines changed

17 files changed

+65
-36
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- Improved RTS flags splash screen message ([PR 2901](https://github.com/input-output-hk/daedalus/pull/2901))
88
- Implemented error message when trying to leave wallet without enough ada to support tokens ([PR 2783](https://github.com/input-output-hk/daedalus/pull/2783))
99

10+
### Fixes
11+
12+
- Fixed styling of the incentivized testnet rewards wallet dropdown ([PR 2907](https://github.com/input-output-hk/daedalus/pull/2907))
13+
1014
### Chores
1115

1216
- Fixed spelling issues and typos ([PR 2915](https://github.com/input-output-hk/daedalus/pull/2915))

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
"react-intl": "2.7.2",
256256
"react-lottie": "1.2.3",
257257
"react-markdown": "4.3.1",
258-
"react-polymorph": "1.0.2",
258+
"react-polymorph": "1.0.3",
259259
"react-router": "5.2.0",
260260
"react-router-dom": "5.2.0",
261261
"react-svg-inline": "2.1.1",

source/renderer/app/components/staking/redeem-itn-rewards/Step1ConfigurationDialog.scss

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,6 @@
3838
margin-bottom: 17px;
3939
}
4040

41-
.walletsDropdown {
42-
&.disabled {
43-
pointer-events: none;
44-
:global {
45-
.SelectOverrides_selectInput:after {
46-
opacity: 0.5;
47-
}
48-
.SimpleFormField_inputWrapper {
49-
opacity: 0.5;
50-
}
51-
}
52-
}
53-
}
54-
5541
.checkbox {
5642
margin-bottom: 20px;
5743

source/renderer/app/components/staking/redeem-itn-rewards/Step1ConfigurationDialog.tsx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ type Props = {
142142
wallets: Array<Wallet>;
143143
};
144144

145+
type State = {
146+
wasRecoveryPhraseValidAtLeastOnce: boolean;
147+
};
148+
145149
interface FormFields {
146150
checkboxAcceptance1: string;
147151
checkboxAcceptance2: string;
@@ -150,14 +154,19 @@ interface FormFields {
150154
}
151155

152156
@observer
153-
class Step1ConfigurationDialog extends Component<Props> {
157+
class Step1ConfigurationDialog extends Component<Props, State> {
154158
static contextTypes = {
155159
intl: intlShape.isRequired,
156160
};
157161
static defaultProps = {
158162
error: null,
159163
recoveryPhrase: [],
160164
};
165+
166+
state = {
167+
wasRecoveryPhraseValidAtLeastOnce: false,
168+
};
169+
161170
recoveryPhraseAutocomplete: Autocomplete;
162171
form = new ReactToolboxMobxForm<FormFields>(
163172
{
@@ -177,6 +186,16 @@ class Step1ConfigurationDialog extends Component<Props> {
177186
this.context.intl.formatMessage(messages.invalidRecoveryPhrase),
178187
],
179188
}),
189+
hooks: {
190+
onChange: (field) => {
191+
if (
192+
this.state.wasRecoveryPhraseValidAtLeastOnce === false &&
193+
field.isValid
194+
) {
195+
this.setState({ wasRecoveryPhraseValidAtLeastOnce: true });
196+
}
197+
},
198+
},
180199
},
181200
walletsDropdown: {
182201
type: 'select',
@@ -276,11 +295,11 @@ class Step1ConfigurationDialog extends Component<Props> {
276295
const checkboxAcceptance1Field = form.$('checkboxAcceptance1');
277296
const checkboxAcceptance2Field = form.$('checkboxAcceptance2');
278297
const walletId = get(wallet, 'id', null);
279-
const validRecoveryPhase = recoveryPhraseField.isValid;
280-
const walletsDropdownClasses = classnames([
281-
styles.walletsDropdown,
282-
!validRecoveryPhase ? styles.disabled : null,
283-
]);
298+
const walletsDropdownDisabled = !(
299+
recoveryPhraseField.isValid ||
300+
this.state.wasRecoveryPhraseValidAtLeastOnce
301+
);
302+
284303
const actions = {
285304
direction: 'column',
286305
items: [
@@ -365,7 +384,6 @@ class Step1ConfigurationDialog extends Component<Props> {
365384
/>
366385
<div className={styles.walletsDropdownWrapper}>
367386
<WalletsDropdown
368-
className={walletsDropdownClasses}
369387
{...walletsDropdownField.bind()}
370388
numberOfStakePools={4}
371389
wallets={wallets}
@@ -376,6 +394,7 @@ class Step1ConfigurationDialog extends Component<Props> {
376394
value={walletId}
377395
getStakePoolById={() => {}}
378396
errorPosition="bottom"
397+
disabled={walletsDropdownDisabled}
379398
/>
380399
</div>
381400
<Checkbox

source/renderer/app/components/wallet/WalletSendForm.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
input {
5858
background-color: var(--rp-input-bg-color-disabled) !important;
59-
border-color: var(--rp-input-bg-color-disabled) !important;
59+
border-color: var(--rp-input-border-color-disabled) !important;
6060
font-family: var(--font-regular);
6161
pointer-events: none;
6262

source/renderer/app/components/widgets/DialogFullSizeOverride.scss

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
.AutocompleteOverrides_autocompleteContent,
2020
.SimpleInput_customValueBlock,
2121
.SimpleInput_customValueWrapper,
22-
.SimpleInput_input,
23-
.SimpleInput_input:focus,
24-
.SimpleInput_input:hover,
22+
.SimpleInput_input:not(.SimpleInput_disabled),
23+
.SimpleInput_input:focus:not(.SimpleInput_disabled),
24+
.SimpleInput_input:hover:not(.SimpleInput_disabled),
2525
.SimpleLink_root {
2626
background-color: transparent !important;
2727
}
@@ -106,9 +106,10 @@
106106

107107
// Border Color
108108
.AutocompleteOverrides_autocompleteContent:not(.SimpleAutocomplete_errored),
109-
.SelectOverrides_selectInput input,
109+
.SelectOverrides_selectInput input:not(.SimpleInput_disabled),
110110
.SimpleInput_customValueBlock,
111-
.SimpleInput_customValueWrapper .SimpleInput_input,
111+
.SimpleInput_customValueWrapper
112+
.SimpleInput_input:not(.SimpleInput_disabled),
112113
.SimpleInput_input:focus:not(.SimpleInput_errored),
113114
.SimpleInput_input:hover:not(.SimpleInput_errored),
114115
.SimpleOptions_option:after {

source/renderer/app/components/widgets/forms/ItemsDropdown.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import globalMessages from '../../../i18n/global-messages';
3030
export type ItemDropdownProps = {
3131
options: Array<ItemDropdown>;
3232
className?: string;
33+
disabled?: boolean;
3334
};
3435
export const onSearchItemsDropdown = (
3536
searchValue: string,

source/renderer/app/themes/daedalus/cardano.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ export const CARDANO_THEME_OUTPUT = {
640640
'--rp-input-bg-color': '#ffffff',
641641
'--rp-input-bg-color-disabled': 'rgba(94, 96, 102, 0.05)',
642642
'--rp-input-border-color': 'rgba(94, 96, 102, 0.3)',
643-
'--rp-input-border-color-disabled': 'rgba(94, 96, 102, 0.05)',
643+
'--rp-input-border-color-disabled': 'transparent',
644644
'--rp-input-border-color-errored': '#ea4c5b',
645645
'--rp-input-border-color-focus': 'rgba(94, 96, 102, 0.7)',
646646
'--rp-input-line-height': '22px',
@@ -700,8 +700,10 @@ export const CARDANO_THEME_OUTPUT = {
700700
'--rp-select-arrow-bg-color': 'rgba(94, 96, 102, 0.3)',
701701
'--rp-select-arrow-bg-color-open': 'rgba(94, 96, 102, 0.7)',
702702
'--rp-select-input-bg-color': 'transparent',
703+
'--rp-select-input-bg-color-disabled': 'rgba(255, 255, 255, 0.05)',
703704
'--rp-select-input-border-color': 'rgba(94, 96, 102, 0.3)',
704705
'--rp-select-input-border-color-focus': 'rgba(94, 96, 102, 0.7)',
706+
'--rp-select-input-border-color-disabled': 'transparent',
705707
'--rp-select-input-text-color': '#5e6066',
706708
'--rp-select-input-placeholder-color': 'rgba(94, 96, 102, 0.5)',
707709
},

source/renderer/app/themes/daedalus/dark-blue.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,10 @@ export const DARK_BLUE_THEME_OUTPUT = {
702702
'--rp-select-arrow-bg-color': 'rgba(233, 244, 254, 0.3)',
703703
'--rp-select-arrow-bg-color-open': 'rgba(233, 244, 254, 1)',
704704
'--rp-select-input-bg-color': 'transparent',
705+
'--rp-select-input-bg-color-disabled': 'rgba(233, 244, 254, 0.05)',
705706
'--rp-select-input-border-color': 'rgba(233, 244, 254, 0.3)',
706707
'--rp-select-input-border-color-focus': 'rgba(233, 244, 254, 0.7)',
708+
'--rp-select-input-border-color-disabled': 'transparent',
707709
'--rp-select-input-text-color': 'rgba(233, 244, 254, 1)',
708710
'--rp-select-input-placeholder-color': 'rgba(233, 244, 254, 0.5)',
709711
},

source/renderer/app/themes/daedalus/dark-cardano.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,10 @@ export const DARK_CARDANO_THEME_OUTPUT = {
686686
'--rp-select-arrow-bg-color': 'rgba(255, 255, 255, 0.3)',
687687
'--rp-select-arrow-bg-color-open': 'rgba(255, 255, 255, 0.7)',
688688
'--rp-select-input-bg-color': 'transparent',
689+
'--rp-select-input-bg-color-disabled': 'rgba(255, 255, 255, 0.05)',
689690
'--rp-select-input-border-color': 'rgba(255, 255, 255, 0.3)',
690691
'--rp-select-input-border-color-focus': 'rgba(255, 255, 255, 0.7)',
692+
'--rp-select-input-border-color-disabled': 'transparent',
691693
'--rp-select-input-text-color': '#ffffff',
692694
'--rp-select-input-placeholder-color': 'rgba(255, 255, 255, 0.5)',
693695
},

0 commit comments

Comments
 (0)