Skip to content

Commit

Permalink
Merge pull request #499 from tzConnectBerlin/release/0.7.1
Browse files Browse the repository at this point in the history
release/0.7.1
  • Loading branch information
shekhar-shubhendu authored Aug 24, 2021
2 parents e1b857d + ec2d8c9 commit c64c21d
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prediction-market-ui",
"version": "0.7.0",
"version": "0.7.1",
"private": false,
"license": "MIT",
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions src/api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,12 @@ export const getClosedMarkets = (markets: Market[]): Market[] =>

const byOperationGroupNumber = R.descend(R.path(['txContext', 'operationGroupNumber']));
const byContentNumber = R.descend(R.path(['txContext', 'contentNumber']));
const byOperationNumber = R.descend(R.path(['txContext', 'operationNumber']));
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
export const orderByTxContext = (data: T): T =>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
R.sortWith([byOperationGroupNumber, byOperationNumber, byContentNumber])(data);
R.sortWith([byOperationGroupNumber, byContentNumber])(data);

export const toMarket = async (
graphMarket: GraphMarket,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const CloseOpenMarketCard: React.FC<CloseOpenMarketProps> = ({
});
} catch (error) {
logError(error);
const errorText = error?.data[1]?.with?.string || t('txFailed');
const errorText = error?.description || error?.data?.[1]?.with?.string || t('txFailed');
addToast(errorText, {
appearance: 'error',
autoDismiss: true,
Expand All @@ -78,7 +78,7 @@ export const CloseOpenMarketCard: React.FC<CloseOpenMarketProps> = ({
});
} catch (error) {
logError(error);
const errorText = error?.data[1]?.with?.string || t('txFailed');
const errorText = error?.description || error?.data?.[1]?.with?.string || t('txFailed');
addToast(errorText, {
appearance: 'error',
autoDismiss: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Grid, useTheme } from '@material-ui/core';
import { Typography } from '../../atoms/Typography';
import { PaperWrapperStyled } from '../PortfolioTable/PortfolioTable';
import { CURRENCY_SYMBOL } from '../../../globals';
import { roundToTwo } from '../../../utils/math';

export type Position = {
type?: string;
Expand All @@ -26,7 +27,7 @@ export const PortfolioSummary: React.FC<PortfolioSummaryProps> = ({
const totalValue = React.useMemo(() => {
return positions.reduce(
(prev, curr) => ({
value: prev.value + curr.value,
value: roundToTwo(prev.value + curr.value),
weekly:
curr.weekly && typeof curr.weekly === 'number'
? prev.weekly ?? 0 + curr.weekly
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AuctionPage/AuctionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export const AuctionPageComponent: React.FC<AuctionPageProps> = ({ market }) =>
}
} catch (error) {
logError(error);
const errorText = error?.data[1]?.with?.string || t('txFailed');
const errorText = error?.description || error?.data?.[1]?.with?.string || t('txFailed');
addToast(errorText, {
appearance: 'error',
autoDismiss: true,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/CreateMarketPage/CreateMarketPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const CreateMarketPageComponent: React.FC<CreateMarketPageProps> = ({ t }) => {
setIconURL('');
} catch (error) {
logError(error);
const errorText = error?.data[1]?.with?.string || t('txFailed');
const errorText = error?.description || error?.data?.[1]?.with?.string || t('txFailed');
addToast(errorText, {
appearance: 'error',
autoDismiss: true,
Expand Down
6 changes: 3 additions & 3 deletions src/pages/MarketPage/MarketPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export const MarketPageComponent: React.FC<MarketPageProps> = ({ market }) => {
helpers.resetForm();
} catch (error) {
logError(error);
const errorText = error?.data[1]?.with?.string || t('txFailed');
const errorText = error?.description || error?.data?.[1]?.with?.string || t('txFailed');
addToast(errorText, {
appearance: 'error',
autoDismiss: true,
Expand Down Expand Up @@ -276,7 +276,7 @@ export const MarketPageComponent: React.FC<MarketPageProps> = ({ market }) => {
helpers.resetForm();
} catch (error) {
logError(error);
const errorText = error?.data[1]?.with?.string || t('txFailed');
const errorText = error?.description || error?.data?.[1]?.with?.string || t('txFailed');
addToast(errorText, {
appearance: 'error',
autoDismiss: true,
Expand All @@ -300,7 +300,7 @@ export const MarketPageComponent: React.FC<MarketPageProps> = ({ market }) => {
}
} catch (error) {
logError(error);
const errorText = error?.data?.[1]?.with?.string || t('txFailed');
const errorText = error?.description || error?.data?.[1]?.with?.string || t('txFailed');
addToast(errorText, {
appearance: 'error',
autoDismiss: true,
Expand Down
10 changes: 5 additions & 5 deletions src/pages/PortfolioPage/PortfolioPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const PortfolioPageComponent: React.FC<PortfolioPageProps> = ({ t }) => {
}
} catch (error) {
logError(error);
const errorText = error?.data?.[1]?.with?.string || t('txFailed');
const errorText = error?.description || error?.data?.[1]?.with?.string || t('txFailed');
addToast(errorText, {
appearance: 'error',
autoDismiss: true,
Expand All @@ -92,7 +92,7 @@ export const PortfolioPageComponent: React.FC<PortfolioPageProps> = ({ t }) => {
getMarketLocalStorage(true, marketId, 'portfolio', 'true');
} catch (error) {
logError(error);
const errorText = error?.data?.[1]?.with?.string || t('txFailed');
const errorText = error?.description || error?.data?.[1]?.with?.string || t('txFailed');
addToast(errorText, {
appearance: 'error',
autoDismiss: true,
Expand Down Expand Up @@ -262,7 +262,7 @@ export const PortfolioPageComponent: React.FC<PortfolioPageProps> = ({ t }) => {
});
return MarketRowList;
},
[activeAccount, t, ledgers, getMarketLocalStorage],
[activeAccount, t, ledgers, allBets],
);

const setAuctionRows = React.useCallback(
Expand Down Expand Up @@ -290,7 +290,7 @@ export const PortfolioPageComponent: React.FC<PortfolioPageProps> = ({ t }) => {
handleClick: () => history.push(`/market/${item.marketId}/${cardLink}`),
rowAction:
(role === Role.participant || Role.adjudicator) &&
(status === 'Active' || 'Closed') &&
(status === 'Active' || status === 'Closed') &&
!getMarketLocalStorage(false, item.marketId, 'portfolio') &&
isAuctionParticipant(item.marketId, allBets)
? {
Expand All @@ -310,7 +310,7 @@ export const PortfolioPageComponent: React.FC<PortfolioPageProps> = ({ t }) => {
});
return AuctionRowList;
},
[activeAccount, t, allBets, getMarketLocalStorage],
[activeAccount, t, allBets],
);

useEffect(() => {
Expand Down

1 comment on commit c64c21d

@vercel
Copy link

@vercel vercel bot commented on c64c21d Aug 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.