feat: add name missing error in new brain modal (#1055)

* feat: update toast z index

* feat(brain modal): add name missing message
This commit is contained in:
Mamadou DICKO 2023-08-30 11:04:03 +02:00 committed by GitHub
parent bcf954135c
commit 5612c2b455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -59,6 +59,11 @@ export const useAddBrainModal = () => {
const { name, description, setDefault } = getValues();
if (name.trim() === "" || isPending) {
publish({
variant: "danger",
text: t("nameRequired", { ns: "config" }),
});
return;
}
@ -80,7 +85,7 @@ export const useAddBrainModal = () => {
if (createdBrainId === undefined) {
publish({
variant: "danger",
text: t("errorCreatingBrain",{ns:"brain"})
text: t("errorCreatingBrain", { ns: "brain" }),
});
return;
@ -99,7 +104,7 @@ export const useAddBrainModal = () => {
reset(defaultValues);
publish({
variant: "success",
text: t("brainCreated",{ns:"brain"})
text: t("brainCreated", { ns: "brain" }),
});
} catch (err) {
if (axios.isAxiosError(err) && err.response?.status === 429) {

View File

@ -19,7 +19,7 @@ export const Toast = ({
children?: ReactNode;
} & ToastPrimitive.ToastProviderProps): JSX.Element => {
const { publish, toasts, toggleToast } = useToastBuilder();
const {t, i18n} = useTranslation();
const { t } = useTranslation();
return (
<ToastPrimitive.Provider {...toastProviderProps}>
@ -62,7 +62,7 @@ export const Toast = ({
);
})}
</AnimatePresence>
<ToastPrimitive.Viewport className="fixed flex-col bottom-0 left-0 right-0 p-5 flex items-end gap-2 outline-none pointer-events-none z-20" />
<ToastPrimitive.Viewport className="fixed flex-col bottom-0 left-0 right-0 p-5 flex items-end gap-2 outline-none pointer-events-none z-[99999]" />
</ToastContext.Provider>
</ToastPrimitive.Provider>
);