-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
328 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ yarn-error.log* | |
|
||
# vercel | ||
.vercel | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { useState } from "react"; | ||
import axios from "axios"; | ||
import styles from '../styles/Home.module.css' | ||
|
||
export default () => { | ||
const [email, setEmail] = useState(""); | ||
const [state, setState] = useState("IDLE"); | ||
const [errorMessage, setErrorMessage] = useState(null); | ||
|
||
const subscribe = async () => { | ||
setState("LOADING"); | ||
setErrorMessage(null); | ||
try { | ||
const response = await axios.post("/api/newsletter", { email }); | ||
setState("SUCCESS"); | ||
} catch (e) { | ||
setErrorMessage(e.response.data.error); | ||
setState("ERROR"); | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<h3 className={styles.subtitle}> | ||
Connect / Share / Learn | ||
</h3> | ||
|
||
<p className={styles.descriptiontitle}> | ||
Please register your interest... | ||
</p> | ||
|
||
<div className={styles.registerMailchimp}> | ||
<input className={styles.registerMailchimpInput} | ||
type="text" | ||
placeholder="Enter Email" | ||
value={email} | ||
onChange={(e) => setEmail(e.target.value)} | ||
/> | ||
<button type="button" className={styles.registerMailchimpButton} disabled={state === "LOADING"} onClick={subscribe}>Subscribe</button> | ||
</div> | ||
|
||
{state === "ERROR" && ( | ||
<p className={styles.description}>{errorMessage}</p> | ||
)} | ||
|
||
{state === "SUCCESS" && ( | ||
<p className={styles.description}>Thanks! I'll be in touch shortly :) Chris.-</p> | ||
)} | ||
|
||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction | ||
|
||
export default (req, res) => { | ||
res.statusCode = 200 | ||
res.json({ name: 'John Doe' }) | ||
res.status(200).json({ name: 'John Doe' }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import axios from "axios"; | ||
|
||
function getRequestParams(email) { | ||
// get env variables | ||
const API_KEY = process.env.MAILCHIMP_API_KEY; | ||
const LIST_ID = process.env.MAILCHIMP_LIST_ID; | ||
// mailchimp datacenter - mailchimp api keys always look like this: | ||
// fe4f064432e4684878063s83121e4971-us6 | ||
// We need the us6 part | ||
const DATACENTER = process.env.MAILCHIMP_API_KEY.split("-")[1]; | ||
|
||
const url = `https://${DATACENTER}.api.mailchimp.com/3.0/lists/${LIST_ID}/members`; | ||
|
||
// Add aditional params here. See full list of available params: | ||
// https://mailchimp.com/developer/reference/lists/list-members/ | ||
const data = { | ||
email_address: email, | ||
status: "subscribed", | ||
}; | ||
|
||
// Api key needs to be encoded in base 64 format | ||
const base64ApiKey = Buffer.from(`anystring:${API_KEY}`).toString("base64"); | ||
const headers = { | ||
"Content-Type": "application/json", | ||
Authorization: `Basic ${base64ApiKey}`, | ||
}; | ||
|
||
return { | ||
url, | ||
data, | ||
headers, | ||
}; | ||
} | ||
|
||
export default async (req, res) => { | ||
const { email } = req.body; | ||
|
||
if (!email || !email.length) { | ||
return res.status(400).json({ | ||
error: "Forgot to add your email?", | ||
}); | ||
} | ||
|
||
try { | ||
const { url, data, headers } = getRequestParams(email); | ||
|
||
const response = await axios.post(url, data, { headers }); | ||
|
||
// Success | ||
return res.status(201).json({ error: null }); | ||
} catch (error) { | ||
return res.status(400).json({ | ||
error: `Something went wrong... Please contact me by email at [email protected] and I'll add you to the list.`, | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import Head from 'next/head' | ||
import Image from 'next/image' | ||
import styles from '../styles/Home.module.css' | ||
|
||
function Chris() { | ||
return ( | ||
<div className={styles.container}> | ||
<Head> | ||
<title>Chris Mazur - mate.dev</title> | ||
<meta name="description" content="mate.dev community" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
|
||
<main className={styles.main}> | ||
<h1 className={styles.title}> | ||
Chris[tian] Mazur{" "} | ||
<span role="img" aria-label="mate"> | ||
|
||
</span> | ||
</h1> | ||
|
||
<p className={styles.description}> | ||
IT Consultant - Software Developer - Passionate about Tech Communities and collaborative learning.{" "}🇦🇷 🇳🇿 🧉♟ | ||
</p> | ||
|
||
<div className={styles.grid}> | ||
<a href="https://twitter.com/chmazur" className={styles.cardSocial}> | ||
<h2>Twitter →</h2> | ||
<p>@chmazur</p> | ||
</a> | ||
|
||
<a href="https://www.linkedin.com/in/cloud-native" className={styles.cardSocial}> | ||
<h2>LinkedIn →</h2> | ||
<p>cloud-native</p> | ||
</a> | ||
|
||
<a href="https://github.com/chaltenio" className={styles.cardSocial}> | ||
<h2>Github →</h2> | ||
<p>chaltenio</p> | ||
</a> | ||
</div> | ||
|
||
<div className={styles.grid}> | ||
|
||
<a href="#" className={styles.cardSocial}> | ||
<h2>Blog?</h2> | ||
<p>Coming soon!</p> | ||
</a> | ||
|
||
<a href="https://discord.gg/xT9cMSy" className={styles.cardSocial}> | ||
<h2>Discord →</h2> | ||
<p>Join me!</p> | ||
</a> | ||
|
||
<a href="https://www.chess.com/member/chmazur" className={styles.cardSocial}> | ||
<h2>Chess.com →</h2> | ||
<p>Let's play?!</p> | ||
</a> | ||
</div> | ||
|
||
<div className={styles.grid}> | ||
<div> | ||
<h2>My journey with communities:{' '} </h2> | ||
|
||
<div> | ||
<p> | ||
- Argentina PHP User Group Co-Founder <br /> | ||
- Co-Founder & Co-Organizer PHP Conference Argentina (Buenos Aires - @phpconferencear)<br /> | ||
- Founder & Organizer PHP Conference New Zealand (Wellington - php.org.nz)<br /> | ||
- Founder & Organizer ScaleConf New Zealand (Wellington - @sconfnz)<br /> | ||
- Founder & Organizer Cloud Native Summit (Wellington - {" "}<a href="https://cloudnativesummit.co/nz" target="_blank"> | ||
cloudnativesummit.co)</a><br /> | ||
- Founder & Organizer Service Mesh Day (San Francisco & Online - {" "}<a href="https://servicemeshday.com" target="_blank">servicemeshday.com</a>)<br /> | ||
- Founder & Organizer FullStack Day (Auckland & Online - {" "}<a href="https://fullstackday.com" target="_blank">fullstackday.com</a>)<br /> | ||
- Web Dev Meetup Wellington & Auckland<br /> | ||
- Devops Meetup Wellington<br /> | ||
- Cloud Native Meetup Auckland, <br /> | ||
- Connectar.DEV (online meetup)<br /> | ||
- Organizer Elastic NZ community<br /> | ||
- Layer5 contributor (Service Meshes community)<br /> | ||
</p> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
</main> | ||
|
||
<footer className={styles.footer}> | ||
<a | ||
href="https://mate.dev/chris" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
2021 - Contact | ||
</a> | ||
</footer> | ||
</div> | ||
) | ||
} | ||
|
||
export default Chris |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.
965442b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: