Initial commit
This commit is contained in:
parent
eaf3485a21
commit
488d1be3ab
18 changed files with 3271 additions and 1 deletions
34
app/api/route.ts
Normal file
34
app/api/route.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { google } from 'googleapis';
|
||||
import { NextResponse } from 'next/server';
|
||||
import { NextApiResponse } from 'next';
|
||||
|
||||
export async function GET() {
|
||||
const target = ['https://www.googleapis.com/auth/spreadsheets.readonly'];
|
||||
const jwt = new google.auth.JWT(
|
||||
process.env.API_EMAIL,
|
||||
undefined,
|
||||
(process.env.API_KEY || '').replace(/\\n/g, '\n'),
|
||||
target
|
||||
);
|
||||
|
||||
const sheets = google.sheets({version: 'v4', auth: jwt});
|
||||
const response = await sheets.spreadsheets.values.get({
|
||||
spreadsheetId: process.env.SPREADSHEET_ID,
|
||||
range: 'Overview',
|
||||
});
|
||||
|
||||
const rows = response.data.values;
|
||||
if (rows?.length) {
|
||||
let sheetData: Array<Array<number>> = new Array<Array<number>>;
|
||||
for (let i = 3; i < 17; i++) {
|
||||
let tempArray = new Array<number>;
|
||||
tempArray.push(rows[i][1]);
|
||||
tempArray.push(rows[i][2]);
|
||||
sheetData.push(tempArray);
|
||||
}
|
||||
return NextResponse.json({ sheetData });
|
||||
}
|
||||
else {
|
||||
return NextResponse.json({ status: 500 })
|
||||
}
|
||||
}
|
BIN
app/favicon.ico
Normal file
BIN
app/favicon.ico
Normal file
Binary file not shown.
After Width: 256px | Height: 256px | Size: 25 KiB |
27
app/globals.css
Normal file
27
app/globals.css
Normal file
|
@ -0,0 +1,27 @@
|
|||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
:root {
|
||||
--foreground: #000000;
|
||||
--background-start: #D6DBDC;
|
||||
--background-end: #ffffff;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--foreground: #ffffff;
|
||||
--background-start: #000000;
|
||||
--background-end: #000000;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
color: var(--foreground);
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
transparent,
|
||||
var(--background-end)
|
||||
)
|
||||
var(--background-start);
|
||||
}
|
21
app/layout.tsx
Normal file
21
app/layout.tsx
Normal file
|
@ -0,0 +1,21 @@
|
|||
import './globals.css'
|
||||
import { Inter } from 'next/font/google'
|
||||
|
||||
const inter = Inter({ subsets: ['latin'] })
|
||||
|
||||
export const metadata = {
|
||||
title: 'Create Next App',
|
||||
description: 'Generated by create next app',
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={inter.className}>{children}</body>
|
||||
</html>
|
||||
)
|
||||
}
|
9
app/page.tsx
Normal file
9
app/page.tsx
Normal file
|
@ -0,0 +1,9 @@
|
|||
import {RadarChart} from '../components/charts/radar'
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<main className="flex min-h-screen flex-col items-center justify-between">
|
||||
<RadarChart />
|
||||
</main>
|
||||
)
|
||||
}
|
Reference in a new issue