From 803e5884d9a57271c7f04281dcd4b06ffa6afe6d Mon Sep 17 00:00:00 2001 From: Colin Spence Date: Thu, 21 Mar 2024 11:18:30 -0600 Subject: [PATCH 1/3] Creates Intro Pop Up --- web/app/page.tsx | 6 +----- web/components/Disclaimer.tsx | 10 ++++++--- web/components/IntroPopUp.tsx | 39 +++++++++++++++++++++++++++++++++++ web/components/Prompt.tsx | 11 ++++++++-- 4 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 web/components/IntroPopUp.tsx diff --git a/web/app/page.tsx b/web/app/page.tsx index c223470..0b3bcac 100644 --- a/web/app/page.tsx +++ b/web/app/page.tsx @@ -24,9 +24,5 @@ function generateUniqueIndexes(arrayLength: number, count: number): number[] { export default function HomePage() { const promptIdxs = generateUniqueIndexes(EXAMPLE_PROMPTS.length, 6); - return ( -
- -
- ); + return ; } diff --git a/web/components/Disclaimer.tsx b/web/components/Disclaimer.tsx index 6f5cce3..2b89920 100644 --- a/web/components/Disclaimer.tsx +++ b/web/components/Disclaimer.tsx @@ -10,7 +10,7 @@ const Disclaimer = () => {
setShowDisclaimer(false)} - className='absolute top-4 right-4 text-indigo-800 hover:text-indigo-500 cursor-pointer' + className='absolute top-3 right-3 text-indigo-800 hover:text-indigo-500 cursor-pointer' size={20} weight='bold' /> @@ -18,8 +18,12 @@ const Disclaimer = () => {
This AI agent is experimental.
-
- The agent is evaluating projects based on self-reported data through past Gitcoin applications and therefore cannot guarantee their accuracy at this time. The agent also cannot guarantee that each project is still in control of its address, so please double check before sending large amounts. +
+ The agent is evaluating projects based on self-reported data through + past Gitcoin applications and therefore cannot guarantee their + accuracy at this time. The agent also cannot guarantee that each + project is still in control of its address, so please double check + before sending large amounts.
diff --git a/web/components/IntroPopUp.tsx b/web/components/IntroPopUp.tsx new file mode 100644 index 0000000..9cd61db --- /dev/null +++ b/web/components/IntroPopUp.tsx @@ -0,0 +1,39 @@ +"use client"; + +import { X } from "@phosphor-icons/react/dist/ssr"; +import { SparkleIcon } from "./Icons"; +import { Dispatch, SetStateAction } from "react"; + +interface IntroPopupProps { + setShowDisclaimer: Dispatch>; +} + +const IntroPopUp = ({ setShowDisclaimer }: IntroPopupProps) => { + return ( +
+ setShowDisclaimer(false)} + className='absolute top-3 right-3 text-indigo-800 hover:text-indigo-500 cursor-pointer' + size={20} + weight='bold' + /> +
+
+ +
+ Welcome to fundpublicgoods.ai! +
+
+
+ As a proof-of-concept project, fundpublicgoods.ai showcases the + potential of AI in revolutionizing funding for public goods. Our + platform offers personalized strategies to maximize the impact of your + contributions. Engage with our platform and community today to be part + of this innovative approach to philanthropy. +
+
+
+ ); +}; + +export default IntroPopUp; diff --git a/web/components/Prompt.tsx b/web/components/Prompt.tsx index 61ea4f3..b3721ad 100644 --- a/web/components/Prompt.tsx +++ b/web/components/Prompt.tsx @@ -9,9 +9,11 @@ import { startRun } from "@/app/actions"; import clsx from "clsx"; import { EXAMPLE_PROMPTS } from "@/utils/examplePrompts"; import { toast } from "react-toastify"; +import IntroPopUp from "./IntroPopUp"; export default function Prompt({ promptIdxs }: { promptIdxs: number[] }) { const [prompt, setPrompt] = useState(""); + const [showDisclaimer, setShowDisclaimer] = useState(true); const [isWaiting, setIsWaiting] = useState(false); const { data: session } = useSession(); const searchParams = useSearchParams(); @@ -43,7 +45,11 @@ export default function Prompt({ promptIdxs }: { promptIdxs: number[] }) { }, [searchParams, router]); return ( - <> +
@@ -88,6 +94,7 @@ export default function Prompt({ promptIdxs }: { promptIdxs: number[] }) {
- + {showDisclaimer && } +
); } From 2e3e726f829278e2713266f37083577dc1e29e92 Mon Sep 17 00:00:00 2001 From: Colin Spence Date: Sun, 24 Mar 2024 16:45:58 -0600 Subject: [PATCH 2/3] Updates copy; adds localStorage condition --- web/components/IntroPopUp.tsx | 21 ++++++++++++--------- web/components/Prompt.tsx | 13 ++++++++++--- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/web/components/IntroPopUp.tsx b/web/components/IntroPopUp.tsx index 9cd61db..4734abf 100644 --- a/web/components/IntroPopUp.tsx +++ b/web/components/IntroPopUp.tsx @@ -5,14 +5,19 @@ import { SparkleIcon } from "./Icons"; import { Dispatch, SetStateAction } from "react"; interface IntroPopupProps { - setShowDisclaimer: Dispatch>; + setShowIntro: Dispatch>; } -const IntroPopUp = ({ setShowDisclaimer }: IntroPopupProps) => { +const IntroPopUp = ({ setShowIntro }: IntroPopupProps) => { + const handleClose = () => { + setShowIntro(false); + localStorage.setItem("introClosed", true); + }; + return (
setShowDisclaimer(false)} + onClick={handleClose} className='absolute top-3 right-3 text-indigo-800 hover:text-indigo-500 cursor-pointer' size={20} weight='bold' @@ -24,12 +29,10 @@ const IntroPopUp = ({ setShowDisclaimer }: IntroPopupProps) => { Welcome to fundpublicgoods.ai!
-
- As a proof-of-concept project, fundpublicgoods.ai showcases the - potential of AI in revolutionizing funding for public goods. Our - platform offers personalized strategies to maximize the impact of your - contributions. Engage with our platform and community today to be part - of this innovative approach to philanthropy. +
+ This is a proof-of-concept to showcase the potential of AI agents to + assist users with complex transactions. Give it a try and let us know + what you think!
diff --git a/web/components/Prompt.tsx b/web/components/Prompt.tsx index b3721ad..f8021a1 100644 --- a/web/components/Prompt.tsx +++ b/web/components/Prompt.tsx @@ -13,7 +13,7 @@ import IntroPopUp from "./IntroPopUp"; export default function Prompt({ promptIdxs }: { promptIdxs: number[] }) { const [prompt, setPrompt] = useState(""); - const [showDisclaimer, setShowDisclaimer] = useState(true); + const [showIntro, setShowIntro] = useState(false); const [isWaiting, setIsWaiting] = useState(false); const { data: session } = useSession(); const searchParams = useSearchParams(); @@ -44,11 +44,18 @@ export default function Prompt({ promptIdxs }: { promptIdxs: number[] }) { } }, [searchParams, router]); + useEffect(() => { + const introClosed = localStorage.getItem("introClosed"); + if (!introClosed) { + setShowIntro(true); + } + }, []); + return (
@@ -94,7 +101,7 @@ export default function Prompt({ promptIdxs }: { promptIdxs: number[] }) {
- {showDisclaimer && } + {showIntro && } ); } From e22b12eea6f856b68d3afdd00eb08860f0b1747d Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Mon, 25 Mar 2024 16:03:06 +0300 Subject: [PATCH 3/3] chore: fix build --- web/components/IntroPopUp.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/components/IntroPopUp.tsx b/web/components/IntroPopUp.tsx index 4734abf..6ca2737 100644 --- a/web/components/IntroPopUp.tsx +++ b/web/components/IntroPopUp.tsx @@ -11,7 +11,7 @@ interface IntroPopupProps { const IntroPopUp = ({ setShowIntro }: IntroPopupProps) => { const handleClose = () => { setShowIntro(false); - localStorage.setItem("introClosed", true); + localStorage.setItem("introClosed", "true"); }; return (