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

✨ Show trust score and stake rate instead of pending and unconfirmed #148

Merged
merged 2 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
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
54 changes: 39 additions & 15 deletions src/components/UserAccount/AccountInfo/AccountInfo.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import styles from './AccountInfo.module.scss';
import { NE_SmallCard as SmallCard } from 'components/atoms/NE_Card';
import { BsBank, BsFillClockFill } from 'react-icons/bs';
import { FaUserClock } from 'react-icons/fa';
import { FaHandshake, FaUserClock } from 'react-icons/fa';
import { HiChartBar } from 'react-icons/hi';
import { intlNum } from 'utils';

export function AccountInfo({ data }) {
const isTrust = data?.rate === null ? false : true;

return (
<>
<section className={styles.cardsContainer}>
Expand All @@ -20,20 +24,40 @@ export function AccountInfo({ data }) {
unit="NXS"
icon={<BsBank />}
/>
<SmallCard
label="Pending"
sublabel=""
value={new Intl.NumberFormat().format(data?.pending || 0)}
unit="NXS"
icon={<BsFillClockFill />}
/>
<SmallCard
label="Unconfirmed"
sublabel=""
value={data?.unconfirmed || 0}
unit="NXS"
icon={<FaUserClock />}
/>
{isTrust ? (
<SmallCard
label="Stake Rate"
sublabel=""
value={data.rate || 0}
unit="%"
icon={<HiChartBar />}
/>
) : (
<SmallCard
label="Pending"
sublabel=""
value={new Intl.NumberFormat().format(data?.pending || 0)}
unit="NXS"
icon={<BsFillClockFill />}
/>
)}
{isTrust ? (
<SmallCard
label="Trust Score"
sublabel=""
value={data?.trust || 0}
unit="+"
icon={<FaHandshake />}
/>
) : (
<SmallCard
label="Unconfirmed"
sublabel=""
value={data?.unconfirmed || 0}
unit="NXS"
icon={<FaUserClock />}
/>
)}
Comment on lines +27 to +60
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we add a single condition rather duplicating

Copy link
Owner Author

Choose a reason for hiding this comment

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

can we add a single condition rather duplicating

But how ?

</section>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
justify-content: space-between;
align-items: center;
overflow: hidden;
transition: all 0.2s ease;
}
&-body {
display: flex;
Expand Down