diff --git a/.gitignore b/.gitignore index dd19570..4a7ec86 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -node_modules -.next -node_shell -.env +node_modules +.next +node_shell +.env /dump \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index efd0af0..7587be8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,20 @@ -# Set Node.js version -FROM node:16 - -# Set working directory -WORKDIR /usr/src/app - -# Copy package.json and package-lock.json -COPY package*.json ./ - -# Install dependencies -RUN npm install - -# Copy source code -COPY . . - -# Expose port 3000 -EXPOSE 3000 - -# Run the app +# Set Node.js version +FROM node:16 + +# Set working directory +WORKDIR /usr/src/app + +# Copy package.json and package-lock.json +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy source code +COPY . . + +# Expose port 3000 +EXPOSE 3000 + +# Run the app CMD ["npm", "run", "build", "&&", "npm", "start"] \ No newline at end of file diff --git a/README.md b/README.md index e0c8b6b..0545f8b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# personal_site -My personal site +# personal_site +My personal site diff --git a/app/(components)/AboutSection.tsx b/app/(components)/AboutSection.tsx index 33c63df..44fde75 100644 --- a/app/(components)/AboutSection.tsx +++ b/app/(components)/AboutSection.tsx @@ -1,61 +1,61 @@ -/** # MODULE TRACE -====================================================================== - * Detected 1 files that call this module. The files are listed below: -====================================================================== - * `import` Statement Found in [HomepageComponent.tsx] => file:///d:\GitHub\personal_site\app\(components)\HomepageComponent.tsx -==== MODULE TRACE END ==== */ - -"use client"; - -import React from "react"; - -export default function AboutSection() { - return ( -
Here are a few of my works: you can find more of my - work on my 99designs profile.
- -This animation was made for web view. I used aftereffects and bodymoving to accomplish this: - the result? High definition svg anmimation that looks crisp on any resolution and maintains - a relatively light weight
-This project is an ongoing webapp that connects github to asana. In this project I'm focusing - on the UI/UX, together with frontend functionality.
-I've traversed multiple fields over the past decade: from engineering - studies, to solar power constructions, to web design, graphic design, 2d animations, and code. Over the - years I've learnt the best skill: which is learnability and adaptability: hence I aim to cut across many - different fields: the world changes fast, and I think this is the only skill that matters.
-Ever expanding and ever improving, I have proffesional grade understanding - of the tools below. But I don't plan to stop here.
- -Your business is my business as soon as you hit that contact button. I'm - ready - to attend to your needs as soon as possible. Just drop a line.
- - Email Address - - -Here are a few of my works: you can find more of my + work on my 99designs profile.
+ +This animation was made for web view. I used aftereffects and bodymoving to accomplish this: + the result? High definition svg anmimation that looks crisp on any resolution and maintains + a relatively light weight
+This project is an ongoing webapp that connects github to asana. In this project I'm focusing + on the UI/UX, together with frontend functionality.
+I've traversed multiple fields over the past decade: from engineering + studies, to solar power constructions, to web design, graphic design, 2d animations, and code. Over the + years I've learnt the best skill: which is learnability and adaptability: hence I aim to cut across many + different fields: the world changes fast, and I think this is the only skill that matters.
+Ever expanding and ever improving, I have proffesional grade understanding + of the tools below. But I don't plan to stop here.
+ +Your business is my business as soon as you hit that contact button. I'm + ready + to attend to your needs as soon as possible. Just drop a line.
+ + Email Address + + +${name}
${email}
${message}
`; - const sanitizedHtml = sanitizeHtml(html, sanitizeHtmlOptions); - - try { - let info = await transporter.sendMail({ - from: `"Tben.me" <${process.env.TBENMAIL_EMAIL}>`, - to: "benoti.san@gmail.com, benoti.sanchez@gmail.com", - subject: "Tben.me | Client Message", - text: "Hello from tben", - html: sanitizedHtml, - }); - - console.log("Message sent: %s", info.messageId); - res.json({ msg: "Success", info: info }); - } catch (error) { - console.log(error); - res.json({ msg: "Failed" }); - } - } -} +/** + * Imports + */ +const fs = require("fs"); +const sanitizeHtml = require("sanitize-html"); +const nodemailer = require("nodemailer"); + +import sanitizeHtmlOptions from "../../functions/backend/sanitizeHtmlOptions"; +import { NextApiRequest, NextApiResponse } from "next"; + +let transporter = nodemailer.createTransport({ + host: process.env.TBENMAIL_HOST, + port: 587, + auth: { + user: process.env.TBENMAIL_EMAIL, + pass: process.env.TBENMAIL_EMAIL_PASSWORD, + }, +}); + +/** + * API handler + * + */ +export default async function handler(req: NextApiRequest, res: NextApiResponse) { + if (req.method === "POST") { + let name = req.body.name; + let email = req.body.email; + let message = req.body.message; + + const html = `${name}
${email}
${message}
`; + const sanitizedHtml = sanitizeHtml(html, sanitizeHtmlOptions); + + try { + let info = await transporter.sendMail({ + from: `"Tben.me" <${process.env.TBENMAIL_EMAIL}>`, + to: "benoti.san@gmail.com, benoti.sanchez@gmail.com", + subject: "Tben.me | Client Message", + text: "Hello from tben", + html: sanitizedHtml, + }); + + console.log("Message sent: %s", info.messageId); + res.json({ msg: "Success", info: info }); + } catch (error) { + console.log(error); + res.json({ msg: "Failed" }); + } + } +} diff --git a/pages/api/test-route.ts b/pages/api/test-route.ts index bcc5e89..419ebb2 100644 --- a/pages/api/test-route.ts +++ b/pages/api/test-route.ts @@ -1,45 +1,45 @@ -import { NextApiHandler, NextApiRequest, NextApiResponse } from "next"; -import Cors from "cors"; - -const cors = Cors({ - methods: ["GET"], - origin: "*", -}); - -// Helper method to wait for a middleware to execute before continuing -// And to throw an error when an error happens in a middleware -function runMiddleware(req: NextApiRequest, res: NextApiResponse, fn: Function) { - return new Promise((resolve, reject) => { - fn(req, res, (result: any) => { - if (result instanceof Error) { - return reject(result); - } - - return resolve(result); - }); - }); -} - -/** - * @type {NextApiHandler} - */ -export default async function handler(req: NextApiRequest, res: NextApiResponse) { - // res.setHeader("Access-Control-Allow-Credentials", "true"); - // res.setHeader("Access-Control-Allow-Origin", "*"); - // res.setHeader("Access-Control-Allow-Methods", "*"); - // res.setHeader("Access-Control-Allow-Headers", "*"); - - res.setHeader("Access-Control-Allow-Credentials", "true"); - res.setHeader("Access-Control-Allow-Origin", "*"); - // another common pattern - // res.setHeader('Access-Control-Allow-Origin', req.headers.origin); - res.setHeader("Access-Control-Allow-Methods", "GET,OPTIONS,PATCH,DELETE,POST,PUT"); - res.setHeader("Access-Control-Allow-Headers", "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version"); - - // await runMiddleware(req, res, cors); - - res.json({ - title: "Hello There", - message: "General Kenobi", - }); -} +import { NextApiHandler, NextApiRequest, NextApiResponse } from "next"; +import Cors from "cors"; + +const cors = Cors({ + methods: ["GET"], + origin: "*", +}); + +// Helper method to wait for a middleware to execute before continuing +// And to throw an error when an error happens in a middleware +function runMiddleware(req: NextApiRequest, res: NextApiResponse, fn: Function) { + return new Promise((resolve, reject) => { + fn(req, res, (result: any) => { + if (result instanceof Error) { + return reject(result); + } + + return resolve(result); + }); + }); +} + +/** + * @type {NextApiHandler} + */ +export default async function handler(req: NextApiRequest, res: NextApiResponse) { + // res.setHeader("Access-Control-Allow-Credentials", "true"); + // res.setHeader("Access-Control-Allow-Origin", "*"); + // res.setHeader("Access-Control-Allow-Methods", "*"); + // res.setHeader("Access-Control-Allow-Headers", "*"); + + res.setHeader("Access-Control-Allow-Credentials", "true"); + res.setHeader("Access-Control-Allow-Origin", "*"); + // another common pattern + // res.setHeader('Access-Control-Allow-Origin', req.headers.origin); + res.setHeader("Access-Control-Allow-Methods", "GET,OPTIONS,PATCH,DELETE,POST,PUT"); + res.setHeader("Access-Control-Allow-Headers", "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version"); + + // await runMiddleware(req, res, cors); + + res.json({ + title: "Hello There", + message: "General Kenobi", + }); +} diff --git a/pages/blog/[single].tsx b/pages/blog/[single].tsx index 4cc9def..8f2b21d 100644 --- a/pages/blog/[single].tsx +++ b/pages/blog/[single].tsx @@ -1,178 +1,178 @@ -/** - * ============================================================================== - * Imports - * ============================================================================== - */ -import React from "react"; -import Head from "next/head"; -import type { InferGetStaticPropsType, GetStaticProps, GetStaticPaths } from "next"; -const datasquirel = require("datasquirel"); - -/** ********************************************** */ -/** ********************************************** */ -/** ********************************************** */ - -import GeneralLayout from "../../layouts/general_layout/GeneralLayout"; -import TextShuffler from "../../components/actions/TextShuffler"; - -/** ****************************************************************************** */ -/** ****************************************************************************** */ -/** ****************************************************************************** */ -/** ****************************************************************************** */ -/** ****************************************************************************** */ -/** ****************************************************************************** */ - -/** - * ============================================================================== - * Main Component { Functional } - * ============================================================================== - * @param {Object} props - Server props - */ -export default function BlogIndex({ blogPost }: InferGetStaticPropsType