[WEB-570] chore: toast refactor (#3836)

* new toast setup

* chore: new toast implementation.

* chore: move toast component to ui package.

* chore: replace `setToast` with `setPromiseToast` in required places for better UX.
* chore: code cleanup.

* chore: update theme.

* fix: theme switching issue.

* chore: remove toast from issue update operations.

* chore: add promise toast for add/ remove issue to cycle/ module and remove local spinners.

---------

Co-authored-by: rahulramesha <rahulramesham@gmail.com>
This commit is contained in:
Prateek Shourya 2024-03-06 14:18:41 +05:30 committed by GitHub
parent c06ef4d1d7
commit 53367a6bc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
167 changed files with 1827 additions and 1896 deletions

View file

@ -10,8 +10,6 @@ import useSWR, { mutate } from "swr";
import { useForm } from "react-hook-form";
// services
import { IntegrationService, GithubIntegrationService } from "services/integrations";
// hooks
import useToast from "hooks/use-toast";
// components
import {
GithubImportConfigure,
@ -21,7 +19,7 @@ import {
GithubImportConfirm,
} from "components/integration";
// icons
import { UserGroupIcon } from "@plane/ui";
import { UserGroupIcon, TOAST_TYPE, setToast } from "@plane/ui";
import { ArrowLeft, Check, List, Settings, UploadCloud } from "lucide-react";
// images
import GithubLogo from "public/services/github.png";
@ -92,8 +90,6 @@ export const GithubImporterRoot: React.FC = () => {
const router = useRouter();
const { workspaceSlug, provider } = router.query;
const { setToastAlert } = useToast();
const { handleSubmit, control, setValue, watch } = useForm<TFormValues>({
defaultValues: defaultFormValues,
});
@ -149,8 +145,8 @@ export const GithubImporterRoot: React.FC = () => {
mutate(IMPORTER_SERVICES_LIST(workspaceSlug as string));
})
.catch(() =>
setToastAlert({
type: "error",
setToast({
type: TOAST_TYPE.ERROR,
title: "Error!",
message: "Import was unsuccessful. Please try again.",
})