Skip to content

Commit

Permalink
Merge pull request #54 from berachain/ipfs/bend-updates-rebased
Browse files Browse the repository at this point in the history
refactor(bend): removed /market?address in favor of generateStaticParams
  • Loading branch information
bearpong authored Sep 6, 2024
2 parents 9c7040f + d48f63d commit ecc45f1
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"titleBar.activeBackground": "#134A18",
"titleBar.activeForeground": "#F3FCF4"
},
"conventionalCommits.scopes": ["perp"]
"conventionalCommits.scopes": ["perp", "bend"]
}
9 changes: 0 additions & 9 deletions apps/lend/fleek.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions apps/lend/fleek.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"sites": [
{
"slug": "v2-bend",
"distDir": "./out"
}
]
}
10 changes: 0 additions & 10 deletions apps/lend/src/app/market/layout.tsx

This file was deleted.

36 changes: 0 additions & 36 deletions apps/lend/src/app/market/page.tsx

This file was deleted.

26 changes: 13 additions & 13 deletions apps/lend/src/app/markets/[address]/individual-market-analytics.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import Link from "next/link";
import { notFound, useSearchParams } from "next/navigation";
import { notFound } from "next/navigation";
import { usePollReservesDataList, useTokens } from "@bera/berajs";
import { honeyTokenAddress } from "@bera/config";
import { Icons } from "@bera/ui/icons";
Expand Down Expand Up @@ -34,18 +34,18 @@ export default function IndividualMarketAnalytics({
</div>

<TokenInfoCard
{...{
token: tokenData?.tokenDictionary?.[address],
reserve:
Number(reserve?.totalLiquidity) *
Number(reserve?.formattedPriceInMarketReferenceCurrency),
liquidity:
Number(reserve?.totalLiquidity) *
Number(reserve?.formattedPriceInMarketReferenceCurrency) *
Number(1 - Number(reserve?.borrowUsageRatio)),
utilization: Number(reserve?.borrowUsageRatio),
oraclePrice: Number(reserve?.formattedPriceInMarketReferenceCurrency),
}}
token={tokenData?.tokenDictionary?.[address]}
reserve={
Number(reserve?.totalLiquidity) *
Number(reserve?.formattedPriceInMarketReferenceCurrency)
}
liquidity={
Number(reserve?.totalLiquidity) *
Number(reserve?.formattedPriceInMarketReferenceCurrency) *
Number(1 - Number(reserve?.borrowUsageRatio))
}
utilization={Number(reserve?.borrowUsageRatio)}
oraclePrice={Number(reserve?.formattedPriceInMarketReferenceCurrency)}
/>

<div className="mt-9 flex flex-col gap-8 xl:flex-row">
Expand Down
17 changes: 6 additions & 11 deletions apps/lend/src/app/markets/[address]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import React from "react";
import { notFound } from "next/navigation";
import { isIPFS } from "@bera/config";
import { honeyTokenAddress } from "@bera/config";
import { type Address } from "viem";

import IndividualMarketAnalytics from "./individual-market-analytics";

export default function Page({ params }: { params: { address: Address } }) {
if (isIPFS) notFound();
return <IndividualMarketAnalytics address={params.address} />;
}

export async function generateStaticParams() {
if (isIPFS) {
const addresses = ["0x"];
return addresses.map((address) => ({
address,
}));
}
return [];
export function generateStaticParams() {
const addresses = [honeyTokenAddress];
return addresses.map((address) => ({
address,
}));
}
9 changes: 2 additions & 7 deletions apps/lend/src/components/honey-borrow-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,8 @@ export default function HoneyBorrowCard() {
variant="outline"
className="w-full flex-1 border border-yellow-900 bg-background bg-opacity-20 py-2 text-lg font-semibold leading-7 text-yellow-900 backdrop-blur-2xl hover:bg-yellow-900 hover:text-white hover:opacity-90 dark:border-yellow-600 dark:text-yellow-600 dark:hover:bg-yellow-600 dark:hover:text-white"
/>
<Link
href={
isIPFS
? `/market?address=${honeyTokenAddress}`
: `/markets/${honeyTokenAddress}`
}
>

<Link href={`/markets/${honeyTokenAddress}`}>
<Button className="w-fit border border-yellow-900 bg-background bg-opacity-20 py-2 text-lg font-semibold leading-7 text-yellow-900 backdrop-blur-2xl hover:bg-yellow-900 hover:text-white hover:opacity-90 dark:border-yellow-600 dark:text-yellow-600 dark:hover:bg-yellow-600 dark:hover:text-white">
Details
</Button>
Expand Down

0 comments on commit ecc45f1

Please sign in to comment.