Skip to content

Commit 9d550d0

Browse files
authored
Merge pull request #2687 from starknet-io/Blog-posts-latests-updates-side-banner
Blog post Latest Announcements side banner
2 parents f5619f0 + bcb99c1 commit 9d550d0

File tree

27 files changed

+634
-335
lines changed

27 files changed

+634
-335
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- isActive: true
2+
image: https://www.starknet.io/assets/final-.jpeg
3+
text: What are onramps and cross rollup bridges?
4+
buttonText: See more
5+
buttonLink: /
6+
- isActive: true
7+
image: https://www.starknet.io/assets/guide-image-3-.jpg
8+
text: What are onramps and cross rollup bridges?
9+
buttonText: See more
10+
buttonLink: /

workspaces/cms-config/src/blocks.ts

+19
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,25 @@ export const topLevelBlocks = [
936936
},
937937
],
938938
},
939+
{
940+
name: "side_sticky_banner",
941+
label: "Side Sticky Banner",
942+
widget: "object",
943+
fields: [
944+
{
945+
name: "blocks",
946+
label: "Blocks",
947+
widget: "list",
948+
types: [...blocks, flexLayout],
949+
default: [],
950+
},
951+
{
952+
name: "isActive",
953+
widget: "boolean",
954+
default: false,
955+
},
956+
],
957+
},
939958
flexLayout,
940959
...blocks,
941960
] satisfies CmsFieldList["types"];

workspaces/cms-config/src/collections/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ export const collections: CmsConfig["collections"] = [
2424
SEOCollectionConfig,
2525
roadmapPostsCollectionConfig,
2626
roadmapVersionsCollectionConfig,
27-
announcementsCollectionConfig
27+
announcementsCollectionConfig,
2828
];

workspaces/cms-config/src/collections/settings.ts

+69-29
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { linkFields } from "../blocks";
22
import { CmsCollection } from "../types";
33

4-
54
const permissionOptions = [
65
{
76
label: "All",
@@ -43,7 +42,7 @@ const permissionOptions = [
4342
label: "Roadmap and Announcements",
4443
value: "roadmap",
4544
},
46-
]
45+
];
4746

4847
export const settingsCollectionConfig = {
4948
crowdin: true,
@@ -65,7 +64,7 @@ export const settingsCollectionConfig = {
6564
label: "Title",
6665
name: "title",
6766
widget: "string",
68-
crowdin: true
67+
crowdin: true,
6968
},
7069
{
7170
label: "Columns",
@@ -83,7 +82,7 @@ export const settingsCollectionConfig = {
8382
name: "title",
8483
required: false,
8584
widget: "string",
86-
crowdin: true
85+
crowdin: true,
8786
},
8887
{
8988
label: "Menu Items",
@@ -120,12 +119,12 @@ export const settingsCollectionConfig = {
120119
{
121120
name: "source",
122121
widget: "string",
123-
crowdin: false
122+
crowdin: false,
124123
},
125124
{
126125
name: "destination",
127126
widget: "string",
128-
crowdin: false
127+
crowdin: false,
129128
},
130129
],
131130
},
@@ -143,14 +142,14 @@ export const settingsCollectionConfig = {
143142
widget: "list",
144143
fields: [
145144
{
146-
name: 'category',
147-
label: 'Category',
148-
widget: 'relation',
149-
collection: 'categories',
150-
search_fields: ['name'],
151-
value_field: 'id',
152-
display_fields: ['name'],
153-
options_length: 300
145+
name: "category",
146+
label: "Category",
147+
widget: "relation",
148+
collection: "categories",
149+
search_fields: ["name"],
150+
value_field: "id",
151+
display_fields: ["name"],
152+
options_length: 300,
154153
},
155154
],
156155
},
@@ -171,7 +170,7 @@ export const settingsCollectionConfig = {
171170
label: "Name",
172171
name: "name",
173172
widget: "string",
174-
crowdin: true
173+
crowdin: true,
175174
},
176175
{
177176
label: "Type",
@@ -202,19 +201,19 @@ export const settingsCollectionConfig = {
202201
label: "Twitter handle",
203202
name: "twitter",
204203
widget: "string",
205-
crowdin: false
204+
crowdin: false,
206205
},
207206
{
208207
label: "Website url",
209208
name: "website_url",
210209
widget: "string",
211-
crowdin: false
210+
crowdin: false,
212211
},
213212
{
214213
label: "Description",
215214
name: "body",
216215
widget: "string",
217-
crowdin: true
216+
crowdin: true,
218217
},
219218
],
220219
},
@@ -255,7 +254,7 @@ export const settingsCollectionConfig = {
255254
name: "title",
256255
label: "Title",
257256
widget: "string",
258-
crowdin: true
257+
crowdin: true,
259258
},
260259
{
261260
name: "body",
@@ -268,7 +267,7 @@ export const settingsCollectionConfig = {
268267
hint: "If page url is not specified (e.g. 'learn/glossary'), it will be used globally",
269268
required: false,
270269
widget: "string",
271-
crowdin: false
270+
crowdin: false,
272271
},
273272
],
274273
},
@@ -294,7 +293,7 @@ export const settingsCollectionConfig = {
294293
search_fields: ["title"],
295294
value_field: "id",
296295
display_fields: ["title"],
297-
options_length: 300
296+
options_length: 300,
298297
},
299298
],
300299
},
@@ -315,36 +314,36 @@ export const settingsCollectionConfig = {
315314
label: "Hero banner title",
316315
widget: "string",
317316
required: true,
318-
crowdin: true
317+
crowdin: true,
319318
},
320319
{
321320
name: "hero_description",
322321
label: "Hero description",
323322
widget: "string",
324323
required: true,
325-
crowdin: true
324+
crowdin: true,
326325
},
327326
{
328327
name: "show_hero_cta",
329328
label: "Show hero banner CTA",
330329
widget: "boolean",
331330
default: true,
332-
crowdin: true
331+
crowdin: true,
333332
},
334333
{
335334
name: "hero_cta_copy",
336335
label: "Hero banner CTA copy",
337336
widget: "string",
338337
required: false,
339-
crowdin: true
338+
crowdin: true,
340339
},
341340
{
342341
name: "roadmap_post_ps",
343342
label: "Roadmap post p.s. copy",
344343
widget: "markdown",
345344
required: false,
346-
crowdin: true
347-
}
345+
crowdin: true,
346+
},
348347
],
349348
},
350349
{
@@ -369,14 +368,55 @@ export const settingsCollectionConfig = {
369368
label: "Name",
370369
widget: "string",
371370
crowdin: false,
372-
required: false
371+
required: false,
373372
},
374373
{
375374
name: "access",
376375
label: "Access to collections",
377376
multiple: true,
378377
widget: "select",
379-
options: permissionOptions
378+
options: permissionOptions,
379+
},
380+
],
381+
},
382+
],
383+
},
384+
{
385+
label: "Latest Announcements",
386+
name: "LatestAnnouncements",
387+
file: `_data/settings/latest-announcements.yml`,
388+
crowdin: false,
389+
fields: [
390+
{
391+
label: "announcements",
392+
name: "announcements",
393+
widget: "list",
394+
fields: [
395+
{
396+
name: "image",
397+
widget: "image",
398+
crowdin: false,
399+
},
400+
{
401+
name: "text",
402+
widget: "string",
403+
crowdin: false,
404+
},
405+
{
406+
name: "buttonText",
407+
widget: "string",
408+
crowdin: false,
409+
},
410+
{
411+
name: "buttonLink",
412+
widget: "string",
413+
crowdin: false,
414+
},
415+
{
416+
name: "isActive",
417+
widget: "boolean",
418+
default: true,
419+
crowdin: false,
380420
},
381421
],
382422
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { getJSON } from "@starknet-io/cms-utils/src/index";
2+
3+
export type LatestAnnouncements = {
4+
readonly image: string;
5+
readonly text: string;
6+
readonly buttonText: string;
7+
readonly buttonLink: string;
8+
readonly isActive: boolean;
9+
};
10+
11+
export async function getLatestAnnouncements(
12+
context: EventContext<{}, any, Record<string, unknown>>
13+
) {
14+
try {
15+
const latestAnnouncements = await getJSON(
16+
"data/latest-announcements/latest-announcements",
17+
context
18+
);
19+
20+
return latestAnnouncements;
21+
} catch (cause) {
22+
throw new Error("getLatestAnnouncements failed!", {
23+
cause,
24+
});
25+
}
26+
}

0 commit comments

Comments
 (0)