Skip to content

Commit 8a56818

Browse files
chore(sponsored-feeds): solana visuals and json file (#755)
* solana visuals and json file * build fix * copy button balanced
1 parent 6aa2de5 commit 8a56818

File tree

3 files changed

+430
-54
lines changed

3 files changed

+430
-54
lines changed

components/SponsoredFeedsTableWithData.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useCopyToClipboard } from "../utils/useCopyToClipboard";
66
// SponsoredFeed interface has the same structure as defined in deployment yaml/json files
77
interface SponsoredFeed {
88
alias: string; // name of the feed
9+
account_address?: string; // optional, needed only for solana.
910
id: string; // price feed id
1011
time_difference: number; // in seconds
1112
price_deviation: number;
@@ -117,6 +118,8 @@ export const SponsoredFeedsTable = ({
117118
);
118119
const defaultParams = paramEntries.length > 0 ? paramEntries[0][0] : "";
119120

121+
const hasAccountAddress = feeds.some((feed) => !!feed.account_address);
122+
120123
return (
121124
<div className="my-6">
122125
<p className="mb-3">
@@ -158,6 +161,11 @@ export const SponsoredFeedsTable = ({
158161
<th className="text-left px-3 py-2 font-semibold text-gray-900 dark:text-gray-100 border-b border-gray-200 dark:border-gray-600 min-w-[100px]">
159162
Name
160163
</th>
164+
{hasAccountAddress && (
165+
<th className="text-left px-3 py-2 font-semibold text-gray-900 dark:text-gray-100 border-b border-gray-200 dark:border-gray-600 min-w-[400px]">
166+
Account Address
167+
</th>
168+
)}
161169
<th className="text-left px-3 py-2 font-semibold text-gray-900 dark:text-gray-100 border-b border-gray-200 dark:border-gray-600 min-w-[400px]">
162170
Price Feed Id
163171
</th>
@@ -181,6 +189,33 @@ export const SponsoredFeedsTable = ({
181189
{feed.alias}
182190
</span>
183191
</td>
192+
{hasAccountAddress && (
193+
<td className="px-3 py-2 align-top">
194+
{feed.account_address ? (
195+
<div className="flex items-start gap-2">
196+
<code className="text-xs font-mono text-gray-600 dark:text-gray-400 break-all leading-relaxed">
197+
{feed.account_address}
198+
</code>
199+
<button
200+
onClick={() =>
201+
feed.account_address &&
202+
copyToClipboard(feed.account_address)
203+
}
204+
className="p-1 hover:bg-gray-200 dark:hover:bg-gray-600 rounded flex-shrink-0 mt-0.5"
205+
title="Copy Account Address"
206+
>
207+
{copiedText === feed.account_address ? (
208+
<span className="text-green-500 text-xs font-bold">
209+
210+
</span>
211+
) : (
212+
<CopyIcon className="w-3 h-3 text-gray-400" />
213+
)}
214+
</button>
215+
</div>
216+
) : null}
217+
</td>
218+
)}
184219
<td className="px-3 py-2 align-top">
185220
<div className="flex items-start gap-2">
186221
<code className="text-xs font-mono text-gray-600 dark:text-gray-400 flex-1 break-all leading-relaxed">

0 commit comments

Comments
 (0)