Skip to content

Commit

Permalink
Merge pull request #209 from stabilitydao/4-vault
Browse files Browse the repository at this point in the history
Architecture update + codecov & unit tests
  • Loading branch information
a17 authored Aug 6, 2024
2 parents d2f5940 + 054f0a7 commit c416c06
Show file tree
Hide file tree
Showing 65 changed files with 870 additions and 623 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

[Issues](https://github.com/stabilitydao/stability-ui/issues)

## Coverage

[![codecov](https://codecov.io/gh/stabilitydao/stability-ui/graph/badge.svg?token=ER8QCFAF8C)](https://codecov.io/gh/stabilitydao/stability-ui)

![Coverage Grid](https://codecov.io/gh/stabilitydao/stability-ui/graphs/tree.svg?token=ER8QCFAF8C)

## Develop

### πŸ‘€ Learn stack
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "stability-ui",
"type": "module",
"version": "0.9.3-alpha",
"version": "0.9.5-alpha",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
Expand Down Expand Up @@ -58,6 +58,7 @@
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"jsdom": "^24.1.1",
"prettier": "^3.3.3",
"typescript": "^5.5.3",
"vitest": "^2.0.2"
Expand Down
47 changes: 1 addition & 46 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,4 @@
import { CreateVaultComponent } from "./CreateVaultComponent";
import { Vault } from "./Vault";
import { Vaults } from "./Vaults";
import { Header } from "./Header";
import { Footer } from "./Footer";

import {
AssetsProportion,
TimeDifferenceIndicator,
VaultState,
VaultType,
Loader,
AssetsSkeleton,
ShareSkeleton,
ErrorMessage,
Skeleton,
HideFeesHandler,
APRtimeSwitcher,
FeeAPRModal,
ChartSkeleton,
HoldModal,
ShortAddress,
} from "./VaultUtils";

import { Toast } from "./VaultUtils/Toast";

export {
CreateVaultComponent,
Vault,
Vaults,
VaultType,
Loader,
AssetsProportion,
Header,
Footer,
VaultState,
TimeDifferenceIndicator,
ShareSkeleton,
AssetsSkeleton,
Toast,
ErrorMessage,
Skeleton,
ChartSkeleton,
HideFeesHandler,
APRtimeSwitcher,
FeeAPRModal,
HoldModal,
ShortAddress,
};
export { Header, Footer };
29 changes: 1 addition & 28 deletions src/layouts/AppStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ import {
connected,
apiData,
lastTx,
transactionSettings,
hideFeeApr,
reload,
error,
isWeb3Load,
aprFilter,
currentChainID,
assetsPrices,
assetsBalances,
Expand All @@ -49,6 +46,7 @@ import {
addVaultData,
getTimeDifference,
determineAPR,
getLocalStorageData,
} from "@utils";

import {
Expand Down Expand Up @@ -102,31 +100,6 @@ const AppStore = (props: React.PropsWithChildren): JSX.Element => {

let stabilityAPIData: TAPIData = {};

const getLocalStorageData = () => {
const savedSettings = localStorage.getItem("transactionSettings");
const savedHideFeeAPR = localStorage.getItem("hideFeeAPR");
const APRsFiler = localStorage.getItem("APRsFiler");

if (savedSettings) {
const savedData = JSON.parse(savedSettings);
transactionSettings.set(savedData);
}
if (savedHideFeeAPR) {
const savedData = JSON.parse(savedHideFeeAPR);
hideFeeApr.set(savedData);
}

let localAPRfilter = APRsFiler ? JSON.parse(APRsFiler) : "weekly";

if (localAPRfilter === "week") {
localAPRfilter = "weekly";
} else if (localAPRfilter === "24h") {
localAPRfilter = "daily";
}

aprFilter.set(localAPRfilter);
};

const getDataFromStabilityAPI = async () => {
try {
const response = await axios.get(STABILITY_API);
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ const { title } = Astro.props as IProps;
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-X8NC1VWRMV"></script>
<!-- <script async src="https://www.googletagmanager.com/gtag/js?id=G-X8NC1VWRMV"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', import.meta.env.PUBLIC_GOOGLE_ANALYTICS_KEY);
</script>
</script> -->
<meta charset="UTF-8" />
<meta name="description" content="Asset Management Platform" />
<meta name="viewport" content="width=device-width" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
waitForTransactionReceipt,
} from "@wagmi/core";

import { Loader } from "@components";
import { Loader } from "@ui";

import { FactoryABI, ERC20ABI, wagmiConfig } from "@web3";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type TFreeVaults =

type TBuildingPrices = { [vaultType: string]: bigint };

const CreateVaultComponent = (): JSX.Element => {
const CreateVault = (): JSX.Element => {
const $publicClient = useStore(publicClient);
const $platformsData = useStore(platformsData);
const $balances = useStore(balances);
Expand Down Expand Up @@ -268,7 +268,7 @@ const CreateVaultComponent = (): JSX.Element => {
useEffect(() => {
getBuildingPrices();
getData();
}, [$publicClient, $platformsData[$currentChainID]?.factory, lastTx.get()]);
}, [$publicClient, $platformsData?.[$currentChainID]?.factory, lastTx.get()]);

useEffect(() => {
freeVaultsHandler();
Expand Down Expand Up @@ -510,7 +510,7 @@ const CreateVaultComponent = (): JSX.Element => {
<h2 className="text-[22px] mt-5">Rewarding managed vault</h2>
<div className="text-[22px] text-center">Coming soon</div>

{$platformsData[$currentChainID] && buildIndex !== undefined && (
{$platformsData?.[$currentChainID] && buildIndex !== undefined && (
<div
className="overlay"
onClick={() => {
Expand Down Expand Up @@ -566,4 +566,4 @@ const CreateVaultComponent = (): JSX.Element => {
</WagmiLayout>
);
};
export { CreateVaultComponent };
export { CreateVault };
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import axios from "axios";
import { Chart } from "./Chart";
import { ChartBar } from "./ChartBar";

import { ChartSkeleton } from "@components";
import { ChartSkeleton } from "@ui";

import { formatFromBigInt } from "@utils";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useStore } from "@nanostores/react";

import { formatUnits } from "viem";

import { APRtimeSwitcher, HideFeesHandler, FeeAPRModal } from "@components";
import { APRtimeSwitcher, HideFeesHandler, FeeAPRModal } from "@ui";

import { hideFeeApr, aprFilter } from "@store";

Expand Down
File renamed without changes.
Loading

0 comments on commit c416c06

Please sign in to comment.