Skip to content

Commit

Permalink
reorganize components, temporarily remove guestbook, add contact page…
Browse files Browse the repository at this point in the history
… with form
  • Loading branch information
devashish2024 committed Jan 6, 2025
1 parent 9455a10 commit 2d4d6ae
Show file tree
Hide file tree
Showing 30 changed files with 2,407 additions and 40 deletions.
32 changes: 32 additions & 0 deletions actions/email.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use server";

import EmailTemplate from "@/emails/thank-you";
import { Resend } from "resend";

const resend = new Resend(process.env.RESEND_API_KEY);

export async function postContactEmail(formData: FormData): Promise<any> {
try {
const { data, error } = await resend.emails.send({
from: "Ashish Agarwal <[email protected]>",
to: [formData.get("email") as string],
cc: "[email protected]",
subject: `(Contact) ${formData.get("subject") as string}`,
react: EmailTemplate({
name: formData?.get("name") as string,
subject: formData?.get("subject") as string,
message: formData?.get("message") as string,
}),
});

if (error) {
console.error(error.message);
return false;
}

return true;
} catch (error) {
console.error(error);
return false;
}
}
6 changes: 2 additions & 4 deletions app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import Certifications from "@/components/certificates";
import Skills from "@/components/skills";
import Certifications from "@/components/portfolio/certificates";
import Skills from "@/components/portfolio/skills";
import ActionLink from "@/components/ui/actionlink";
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb";
import Link from "next/link";

export default function Page() {
return (
Expand Down
175 changes: 174 additions & 1 deletion app/contact/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,176 @@
"use client";

import avatarImage from "@/public/assets/avatar.png";
import Image from "next/image";
import ActionLink from "@/components/ui/actionlink";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { Button } from "@/components/ui/button";
import { FaDiscord, FaGithub } from "react-icons/fa";
import Link from "next/link";
import { Mail, Send } from "lucide-react";
import { Label } from "@/components/ui/label";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { postContactEmail } from "@/actions/email";
import { useState } from "react";
import { useFormStatus } from "react-dom";
import { useToast } from "@/hooks/use-toast";
import { Toaster } from "@/components/ui/toaster";

function SubmitButton() {
const { pending } = useFormStatus();

return (
<Button className="w-full text-white dark:text-white" disabled={pending}>
{pending ? "Sending..." : "Send Message"}
<Send className="ml-2 h-4 w-4" />
</Button>
);
}

export default function Page() {
return "";
const [formVisible, setFormVisible] = useState(true);
const { toast } = useToast();

async function handleSubmit(formData: FormData) {
const result = await postContactEmail(formData);
if (result) {
toast({
title: "Message Sent",
description: "Thank you for your message. I'll get back to you soon!",
variant: "default",
});
setFormVisible(false);
} else {
toast({
title: "Error",
description: "Failed to send message. Please try again later.",
variant: "destructive",
});
}
}

return (
<div className="container px-4 mb-12 md:mt-4 space-y-12 min-h-screen">
<div className="space-y-4">
<div className="flex items-center space-x-4">
<Image
src={avatarImage}
alt="Avatar"
priority
className="size-16 rounded-full ring ring-primary"
/>
<div className="font-serif">
<div className="text-2xl font-medium">Ashish Agarwal</div>
<div className="text-xl text-gray-500">@devashish2024</div>
</div>
</div>
<p className="text-lg">
I'm always excited to connect with fellow developers, potential
collaborators, or anyone interested in my work. Feel free to reach out
using the form below or connect with me on social media!
</p>
<div className="flex flex-col sm:flex-row justify-center items-start sm:justify-start sm:items-center gap-2 sm:gap-4">
{[
{
href: "https://github.com/devashish2024",
icon: FaGithub,
label: "devashish2024",
},
{
href: "https://discordapp.com/users/1153023901203447940",
icon: FaDiscord,
label: "v0rtexdev.",
},
{
href: "mailto:[email protected]",
icon: Mail,
label: "[email protected]",
},
].map((link, index) => (
<Link
key={index}
href={link.href}
target={link.href.startsWith("http") ? "_blank" : "_self"}
className="flex items-center gap-2 text-gray-700 dark:text-gray-300 hover:text-primary dark:hover:text-primary font-serif transition-all duration-75"
>
<link.icon className="size-5" />
<span>{link.label}</span>
</Link>
))}
</div>
</div>

{formVisible ? (
<Card className="w-full max-w-2xl mx-auto">
<CardHeader>
<CardTitle className="text-2xl font-medium text-primary font-serif">
Get in Touch
</CardTitle>
<CardDescription className="font-serif text-lg text-gray-800 dark:text-gray-200">
If you have any questions, project in mind or just want to say hi,
I would love to hear from you!
</CardDescription>
</CardHeader>
<CardContent className="font-serif">
<form className="space-y-6" action={handleSubmit}>
<div className="space-y-2">
<Label htmlFor="name">Your Name</Label>
<Input name="name" id="name" placeholder="John Doe" required />
</div>
<div className="space-y-2">
<Label htmlFor="email">Your Email</Label>
<Input
name="email"
id="email"
type="email"
placeholder="[email protected]"
required
/>
</div>
<div className="space-y-2">
<Label htmlFor="subject">Subject</Label>
<Input
name="subject"
id="subject"
placeholder="What's this about?"
required
/>
</div>
<div className="space-y-2">
<Label htmlFor="message">Your Message</Label>
<Textarea
name="message"
id="message"
placeholder="Tell me more about your project, idea, or question..."
className="min-h-[150px]"
required
/>
</div>
<SubmitButton />
</form>
</CardContent>
</Card>
) : (
<Card className="w-full max-w-2xl mx-auto">
<CardContent className="font-serif text-center py-8">
<h2 className="text-2xl font-medium text-primary mb-4">
Thank You!
</h2>
<p className="text-lg text-gray-800 dark:text-gray-200">
Your message has been sent successfully. I'll get back to you as
soon as possible.
</p>
</CardContent>
</Card>
)}
<Toaster />
</div>
);
}
4 changes: 2 additions & 2 deletions app/interviews/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Articles from "@/components/articles";
import VideoInterviews from "@/components/videointerviews";
import Articles from "@/components/interviews/articles";
import VideoInterviews from "@/components/interviews/videointerviews";

export default function Page() {
return (
Expand Down
3 changes: 2 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { Metadata } from "next";
import { Montserrat, Outfit } from "next/font/google";
import "./globals.css";
import Providers from "@/components/providers";

import Providers from "@/components/layout/providers";

const sans = Montserrat({
variable: "--font-sans",
Expand Down
21 changes: 14 additions & 7 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import avatarImage from "@/public/assets/avatar.png";

import Image from "next/image";
import ProjectList from "@/components/projects";
import InterviewList from "@/components/interviews";
import ProjectList from "@/components/portfolio/projects";
import InterviewList from "@/components/interviews/interviews";
import ActionLink from "@/components/ui/actionlink";
import WorkExperience from "@/components/experience";
import WorkExperience from "@/components/portfolio/experience";

import projects from "@/data/projects";
import { interviews } from "@/data/interviews";
Expand All @@ -16,7 +16,7 @@ const currentRole = experiences.slice(0, 1);

export default function Page() {
return (
<div className="container px-4 mb-12 md:mt-4 space-y-12 min-h-screen">
<div className="container px-4 mb-12 mt-2 md:mt-4 space-y-12 min-h-screen">
<div className="space-y-4">
<div className="flex items-center space-x-4">
<Image
Expand Down Expand Up @@ -46,13 +46,20 @@ export default function Page() {

<WorkExperience experiences={currentRole} />

<div className="flex gap-4">
<div className="flex flex-col sm:flex-row gap-4">
{/* href: "/sign", label: "Sign my guestbook" */}
{[
{ href: "/about", label: "About me" },
{ href: "/sign", label: "Sign my guestbook" },
{ href: "/work", label: "My projects" },
{ href: "/contact", label: "Contact me" },
].map((link, index) => {
return <ActionLink className="mt-0" key={index} {...link} />;
return (
<ActionLink
className="justify-start mt-0"
key={index}
{...link}
/>
);
})}
</div>
</div>
Expand Down
11 changes: 2 additions & 9 deletions app/sign/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { Guestbook } from "@/components/guestbook";
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import { signs } from "@/lib/sign";
import { parseTimestamp } from "@/lib/utils";
import Image from "next/image";
import Link from "next/link";
import { FaGithub, FaGoogle } from "react-icons/fa";
// import { Guestbook } from "@/components/guestbook/guestbook";

export default function Page() {
return (
<div className="container px-4 mb-12 md:mt-8 space-y-8 min-h-screen">
<Guestbook />
{/* <Guestbook /> */}
</div>
);
}
4 changes: 2 additions & 2 deletions app/work/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import WorkExperience from "@/components/experience";
import ProjectList from "@/components/projects";
import WorkExperience from "@/components/portfolio/experience";
import ProjectList from "@/components/portfolio/projects";
import experiences from "@/data/experiences";
import projects from "@/data/projects";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
CardHeader,
CardTitle,
} from "@/components/ui/card";
import ActionLink from "./ui/actionlink";
import ActionLink from "@/components/ui/actionlink";

export function CreateMessage({ onSignOut }: { onSignOut: () => void }) {
const [message, setMessage] = useState("");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default async function Articles() {
Also featured by some articles on the internet, including Zee News.
</p>
<div className="flex flex-col justify-between gap-4">
<div className="grid grid-cols-2 gap-4">
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
{articles.map((article, index) => (
<Link
href={article.url}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function InterviewList({
{interviews.map((interview: string) => (
<li
key={interview}
className="col-span-1 min-w-80 snap-start transition-opacity"
className="col-span-1 min-w-60 snap-start transition-opacity"
>
<Link href={interview} className="space-y-4" target="_blank">
<div className="aspect-video overflow-hidden rounded-md bg-secondary">
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions components/header.tsx → components/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import {
SheetTitle,
SheetDescription,
} from "@/components/ui/sheet";
import { Separator } from "./ui/separator";
import { Separator } from "@/components/ui/separator";
import { useState } from "react";

export const links = [
{ href: "/", label: "Home" },
{ href: "/about", label: "About" },
{ href: "/work", label: "Work" },
{ href: "/interviews", label: "Interviews" },
{ href: "/sign", label: "Guestbook" },
{ href: "/contact", label: "Contact" },
];

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function ProjectList({
{filteredAndSortedProjects.map((project) => (
<li
key={project.slug}
className="col-span-1 min-w-80 snap-start transition-opacity group"
className="col-span-1 min-w-60 snap-start transition-opacity group"
>
<Link href={`/projects/${project.slug}`} className="space-y-4">
<div className="aspect-video overflow-hidden rounded-md bg-secondary">
Expand Down
File renamed without changes.
Loading

0 comments on commit 2d4d6ae

Please sign in to comment.