Skip to content

Commit ad4a67b

Browse files
committed
swaps: add Loop type (in/out) to Processing Loops section
1 parent 863376a commit ad4a67b

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

app/src/__tests__/components/loop/ProcessingSwaps.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ describe('ProcessingSwaps component', () => {
4949
const swap = addSwap(LOOP_IN, INITIATED);
5050
expect(getByText('dot.svg')).toHaveClass('warn');
5151
expect(getByText(swap.ellipsedId)).toBeInTheDocument();
52+
expect(getByText(swap.typeName)).toBeInTheDocument();
5253
expect(getByTitle(swap.stateLabel)).toBeInTheDocument();
5354
expect(width(getByTitle(swap.stateLabel))).toBe('25%');
5455
});
@@ -58,6 +59,7 @@ describe('ProcessingSwaps component', () => {
5859
const swap = addSwap(LOOP_IN, HTLC_PUBLISHED);
5960
expect(getByText('dot.svg')).toHaveClass('warn');
6061
expect(getByText(swap.ellipsedId)).toBeInTheDocument();
62+
expect(getByText(swap.typeName)).toBeInTheDocument();
6163
expect(getByTitle(swap.stateLabel)).toBeInTheDocument();
6264
expect(width(getByTitle(swap.stateLabel))).toBe('50%');
6365
});
@@ -67,6 +69,7 @@ describe('ProcessingSwaps component', () => {
6769
const swap = addSwap(LOOP_IN, INVOICE_SETTLED);
6870
expect(getByText('dot.svg')).toHaveClass('warn');
6971
expect(getByText(swap.ellipsedId)).toBeInTheDocument();
72+
expect(getByText(swap.typeName)).toBeInTheDocument();
7073
expect(getByTitle(swap.stateLabel)).toBeInTheDocument();
7174
expect(width(getByTitle(swap.stateLabel))).toBe('75%');
7275
});
@@ -75,6 +78,7 @@ describe('ProcessingSwaps component', () => {
7578
const { getByText, getByTitle } = render();
7679
const swap = addSwap(LOOP_IN, SUCCESS);
7780
expect(getByText(swap.ellipsedId)).toBeInTheDocument();
81+
expect(getByText(swap.typeName)).toBeInTheDocument();
7882
expect(getByTitle(swap.stateLabel)).toBeInTheDocument();
7983
expect(width(getByTitle(swap.stateLabel))).toBe('100%');
8084
});
@@ -92,6 +96,7 @@ describe('ProcessingSwaps component', () => {
9296
const swap = addSwap(LOOP_OUT, INITIATED);
9397
expect(getByText('dot.svg')).toHaveClass('warn');
9498
expect(getByText(swap.ellipsedId)).toBeInTheDocument();
99+
expect(getByText(swap.typeName)).toBeInTheDocument();
95100
expect(getByTitle(swap.stateLabel)).toBeInTheDocument();
96101
expect(width(getByTitle(swap.stateLabel))).toBe('33%');
97102
});
@@ -101,6 +106,7 @@ describe('ProcessingSwaps component', () => {
101106
const swap = addSwap(LOOP_OUT, PREIMAGE_REVEALED);
102107
expect(getByText('dot.svg')).toHaveClass('warn');
103108
expect(getByText(swap.ellipsedId)).toBeInTheDocument();
109+
expect(getByText(swap.typeName)).toBeInTheDocument();
104110
expect(getByTitle(swap.stateLabel)).toBeInTheDocument();
105111
expect(width(getByTitle(swap.stateLabel))).toBe('66%');
106112
});
@@ -110,6 +116,7 @@ describe('ProcessingSwaps component', () => {
110116
const swap = addSwap(LOOP_OUT, SUCCESS);
111117
expect(getByText('dot.svg')).toHaveClass('success');
112118
expect(getByText(swap.ellipsedId)).toBeInTheDocument();
119+
expect(getByText(swap.typeName)).toBeInTheDocument();
113120
expect(getByTitle(swap.stateLabel)).toBeInTheDocument();
114121
expect(width(getByTitle(swap.stateLabel))).toBe('100%');
115122
});

app/src/components/loop/processing/SwapProgress.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ const Styled = {
3333
border-radius: 2px;
3434
`,
3535
Status: styled.div<{ pct: number }>`
36+
display: flex;
37+
justify-content: space-between;
3638
width: ${props => props.pct}%;
3739
text-align: right;
3840
font-size: ${props => props.theme.sizes.xs};
3941
transition: all 1s;
42+
43+
> span:first-of-type {
44+
color: ${props => props.theme.colors.gray};
45+
}
4046
`,
4147
Fill: styled.div<{ state: number; pct: number }>`
4248
height: 1px;
@@ -58,7 +64,10 @@ const SwapProgress: React.FC<Props> = ({ swap }) => {
5864
const { Wrapper, Status, Track, Fill } = Styled;
5965
return (
6066
<Wrapper>
61-
<Status pct={pct}>{swap.stateLabel}</Status>
67+
<Status pct={pct}>
68+
<span>{swap.typeName}</span>
69+
<span>{swap.stateLabel}</span>
70+
</Status>
6271
<Track>
6372
<Fill state={swap.state} pct={pct} title={swap.stateLabel} />
6473
</Track>

0 commit comments

Comments
 (0)