Skip to content

Commit

Permalink
Merge branch 'master' into base-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
intls authored Feb 20, 2025
2 parents 3a29f34 + 7728869 commit 9322de0
Show file tree
Hide file tree
Showing 1,256 changed files with 59,203 additions and 80,026 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
],
rules: {
'import/no-extraneous-dependencies': 'off',
'import/extensions': 'off',
},
},
],
Expand All @@ -29,6 +30,7 @@ module.exports = {
'import/extensions': ['error', 'never'],
'react/destructuring-assignment': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx', '.mdx'] }],
'react/react-in-jsx-scope': 'off',

// We utilize prop spreading
'react/jsx-props-no-spreading': 'off',
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ persisted_queries.json

# eslint
.eslintcache

.vercel
1 change: 0 additions & 1 deletion apps/base-docs/.env.example

This file was deleted.

1 change: 0 additions & 1 deletion apps/base-docs/.eslintignore

This file was deleted.

15 changes: 15 additions & 0 deletions apps/base-docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
node_modules/
docs/dist/
docs/build/
./vocs.config.tsx.timestamp*

# Yarn
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions

# Environment variables
.env*.local
.env
1 change: 1 addition & 0 deletions apps/base-docs/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
10 changes: 0 additions & 10 deletions apps/base-docs/404.js

This file was deleted.

4 changes: 1 addition & 3 deletions apps/base-docs/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# Base Docs

This the Docusaurus app for the Base docs. You can run the dev server locally with `yarn workspace @app/base-docs dev`.
This is a [Vocs](https://vocs.dev) project bootstrapped with the Vocs CLI.
46 changes: 0 additions & 46 deletions apps/base-docs/algolia.json

This file was deleted.

73 changes: 73 additions & 0 deletions apps/base-docs/api/submitFeedback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { google } from '@googleapis/sheets';
import type { VercelRequest, VercelResponse } from '@vercel/node';

// Initialize Google Sheets client
const getGoogleSheetsClient = () => {
try {
const credentials = JSON.parse(
Buffer.from(process.env.GOOGLE_SERVICE_ACCOUNT_KEY || '', 'base64').toString(),
);

const auth = new google.auth.GoogleAuth({
credentials,
scopes: ['https://www.googleapis.com/auth/spreadsheets'],
});

return google.sheets({ version: 'v4', auth });
} catch (error) {
console.error('Failed to initialize Google Sheets client:', error);
throw new Error('Failed to initialize Google Sheets client');
}
};

type FeedbackPayload = {
likeOrDislike: boolean;
options: string[];
comment: string;
url: string;
ipAddress: string;
timestamp: number;
};

export default async function handler(req: VercelRequest, res: VercelResponse) {
if (req.method !== 'POST') {
return res.status(405).json({ error: 'Method not allowed' });
}

try {
const { likeOrDislike, options, comment, url, ipAddress, timestamp } =
req.body as FeedbackPayload;

const sheets = getGoogleSheetsClient();
const spreadsheetId = process.env.GOOGLE_SHEETS_ID;

if (!spreadsheetId) {
throw new Error('GOOGLE_SHEETS_ID environment variable is not set');
}

// Format the row data
const rowData = [
new Date(timestamp).toISOString(),
url,
ipAddress,
likeOrDislike ? 'Like' : 'Dislike',
options.join(', '),
comment,
];

// Append the row to the sheet
await sheets.spreadsheets.values.append({
spreadsheetId,
range: 'Sheet1!A:F', // Adjust range based on your sheet's structure
valueInputOption: 'USER_ENTERED',
requestBody: {
values: [rowData],
},
});

return res.status(200).json({ success: true });
} catch (error) {
console.error('Error submitting feedback:', error);
return res.status(500).json({ error: 'Failed to submit feedback' });
}
}
12 changes: 0 additions & 12 deletions apps/base-docs/assets/icons/caret-down-black.svg

This file was deleted.

12 changes: 0 additions & 12 deletions apps/base-docs/assets/icons/caret-down-white.svg

This file was deleted.

4 changes: 0 additions & 4 deletions apps/base-docs/assets/icons/collapse-black.svg

This file was deleted.

4 changes: 0 additions & 4 deletions apps/base-docs/assets/icons/collapse-white.svg

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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 0 additions & 5 deletions apps/base-docs/babel.config.js

This file was deleted.

Loading

0 comments on commit 9322de0

Please sign in to comment.