Skip to content

Commit 39ae2db

Browse files
committed
swap: update "x channels selected" label
1 parent f9006fb commit 39ae2db

File tree

4 files changed

+53
-14
lines changed

4 files changed

+53
-14
lines changed

app/src/components/loop/LoopActions.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@ import { SwapDirection } from 'types/state';
44
import { usePrefixedTranslation } from 'hooks';
55
import { formatSats } from 'util/formatters';
66
import { useStore } from 'store';
7-
import { Button, Close, Pill, Refresh } from 'components/base';
7+
import { Button, Close, Refresh } from 'components/base';
88
import { styled } from 'components/theme';
9+
import SelectedChannels from './SelectedChannels';
910

1011
const Styled = {
1112
Wrapper: styled.section`
1213
margin: 50px 0;
1314
`,
1415
Actions: styled.div`
16+
display: flex;
17+
align-items: center;
1518
margin-top: -15px;
1619
`,
1720
ActionBar: styled.div`
18-
display: inline-block;
21+
display: flex;
22+
align-items: center;
1923
width: 595px;
2024
padding: 15px;
2125
background-color: ${props => props.theme.colors.darkBlue};
@@ -30,9 +34,8 @@ const Styled = {
3034
CloseIcon: styled(Close)`
3135
margin-right: 25px;
3236
`,
33-
Selected: styled.span`
34-
display: inline-block;
35-
margin-right: 50px;
37+
Selected: styled(SelectedChannels)`
38+
flex: 1;
3639
`,
3740
Note: styled.span`
3841
display: inline-block;
@@ -64,8 +67,7 @@ const LoopActions: React.FC = () => {
6467
<Actions>
6568
<ActionBar>
6669
<CloseIcon onClick={buildSwapStore.cancel} />
67-
<Pill>{selectedCount}</Pill>
68-
<Selected>{l('channelsSelected')}</Selected>
70+
<Selected count={selectedCount} />
6971
<Button
7072
primary={loopOutAllowed && inferredDirection === SwapDirection.OUT}
7173
borderless
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from 'react';
2+
import { usePrefixedTranslation } from 'hooks';
3+
import { Pill } from 'components/base';
4+
import { styled } from 'components/theme';
5+
6+
const Styled = {
7+
Wrapper: styled.span`
8+
/* display: flex;
9+
justify-content: center; */
10+
`,
11+
};
12+
13+
interface Props {
14+
count: number;
15+
className?: string;
16+
}
17+
18+
const SelectedChannels: React.FC<Props> = ({ count, className }) => {
19+
const { l } = usePrefixedTranslation('cmps.loop.SelectedChannels');
20+
21+
const label =
22+
count === 0
23+
? l('useAnyChannel')
24+
: count === 1
25+
? l('channelSelected')
26+
: l('channelsSelected');
27+
28+
const { Wrapper } = Styled;
29+
return (
30+
<Wrapper className={className}>
31+
{count > 0 && <Pill>{count}</Pill>}
32+
<span>{label}</span>
33+
</Wrapper>
34+
);
35+
};
36+
37+
export default SelectedChannels;

app/src/components/loop/swap/StepSummary.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'react';
2-
import { usePrefixedTranslation } from 'hooks';
2+
33
import { useStore } from 'store';
4-
import { HeaderFive, HeaderFour, Pill, Small } from 'components/base';
4+
import { HeaderFive, HeaderFour, Small } from 'components/base';
55
import { styled } from 'components/theme';
6+
import SelectedChannels from '../SelectedChannels';
67

78
const Styled = {
89
Wrapper: styled.div`
@@ -27,7 +28,6 @@ interface Props {
2728
}
2829

2930
const StepSummary: React.FC<Props> = ({ title, heading, description }) => {
30-
const { l } = usePrefixedTranslation('cmps.loop.swap.StepSummary');
3131
const { buildSwapStore } = useStore();
3232

3333
const { Wrapper, Description } = Styled;
@@ -39,8 +39,7 @@ const StepSummary: React.FC<Props> = ({ title, heading, description }) => {
3939
<Description>{description}</Description>
4040
</div>
4141
<div>
42-
<Pill>{buildSwapStore.selectedChanIds.length}</Pill>
43-
{l('channelsSelected')}
42+
<SelectedChannels count={buildSwapStore.selectedChanIds.length} />
4443
</div>
4544
</Wrapper>
4645
);

app/src/i18n/locales/en-US.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
"cmps.loop.ChannelRowHeader.upTime": "Up Time %",
2727
"cmps.loop.ChannelRowHeader.peer": "Peer/Alias",
2828
"cmps.loop.ChannelRowHeader.capacity": "Capacity",
29-
"cmps.loop.LoopActions.channelsSelected": "channels selected",
29+
"cmps.loop.SelectedChannels.channelSelected": "channel selected",
30+
"cmps.loop.SelectedChannels.channelsSelected": "channels selected",
31+
"cmps.loop.SelectedChannels.useAnyChannel": "Automatic channel selection",
3032
"cmps.loop.LoopActions.loopMinimumNote": "Minimum Loop amount is {{min}}",
3133
"cmps.loop.LoopActions.loopInNote": "For multi Loop In, all channels must use the same peer.",
3234
"cmps.loop.LoopPage.pageTitle": "Lightning Loop",
@@ -41,7 +43,6 @@
4143
"cmps.loop.swap.StepButtons.cancel": "Cancel",
4244
"cmps.loop.swap.StepButtons.next": "Next",
4345
"cmps.loop.swap.StepButtons.confirm": "Confirm",
44-
"cmps.loop.swap.StepSummary.channelsSelected": "channels selected",
4546
"cmps.loop.swap.SwapConfigStep.title": "Step 1 of 2",
4647
"cmps.loop.swap.SwapConfigStep.heading": "Set Liquidity Parameters",
4748
"cmps.loop.swap.SwapConfigStep.description": "Use the slider to prevent errors receiving or forwarding payments on the channels selected below.",

0 commit comments

Comments
 (0)