Skip to content

Commit

Permalink
chore: fetches vault description and renders markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
bearpong committed Jan 8, 2025
1 parent 1b8422d commit eb9409c
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 16 deletions.
4 changes: 2 additions & 2 deletions apps/hub/src/app/incentivize/incentivize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ export const Incentivize = () => {
<>
{" "}
<MarketIcon
market={gaugeInfo?.metadata?.productName ?? ""}
market={gaugeInfo?.metadata?.protocolName ?? ""}
size={"md"}
/>
{gaugeInfo?.metadata?.productName ?? "OTHER"}
{gaugeInfo?.metadata?.protocolName ?? "OTHER"}
</>
),
externalLink: gaugeInfo?.metadata?.url ?? "",
Expand Down
4 changes: 2 additions & 2 deletions apps/hub/src/app/vaults/[address]/components/VaultDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ const _VaultDetails = ({ address }: { address: Address }) => {
content: (
<>
<MarketIcon
market={rewardVault?.metadata?.productName ?? ""}
market={rewardVault?.metadata?.protocolName ?? ""}
size={"md"}
/>
{rewardVault?.metadata?.productName ?? "OTHER"}
{rewardVault?.metadata?.protocolName ?? "OTHER"}
</>
),
externalLink: rewardVault?.metadata?.url ?? "",
Expand Down
29 changes: 26 additions & 3 deletions apps/hub/src/app/vaults/[address]/components/my-gauge-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
DialogTrigger,
} from "@bera/ui/dialog";
import { WithdrawLP } from "./WithdrawLP";
import Markdown from "react-markdown";

export const MyGaugeDetails = ({
rewardVault,
Expand Down Expand Up @@ -44,9 +45,31 @@ export const MyGaugeDetails = ({
<Icons.tooltip height={16} width={16} />
</div>
<div>
<h3 className="leading-none">How do I get Receipt Tokens?</h3>
<p className="text-muted-foreground">
{rewardVault?.metadata?.description}
<h3 className="leading-none mb-1">
How do I get Receipt Tokens?
</h3>
<p className="text-muted-foreground leading-normal">
<Markdown
components={{
a: ({ children, href }) => (
<a
href={href}
target="_blank"
className="underline"
rel="noopener noreferrer"
>
{children}
</a>
),
i: ({ children }) => <i className="italic">{children}</i>,
b: ({ children }) => (
<b className="font-medium">{children}</b>
),
}}
allowedElements={["a", "i", "b", "p"]}
>
{rewardVault?.metadata?.description}
</Markdown>
</p>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/hub/src/components/chart-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export function ChartTooltip({
</div>
<div className="flex items-center gap-1 whitespace-nowrap text-xs leading-4 text-muted-foreground">
<MarketIcon
market={gauge.receivingVault?.metadata?.productName ?? ""}
market={gauge.receivingVault?.metadata?.protocolName ?? ""}
className="h-4 w-4"
/>{" "}
{gauge.receivingVault?.metadata?.productName ?? "OTHER"}
{gauge.receivingVault?.metadata?.protocolName ?? "OTHER"}
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/hub/src/components/gauge-header-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export const GaugeHeaderWidget = ({
</div>
<div className="flex items-center gap-1 text-sm font-medium leading-5">
<MarketIcon
market={gauge.metadata?.productName ?? "OTHER"}
market={gauge.metadata?.protocolName ?? "OTHER"}
size="md"
/>
{gauge.metadata?.productName ?? "OTHER"}
{gauge.metadata?.protocolName ?? "OTHER"}
</div>
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion apps/hub/src/components/user-gauge-weight-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function UserGaugeWeightTable({
.filter((vaultInfo: UserVault) => {
if (keywords === "") return true;
if (vaultInfo.vault.metadata?.name?.includes(keywords)) return true;
if (vaultInfo.vault.metadata?.productName?.includes(keywords))
if (vaultInfo.vault.metadata?.protocolName?.includes(keywords))
return true;
if (vaultInfo.vault.vaultAddress.includes(keywords)) return true;
return false;
Expand Down
5 changes: 2 additions & 3 deletions packages/graphql/src/modules/pol/api.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ fragment ApiVault on GqlRewardVault {
}

metadata {
name
name
logoURI
url
productName
description: name
protocolName
description
}

activeIncentives {
Expand Down
2 changes: 1 addition & 1 deletion secrets

0 comments on commit eb9409c

Please sign in to comment.