Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Delegate modal dialog #3573

Merged
merged 10 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
24 changes: 21 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,21 @@ export default function SwapOrdersPage(props: StoresAndActionsProps): Node {
.map(c => resolveValueOrGetter(c.width ?? 'auto', columnContext))
.join(' ');

const isOpenOrdersEmpty = openOrders?.length === 0 && !showCompletedOrders;
const isCompleteOrdersEmpty = completedOrders?.length === 0 && showCompletedOrders;

const handleColumnNames = () => {
if (isOpenOrdersEmpty) {
return [];
}
if (isCompleteOrdersEmpty) {
return [];
}
return columnNames;
};

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

<Table
columnKeys={columnKeys}
columnNames={columnNames}
columnNames={handleColumnNames()}
columnAlignment={columnAlignment}
columnLeftPaddings={columnLeftPaddings}
gridTemplateColumns={gridTemplateColumns}
Expand Down Expand Up @@ -447,7 +463,9 @@ export default function SwapOrdersPage(props: StoresAndActionsProps): Node {
hwWalletError={null}
/>
)}
</>
{isOpenOrdersEmpty && <NoOpenOrders />}
{isCompleteOrdersEmpty && <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
Loading