Skip to content

Commit 6c5e84d

Browse files
committed
Update blockchain index page to include extended chains
1 parent af7a480 commit 6c5e84d

File tree

4 files changed

+46
-44
lines changed

4 files changed

+46
-44
lines changed

src/routes/trading-view/[chain=slug]/+layout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { error } from '@sveltejs/kit';
22
import { chainsUnderMaintenance } from '$lib/config';
3-
import { getChain } from '$lib/helpers/chain.js';
3+
import { getChain } from '$lib/helpers/chain';
44

55
export async function load({ params }) {
66
const { chain: chainSlug } = params;

src/routes/trading-view/blockchains/+page.svelte

Lines changed: 45 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
-->
44
<script lang="ts">
55
import Breadcrumbs from '$lib/breadcrumb/Breadcrumbs.svelte';
6+
import Button from '$lib/components/Button.svelte';
7+
import HeroBanner from '$lib/components/HeroBanner.svelte';
8+
import Section from '$lib/components/Section.svelte';
9+
import { chains } from '$lib/helpers/chain';
610
import { getLogoUrl } from '$lib/helpers/assets';
7-
import { formatAmount } from '$lib/helpers/formatters';
8-
import { Button, ContentCard, ContentCardsSection, ContentCardsTemplate, HeroBanner } from '$lib/components';
9-
10-
export let data;
1111
</script>
1212

1313
<svelte:head>
@@ -17,33 +17,49 @@
1717

1818
<Breadcrumbs labels={{ blockchains: 'Blockchains' }} />
1919

20-
<ContentCardsTemplate pageTitle="DEX trading view" pageDescription="DEX trading view">
21-
<HeroBanner slot="hero" title="Blockchains" subtitle="List of currently active blockchains producing trading data." />
22-
23-
<ContentCardsSection cols={4} --button-width="100%">
24-
{#each data.chains as chain}
25-
<ContentCard href={`/trading-view/${chain.chain_slug}`} testId="chain-{chain.chain_id}-{chain.chain_slug}">
26-
<img
27-
slot="icon"
28-
class="blockchain-logo"
29-
alt={`${chain.chain_name} logo`}
30-
src={getLogoUrl('blockchain', chain.chain_slug)}
31-
/>
32-
<h3 slot="title" class="blockchain-title">{chain.chain_name}</h3>
33-
<p>{formatAmount(chain.exchanges)} exchanges</p>
34-
<Button label="Details" />
35-
</ContentCard>
36-
{/each}
37-
</ContentCardsSection>
38-
</ContentCardsTemplate>
20+
<main class="blockchains-page">
21+
<Section>
22+
<HeroBanner title="Blockchains" subtitle="List of currently active blockchains producing trading data." />
23+
</Section>
24+
25+
<Section>
26+
<div class="chains">
27+
{#each chains as chain (chain.id)}
28+
<a class="tile b" href={`/trading-view/${chain.slug}`}>
29+
<img class="tile c" alt={`${chain.name} logo`} src={getLogoUrl('blockchain', chain.slug)} />
30+
<h3>{chain.name}</h3>
31+
<Button>View details</Button>
32+
</a>
33+
{/each}
34+
</div>
35+
</Section>
36+
</main>
3937

4038
<style>
41-
.blockchain-logo {
42-
height: 3rem;
43-
width: 3rem;
44-
}
39+
.chains {
40+
display: grid;
41+
grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
42+
gap: 1.5rem;
43+
margin-top: 1rem;
44+
45+
a {
46+
display: grid;
47+
padding: 1.5rem;
48+
gap: 1rem;
49+
justify-items: center;
50+
--button-width: clamp(10rem, 50%, 15rem);
51+
}
52+
53+
img {
54+
height: 5rem;
55+
width: 5rem;
56+
border-radius: 50%;
57+
margin-bottom: 0.5rem;
58+
padding: 1rem;
59+
}
4560
46-
h3.blockchain-title {
47-
font: var(--f-heading-md-medium);
61+
h3 {
62+
font: var(--f-heading-md-medium);
63+
}
4864
}
4965
</style>

src/routes/trading-view/blockchains/+page.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/e2e/trading-view/chain-index.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ test.describe('chain index page', () => {
66
await page.goto('/trading-view/blockchains');
77
});
88

9-
test('tiles should include exchange count', async ({ page }) => {
10-
const blockchains = page.getByRole('link', { name: /[\d,]+ exchanges/ });
11-
const count = await blockchains.count();
12-
expect(count).toBeGreaterThan(0);
13-
});
14-
159
test('chain tile should link to chain details', async ({ page }) => {
1610
const chain = page.getByRole('link', { name: /Ethereum/ });
1711
await chain.click();

0 commit comments

Comments
 (0)