Skip to content

Commit f6f59b3

Browse files
committed
Update
- Using worker to load data - Type strict - Other adjustments
1 parent a4a7165 commit f6f59b3

28 files changed

Lines changed: 449 additions & 401 deletions

netlify/functions/sendMail.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ export const handler: Handler = async (event) => {
3232
if (event.httpMethod !== "POST") {
3333
return {
3434
statusCode: 405,
35-
headers: corsHeaders,
36-
body: "Method Not Allowed",
35+
headers: { ...corsHeaders, "Content-Type": "application/json" },
36+
body: JSON.stringify({ error: "Method Not Allowed" }),
3737
};
3838
}
3939

40+
const forwarded = event.headers["x-forwarded-for"];
4041
const clientIP =
41-
event.headers["x-forwarded-for"] ||
42+
(forwarded ? forwarded.split(",")[0] : null) ||
4243
event.headers["client-ip"] ||
4344
event.headers["x-nf-client-connection-ip"] ||
4445
"unknown";
@@ -54,7 +55,10 @@ export const handler: Handler = async (event) => {
5455
if (ipStore[clientIP].count >= MAX_EMAILS_PER_HOUR) {
5556
return {
5657
statusCode: 429,
57-
headers: corsHeaders,
58+
headers: {
59+
...corsHeaders,
60+
"Content-Type": "application/json",
61+
},
5862
body: JSON.stringify({
5963
error: "Rate limit exceeded: Max 3 emails per hour allowed.",
6064
}),
@@ -74,26 +78,29 @@ export const handler: Handler = async (event) => {
7478
if (!firstname || !email || !message) {
7579
return {
7680
statusCode: 400,
77-
headers: corsHeaders,
81+
headers: { ...corsHeaders, "Content-Type": "application/json" },
7882
body: JSON.stringify({ error: "Missing required fields" }),
7983
};
8084
}
8185

8286
const transporter = nodemailer.createTransport({
8387
host: process.env.SMTP_HOST,
8488
port: Number(process.env.SMTP_PORT),
85-
secure: true,
89+
secure: Number(process.env.SMTP_PORT) === 465,
8690
auth: {
8791
user: process.env.SMTP_USER,
8892
pass: process.env.SMTP_PASS,
8993
},
9094
});
9195

9296
await transporter.sendMail({
93-
from: `"${firstname} ${lastname || ""}" <${email}>`,
97+
from: process.env.SMTP_USER,
98+
replyTo: email,
9499
to: process.env.SMTP_TO,
95-
subject: subject,
96-
text: `${message} \n${email}`,
100+
subject: subject || "New Contact Form Submission",
101+
text: `Name: ${firstname} ${
102+
lastname || ""
103+
}\nEmail: ${email}\n\n${message}`,
97104
});
98105

99106
return {
@@ -105,7 +112,7 @@ export const handler: Handler = async (event) => {
105112
console.error("Error sending mail:", error);
106113
return {
107114
statusCode: 500,
108-
headers: corsHeaders,
115+
headers: { ...corsHeaders, "Content-Type": "application/json" },
109116
body: JSON.stringify({ error: error.message || "Unknown error" }),
110117
};
111118
}

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/components/Card.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1+
import { CommonItem } from "app/types/Section";
2+
13
import { Lato } from "next/font/google";
24
import React from "react";
3-
import { IconType } from "react-icons";
45
import { IoIosLink } from "react-icons/io";
56

67
const lato = Lato({ weight: "400", subsets: ["latin"] });
78

8-
type Props = {
9-
title: string;
10-
subtitle: string;
11-
duration: string;
12-
detail: React.ReactNode;
13-
className?: string;
14-
link?: string; // The URL
15-
linkIcon?: IconType; // Icon component
16-
};
17-
189
export default React.memo(function Card({
1910
title,
2011
subtitle,
@@ -23,7 +14,7 @@ export default React.memo(function Card({
2314
className,
2415
link,
2516
linkIcon: LinkIcon = IoIosLink, // Default icon
26-
}: Props) {
17+
}: CommonItem) {
2718
return (
2819
<article
2920
className={`max-w-md h-full justify-between flex flex-col gap-4 p-4 rounded-lg border border-gray-200 shadow-sm ${

src/app/components/ContactCard.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1+
import { ContactItem } from "app/types/Section";
2+
13
import { Lato } from "next/font/google";
2-
import { IconType } from "react-icons";
34

45
const lato = Lato({ weight: "400", subsets: ["latin"] });
56

6-
type ContactProps = {
7-
title: string;
8-
image: IconType;
9-
content: React.ReactNode;
10-
};
11-
127
export default function ContactCard({
138
title,
149
image: Icon,
1510
content,
16-
}: ContactProps) {
11+
}: ContactItem) {
1712
return (
1813
<div className="flex flex-row w-full gap-4 rounded-xl p-4 border-2 border-solid border-(--primary) items-center">
1914
{/* Icon */}

src/app/components/Menu.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export default function Hamburger() {
2+
return (
3+
<>
4+
<span className="line"></span>
5+
<span className="line"></span>
6+
<span className="line"></span>
7+
</>
8+
);
9+
}

src/app/components/ProjectCard.tsx

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,21 @@
1+
import { ProjectItem } from "app/types/Section";
2+
13
import { Lato } from "next/font/google";
24
import Image from "next/image";
3-
import { IconType } from "react-icons";
45
import { IoIosLink } from "react-icons/io";
56

67
const lato = Lato({ weight: "400", subsets: ["latin"] });
78

8-
type ProjectCardProps = {
9-
name: string;
10-
image: string;
11-
details: string;
12-
points: string[];
13-
className?: string;
14-
link: string;
15-
techStack: string[];
16-
linkIcon?: IconType;
17-
};
18-
199
export default function ProjectCard({
20-
name,
10+
title,
2111
image,
22-
details,
12+
detail,
2313
points,
2414
className,
2515
link,
2616
techStack,
2717
linkIcon: LinkIcon = IoIosLink,
28-
}: ProjectCardProps) {
18+
}: ProjectItem) {
2919
return (
3020
<div
3121
className={`flex flex-col gap-5 w-full h-full max-w-md items-center justify-between border-2 rounded-xl p-5 ${
@@ -34,20 +24,20 @@ export default function ProjectCard({
3424
<div className="relative flex flex-col h-[200px] w-[300px]">
3525
<Image
3626
src={image || "https://dummyimage.com/600x400/000/fff"}
37-
alt={`image of ${name?.trim() || "dummy project"}`}
27+
alt={`image of ${title?.trim() || "dummy project"}`}
3828
fill={true}
3929
loading="lazy"
4030
draggable="false"
4131
className="w-full h-full select-none object-cover rounded-md"
4232
/>
4333
<h3 className="absolute font-bold text-lg z-10 w-full bottom-1 text-center text-(--accent) bg-(--secondary)">
44-
{name || "This is a dummy project name"}
34+
{title || "This is a dummy project name"}
4535
</h3>
4636
</div>
4737

4838
<div
4939
className={`flex flex-col gap-3 w-full max-w-sm justify-between ${lato.className}`}>
50-
<p className="text-justify">{details}</p>
40+
<p className="text-justify">{detail}</p>
5141
<ol className="list-decimal list-inside flex flex-col gap-1">
5242
{points.map((point, index) => (
5343
<li key={index} className="text-justify">

src/app/components/SkillCard.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
1-
import { Lato } from "next/font/google";
1+
import { SkillItem } from "app/types/Section";
22

3-
type SkillCardProps = {
4-
skillName: string;
5-
skillSet: string[];
6-
className?: string;
7-
};
3+
import { Lato } from "next/font/google";
84

95
const lato = Lato({ weight: "400", subsets: ["latin"] });
106

11-
export default function SkillCard({
12-
skillName,
13-
skillSet,
14-
className,
15-
}: SkillCardProps) {
7+
export default function SkillCard({ title, set, className }: SkillItem) {
168
return (
179
<article
1810
className={`flex flex-col text-left p-10 border-2 rounded-lg
1911
hover:shadow-2xl hover:shadow-black/40 transition duration-200
2012
cursor-pointer max-w-sm w-full h-full ${lato.className} ${className || ""}`}>
21-
<h3 className="text-xl font-semibold">{skillName}</h3>
13+
<h3 className="text-xl font-semibold">{title}</h3>
2214
<ul className="mt-3 list-disc list-inside space-y-1">
23-
{skillSet.map((skill, index) => (
15+
{set.map((skill, index) => (
2416
<li key={index}>{skill}</li>
2517
))}
2618
</ul>

src/app/data/Achievement.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[
2+
{
3+
"title": "Programming in Java",
4+
"subtitle": "IIT-KGP",
5+
"duration": "2023",
6+
"detail": "Successfully completed the Java Programming course offered by IIT-KGP through the NPTEL program, within the prescribed duration. Gained a thorough understanding of core Object-Oriented Programming concepts such as inheritance, multiple inheritance, polymorphism, etc. Concepts like Data Structures, multithreading, Collections etc. The fundamental were clearly explained and well understood. Submitted all assignments and assessments on time, and achieved a score of 71% in the certification exam.",
7+
"link": "https://archive.nptel.ac.in/content/noc/NOC23/SEM2/Ecertificates/106/noc23-cs74/Course/NPTEL23CS74S73270001020114236.pdf"
8+
},
9+
{
10+
"title": "Collections in Java",
11+
"subtitle": "Great Learning",
12+
"duration": "2024",
13+
"detail": "Gained a comprehensive understanding of the Java Collections Framework, including key concepts such as List, Set, Map, and their implementations (ArrayList, LinkedList, HashSet, TreeSet, HashMap, etc.). Learned about collection algorithms, iteration techniques, sorting, and efficient data handling practices. The course provided in-depth coverage of practical usage, performance considerations, and best practices. Successfully completed the course within the prescribed time frame.",
14+
"link": "https://www.mygreatlearning.com/certificate/PBQNAOTL"
15+
},
16+
{
17+
"title": "OOP in Java",
18+
"subtitle": "Great Learning",
19+
"duration": "2024",
20+
"detail": "Gained a thorough understanding of core object-oriented programming concepts, including inheritance, multiple inheritance, polymorphism, encapsulation, interfaces, abstraction, classes, and objects. The fundamental pillars of OOP were clearly covered and well comprehended. Successfully completed the course within the prescribed time frame.",
21+
"link": "https://www.mygreatlearning.com/certificate/JMEIZSVL"
22+
},
23+
{
24+
"title": "Java (Basics)",
25+
"subtitle": "HackerRank",
26+
"duration": "2024",
27+
"detail": "Successfully completed the Java Basics course on HackerRank, developing a strong foundation in core Java programming concepts. Covered essential topics such as data types, conditionals, loops, arrays, functions, and basic input/output handling. Gained experience by solving practical coding challenges, which reinforced problem-solving skills and logical thinking in Java.",
28+
"link": "https://www.hackerrank.com/certificates/cbaf34afb204"
29+
},
30+
{
31+
"title": "Software Engineering in Java",
32+
"subtitle": "HackerRank",
33+
"duration": "2024",
34+
"detail": "Completed the Software Engineering Intern program on HackerRank, gaining hands-on experience in problem-solving, coding best practices, and core software development concepts. Developed skills in algorithms, data structures, object-oriented programming, and debugging by working on practical coding challenges. Built a solid foundation for approaching real-world software engineering tasks with efficiency and clarity.",
35+
"link": "https://www.hackerrank.com/certificates/fd23e8486b66"
36+
},
37+
{
38+
"title": "Solved 300+ questions in Java",
39+
"subtitle": "LeetCode",
40+
"duration": "2024",
41+
"detail": "Solved over 300 coding problems on LeetCode, focusing on Easy and Medium difficulty levels, to strengthen problem-solving skills and algorithmic thinking. Maintained a continuous streak of nearly ~290 days of daily practice, demonstrating strong discipline, consistency, and dedication toward mastering data structures and algorithms.",
42+
"link": "https: //leetcode.com/u/davinash97"
43+
}
44+
]

src/app/data/Education.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"title": "Diploma in Electrical Engineering (Lateral)",
4+
"subtitle": "Rungta College of Engineering & Technology",
5+
"duration": "2017-2019",
6+
"detail": "I completed my Diploma in Electrical Engineering from Rungta College of Engineering & Technology, where I gained extensive knowledge during my academic years (2017-2019 Lateral Entry after ITI). I worked on various projects, including an Arduino-based robotic arm capable of picking up and placing objects, and a path-following vehicle designed to reach a predefined destination. Both projects were controllable via an Android device using Bluetooth communication."
7+
},
8+
{
9+
"title": "Bachelors in Computer Science Engineering (Lateral)",
10+
"subtitle": "Rungta College of Engineering & Technology",
11+
"duration": "2021-2024",
12+
"detail": "I completed my Bachelor of Technology in Computer Science Engineering from 2021 to 2024 (3 years due to Lateral Entry). Throughout my academic journey, I gained a solid understanding of how computers work, as well as the wide range of applications and software in the industry. During this time, I was part of a team that developed a social media-like platform for pets, designed to help users arrange playdates. Additionally, I worked on various web-based management software projects. These experiences significantly enhanced my knowledge and skills in web development and software engineering."
13+
}
14+
]

src/app/data/Experience.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"title": "Catalog Associate",
4+
"subtitle": "Amazon Development Center",
5+
"duration": "Jan 2025 - Present",
6+
"detail": "Currently working at Amazon as a Catalog Associate, specializing in Product Knowledge Classification.In my role, I have classified thousands of products accurately according to Standard Operating Procedures (SOPs),maintaining a consistent reliability score of 100%. I collaborate closely with cross-functional teams to ensure product data quality and correctness, helping improve catalog accuracy and customer experience.Additionally, streamline classification workflows by identifying process improvements, contributing to higher efficiency and faster turnaround times in product onboarding."
7+
},
8+
{
9+
"title": "Web Developer Intern",
10+
"subtitle": "Rungta Infotech Pvt Ltd",
11+
"duration": "Feb 2024 - Apr 2024",
12+
"detail": "Worked as a Web Development Intern at Rungta Infotech PVT LTD, where I gained hands-on experience in building and maintaining web applications. Throughout my internship, I learned and worked with key web development technologies including PHP, HTML, CSS, JavaScript, and SQL. I contributed to developing responsive web pages, implementing dynamic features, and managing database interactions, while following best practices for clean code and efficient performance. This experience strengthened my problem-solving skills and understanding of full-stack web development in a real-world environment."
13+
}
14+
]

0 commit comments

Comments
 (0)