Skip to content

Commit

Permalink
Merge pull request #3573 from Emurgo/sorin/YOEXT-1225/fix-modal
Browse files Browse the repository at this point in the history
fix: Delegate modal dialog
  • Loading branch information
vsubhuman authored Jul 13, 2024
2 parents 4e75be2 + bd636fc commit d5116e7
Show file tree
Hide file tree
Showing 7 changed files with 611 additions and 4 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion packages/yoroi-extension/app/components/swap/SwapInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function SwapInput({
component="fieldset"
sx={{
borderStyle: 'solid',
borderWidth: tokenInfo.id?.length > 0 && error ? '2px' : '1px',
borderWidth: (tokenInfo.id?.length > 0 && error) || focusState.value ? '2px' : '1px',
borderColor: error ? 'magenta.500' : isFocusedColor,
borderRadius: '8px',
p: '16px',
Expand All @@ -88,6 +88,7 @@ export default function SwapInput({
bgcolor: 'common.white',
columnGap: '6px',
rowGap: '8px',
maxHeight: '95px',
'&:hover': {
borderColor: !error && 'grayscale.max',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// @flow

import { Stack, Typography } from '@mui/material';
import { ReactComponent as NoCompleteOders } from '../../../assets/images/revamp/no-complete-orders.inline.svg';
import type { Node } from 'react';

const NoCompleteOrders = (): Node => {
return (
<Stack direction="column" justifyContent="center" alignItems="center" flex={1} pt="98px">
<NoCompleteOders />
<Typography variant="h4" fontWeight="500" color="ds.text_gray_normal" mt="52px" pb="8px">
No orders completed yet
</Typography>
</Stack>
);
};

export default NoCompleteOrders;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// @flow

import { Stack, Typography } from '@mui/material';
import type { Node } from 'react';
import { ReactComponent as NoOpenOders } from '../../../assets/images/revamp/no-open-orders.inline.svg';

const NoOpenOrders = (): Node => {
return (
<Stack direction="column" justifyContent="center" alignItems="center" flex={1} pt="98px">
<NoOpenOders />
<Typography variant="h4" fontWeight="500" color="ds.text_gray_normal" mt="52px" pb="8px">
No orders available yet
</Typography>
<Typography variant="body1" color="ds.text_gray_medium" width="343px" textAlign="center">
Start doing the swap operations to see your open orders here
</Typography>
</Stack>
);
};

export default NoOpenOrders;
15 changes: 12 additions & 3 deletions packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import type { CardanoConnectorSignRequest } from '../../../connector/types';
import { genLookupOrFail } from '../../../stores/stateless/tokenHelpers';
import moment from 'moment';
import { signTransactionHex } from '../../../api/ada/transactions/signTransactionHex';
import NoCompleteOrders from './NoCompleteOrders';
import NoOpenOrders from './NoOpenOrders';

type ColumnContext = {|
completedOrders: boolean,
Expand Down Expand Up @@ -378,8 +380,12 @@ export default function SwapOrdersPage(props: StoresAndActionsProps): Node {
.map(c => resolveValueOrGetter(c.width ?? 'auto', columnContext))
.join(' ');

const isDisplayOpenOrdersEmpty = !showCompletedOrders && openOrders?.length === 0;
const isDisplayCompletedOrdersEmpty = showCompletedOrders && completedOrders?.length === 0;
const safeColumnNames = isDisplayOpenOrdersEmpty || isDisplayCompletedOrdersEmpty ? [] : columnNames;

return (
<>
<Box sx={{ border: '1px solid transparent' }}>
<Box sx={{ mx: '24px' }}>
<Box sx={{ my: '24px' }}>
<Tabs
Expand All @@ -397,9 +403,10 @@ export default function SwapOrdersPage(props: StoresAndActionsProps): Node {
]}
/>
</Box>

<Table
columnKeys={columnKeys}
columnNames={columnNames}
columnNames={safeColumnNames}
columnAlignment={columnAlignment}
columnLeftPaddings={columnLeftPaddings}
gridTemplateColumns={gridTemplateColumns}
Expand Down Expand Up @@ -447,7 +454,9 @@ export default function SwapOrdersPage(props: StoresAndActionsProps): Node {
hwWalletError={null}
/>
)}
</>
{isDisplayOpenOrdersEmpty && <NoOpenOrders />}
{isDisplayCompletedOrdersEmpty && <NoCompleteOrders />}
</Box>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ class CardanoStakingPage extends Component<AllProps, State> {
@observable notificationElementId: string = '';

cancel: void => void = () => {
const selectedWallet = this.props.stores.wallets.selected;
this.props.stores.delegation.setPoolTransitionConfig(selectedWallet, {
shouldUpdatePool: false,
show: 'idle',
});
this.props.actions.ada.delegationTransaction.reset.trigger({ justTransaction: true });
};

async componentWillUnmount() {
this.props.actions.ada.delegationTransaction.reset.trigger({ justTransaction: false });
await this.props.actions.ada.delegationTransaction.setPools.trigger([]);
Expand Down

0 comments on commit d5116e7

Please sign in to comment.