Skip to content
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

[WIP] feat: toast with docs on first login #2307

Closed
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
74 changes: 68 additions & 6 deletions keep-ui/app/incidents/IncidentPlaceholder.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,78 @@
import { Fragment } from "react";
import { Fragment, useEffect } from "react";
import { Button, Subtitle, Title } from "@tremor/react";

import { useLocalStorage } from "@/utils/hooks/useLocalStorage";
import { toast } from "react-toastify";

interface Props {
setIsFormOpen: (value: boolean) => void;
}

const FirstTimeToast = () => {
const openDocs = (link: string) => {
window.open(link, "_blank");
};

export const IncidentPlaceholder = ({
setIsFormOpen,
}: Props) => {
return (
<div className="flex flex-col gap-y-4 items-center">
If this is the first time you have logged in to Keep, we suggest reading
some of our docs 📚
<div className="flex gap-x-4">
<div className="flex flex-col">
See our supported providers
<Button
size="xs"
variant="secondary"
onClick={() =>
openDocs("https://docs.keephq.dev/providers/overview")
}
>
Providers
</Button>
</div>
<div className="flex flex-col">
Read an introduction
<Button
size="xs"
variant="secondary"
onClick={() =>
openDocs("https://docs.keephq.dev/overview/introduction")
}
>
Introduction
</Button>
</div>
<div className="flex flex-col">
See some classic use cases
<Button
size="xs"
variant="secondary"
onClick={() =>
openDocs("https://docs.keephq.dev/overview/usecases")
}
>
Use Cases
</Button>
</div>
</div>
</div>
);
};

export const IncidentPlaceholder = ({ setIsFormOpen }: Props) => {
useEffect(() => {
const firstTimeToastShown = localStorage.getItem("firstTimeToastShown");
if (!firstTimeToastShown) {
toast(<FirstTimeToast />, {
type: "info",
icon: false,
position: toast.POSITION.TOP_CENTER,
autoClose: 10000,
className: "w-[1000px]",
progressStyle: { backgroundColor: "orange" },
});
localStorage.setItem("firstTimeToastShown", "true");
}
}, []);

const onCreateButtonClick = () => {
setIsFormOpen(true);
Expand All @@ -32,7 +95,6 @@ export const IncidentPlaceholder = ({
Create Incident
</Button>
</div>

</Fragment>
);
};
Loading