update 5 files

This commit is contained in:
faisolavolut 2025-02-12 08:52:15 +07:00
parent 13917ad905
commit fbfa075c51
5 changed files with 47 additions and 35 deletions

View File

@ -275,7 +275,7 @@ export const TableList: React.FC<any> = ({
}
setTimeout(() => {
toast.dismiss();
}, 2000);
}, 100);
};
if (typeof onInit === "function") {
onInit(local);
@ -943,7 +943,7 @@ export const Pagination: React.FC<any> = ({
{/* <span>Next</span> */}
<HiChevronRight className="text-sm" />
</div>
</div>
</div>
</div>
</div>
);

View File

@ -23,10 +23,11 @@ export const PinterestLayout: React.FC<{
col: [] as string[],
data: [] as string[],
},
user: null as any,
ready: false as boolean,
});
useEffect(() => {
const columns: any[] = Array.from({ length: col }, () => []); // Inisialisasi array kosong sebanyak 'col'
const columns: any[] = Array.from({ length: col }, () => []);
data.forEach((item, index) => {
const targetColumn = index % col; // Menentukan kolom target berdasarkan indeks
columns[targetColumn].push(item); // Memasukkan elemen ke kolom yang sesuai
@ -34,7 +35,6 @@ export const PinterestLayout: React.FC<{
local.data = columns;
local.render();
}, [data, col]);
return (
<>
<div className="flex flex-grow flex-1 flex-col w-full h-full">

View File

@ -18,7 +18,7 @@ const AlertDialogOverlay = React.forwardRef<
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Overlay
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
"fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}

View File

@ -12,6 +12,7 @@ import {
} from "./alert-dialog";
export const Alert: FC<{
title?: string;
type: string;
onClick?: (event?: any) => Promise<any> | any;
children?: any;
@ -21,7 +22,9 @@ export const Alert: FC<{
mode?: "auto" | "manual";
open?: boolean;
onOpenChange?: (event: boolean) => void;
hiddenFooter?: boolean;
}> = ({
title = " Are you certain you want to continue?",
type,
onClick,
children,
@ -31,6 +34,7 @@ export const Alert: FC<{
mode,
open,
onOpenChange,
hiddenFooter = false,
}) => {
const message: any = {
save: "Your data will be saved securely. You can update it at any time if needed.",
@ -59,22 +63,26 @@ export const Alert: FC<{
) : (
<>
<AlertDialogHeader>
<AlertDialogTitle>
Are you certain you want to continue?
</AlertDialogTitle>
<AlertDialogTitle>{title}</AlertDialogTitle>
<AlertDialogDescription>
{msg || message?.[type]}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>No</AlertDialogCancel>
<AlertDialogAction
className={"bg-primary text-white"}
onClick={onClick}
>
Yes
</AlertDialogAction>
</AlertDialogFooter>
{!hiddenFooter ? (
<>
<AlertDialogFooter>
<AlertDialogCancel>No</AlertDialogCancel>
<AlertDialogAction
className={"bg-primary text-white"}
onClick={onClick}
>
Yes
</AlertDialogAction>
</AlertDialogFooter>
</>
) : (
<></>
)}
</>
)}
</AlertDialogContent>

View File

@ -39,6 +39,7 @@ export const actionToast = async (data: {
);
if (typeof task === "function") await task();
setTimeout(() => {
toast.dismiss();
toast.success(
<div
className={cx(
@ -57,23 +58,26 @@ export const actionToast = async (data: {
if (typeof after === "function") after();
if (typeof success === "function") success();
}, 1000);
}, 100);
} catch (ex: any) {
toast.error(
<div className="flex flex-col w-full">
<div className="flex text-red-600 items-center">
<AlertTriangle className="h-4 w-4 mr-1" />
{msg_error ? msg_error : " Failed"}{" "}
{get(ex, "response.data.meta.message") || ex.message}.
</div>
</div>,
{
dismissible: true,
className: css`
background: #ffecec;
border: 2px solid red;
`,
}
);
setTimeout(() => {
toast.dismiss();
toast.error(
<div className="flex flex-col w-full">
<div className="flex text-red-600 items-center">
<AlertTriangle className="h-4 w-4 mr-1" />
{msg_error ? msg_error : " Failed"}{" "}
{get(ex, "response.data.meta.message") || ex.message}.
</div>
</div>,
{
dismissible: true,
className: css`
background: #ffecec;
border: 2px solid red;
`,
}
);
}, 100);
}
};