Skip to content

Commit 794b003

Browse files
author
Abdulhakim Ajetunmobi
committed
dynamic toolbar loading
1 parent 9dae250 commit 794b003

File tree

10 files changed

+330
-20
lines changed

10 files changed

+330
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
*.zip
55
.DS_Store
6+
*.drawio
67

78
### Node ###
89
# Logs

tutorials/messages_api-sms/.astro/astro/content.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
declare module 'astro:content' {
2+
interface Render {
3+
'.mdoc': Promise<{
4+
Content(props: Record<string, any>): import('astro').MarkdownInstance<{}>['Content'];
5+
headings: import('astro').MarkdownHeading[];
6+
}>;
7+
}
8+
}
9+
110
declare module 'astro:content' {
211
interface Render {
312
'.mdx': Promise<{
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import { defineConfig } from 'astro/config';
2+
3+
import markdoc from '@astrojs/markdoc';
24
import starlight from '@astrojs/starlight';
35
import relativeLinks from 'astro-relative-links';
4-
import myIntegration from './my-toolbar-app/my-integration.ts';
6+
import vonageIntegration from './vonage-toolbar/integration.ts';
57

68
// https://astro.build/config
79
export default defineConfig({
810
integrations: [
911
relativeLinks(),
10-
myIntegration,
12+
vonageIntegration,
1113
starlight({
1214
title: 'Vonage Onboarding',
1315
tableOfContents: false,
1416
pagefind: false,
1517
}),
18+
markdoc({ allowHTML: true })
1619
],
1720
});
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import fs from 'fs/promises';
2+
3+
async function downloadFile(url, filename) {
4+
console.log('downloading: ', filename);
5+
try {
6+
const response = await fetch(url);
7+
const buffer = await response.arrayBuffer();
8+
9+
await fs.mkdir('./vonage-toolbar', { recursive: true }); // Create the downloads directory if it doesn't exist
10+
await fs.writeFile(
11+
`./vonage-toolbar/${filename}`,
12+
Buffer.from(buffer),
13+
(err) => {
14+
if (err) {
15+
console.error('Error writing file:', err);
16+
} else {
17+
console.log('File downloaded and written successfully!');
18+
}
19+
}
20+
);
21+
} catch (error) {
22+
console.error('Error downloading file:', error);
23+
}
24+
}
25+
26+
console.log('download toolbar application files');
27+
28+
downloadFile(
29+
'https://raw.githubusercontent.com/conshus/onboarding-tutorials/refs/heads/main/toolbar-app/vonage-toolbar/integration.ts',
30+
'integration.ts'
31+
);
32+
33+
downloadFile(
34+
'https://raw.githubusercontent.com/conshus/onboarding-tutorials/refs/heads/main/toolbar-app/vonage-toolbar/app.ts',
35+
'app.ts'
36+
);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineMarkdocConfig } from '@astrojs/markdoc/config';
2+
import starlightMarkdoc from '@astrojs/starlight-markdoc';
3+
4+
export default defineMarkdocConfig({
5+
extends: [starlightMarkdoc()],
6+
});

0 commit comments

Comments
 (0)