Skip to content

Commit 40d9e88

Browse files
committed
pool+orders: add indicator when a hidden option is invalid
1 parent e408d85 commit 40d9e88

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

app/src/components/common/StatusDot.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ const Styled = {
2121

2222
interface Props {
2323
status: 'success' | 'warn' | 'error' | 'idle';
24+
className?: string;
2425
}
2526

26-
const StatusDot: React.FC<Props> = ({ status }) => {
27+
const StatusDot: React.FC<Props> = ({ status, className }) => {
2728
const { DotIcon } = Styled;
28-
return <DotIcon size="small" className={status} aria-label={status} />;
29+
const cn = `${status} ${className || ''}`;
30+
return <DotIcon size="small" className={cn} aria-label={status} />;
2931
};
3032

3133
export default StatusDot;

app/src/components/pool/OrderFormSection.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
import FormField from 'components/common/FormField';
1717
import FormInputNumber from 'components/common/FormInputNumber';
1818
import FormSelect from 'components/common/FormSelect';
19+
import StatusDot from 'components/common/StatusDot';
1920
import Toggle from 'components/common/Toggle';
2021
import { styled } from 'components/theme';
2122

@@ -46,6 +47,11 @@ const Styled = {
4647
opacity: 0.7;
4748
padding: 0;
4849
`,
50+
OptionsStatus: styled(StatusDot)<{ visible: boolean }>`
51+
margin-left: ${props => (props.visible ? '0' : '10px')} !important;
52+
opacity: ${props => (props.visible ? '1' : '0')};
53+
transition: all 0.5s;
54+
`,
4955
Divider: styled.div`
5056
margin: 15px 0 20px;
5157
border-bottom: 2px solid ${props => props.theme.colors.blue};
@@ -60,7 +66,19 @@ const OrderFormSection: React.FC = () => {
6066
const { l } = usePrefixedTranslation('cmps.pool.OrderFormSection');
6167
const { orderFormView } = useStore();
6268

63-
const { Section, OrderType, Small, Options, OptionsButton, Divider, Actions } = Styled;
69+
const addlOptionsError =
70+
!!orderFormView.minChanSizeError || !!orderFormView.feeRateError;
71+
72+
const {
73+
Section,
74+
OrderType,
75+
Small,
76+
Options,
77+
OptionsButton,
78+
OptionsStatus,
79+
Divider,
80+
Actions,
81+
} = Styled;
6482
return (
6583
<Section>
6684
<Scrollable>
@@ -141,6 +159,10 @@ const OrderFormSection: React.FC = () => {
141159
<OptionsButton ghost borderless compact onClick={orderFormView.toggleAddlOptions}>
142160
{orderFormView.addlOptionsVisible ? <ChevronUp /> : <ChevronDown />}
143161
{orderFormView.addlOptionsVisible ? l('hideOptions') : l('viewOptions')}
162+
<OptionsStatus
163+
status="error"
164+
visible={!orderFormView.addlOptionsVisible && addlOptionsError}
165+
/>
144166
</OptionsButton>
145167
<Divider />
146168
<SummaryItem>

0 commit comments

Comments
 (0)