[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

@ -8,10 +8,8 @@ import { InstanceAdminLayout } from "layouts/admin-layout";
import { NextPageWithLayout } from "lib/types";
// hooks
import { useApplication } from "hooks/store";
// hooks
import useToast from "hooks/use-toast";
// ui
import { Loader, ToggleSwitch } from "@plane/ui";
import { Loader, ToggleSwitch, TOAST_TYPE, setToast } from "@plane/ui";
// components
import { InstanceGithubConfigForm, InstanceGoogleConfigForm } from "components/instance";
import { PageHead } from "components/core";
@ -24,9 +22,6 @@ const InstanceAdminAuthorizationPage: NextPageWithLayout = observer(() => {
useSWR("INSTANCE_CONFIGURATIONS", () => fetchInstanceConfigurations());
// toast
const { setToastAlert } = useToast();
// state
const [isSubmitting, setIsSubmitting] = useState<boolean>(false);
@ -46,18 +41,18 @@ const InstanceAdminAuthorizationPage: NextPageWithLayout = observer(() => {
await updateInstanceConfigurations(payload)
.then(() => {
setToastAlert({
setToast({
title: "Success",
type: "success",
type: TOAST_TYPE.SUCCESS,
message: "SSO and OAuth Settings updated successfully",
});
setIsSubmitting(false);
})
.catch((err) => {
console.error(err);
setToastAlert({
setToast({
title: "Error",
type: "error",
type: TOAST_TYPE.ERROR,
message: "Failed to update SSO and OAuth Settings",
});
setIsSubmitting(false);