Skip to content

message for empty draft , sent , archive handled. #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 51 additions & 39 deletions apps/web/components/Celebration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Image from "next/image";
import { getCelebrationImage } from "@/utils/celebration";
import { Button } from "@/components/Button";

export function Celebration(props: { message: string }) {
export function Celebration(props: { type: string }) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I'd just use the existing format and pass in the relevant message. No need to change the props. Or this component at all.

const [active, setActive] = useState(false);

useEffect(() => {
Expand All @@ -14,47 +14,59 @@ export function Celebration(props: { message: string }) {
return (
<>
<div className="mt-20 flex items-center justify-center font-cal text-2xl text-gray-900">
Congrats! {props.message}
</div>
<div className="flex items-center justify-center">
<Confetti
active={active}
config={{
duration: 5_000,
elementCount: 500,
spread: 200,
}}
/>
{props.type === "inbox"
? "You made it to Inbox Zero!"
: props.type === "draft"
? "You don't have any saved drafts."
: props.type === "sent"
? "You haven't sent any emails yet."
: props.type === "archive"
? "No emails have been archived."
: "All emails handled!"}
</div>
{props.type === "inbox" && (
<>
<div className="flex items-center justify-center">
<Confetti
active={active}
config={{
duration: 5_000,
elementCount: 500,
spread: 200,
}}
/>
</div>

<div className="mt-8 flex justify-center">
<Button
size="2xl"
onClick={() => {
const tweet = encodeURIComponent(
"I made it to Inbox Zero thanks to @inboxzero_ai!",
);
const twitterIntentURL = `https://x.com/intent/tweet?text=${tweet}`;
window.open(
twitterIntentURL,
"_blank",
"noopener,noreferrer,width=550,height=420",
);
}}
>
Share on Twitter
</Button>
</div>
<div className="mt-8 flex justify-center">
<Button
size="2xl"
onClick={() => {
const tweet = encodeURIComponent(
"I made it to Inbox Zero thanks to @inboxzero_ai!",
);
const twitterIntentURL = `https://x.com/intent/tweet?text=${tweet}`;
window.open(
twitterIntentURL,
"_blank",
"noopener,noreferrer,width=550,height=420",
);
}}
>
Share on Twitter
</Button>
</div>

<div className="mt-8 flex items-center justify-center">
<Image
src={getCelebrationImage()}
width={400}
height={400}
alt="Congrats!"
unoptimized
/>
</div>
<div className="mt-8 flex items-center justify-center">
<Image
src={getCelebrationImage()}
width={400}
height={400}
alt="Congrats!"
unoptimized
/>
</div>
</>
)}
</>
);
}
8 changes: 1 addition & 7 deletions apps/web/components/email-list/EmailList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,7 @@ export function List(props: {
refetch={refetch}
/>
) : (
<Celebration
message={
props.type === "inbox"
? "You made it to Inbox Zero!"
: "All emails handled!"
}
/>
<Celebration type={props.type!} />
)}
</>
);
Expand Down