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]: Disable avg price for now due to too many network calls #77

Merged
merged 1 commit into from
Nov 5, 2022
Merged
Changes from all 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
48 changes: 24 additions & 24 deletions src/component/PositionCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ArrowRightIcon, RepeatIcon } from '@chakra-ui/icons';
import { ArrowRightIcon } from '@chakra-ui/icons';
import { Text, Box, HStack, Image, Skeleton, Progress, useDisclosure } from '@chakra-ui/react';
import { findVaultPeriodPubkey } from '@dcaf-labs/drip-sdk';
import { useMemo, useState } from 'react';
import { useMemo } from 'react';
import styled from 'styled-components';
import { useAsyncMemo } from 'use-async-memo';
import { useDripContext } from '../contexts/DripContext';
Expand All @@ -14,13 +14,13 @@ import { formatDate } from '../utils/date';
import { explainGranularity } from '../utils/granularity';
import { formatTokenAmount } from '../utils/token-amount';
import { Device } from '../utils/ui/css';
import { AverageDripPrice } from './AveragePrice';
// import { AverageDripPrice } from './AveragePrice';
import { PositionModal } from './PositionModal';

export function PositionCard({ position }: PositionCardProps) {
const drip = useDripContext();

const [isPriceFlipped, setIsPriceFlipped] = useState(false);
// const [isPriceFlipped, setIsPriceFlipped] = useState(false);

const [vault] =
useAsyncMemo(async () => drip?.querier.fetchVaultAccounts(position.vault), [drip, position]) ??
Expand Down Expand Up @@ -145,14 +145,14 @@ export function PositionCard({ position }: PositionCardProps) {
<Skeleton h="20px" w="100px" />
)}
</StyledDataRow>
<StyledDataRow>
{/* <StyledDataRow>
<StyledDataRowLeft>
<StyledDataKey>Avg. Price</StyledDataKey>
<RepeatIcon
onClick={(e) => {
e.stopPropagation();
setIsPriceFlipped((isFlipped) => !isFlipped);
}}
// onClick={(e) => {
// e.stopPropagation();
// setIsPriceFlipped((isFlipped) => !isFlipped);
// }}
_hover={{
color: 'rgba(255, 255, 255, 0.8)',
transition: '0.2s ease'
Expand All @@ -172,7 +172,7 @@ export function PositionCard({ position }: PositionCardProps) {
tokenBInfo={tokenBInfo}
/>
</StyledDataRowRight>
</StyledDataRow>
</StyledDataRow> */}
</StyledBodyContainer>
<StyledFooterContainer>
<Progress
Expand Down Expand Up @@ -281,21 +281,21 @@ const StyledDataRow = styled(Box)`
margin-top: 10px;
`;

const StyledDataRowLeft = styled(Box)`
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
margin-top: 10px;
`;
// const StyledDataRowLeft = styled(Box)`
// display: flex;
// flex-direction: row;
// justify-content: flex-start;
// align-items: center;
// margin-top: 10px;
// `;

const StyledDataRowRight = styled(Box)`
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: baseline;
margin-top: 10px;
`;
// const StyledDataRowRight = styled(Box)`
// display: flex;
// flex-direction: row;
// justify-content: flex-end;
// align-items: baseline;
// margin-top: 10px;
// `;

const StyledDataKey = styled(Text)`
font-weight: bold;
Expand Down