Skip to content

Commit

Permalink
Updates copy; adds localStorage condition
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricwaxwing committed Mar 24, 2024
1 parent 803e588 commit 2e3e726
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
21 changes: 12 additions & 9 deletions web/components/IntroPopUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ import { SparkleIcon } from "./Icons";
import { Dispatch, SetStateAction } from "react";

interface IntroPopupProps {
setShowDisclaimer: Dispatch<SetStateAction<boolean>>;
setShowIntro: Dispatch<SetStateAction<boolean>>;
}

const IntroPopUp = ({ setShowDisclaimer }: IntroPopupProps) => {
const IntroPopUp = ({ setShowIntro }: IntroPopupProps) => {
const handleClose = () => {
setShowIntro(false);
localStorage.setItem("introClosed", true);
};

return (
<div className='fixed bottom-16 left-1/2 transform -translate-x-1/2 max-w-screen-md w-[calc(100%-48px)] z-10'>
<X
onClick={() => setShowDisclaimer(false)}
onClick={handleClose}
className='absolute top-3 right-3 text-indigo-800 hover:text-indigo-500 cursor-pointer'
size={20}
weight='bold'
Expand All @@ -24,12 +29,10 @@ const IntroPopUp = ({ setShowDisclaimer }: IntroPopupProps) => {
Welcome to fundpublicgoods.ai!
</div>
</div>
<div className='text-[13px] leading-relaxed'>
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.
<div className='text-[14px] leading-relaxed'>
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!
</div>
</div>
</div>
Expand Down
13 changes: 10 additions & 3 deletions web/components/Prompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import IntroPopUp from "./IntroPopUp";

export default function Prompt({ promptIdxs }: { promptIdxs: number[] }) {
const [prompt, setPrompt] = useState<string>("");
const [showDisclaimer, setShowDisclaimer] = useState<boolean>(true);
const [showIntro, setShowIntro] = useState<boolean>(false);
const [isWaiting, setIsWaiting] = useState(false);
const { data: session } = useSession();
const searchParams = useSearchParams();
Expand Down Expand Up @@ -44,11 +44,18 @@ export default function Prompt({ promptIdxs }: { promptIdxs: number[] }) {
}
}, [searchParams, router]);

useEffect(() => {
const introClosed = localStorage.getItem("introClosed");
if (!introClosed) {
setShowIntro(true);
}
}, []);

return (
<div
className={clsx(
"flex h-full justify-center md:items-center md:pt-0",
showDisclaimer ? "items-start pt-8" : "items-center"
showIntro ? "items-start pt-8" : "items-center"
)}>
<div className='mx-auto max-w-screen-lg'>
<div className='w-full space-y-8 px-6 flex flex-col items-center'>
Expand Down Expand Up @@ -94,7 +101,7 @@ export default function Prompt({ promptIdxs }: { promptIdxs: number[] }) {
</div>
</div>
</div>
{showDisclaimer && <IntroPopUp setShowDisclaimer={setShowDisclaimer} />}
{showIntro && <IntroPopUp setShowIntro={setShowIntro} />}
</div>
);
}

0 comments on commit 2e3e726

Please sign in to comment.