Skip to content

Commit

Permalink
Merge pull request #749 from yieldprotocol/bugfix/StrategyNaming
Browse files Browse the repository at this point in the history
bugfix/StrategyNaming
  • Loading branch information
brucedonovan authored Jan 5, 2022
2 parents 2ed9ea5 + 187de28 commit 8013201
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/components/positionItems/StrategyItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { Box, Text } from 'grommet';

import { ActionType, ISeries, IStrategy, IUserContext, IUserContextActions, IUserContextState } from '../../types';
import { UserContext } from '../../contexts/UserContext';
import { cleanValue, nFormatter } from '../../utils/appUtils';
import { cleanValue, formatStrategyName, nFormatter } from '../../utils/appUtils';
import PositionAvatar from '../PositionAvatar';
import ItemWrap from '../wraps/ItemWrap';
import SkeletonWrap from '../wraps/SkeletonWrap';
import { Strategy } from '../../contracts';

function StrategyItem({ strategy, index, condensed }: { strategy: IStrategy; index: number; condensed?: boolean }) {
const history = useHistory();
Expand All @@ -34,8 +35,9 @@ function StrategyItem({ strategy, index, condensed }: { strategy: IStrategy; ind
<PositionAvatar position={strategy.currentSeries!} condensed={condensed} actionType={ActionType.POOL} />
<Box fill={condensed ? 'horizontal' : undefined} justify={condensed ? 'between' : undefined}>
<Text weight={900} size="small">
{strategy.name}
{formatStrategyName(strategy.name)}
</Text>
<Text size='xsmall'> Rolling: { strategy.currentSeries?.fullDate} </Text>
<Box direction="row" gap="medium">
<Box gap="xxsmall" direction={condensed ? 'row' : undefined}>
<Text weight={450} size="xsmall">
Expand Down
5 changes: 2 additions & 3 deletions src/utils/appUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,8 @@ export const getSeriesAfterRollPosition = (receipt: any, seriesMap: any) => {
};

export const formatStrategyName = (name: string) => {
const name_ = name.toLowerCase();
const timeFrame = name_.slice(-2) === 'q2' ? '3 Month' : '6 Month';
return `${timeFrame}`;
const name_ = name.slice(6, 22);
return `${name_}`;
};

export const getStrategySymbol = (name: string) => name.slice(2).slice(0, -2);
Expand Down
13 changes: 10 additions & 3 deletions src/views/PoolPosition.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useContext, useState, useEffect } from 'react';
import { Box, CheckBox, ResponsiveContext, Select, Text, TextInput } from 'grommet';
import { useHistory, useParams } from 'react-router-dom';
import { FiArrowRight, FiPercent, FiSlash } from 'react-icons/fi';
import { FiArrowRight, FiClock, FiPercent, FiSlash } from 'react-icons/fi';

import ActionButtonGroup from '../components/wraps/ActionButtonWrap';
import InputWrap from '../components/wraps/InputWrap';
import { abbreviateHash, cleanValue, nFormatter } from '../utils/appUtils';
import { abbreviateHash, cleanValue, formatStrategyName, nFormatter } from '../utils/appUtils';
import SectionWrap from '../components/wraps/SectionWrap';

import { UserContext } from '../contexts/UserContext';
Expand Down Expand Up @@ -147,7 +147,7 @@ const PoolPosition = () => {
<Box direction="row" align="center" gap="medium">
<PositionAvatar position={selectedSeries!} actionType={ActionType.POOL} />
<Box>
<Text size={mobile ? 'medium' : 'large'}> {_selectedStrategy?.name} </Text>
<Text size={mobile ? 'medium' : 'large'}> {formatStrategyName(_selectedStrategy?.name)}</Text>
<CopyWrap hash={_selectedStrategy.address}>
<Text size="small"> {abbreviateHash(_selectedStrategy.address!, 6)}</Text>
</CopyWrap>
Expand All @@ -158,6 +158,13 @@ const PoolPosition = () => {

<SectionWrap>
<Box gap="small">
<InfoBite
label="Next Roll Date"
value={_selectedStrategy?.currentSeries?.fullDate.toString()!}
icon={<FiClock height="1em" />}
loading={seriesLoading}
/>

<InfoBite
label="Strategy Token Balance"
value={cleanValue(_selectedStrategy?.accountBalance_, selectedBase?.digitFormat!)}
Expand Down

0 comments on commit 8013201

Please sign in to comment.