-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
227 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
apps/wallet-mobile/src/features/Swap/useCases/ListOrders/ListOrders.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import {useTheme} from '@yoroi/theme' | ||
import React from 'react' | ||
import {ErrorBoundary} from 'react-error-boundary' | ||
import {StyleSheet, View} from 'react-native' | ||
|
||
import {Boundary} from '../../../../components/Boundary/Boundary' | ||
import {Button, ButtonType} from '../../../../components/Button/Button' | ||
import {useWalletNavigation} from '../../../../kernel/navigation' | ||
import {useSearchOnNavBar} from '../../../Search/SearchContext' | ||
import {ServiceUnavailable} from '../../common/ServiceUnavailable/ServiceUnavailable' | ||
import {useStrings} from '../../common/strings' | ||
// import {CompletedOrders, CompletedOrdersSkeleton} from './CompletedOrders' | ||
// import {OpenOrders, OpenOrdersSkeleton} from './OpenOrders' | ||
// TODO | ||
const CompletedOrders = () => null | ||
const CompletedOrdersSkeleton = () => null | ||
const OpenOrders = () => null | ||
const OpenOrdersSkeleton = () => null | ||
|
||
export const ListOrders = () => { | ||
const {navigateToTxHistory} = useWalletNavigation() | ||
const [filter, setFilter] = React.useState<'open' | 'completed'>('open') | ||
|
||
const strings = useStrings() | ||
const styles = useStyles() | ||
|
||
useSearchOnNavBar({ | ||
placeholder: strings.searchTokens, | ||
title: strings.swapTitle, | ||
isChild: true, | ||
onBack: navigateToTxHistory, | ||
}) | ||
|
||
return ( | ||
<View style={styles.root}> | ||
<View style={styles.group}> | ||
<View> | ||
<Button | ||
onPress={() => setFilter('open')} | ||
type={ButtonType.SecondaryText} | ||
title={strings.openOrders} | ||
size="S" | ||
{...(filter === 'open' && {style: styles.activeButton})} | ||
/> | ||
</View> | ||
|
||
<View> | ||
<Button | ||
onPress={() => setFilter('completed')} | ||
type={ButtonType.SecondaryText} | ||
title={strings.completedOrders} | ||
size="S" | ||
{...(filter === 'completed' && {style: styles.activeButton})} | ||
/> | ||
</View> | ||
</View> | ||
|
||
{filter === 'open' ? ( | ||
<Boundary loading={{fallback: <OpenOrdersSkeleton />}}> | ||
<ErrorBoundary | ||
fallbackRender={({resetErrorBoundary}) => <ServiceUnavailable resetErrorBoundary={resetErrorBoundary} />} | ||
> | ||
<OpenOrders /> | ||
</ErrorBoundary> | ||
</Boundary> | ||
) : ( | ||
<Boundary loading={{fallback: <CompletedOrdersSkeleton />}}> | ||
<ErrorBoundary | ||
fallbackRender={({resetErrorBoundary}) => <ServiceUnavailable resetErrorBoundary={resetErrorBoundary} />} | ||
> | ||
<CompletedOrders /> | ||
</ErrorBoundary> | ||
</Boundary> | ||
)} | ||
</View> | ||
) | ||
} | ||
|
||
const useStyles = () => { | ||
const {color, atoms} = useTheme() | ||
|
||
const styles = StyleSheet.create({ | ||
group: { | ||
...atoms.flex_row, | ||
...atoms.gap_md, | ||
}, | ||
root: { | ||
...atoms.flex_1, | ||
...atoms.justify_between, | ||
...atoms.p_lg, | ||
backgroundColor: color.bg_color_max, | ||
}, | ||
activeButton: { | ||
backgroundColor: color.el_gray_min, | ||
}, | ||
}) | ||
return styles | ||
} |
76 changes: 0 additions & 76 deletions
76
apps/wallet-mobile/src/features/Swap/useCases/ListOrders/ListOrders.tsx_
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.