Skip to content

Commit

Permalink
Merge pull request #234 from k0beLeenders/error-cleanup
Browse files Browse the repository at this point in the history
fix(mfi-v2-ui): Porfolio page and HTML formatting & rehydration issues
  • Loading branch information
losman0s authored Sep 28, 2023
2 parents 07ec76c + c8be4ee commit ac432e5
Show file tree
Hide file tree
Showing 22 changed files with 1,378 additions and 892 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ const UserStats: FC<UserStatsProps> = ({ accountSummary, healthFactor }) => {
<div className="flex flex-wrap sm:flex-nowrap gap-4 h-full w-full min-w-1/2 mt-[20px]">
<div className="h-full lg:flex w-1/5 min-w-1/5">
<div>
<Typography color="#868E95" className="font-aeonik font-[300] text-xs flex gap-1" gutterBottom>
<Typography
color="#868E95"
className="font-aeonik font-[300] text-xs flex gap-1"
gutterBottom
component="div"
>
Account
<div className="self-center">
{accountSummary && (
Expand Down Expand Up @@ -90,7 +95,12 @@ const UserStats: FC<UserStatsProps> = ({ accountSummary, healthFactor }) => {
<DividerLine />
<div className="h-full w-1/4 md:w-1/5">
<div>
<Typography color="#868E95" className="font-aeonik font-[300] text-xs flex gap-1" gutterBottom>
<Typography
color="#868E95"
className="font-aeonik font-[300] text-xs flex gap-1"
gutterBottom
component="div"
>
Supplying
<div className="self-center">
{accountSummary && (
Expand Down Expand Up @@ -143,7 +153,12 @@ const UserStats: FC<UserStatsProps> = ({ accountSummary, healthFactor }) => {
<DividerLine />
<div className="h-full w-1/4 md:w-1/5">
<div>
<Typography color="#868E95" className="font-aeonik font-[300] text-xs flex gap-1" gutterBottom>
<Typography
color="#868E95"
className="font-aeonik font-[300] text-xs flex gap-1"
gutterBottom
component="div"
>
Borrowing
<div className="self-center">
{accountSummary && (
Expand Down Expand Up @@ -196,7 +211,12 @@ const UserStats: FC<UserStatsProps> = ({ accountSummary, healthFactor }) => {
<DividerLine />
<div className="h-full w-1/4 md:w-1/5">
<div>
<Typography color="#868E95" className="font-aeonik font-[300] text-xs flex gap-1" gutterBottom>
<Typography
color="#868E95"
className="font-aeonik font-[300] text-xs flex gap-1"
gutterBottom
component="div"
>
Health
<div className="self-center">
{accountSummary && (
Expand Down Expand Up @@ -242,7 +262,12 @@ const UserStats: FC<UserStatsProps> = ({ accountSummary, healthFactor }) => {
<DividerLine />
<div className="h-full w-1/4 md:w-1/5">
<div>
<Typography color="#868E95" className="font-aeonik font-[300] text-xs flex gap-1" gutterBottom>
<Typography
color="#868E95"
className="font-aeonik font-[300] text-xs flex gap-1"
gutterBottom
component="div"
>
Free
<div className="self-center">
<MrgnTooltip
Expand Down
329 changes: 169 additions & 160 deletions apps/marginfi-v2-ui/src/components/desktop/AssetsList/AssetsList.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, { FC } from "react";
import { Card, CardContent, CircularProgress } from "@mui/material";

interface PointsCheckingUserProps {}

export const PointsCheckingUser: FC<PointsCheckingUserProps> = ({}) => {
return (
<Card className="max-w-[800px] mx-auto w-full bg-[#131619] h-full h-24 rounded-xl" elevation={0}>
<CardContent>
<div className="w-full flex flex-col justify-evenly items-center p-2 text-base text-white font-aeonik font-[400] rounded-xl text-center">
<div>
<span className="text-2xl font-[500]">Access upgraded features</span>
<br />
<br />
</div>
<div className="flex gap-3 justify-center items-center">
<div className="w-full flex justify-center items-center">Retrieving data</div>
<CircularProgress size="20px" sx={{ color: "#e1e1e1" }} />
</div>
</div>
</CardContent>
</Card>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React, { FC } from "react";
import { Card, CardContent } from "@mui/material";

import { WalletButton } from "~/components/common/Navbar";

interface PointsConnectWalletProps {}

export const PointsConnectWallet: FC<PointsConnectWalletProps> = ({}) => {
return (
<Card className="max-w-[800px] mx-auto w-full bg-[#131619] h-full h-24 rounded-xl" elevation={0}>
<CardContent>
<div className="w-full flex flex-col justify-evenly items-center p-2 text-base text-white font-aeonik font-[400] rounded-xl text-center">
<div>
<span className="text-2xl font-[500]">Access upgraded features</span>
<br />
<br />
</div>
<div className="w-full flex justify-center items-center">
<WalletButton />
</div>
</div>
</CardContent>
</Card>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import React, { FC } from "react";
import { Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from "@mui/material";

import { groupedNumberFormatterDyn } from "@mrgnlabs/mrgn-common";
import { LeaderboardRow } from "@mrgnlabs/marginfi-v2-ui-state";

interface PointsLeaderBoardProps {
leaderboardData: LeaderboardRow[];
currentUserId?: string;
}

export const PointsLeaderBoard: FC<PointsLeaderBoardProps> = ({ leaderboardData, currentUserId }) => {
return (
<TableContainer component={Paper} className="h-full w-4/5 sm:w-full bg-[#131619] rounded-xl overflow-x-auto">
<Table>
<TableHead>
<TableRow>
<TableCell
align="center"
className="text-white text-base font-aeonik border-none pl-2"
style={{ fontWeight: 500 }}
>
Rank
</TableCell>
<TableCell className="text-white text-base font-aeonik border-none" style={{ fontWeight: 500 }}>
User
</TableCell>
<TableCell
className="text-white text-base font-aeonik border-none"
align="right"
style={{ fontWeight: 500 }}
>
Lending Points
</TableCell>
<TableCell
className="text-white text-base font-aeonik border-none"
align="right"
style={{ fontWeight: 500 }}
>
Borrowing Points
</TableCell>
<TableCell
className="text-white text-base font-aeonik border-none"
align="right"
style={{ fontWeight: 500 }}
>
Referral Points
</TableCell>
<TableCell
className="text-white text-base font-aeonik border-none"
align="right"
style={{ fontWeight: 500 }}
>
Social Points
</TableCell>
<TableCell
className="text-white text-base font-aeonik border-none"
align="right"
style={{ fontWeight: 500 }}
>
Total Points
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{leaderboardData.map((row: LeaderboardRow, index: number) => (
<TableRow key={row.id} className={`${row.id === currentUserId ? "glow" : ""}`}>
<TableCell
align="center"
className={`${index <= 2 ? "text-2xl" : "text-base"} border-none font-aeonik ${
row.id === currentUserId ? "text-[#DCE85D]" : "text-white"
}`}
>
{index === 0 ? "🥇" : index === 1 ? "🥈" : index === 2 ? "🥉" : index + 1}
</TableCell>
<TableCell
className={`text-base border-none font-aeonik ${
row.id === currentUserId ? "text-[#DCE85D]" : "text-white"
}`}
style={{ fontWeight: 400 }}
>
<a
href={`https://solscan.io/account/${row.id}`}
target="_blank"
rel="noopener noreferrer"
style={{ textDecoration: "none", color: "inherit" }}
className="hover:text-[#7fff00]"
>
{`${row.id.slice(0, 5)}...${row.id.slice(-5)}`}
<style jsx>{`
a:hover {
text-decoration: underline;
}
`}</style>
</a>
</TableCell>
<TableCell
align="right"
className={`text-base border-none font-aeonik ${
row.id === currentUserId ? "text-[#DCE85D]" : "text-white"
}`}
style={{ fontWeight: 400 }}
>
{groupedNumberFormatterDyn.format(Math.round(row.total_activity_deposit_points))}
</TableCell>
<TableCell
align="right"
className={`text-base border-none font-aeonik ${
row.id === currentUserId ? "text-[#DCE85D]" : "text-white"
}`}
style={{ fontWeight: 400 }}
>
{groupedNumberFormatterDyn.format(Math.round(row.total_activity_borrow_points))}
</TableCell>
<TableCell
align="right"
className={`text-base border-none font-aeonik ${
row.id === currentUserId ? "text-[#DCE85D]" : "text-white"
}`}
style={{ fontWeight: 400 }}
>
{groupedNumberFormatterDyn.format(
Math.round(row.total_referral_deposit_points + row.total_referral_borrow_points)
)}
</TableCell>
<TableCell
align="right"
className={`text-base border-none font-aeonik ${
row.id === currentUserId ? "text-[#DCE85D]" : "text-white"
}`}
style={{ fontWeight: 400 }}
>
{groupedNumberFormatterDyn.format(Math.round(row.socialPoints ? row.socialPoints : 0))}
</TableCell>
<TableCell
align="right"
className={`text-base border-none font-aeonik ${
row.id === currentUserId ? "text-[#DCE85D]" : "text-white"
}`}
style={{ fontWeight: 400 }}
>
{groupedNumberFormatterDyn.format(
Math.round(
row.total_deposit_points + row.total_borrow_points + (row.socialPoints ? row.socialPoints : 0)
)
)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
);
};
Loading

0 comments on commit ac432e5

Please sign in to comment.