significant refactor

This commit is contained in:
2025-08-30 01:42:23 -05:00
parent 7136f646a3
commit 052f53444e
106 changed files with 1994 additions and 1701 deletions

View File

@@ -1,9 +1,9 @@
import { toast as sonnerToast } from 'sonner';
import { ToastProps } from './types';
import { Notification } from '@mantine/core';
import { ShieldCheckIcon, WarningCircleIcon } from '@phosphor-icons/react';
import { toast as sonnerToast } from "sonner";
import { ToastProps } from "./types";
import { Notification } from "@mantine/core";
import { ShieldCheckIcon, WarningCircleIcon } from "@phosphor-icons/react";
const makeToast = (toast: Omit<ToastProps, 'id'>) => {
const makeToast = (toast: Omit<ToastProps, "id">) => {
return sonnerToast.custom((id) => (
<Toast
id={id}
@@ -14,24 +14,33 @@ const makeToast = (toast: Omit<ToastProps, 'id'>) => {
color={toast.color}
loading={!!toast.loading}
/>
))
));
};
function success(toast: Omit<ToastProps, "id"> | string) {
const config = typeof toast === "string" ? { description: toast } : toast;
return makeToast({
...config,
icon: <ShieldCheckIcon color="lightgreen" size={48} weight="fill" />,
});
}
function success(toast: Omit<ToastProps, 'id'> | string) {
const config = typeof toast === 'string' ? { description: toast } : toast;
return makeToast({ ...config, icon: <ShieldCheckIcon color='lightgreen' size={48} weight='fill'/> });
}
function error(toast: Omit<ToastProps, 'id'> | string) {
const config = typeof toast === 'string' ? { description: toast } : toast;
return makeToast({ ...config, icon: <WarningCircleIcon color='lightcoral' size={48} weight='fill' /> });
function error(toast: Omit<ToastProps, "id"> | string) {
const config = typeof toast === "string" ? { description: toast } : toast;
return makeToast({
...config,
icon: <WarningCircleIcon color="lightcoral" size={48} weight="fill" />,
});
}
function Toast(props: ToastProps) {
const { title, description, withCloseButton, icon, loading } = props;
return (
<Notification miw='md' color={'rgba(0,0,0,0)'} withBorder
<Notification
miw="md"
color={"rgba(0,0,0,0)"}
withBorder
withCloseButton={!!withCloseButton}
loading={loading}
title={title}
@@ -42,7 +51,7 @@ function Toast(props: ToastProps) {
);
}
export default {
export default {
success,
error,
}
};