mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 13:01:56 +00:00
chore: handle lib folder dependencies with nextui
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { MetaDataProps } from "@/types";
|
||||
|
||||
export const parseStringify = (value: any) => JSON.parse(JSON.stringify(value));
|
||||
|
||||
export const convertFileToUrl = (file: File) => URL.createObjectURL(file);
|
||||
|
||||
export const getPaginationInfo = (metadata: MetaDataProps) => {
|
||||
const currentPage = metadata?.pagination.page ?? "1";
|
||||
const totalPages = metadata?.pagination.pages;
|
||||
const totalEntries = metadata?.pagination.count;
|
||||
|
||||
return { currentPage, totalPages, totalEntries };
|
||||
};
|
||||
|
||||
export function encryptKey(passkey: string) {
|
||||
return btoa(passkey);
|
||||
}
|
||||
|
||||
export function decryptKey(passkey: string) {
|
||||
return atob(passkey);
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from "./custom";
|
||||
export * from "./seed";
|
||||
export * from "./utils";
|
||||
|
||||
+1
-104
@@ -1,109 +1,6 @@
|
||||
import { type ClassValue, clsx } from "clsx";
|
||||
import { extendTailwindMerge } from "tailwind-merge";
|
||||
|
||||
const COMMON_UNITS = ["small", "medium", "large"];
|
||||
import { MetaDataProps } from "@/types";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
const twMerge = extendTailwindMerge({
|
||||
extend: {
|
||||
theme: {
|
||||
opacity: ["disabled"],
|
||||
spacing: ["divider"],
|
||||
borderWidth: COMMON_UNITS,
|
||||
borderRadius: COMMON_UNITS,
|
||||
},
|
||||
classGroups: {
|
||||
shadow: [{ shadow: COMMON_UNITS }],
|
||||
"font-size": [{ text: ["tiny", ...COMMON_UNITS] }],
|
||||
"bg-image": ["bg-stripe-gradient"],
|
||||
},
|
||||
},
|
||||
});
|
||||
export const parseStringify = (value: any) => JSON.parse(JSON.stringify(value));
|
||||
|
||||
export const convertFileToUrl = (file: File) => URL.createObjectURL(file);
|
||||
|
||||
export const extractPaginationInfo = (metadata: MetaDataProps) => {
|
||||
const currentPage = metadata?.pagination.page ?? "1";
|
||||
const totalPages = metadata?.pagination.pages;
|
||||
const totalEntries = metadata?.pagination.count;
|
||||
|
||||
return { currentPage, totalPages, totalEntries };
|
||||
};
|
||||
|
||||
// FORMAT DATE TIME
|
||||
export const formatDateTime = (
|
||||
dateString: Date | string,
|
||||
timeZone: string = Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
) => {
|
||||
const dateTimeOptions: Intl.DateTimeFormatOptions = {
|
||||
// weekday: "short", // abbreviated weekday name (e.g., 'Mon')
|
||||
month: "short", // abbreviated month name (e.g., 'Oct')
|
||||
day: "numeric", // numeric day of the month (e.g., '25')
|
||||
year: "numeric", // numeric year (e.g., '2023')
|
||||
hour: "numeric", // numeric hour (e.g., '8')
|
||||
minute: "numeric", // numeric minute (e.g., '30')
|
||||
hour12: true, // use 12-hour clock (true) or 24-hour clock (false),
|
||||
timeZone: timeZone, // use the provided timezone
|
||||
};
|
||||
|
||||
const dateDayOptions: Intl.DateTimeFormatOptions = {
|
||||
weekday: "short", // abbreviated weekday name (e.g., 'Mon')
|
||||
year: "numeric", // numeric year (e.g., '2023')
|
||||
month: "2-digit", // abbreviated month name (e.g., 'Oct')
|
||||
day: "2-digit", // numeric day of the month (e.g., '25')
|
||||
timeZone: timeZone, // use the provided timezone
|
||||
};
|
||||
|
||||
const dateOptions: Intl.DateTimeFormatOptions = {
|
||||
month: "short", // abbreviated month name (e.g., 'Oct')
|
||||
year: "numeric", // numeric year (e.g., '2023')
|
||||
day: "numeric", // numeric day of the month (e.g., '25')
|
||||
timeZone: timeZone, // use the provided timezone
|
||||
};
|
||||
|
||||
const timeOptions: Intl.DateTimeFormatOptions = {
|
||||
hour: "numeric", // numeric hour (e.g., '8')
|
||||
minute: "numeric", // numeric minute (e.g., '30')
|
||||
hour12: true, // use 12-hour clock (true) or 24-hour clock (false)
|
||||
timeZone: timeZone, // use the provided timezone
|
||||
};
|
||||
|
||||
const formattedDateTime: string = new Date(dateString).toLocaleString(
|
||||
"en-US",
|
||||
dateTimeOptions,
|
||||
);
|
||||
|
||||
const formattedDateDay: string = new Date(dateString).toLocaleString(
|
||||
"en-US",
|
||||
dateDayOptions,
|
||||
);
|
||||
|
||||
const formattedDate: string = new Date(dateString).toLocaleString(
|
||||
"en-US",
|
||||
dateOptions,
|
||||
);
|
||||
|
||||
const formattedTime: string = new Date(dateString).toLocaleString(
|
||||
"en-US",
|
||||
timeOptions,
|
||||
);
|
||||
|
||||
return {
|
||||
dateTime: formattedDateTime,
|
||||
dateDay: formattedDateDay,
|
||||
dateOnly: formattedDate,
|
||||
timeOnly: formattedTime,
|
||||
};
|
||||
};
|
||||
|
||||
export function encryptKey(passkey: string) {
|
||||
return btoa(passkey);
|
||||
}
|
||||
|
||||
export function decryptKey(passkey: string) {
|
||||
return atob(passkey);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user