Skip to content

Commit d89f1b5

Browse files
committed
add query types
1 parent 45fbda3 commit d89f1b5

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

src/components/ChangelogSnippet/ChangelogCard.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
}
133133

134134
.metaSection {
135-
gap: 4px;
135+
gap: var(--space-1x);
136136
}
137137

138138
.expandButton {

src/components/ChangelogSnippet/ChangelogSnippet.astro

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import { SvgArrowRight2, Typography } from "@chainlink/blocks"
33
import { searchClient } from "@algolia/client-search"
44
import ChangelogCard from "./ChangelogCard.astro"
5-
import { ALGOLIA_INDEX, type ChangelogItem } from "./types"
5+
import { AlgoliaQuery, type ChangelogItem } from "./types"
66
import styles from "./ChangelogSnippet.module.css"
77
import { getSecret } from "astro:env/server"
88
99
interface Props {
10-
query: string
10+
query: AlgoliaQuery
1111
}
1212
1313
const { query } = Astro.props
@@ -24,8 +24,10 @@ const client = searchClient(appId, apiKey)
2424
const req = await client.search({
2525
requests: [
2626
{
27-
indexName: ALGOLIA_INDEX.CHANGELOG,
27+
indexName: "Changelog",
28+
restrictSearchableAttributes: ["topic"],
2829
query,
30+
hitsPerPage: 1,
2931
},
3032
],
3133
})

src/components/ChangelogSnippet/types.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
export const ALGOLIA_INDEX = {
2-
CCIP_CHAINS: "CCIP Network",
3-
CCIP_LANES: "CCIP Lane",
4-
CCIP_TOKENS: "CCIP Tokens",
5-
CCIP_TOKENS_ON_NETWORK: "CCIP Tokens on Network",
6-
LINK_TOKENS: "LINK Token",
7-
DATA_FEED: "Data Feed",
8-
DATA_STREAMS: "Data Stream",
9-
DATA_STREAMS_NETWORK: "Data Stream Network",
10-
FAUCET: "Faucet",
11-
SITE: "Site",
12-
DOCUMENTATION: "Documentation",
13-
QUICKSTART: "Quickstart",
14-
GUIDE: "Guide",
15-
TUTORIAL: "Tutorial",
16-
CHANGELOG: "Changelog",
17-
BOOTCAMP: "Bootcamp",
18-
BLOG_NEW: "blog_new",
19-
VIDEO: "Video",
20-
} as const
1+
export type AlgoliaQuery =
2+
| "ccip"
3+
| "data-streams"
4+
| "smart-data"
5+
| "nodes"
6+
| "data-feeds"
7+
| "functions"
8+
| "automation"
9+
| "vrf"
10+
| "general"
2111

2212
export interface ChangelogItem {
2313
createdOn: string

0 commit comments

Comments
 (0)