|
|
@ -2,58 +2,64 @@ import Head from 'next/head'
|
|
|
|
import styles from '../styles/Gallery.module.css'
|
|
|
|
import styles from '../styles/Gallery.module.css'
|
|
|
|
import Header from '../components/header';
|
|
|
|
import Header from '../components/header';
|
|
|
|
import Footer from '../components/footer';
|
|
|
|
import Footer from '../components/footer';
|
|
|
|
// import { google } from 'googleapis';
|
|
|
|
|
|
|
|
// import fs from 'fs';
|
|
|
|
|
|
|
|
// import readline from 'readline';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default function Gallery() {
|
|
|
|
export default function Gallery({ response }) {
|
|
|
|
return (
|
|
|
|
let images = [];
|
|
|
|
<div className="page">
|
|
|
|
for(const key in response) {
|
|
|
|
<Head>
|
|
|
|
let item = response[key];
|
|
|
|
<title>Trick - Gallery</title>
|
|
|
|
images.push(item['fields']);
|
|
|
|
</Head>
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
<Header />
|
|
|
|
return (
|
|
|
|
|
|
|
|
<div className="page">
|
|
|
|
|
|
|
|
<Head>
|
|
|
|
|
|
|
|
<title>Trick - Gallery</title>
|
|
|
|
|
|
|
|
</Head>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="container">
|
|
|
|
<Header />
|
|
|
|
<article className="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section className="card">
|
|
|
|
<div className="container">
|
|
|
|
<h1 className="h-unset">Gallery</h1>
|
|
|
|
<article className="content">
|
|
|
|
<p>Coming Soon...</p>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</article>
|
|
|
|
<section className="card">
|
|
|
|
</div>
|
|
|
|
<h1 className="h-unset">Gallery</h1>
|
|
|
|
|
|
|
|
|
|
|
|
<Footer />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// export async function getServerSideProps() {
|
|
|
|
<div className={styles.gallery}>
|
|
|
|
// const auth = new google.auth.GoogleAuth({
|
|
|
|
{images.map((image) => (
|
|
|
|
// keyFile: process.env.GOOGLE_APPLICATION_CREDENTIALS,
|
|
|
|
<div>
|
|
|
|
// scopes: ['https://www.googleapis.com/auth/spreadsheets.readonly']
|
|
|
|
<img src={image.link}></img>
|
|
|
|
// });
|
|
|
|
<h4 style={{ textAlign: "center", margin: "unset" }}>{image.name}</h4>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
))}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
// const sheets = google.sheets({ version: 'v4', auth });
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
// const { id } = 2;
|
|
|
|
</article>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
// const range = `Gallery!A:${id}:B${id}`;
|
|
|
|
<Footer />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// const response = sheets.spreadsheets.values.get({
|
|
|
|
async function getGallery() {
|
|
|
|
// spreadsheetId: "13V7PXSJ6FSPZakBbYEpi1495T3nWxJ7Loi4EWwOZ7lE",
|
|
|
|
const req = await fetch("https://api.airtable.com/v0/appQnOyKBnBVQXLUM/Gallery", {
|
|
|
|
// range,
|
|
|
|
method: "GET",
|
|
|
|
// });
|
|
|
|
headers: {
|
|
|
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
|
|
|
"Authorization": "Bearer " + process.env.AIRTABLE,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// const data = await response.json();
|
|
|
|
const data = await req.json();
|
|
|
|
|
|
|
|
return data['records'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// return {
|
|
|
|
export async function getServerSideProps() {
|
|
|
|
// props: {
|
|
|
|
return {
|
|
|
|
// response: data
|
|
|
|
props: {
|
|
|
|
// }
|
|
|
|
response: await getGallery()
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|