Skip to content

Commit 7671222

Browse files
Refine inlined widget snippets
- Rename AppCardV2 to AppCard now that the V1 card no longer exists - Map sei-ibc-go PRs to the correct repo and key changelog entries by version - Sync the active network tab to the URL hash Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d0ee3d2 commit 7671222

3 files changed

Lines changed: 22 additions & 17 deletions

File tree

‎snippets/changelog.jsx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ sei-tendermint
578578
}
579579
}
580580

581-
return order.map((v, idx) => ({ ...merged.get(v), idx }));
581+
return order.map((v) => merged.get(v));
582582
};
583583

584584
useEffect(() => {
@@ -629,6 +629,7 @@ sei-tendermint
629629
'sei-db': 'sei-protocol/sei-db',
630630
'sei-wasmd': 'sei-protocol/sei-wasmd',
631631
'sei-iavl': 'sei-protocol/sei-iavl',
632+
'sei-ibc-go': 'sei-protocol/sei-ibc-go',
632633
'tm-db': 'sei-protocol/tm-db'
633634
};
634635
return repoMap[compName] || 'sei-protocol/sei-chain';
@@ -706,7 +707,7 @@ sei-tendermint
706707
if (trimmedPart.match(/^#\d+$/)) {
707708
const num = trimmedPart.slice(1);
708709
const prevParts = prParts.slice(0, j).join('');
709-
const inlineComponentMatch = prevParts.match(/\b(sei-chain|sei-tendermint|sei-cosmos|sei-db|sei-wasmd|sei-iavl|tm-db)\s*$/i);
710+
const inlineComponentMatch = prevParts.match(/\b(sei-chain|sei-tendermint|sei-cosmos|sei-db|sei-wasmd|sei-iavl|sei-ibc-go|tm-db)\s*$/i);
710711
const effectiveComponent = inlineComponentMatch ? inlineComponentMatch[1] : componentName;
711712
const repoPath = getRepoUrl(effectiveComponent);
712713
return (
@@ -735,7 +736,7 @@ sei-tendermint
735736

736737
if (isLikelyPRNumber) {
737738
const prevParts = prParts.slice(0, j).join('');
738-
const inlineComponentMatch = prevParts.match(/\b(sei-chain|sei-tendermint|sei-cosmos|sei-db|sei-wasmd|sei-iavl|tm-db)\s*$/i);
739+
const inlineComponentMatch = prevParts.match(/\b(sei-chain|sei-tendermint|sei-cosmos|sei-db|sei-wasmd|sei-iavl|sei-ibc-go|tm-db)\s*$/i);
739740
const effectiveComponent = inlineComponentMatch ? inlineComponentMatch[1] : componentName;
740741
const repoPath = getRepoUrl(effectiveComponent);
741742
return (
@@ -907,10 +908,9 @@ sei-tendermint
907908
);
908909
};
909910

910-
const staticVersions = STATIC_CHANGELOG.map((entry, idx) => ({
911+
const staticVersions = STATIC_CHANGELOG.map((entry) => ({
911912
version: entry.version,
912-
body: entry.body,
913-
idx: dynamicVersions.length + idx
913+
body: entry.body
914914
}));
915915
const versions = [...dynamicVersions, ...staticVersions];
916916

@@ -922,7 +922,7 @@ sei-tendermint
922922
</div>
923923
<div className="changelog-content">
924924
{staticVersions.map((version) => (
925-
<div key={version.idx} className="mb-8">
925+
<div key={version.version} className="mb-8">
926926
<div className="flex items-center gap-3 mb-4">
927927
<h2 className="text-xl font-bold text-gray-900 dark:text-white m-0">{version.version}</h2>
928928
<span className="text-xs text-gray-500 bg-gray-100 px-2 py-1 rounded-full">Release</span>
@@ -975,7 +975,7 @@ sei-tendermint
975975

976976
<div className="changelog-content">
977977
{versions.map((version) => (
978-
<div key={version.idx} className="mb-8">
978+
<div key={version.version} className="mb-8">
979979
<div className="flex items-center gap-3 mb-4">
980980
<h2 className="text-xl font-bold text-gray-900 dark:text-white m-0">{version.version}</h2>
981981
<span className="text-xs text-gray-500 bg-gray-100 px-2 py-1 rounded-full">Release</span>

‎snippets/ecosystem-app-grid.jsx‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const EcosystemAppGrid = (props) => {
44
// --- Static config: inlined verbatim from lib/ecosystemData.ts ---
55
const ECOSYSTEM_API_URL = 'https://app-api.seinetwork.io/sanity/ecosystem';
66

7-
// --- Integration-guide overrides: inlined verbatim from AppCard.v2.tsx ---
7+
// --- Integration-guide overrides ---
88
const integrationGuideOverrides = {
99
'The Graph': '/evm/indexer-providers/the-graph',
1010
Covalent: '/evm/indexer-providers/goldrush',
@@ -107,10 +107,8 @@ export const EcosystemAppGrid = (props) => {
107107
</div>
108108
);
109109

110-
// --- App card (ported from AppCard.v2.tsx) ---
111-
// Runs on docs.sei.io, so internal links ('/...') are rendered as
112-
// site-relative hrefs; external links open in a new tab.
113-
const AppCardV2 = ({ app }) => {
110+
// --- App card ---
111+
const AppCard = ({ app }) => {
114112
const [hover, setHover] = useState(false);
115113
const [linkHover, setLinkHover] = useState(false);
116114

@@ -261,7 +259,7 @@ export const EcosystemAppGrid = (props) => {
261259
// its tile the way the original widget does.
262260
<div className='sei-eco-grid grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 py-2'>
263261
{apps.map((app) => (
264-
<AppCardV2 key={app.id} app={app} />
262+
<AppCard key={app.id} app={app} />
265263
))}
266264
</div>
267265
);

‎snippets/network-tabs.jsx‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ export const NetworkTabs = (props) => {
9595
return () => window.removeEventListener('hashchange', handleHashChange);
9696
}, []);
9797

98+
const selectTab = (tab) => {
99+
setActiveTab(tab);
100+
if (typeof window !== 'undefined' && window.history && window.history.replaceState) {
101+
window.history.replaceState(null, '', `#${tab}`);
102+
}
103+
};
104+
98105
const tabButtonClass = (tab) =>
99106
`px-3 py-1.5 text-sm transition-colors ${
100107
activeTab === tab
@@ -258,13 +265,13 @@ export const NetworkTabs = (props) => {
258265
return (
259266
<div className='network-tabs w-full'>
260267
<div className='flex flex-wrap gap-2 mb-6'>
261-
<button type='button' onClick={() => setActiveTab('mainnet')} className={tabButtonClass('mainnet')}>
268+
<button type='button' onClick={() => selectTab('mainnet')} className={tabButtonClass('mainnet')}>
262269
Mainnet (pacific-1)
263270
</button>
264-
<button type='button' onClick={() => setActiveTab('testnet')} className={tabButtonClass('testnet')}>
271+
<button type='button' onClick={() => selectTab('testnet')} className={tabButtonClass('testnet')}>
265272
Testnet (atlantic-2)
266273
</button>
267-
<button type='button' onClick={() => setActiveTab('localnet')} className={tabButtonClass('localnet')}>
274+
<button type='button' onClick={() => selectTab('localnet')} className={tabButtonClass('localnet')}>
268275
Local Environment
269276
</button>
270277
</div>

0 commit comments

Comments
 (0)