Skip to content

Commit

Permalink
fix: feedback round 2
Browse files Browse the repository at this point in the history
- label capitalization
- update options in trailing options
- add tooltip for price tolerance
  • Loading branch information
toniocodo committed Oct 1, 2023
1 parent 44e81fb commit cce0971
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
2 changes: 1 addition & 1 deletion libs/oeth/history/src/components/APYContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function APYContainer() {
<Divider orientation="vertical" flexItem />
<ValueContainer
label={intl.formatMessage({
defaultMessage: 'Lifetime earnings (OETH)',
defaultMessage: 'Lifetime Earnings (OETH)',
})}
value={intl.formatNumber(
earnings?.addressById?.earned ?? 0,
Expand Down
2 changes: 1 addition & 1 deletion libs/oeth/history/src/components/HistoryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function HistoryCard() {
justifyContent="space-between"
>
<Typography>
{intl.formatMessage({ defaultMessage: 'OETH transactions' })}
{intl.formatMessage({ defaultMessage: 'OETH Transactions' })}
</Typography>
<Stack direction="row" gap={1}>
<HistoryFilters
Expand Down
14 changes: 12 additions & 2 deletions libs/oeth/shared/src/components/GasPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
Stack,
useTheme,
} from '@mui/material';
import { PercentInput } from '@origin/shared/components';
import { InfoTooltip, PercentInput } from '@origin/shared/components';
import { useIntl } from 'react-intl';
import { useFeeData } from 'wagmi';

Expand Down Expand Up @@ -89,8 +89,18 @@ export function GasPopover({
>
<Stack gap={1}>
<FormControl variant="standard">
<InputLabel htmlFor="slippage" shrink>
<InputLabel
htmlFor="slippage"
shrink
sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}
>
{intl.formatMessage({ defaultMessage: 'Price Tolerance' })}
<InfoTooltip
tooltipLabel={intl.formatMessage({
defaultMessage:
'Your transaction will revert if the price changes unfavorably by more than this percentage.',
})}
/>
</InputLabel>
<Box sx={gridStyles}>
<Stack direction="row" gap={2}>
Expand Down
28 changes: 15 additions & 13 deletions libs/oeth/swap/src/components/ApyHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,21 @@ export const ApyHeader = (props: StackProps) => {
}}
MenuListProps={{ dense: true }}
>
{trailingOptions.map((t) => (
<MenuItem
divider
key={t.value}
selected={trailing.value === t.value}
onClick={() => {
setTrailing(t);
setAnchorEl(null);
}}
>
{intl.formatMessage(t.label)}
</MenuItem>
))}
{trailingOptions
.filter((t) => t.value !== trailing.value)
.map((t) => (
<MenuItem
divider
key={t.value}
selected={trailing.value === t.value}
onClick={() => {
setTrailing(t);
setAnchorEl(null);
}}
>
{intl.formatMessage(t.label)}
</MenuItem>
))}
</Menu>
</Stack>
</Paper>
Expand Down
8 changes: 7 additions & 1 deletion libs/shared/components/src/InfoTooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Box, Tooltip, Typography } from '@mui/material';

import type { BoxProps } from '@mui/material';

export type InfoTooltipProps = {
tooltipLabel: string;
iconSize?: number;
iconColor?: string;
};
} & BoxProps;

export function InfoTooltip({
tooltipLabel,
iconSize = 12,
iconColor = 'text.secondary',
...rest
}: InfoTooltipProps) {
return (
<Tooltip
Expand All @@ -20,13 +23,16 @@ export function InfoTooltip({
}
>
<Box
{...rest}
component="img"
src="/images/info.svg"
data-testid="swap-route-info"
sx={{
width: (theme) => theme.typography.pxToRem(iconSize),
height: (theme) => theme.typography.pxToRem(iconSize),
color: iconColor,

...rest?.sx,
}}
></Box>
</Tooltip>
Expand Down

0 comments on commit cce0971

Please sign in to comment.