Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit 07848ed

Browse files
authored
Merge pull request #373 from autonomoussoftware/fix-converter-coming-soon
Fix converter screen incorrectly displaying "Coming soon" message when wallet falls into "offline" status
2 parents 2df5f2a + db4dd18 commit 07848ed

File tree

1 file changed

+86
-82
lines changed

1 file changed

+86
-82
lines changed

src/components/Converter.js

Lines changed: 86 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -160,92 +160,96 @@ class Converter extends React.Component {
160160
data-testid="converter-container"
161161
title="Autonomous Converter"
162162
>
163-
{converterStatus ? (convertFeatureStatus === 'ok' ? (
164-
<Container>
165-
<StatsContainer data-testid="stats">
166-
<Sp p={2}>
167-
<Flex.Row justify="space-between" align="baseline">
168-
<Label>Current Price</Label>
169-
<Flex.Column>
170-
<Flex.Row align="baseline">
171-
<Badge>1 MET</Badge>
172-
<Price>
173-
<DisplayValue
174-
maxSize="inherit"
175-
pre=" = "
176-
value={converterStatus.currentPrice}
177-
post=" ETH"
178-
/>
179-
</Price>
180-
</Flex.Row>
181-
<USDPrice>{converterPriceUSD}</USDPrice>
182-
</Flex.Column>
183-
</Flex.Row>
184-
</Sp>
185-
<Sp p={2}>
186-
<Flex.Row justify="space-between" align="baseline">
187-
<Label>Available MET</Label>
188-
<AvailableAmount>
189-
<DisplayValue
190-
maxSize="inherit"
191-
value={converterStatus.availableMtn}
192-
post=" MET"
193-
/>
194-
</AvailableAmount>
195-
</Flex.Row>
196-
</Sp>
197-
<Sp p={2}>
198-
<Flex.Row justify="space-between" align="baseline">
199-
<Label>Available ETH</Label>
200-
<AvailableAmount>
201-
<DisplayValue
202-
maxSize="inherit"
203-
value={converterStatus.availableEth}
204-
post=" ETH"
205-
/>
206-
</AvailableAmount>
207-
</Flex.Row>
208-
</Sp>
209-
</StatsContainer>
163+
{converterStatus ? (
164+
convertFeatureStatus !== 'transfer-disabled' ? (
165+
<Container>
166+
<StatsContainer data-testid="stats">
167+
<Sp p={2}>
168+
<Flex.Row justify="space-between" align="baseline">
169+
<Label>Current Price</Label>
170+
<Flex.Column>
171+
<Flex.Row align="baseline">
172+
<Badge>1 MET</Badge>
173+
<Price>
174+
<DisplayValue
175+
maxSize="inherit"
176+
pre=" = "
177+
value={converterStatus.currentPrice}
178+
post=" ETH"
179+
/>
180+
</Price>
181+
</Flex.Row>
182+
<USDPrice>{converterPriceUSD}</USDPrice>
183+
</Flex.Column>
184+
</Flex.Row>
185+
</Sp>
186+
<Sp p={2}>
187+
<Flex.Row justify="space-between" align="baseline">
188+
<Label>Available MET</Label>
189+
<AvailableAmount>
190+
<DisplayValue
191+
maxSize="inherit"
192+
value={converterStatus.availableMtn}
193+
post=" MET"
194+
/>
195+
</AvailableAmount>
196+
</Flex.Row>
197+
</Sp>
198+
<Sp p={2}>
199+
<Flex.Row justify="space-between" align="baseline">
200+
<Label>Available ETH</Label>
201+
<AvailableAmount>
202+
<DisplayValue
203+
maxSize="inherit"
204+
value={converterStatus.availableEth}
205+
post=" ETH"
206+
/>
207+
</AvailableAmount>
208+
</Flex.Row>
209+
</Sp>
210+
</StatsContainer>
210211

211-
<ConvertBtn
212-
data-disabled={convertFeatureStatus !== 'ok' ? true : null}
213-
data-rh-negative
214-
data-rh={
215-
convertFeatureStatus === 'offline'
216-
? "Can't convert while offline"
217-
: convertFeatureStatus === 'in-initial-auction'
218-
? 'Conversions are disabled during Initial Auction'
219-
: convertFeatureStatus === 'transfer-disabled'
220-
? 'MET conversions not enabled yet'
212+
<ConvertBtn
213+
data-disabled={convertFeatureStatus !== 'ok' ? true : null}
214+
data-rh-negative
215+
data-rh={
216+
convertFeatureStatus === 'offline'
217+
? "Can't convert while offline"
218+
: convertFeatureStatus === 'in-initial-auction'
219+
? 'Conversions are disabled during Initial Auction'
221220
: null
222-
}
223-
data-modal="convert"
224-
data-testid="convert-btn"
225-
onClick={convertFeatureStatus === 'ok' ? this.onOpenModal : null}
226-
>
227-
Convert
228-
</ConvertBtn>
221+
}
222+
data-modal="convert"
223+
data-testid="convert-btn"
224+
onClick={
225+
convertFeatureStatus === 'ok' ? this.onOpenModal : null
226+
}
227+
>
228+
Convert
229+
</ConvertBtn>
229230

230-
<ConvertDrawer
231-
onRequestClose={this.onCloseModal}
232-
isOpen={this.state.activeModal === 'convert'}
233-
/>
234-
</Container>
235-
) : <Sp p={6}>
236-
<LoadingContainer data-testid="waiting">
237-
<Sp py={4}>
238-
<ConverterIcon display='inline' size='69.5px' />
239-
</Sp>
240-
<Title>Coming Soon</Title>
241-
<Sp py={2}>
242-
<SmallText>
243-
The Autonomous Converter will become available after the initial
244-
auction has ended.
245-
</SmallText>
231+
<ConvertDrawer
232+
onRequestClose={this.onCloseModal}
233+
isOpen={this.state.activeModal === 'convert'}
234+
/>
235+
</Container>
236+
) : (
237+
<Sp p={6}>
238+
<LoadingContainer data-testid="waiting">
239+
<Sp py={4}>
240+
<ConverterIcon display="inline" size="69.5px" />
241+
</Sp>
242+
<Title>Coming Soon</Title>
243+
<Sp py={2}>
244+
<SmallText>
245+
The Autonomous Converter will become available after the
246+
initial auction has ended.
247+
</SmallText>
248+
</Sp>
249+
</LoadingContainer>
246250
</Sp>
247-
</LoadingContainer>
248-
</Sp>) : (
251+
)
252+
) : (
249253
<Sp p={6}>
250254
<LoadingContainer data-testid="waiting">
251255
<Text>Waiting for converter status...</Text>

0 commit comments

Comments
 (0)