Skip to content

Commit

Permalink
Add rewards today tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Atatakai authored and Atatakai committed May 28, 2024
1 parent 48d7e81 commit f55dae4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
50 changes: 45 additions & 5 deletions frontend/components/Main/MainRewards.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { Button, Col, Flex, Modal, Row, Skeleton, Tag, Typography } from 'antd';
import { InfoCircleOutlined } from '@ant-design/icons';
import {
Button,
Col,
Flex,
Modal,
Row,
Skeleton,
Tag,
Tooltip,
Typography,
} from 'antd';
import Image from 'next/image';
import { useCallback, useEffect, useState } from 'react';
import styled from 'styled-components';
Expand All @@ -12,7 +23,7 @@ import { useStore } from '@/hooks/useStore';

import { ConfettiAnimation } from '../common/ConfettiAnimation';

const { Text, Title } = Typography;
const { Text, Title, Paragraph } = Typography;

const RewardsRow = styled(Row)`
margin: 0 -24px;
Expand All @@ -24,6 +35,11 @@ const RewardsRow = styled(Row)`
}
`;

const TOOLTIP_OVERLAY_STYLE = {
maxWidth: 'calc(100% - 48px)',
left: '24px',
};

const Loader = () => (
<Flex vertical gap={8}>
<Skeleton.Button active size="small" style={{ width: 92 }} />
Expand Down Expand Up @@ -52,8 +68,32 @@ const DisplayRewards = () => {
<Text type="secondary">Staking rewards today</Text>
{isBalanceLoaded ? (
<>
<Text strong style={{ fontSize: 20 }}>
{balanceFormat(availableRewardsForEpochEth, 2)} OLAS
<Text className="text-xl font-weight-600">
{balanceFormat(availableRewardsForEpochEth, 2)} OLAS&nbsp;
<Text type="secondary">
<Tooltip
arrow={false}
overlayStyle={TOOLTIP_OVERLAY_STYLE}
title={
<>
<Text className="text-sm font-weight-600">
Rewards are specified for the ongoing epoch
</Text>

<Paragraph className="text-sm mt-8">
An epoch is a period when the agent can earn the
staking rewards. It lasts approximately one day, from
12 am to 12 am UTC. Start your agent earlier in the
day to get all the rewards. Sometimes, epochs can last
longer, and you can earn more than the number
specified here.
</Paragraph>
</>
}
>
<InfoCircleOutlined />
</Tooltip>
</Text>
</Text>
{isEligibleForRewards ? (
<Tag color="success">Earned</Tag>
Expand All @@ -72,7 +112,7 @@ const DisplayRewards = () => {
<Text type="secondary">Staked amount</Text>
{isBalanceLoaded ? (
<>
<Text strong style={{ fontSize: 20 }}>
<Text className="text-xl font-weight-600">
{balanceFormat(totalOlasStakedBalance, 2)} OLAS
</Text>
{minimumStakedAmountRequired && !isStaked ? (
Expand Down
4 changes: 4 additions & 0 deletions frontend/styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ button, input, select, textarea, .ant-input-suffix {
margin-right: auto !important;
}

.text-xl {
font-size: 20px;
}

.text-base {
font-size: 16px;
}
Expand Down

0 comments on commit f55dae4

Please sign in to comment.