@apptimate/ui 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import toast from "react-hot-toast";
|
|
3
|
+
import { Button } from "./Button";
|
|
4
|
+
|
|
5
|
+
export const handleFinanceError = (error: any, defaultMessage: string = "An error occurred") => {
|
|
6
|
+
const errMsg = typeof error === "string" ? error : (error?.message || defaultMessage);
|
|
7
|
+
|
|
8
|
+
if (errMsg.toLowerCase().includes("fiscal year")) {
|
|
9
|
+
toast.error((t) => (
|
|
10
|
+
<div className="flex flex-col gap-2 mt-1">
|
|
11
|
+
<span>{errMsg}</span>
|
|
12
|
+
<Button size="small" variant="solid" color="primary" className="w-fit mt-1" onClick={() => {
|
|
13
|
+
toast.dismiss(t.id);
|
|
14
|
+
window.open("/finance/fiscal-years", "_blank");
|
|
15
|
+
}}>
|
|
16
|
+
Open Fiscal Years
|
|
17
|
+
</Button>
|
|
18
|
+
</div>
|
|
19
|
+
), { duration: 8000 });
|
|
20
|
+
} else {
|
|
21
|
+
toast.error(errMsg);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -131,7 +131,7 @@ export function DashboardLayout({
|
|
|
131
131
|
}`}
|
|
132
132
|
>
|
|
133
133
|
{/* Clone the icon to dynamically apply styling based on active state */}
|
|
134
|
-
{React.cloneElement(menu.icon as React.ReactElement
|
|
134
|
+
{React.cloneElement(menu.icon as React.ReactElement<any>, {
|
|
135
135
|
size: 22,
|
|
136
136
|
className: isActive ? "stroke-[2.5]" : "stroke-[2]"
|
|
137
137
|
})}
|
|
@@ -305,7 +305,7 @@ export function DashboardLayout({
|
|
|
305
305
|
{menus.map((menu) => (
|
|
306
306
|
<div key={menu.id}>
|
|
307
307
|
<div className="flex items-center gap-3 text-[#2D3142] font-bold mb-3 px-2">
|
|
308
|
-
{React.cloneElement(menu.icon as React.ReactElement
|
|
308
|
+
{React.cloneElement(menu.icon as React.ReactElement<any>, {
|
|
309
309
|
size: 20,
|
|
310
310
|
className: "stroke-[2.5]"
|
|
311
311
|
})}
|
package/src/index.tsx
CHANGED
|
@@ -33,3 +33,4 @@ export type { ImageUploadComponentProps, ItemImage } from './components/shared/I
|
|
|
33
33
|
export * from './common-components/DashboardLayout';
|
|
34
34
|
export * from './common-components/charts';
|
|
35
35
|
export * from './common-components/PaymentSection';
|
|
36
|
+
export * from './base-components/FinanceErrorToast';
|