Skip to content

Commit

Permalink
Fix show non-awarded federation badges
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Aug 17, 2023
1 parent 8c33115 commit 882bd38
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 45 deletions.
77 changes: 33 additions & 44 deletions frontend/src/components/Dialogs/Coordinator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,23 +233,20 @@ const BadgesHall = ({ badges }: BadgesProps): JSX.Element => {
const tooltipProps = { enterTouchDelay: 0, enterNextDelay: 2000 };
return (
<Grid container direction='row' alignItems='center' justifyContent='center' spacing={1}>
{badges?.isFounder !== undefined && (
<Tooltip
{...tooltipProps}
title={
<Typography align='center' variant='body2'>
{t('Founder: coordinating trades since the testnet federation.')}
</Typography>
}
>
<Grid item>
<BadgeFounder sx={sxProps} />
</Grid>
</Tooltip>
)}
<Tooltip
{...tooltipProps}
title={
<Typography align='center' variant='body2'>
{badges?.isFounder ? t('Founder: coordinating trades since the testnet federation.') : t('Not a federation founder')}
</Typography>
}
>
<Grid item sx={{filter: badges?.isFounder !== true ? "grayscale(100%)" : undefined }}>
<BadgeFounder sx={sxProps} />
</Grid>
</Tooltip>

{Number(badges?.donatesToDevFund) > 20 && (
<Tooltip
<Tooltip
{...tooltipProps}
title={
<Typography align='center' variant='body2'>
Expand All @@ -259,58 +256,51 @@ const BadgesHall = ({ badges }: BadgesProps): JSX.Element => {
</Typography>
}
>
<Grid item>
<Grid item sx={{filter: Number(badges?.donatesToDevFund) >= 20 ? undefined : "grayscale(100%)"}}>
<BadgeDevFund sx={sxProps} />
</Grid>
</Tooltip>
)}

{badges?.hasGoodOpSec !== undefined && (
<Tooltip
{...tooltipProps}
title={
<Typography align='center' variant='body2'>
{t(
{badges?.hasGoodOpSec === true ? t(
'Good OpSec: the coordinator follows best practices to protect his and your privacy.',
)}
): t('The privacy practices of this coordinator could improve')}
</Typography>
}
>
<Grid item>
<Grid item sx={{filter: badges?.hasGoodOpSec === true ? undefined : "grayscale(100%)"}}>
<BadgePrivacy sx={sxProps} />
</Grid>
</Tooltip>
)}

{badges?.robotsLove !== undefined && (
<Tooltip
{...tooltipProps}
title={
<Typography align='center' variant='body2'>
{t('Loved by robots: receives positive comments by robots over the internet.')}
</Typography>
}
>
<Grid item>
<BadgeLoved sx={sxProps} />
</Grid>
</Tooltip>
)}
<Tooltip
{...tooltipProps}
title={
<Typography align='center' variant='body2'>
{badges?.robotsLove === true ? t('Loved by robots: receives positive comments by robots over the internet.') : t('The coordinator does not seem to receive exceptional love from robots over the internet')}
</Typography>
}
>
<Grid item sx={{filter: badges?.robotsLove === true ? undefined : "grayscale(100%)"}}>
<BadgeLoved sx={sxProps} />
</Grid>
</Tooltip>

{badges?.hasLargeLimits !== undefined && (
<Tooltip
{...tooltipProps}
title={
<Typography align='center' variant='body2'>
{t('Large limits: the coordinator has large trade limits.')}
{badges?.hasLargeLimits === true ? t('Large limits: the coordinator has large trade limits.') : t('Does not have large trade limits.')}
</Typography>
}
>
<Grid item>
<Grid item sx={{filter: badges?.hasLargeLimits === true ? undefined : "grayscale(100%)"}}>
<BadgeLimits sx={sxProps} />
</Grid>
</Tooltip>
)}
</Grid>
);
};
Expand Down Expand Up @@ -356,8 +346,7 @@ const CoordinatorDialog = ({ open = false, onClose, coordinator, network }: Prop
</Grid>
</ListItem>

{page === 'offers' ||
(page === 'create' && coordinator?.info !== undefined && (
{['offers','order','create'].includes(page) && (
<>
<ListItem {...listItemProps}>
<ListItemIcon>
Expand Down Expand Up @@ -390,7 +379,7 @@ const CoordinatorDialog = ({ open = false, onClose, coordinator, network }: Prop
/>
</ListItem>
</>
))}
)}
<ListItem>
<BadgesHall badges={coordinator?.badges} />
</ListItem>
Expand Down
2 changes: 1 addition & 1 deletion frontend/static/federation.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"clearnet": "http://127.0.0.1:8000"
},
"badges": {
"donatesToDevFund": 20
"donatesToDevFund": 0
},
"mainnet": {
"onion": "",
Expand Down

0 comments on commit 882bd38

Please sign in to comment.