Skip to content

Commit 7728869

Browse files
brendan-defidschlabachericbrown99
authored
Feat: Base Docs V2 (#1784)
* fresh slate * fresh import * linter settings * working local build * add file-loader * linter fixes * scratch updates * theme working, banner not working * save * remove log * fresh slate * fresh import * linter settings * working local build * add file-loader * linter fixes * scratch updates * theme working, banner not working * save * remove log * fix cookie banner with polyfil * cca draft * logevent * Remove dead code * Fix typo in quickstart * optimize large gif * add csp * move ga to vocs config * QA fixes * linter --------- Co-authored-by: dschlabach <[email protected]> Co-authored-by: eric-brown <[email protected]>
1 parent 08f49a6 commit 7728869

File tree

1,253 files changed

+59181
-80026
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,253 files changed

+59181
-80026
lines changed

Diff for: .eslintrc.js

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
],
1313
rules: {
1414
'import/no-extraneous-dependencies': 'off',
15+
'import/extensions': 'off',
1516
},
1617
},
1718
],
@@ -29,6 +30,7 @@ module.exports = {
2930
'import/extensions': ['error', 'never'],
3031
'react/destructuring-assignment': 'off',
3132
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx', '.mdx'] }],
33+
'react/react-in-jsx-scope': 'off',
3234

3335
// We utilize prop spreading
3436
'react/jsx-props-no-spreading': 'off',

Diff for: apps/base-docs/.env.example

-1
This file was deleted.

Diff for: apps/base-docs/.eslintignore

-1
This file was deleted.

Diff for: apps/base-docs/.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1+
node_modules/
2+
docs/dist/
3+
docs/build/
4+
./vocs.config.tsx.timestamp*
5+
6+
# Yarn
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/releases
10+
!.yarn/plugins
11+
!.yarn/sdks
12+
!.yarn/versions
13+
14+
# Environment variables
15+
.env*.local
116
.env

Diff for: apps/base-docs/.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

Diff for: apps/base-docs/404.js

-10
This file was deleted.

Diff for: apps/base-docs/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
# Base Docs
2-
3-
This the Docusaurus app for the Base docs. You can run the dev server locally with `yarn workspace @app/base-docs dev`.
1+
This is a [Vocs](https://vocs.dev) project bootstrapped with the Vocs CLI.

Diff for: apps/base-docs/algolia.json

-46
This file was deleted.

Diff for: apps/base-docs/api/submitFeedback.ts

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import { google } from '@googleapis/sheets';
2+
import type { VercelRequest, VercelResponse } from '@vercel/node';
3+
4+
// Initialize Google Sheets client
5+
const getGoogleSheetsClient = () => {
6+
try {
7+
const credentials = JSON.parse(
8+
Buffer.from(process.env.GOOGLE_SERVICE_ACCOUNT_KEY || '', 'base64').toString(),
9+
);
10+
11+
const auth = new google.auth.GoogleAuth({
12+
credentials,
13+
scopes: ['https://www.googleapis.com/auth/spreadsheets'],
14+
});
15+
16+
return google.sheets({ version: 'v4', auth });
17+
} catch (error) {
18+
console.error('Failed to initialize Google Sheets client:', error);
19+
throw new Error('Failed to initialize Google Sheets client');
20+
}
21+
};
22+
23+
type FeedbackPayload = {
24+
likeOrDislike: boolean;
25+
options: string[];
26+
comment: string;
27+
url: string;
28+
ipAddress: string;
29+
timestamp: number;
30+
};
31+
32+
export default async function handler(req: VercelRequest, res: VercelResponse) {
33+
if (req.method !== 'POST') {
34+
return res.status(405).json({ error: 'Method not allowed' });
35+
}
36+
37+
try {
38+
const { likeOrDislike, options, comment, url, ipAddress, timestamp } =
39+
req.body as FeedbackPayload;
40+
41+
const sheets = getGoogleSheetsClient();
42+
const spreadsheetId = process.env.GOOGLE_SHEETS_ID;
43+
44+
if (!spreadsheetId) {
45+
throw new Error('GOOGLE_SHEETS_ID environment variable is not set');
46+
}
47+
48+
// Format the row data
49+
const rowData = [
50+
new Date(timestamp).toISOString(),
51+
url,
52+
ipAddress,
53+
likeOrDislike ? 'Like' : 'Dislike',
54+
options.join(', '),
55+
comment,
56+
];
57+
58+
// Append the row to the sheet
59+
await sheets.spreadsheets.values.append({
60+
spreadsheetId,
61+
range: 'Sheet1!A:F', // Adjust range based on your sheet's structure
62+
valueInputOption: 'USER_ENTERED',
63+
requestBody: {
64+
values: [rowData],
65+
},
66+
});
67+
68+
return res.status(200).json({ success: true });
69+
} catch (error) {
70+
console.error('Error submitting feedback:', error);
71+
return res.status(500).json({ error: 'Failed to submit feedback' });
72+
}
73+
}

Diff for: apps/base-docs/assets/icons/caret-down-black.svg

-12
This file was deleted.

Diff for: apps/base-docs/assets/icons/caret-down-white.svg

-12
This file was deleted.

Diff for: apps/base-docs/assets/icons/collapse-black.svg

-4
This file was deleted.

Diff for: apps/base-docs/assets/icons/collapse-white.svg

-4
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-204 KB
Binary file not shown.
Binary file not shown.
-1.37 MB
Binary file not shown.
Binary file not shown.

Diff for: apps/base-docs/babel.config.js

-5
This file was deleted.

0 commit comments

Comments
 (0)