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(() => { setTimeout(() => {
toast.dismiss(); toast.dismiss();
}, 2000); }, 100);
}; };
if (typeof onInit === "function") { if (typeof onInit === "function") {
onInit(local); onInit(local);

View File

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

View File

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

View File

@ -39,6 +39,7 @@ export const actionToast = async (data: {
); );
if (typeof task === "function") await task(); if (typeof task === "function") await task();
setTimeout(() => { setTimeout(() => {
toast.dismiss();
toast.success( toast.success(
<div <div
className={cx( className={cx(
@ -57,8 +58,10 @@ export const actionToast = async (data: {
if (typeof after === "function") after(); if (typeof after === "function") after();
if (typeof success === "function") success(); if (typeof success === "function") success();
}, 1000); }, 100);
} catch (ex: any) { } catch (ex: any) {
setTimeout(() => {
toast.dismiss();
toast.error( toast.error(
<div className="flex flex-col w-full"> <div className="flex flex-col w-full">
<div className="flex text-red-600 items-center"> <div className="flex text-red-600 items-center">
@ -75,5 +78,6 @@ export const actionToast = async (data: {
`, `,
} }
); );
}, 100);
} }
}; };