diff --git a/src/app/page.tsx b/src/app/page.tsx index 56639d4..d7a358d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -4,8 +4,6 @@ import { useState } from "react"; import Header from "../components/Header"; import Footer from "../components/Footer"; import Image from "next/image"; -import GitHubStars from "../components/GitHubStars"; -import SubstackEmbed from "../components/SubstackEmbed"; import CookieConsentBanner from "../components/CookieConsent"; import Books from "../components/BooksSection"; import DevToolsSection from "../components/DevToolsSection"; @@ -14,9 +12,31 @@ import SubstackCustom from "../components/SubstackCustom"; import DSAToolSection from "@/components/DSASection"; import PeopleSection from "@/components/PeopleSection"; - export default function Home() { const [currentSection, setCurrentSection] = useState("home"); + const [isModalOpen, setIsModalOpen] = useState(false); + const [copyMessage, setCopyMessage] = useState(''); + + const handleCopy = () => { + navigator.clipboard.writeText(window.location.href); + setCopyMessage('Copied!'); + setTimeout(() => setCopyMessage(''), 2000); + }; + + const openModal = () => { + setIsModalOpen(true); + }; + + const closeModal = () => { + setIsModalOpen(false); + }; + + const shareOnTwitter = () => { + const tweetText = "Check this awesome project: "; + const url = window.location.href; + window.open(`https://twitter.com/intent/tweet?text=${encodeURIComponent(tweetText)}&url=${encodeURIComponent(url)}`, '_blank'); + closeModal(); + }; const renderSection = () => { switch (currentSection) { @@ -52,17 +72,28 @@ export default function Home() {

- An Open source project with everything you need to learn about - Rust + An open-source project with everything you need to learn about Rust



- {/*
- -
*/} +
+ + +
+ {copyMessage &&

{copyMessage}

} ); } @@ -74,6 +105,43 @@ export default function Home() {
{renderSection()}
+ {isModalOpen && ( +
+
+

Preview Card

+

Share on Twitter

+
+ Profile +
+

Your Name

+

+ Check out this awesome project: {window.location.href} +

+
+
+
+ + +
+
+
+ )}