2023-11-23 17:21:47 +05:30
|
|
|
import { clsx, type ClassValue } from "clsx";
|
|
|
|
|
import { twMerge } from "tailwind-merge";
|
|
|
|
|
|
2024-05-10 02:32:42 +05:30
|
|
|
export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || "";
|
|
|
|
|
|
|
|
|
|
export const ADMIN_BASE_URL = process.env.NEXT_PUBLIC_ADMIN_BASE_URL || "";
|
|
|
|
|
export const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || "";
|
|
|
|
|
|
2024-05-14 22:51:07 +05:30
|
|
|
export const SPACE_BASE_URL = process.env.NEXT_PUBLIC_SPACE_BASE_URL || "";
|
2024-05-10 02:32:42 +05:30
|
|
|
export const SPACE_BASE_PATH = process.env.NEXT_PUBLIC_SPACE_BASE_PATH || "";
|
|
|
|
|
|
2024-10-01 21:03:17 +05:30
|
|
|
export const LIVE_BASE_URL = process.env.NEXT_PUBLIC_LIVE_BASE_URL || "";
|
2024-09-02 17:54:12 +05:30
|
|
|
export const LIVE_BASE_PATH = process.env.NEXT_PUBLIC_LIVE_BASE_PATH || "";
|
|
|
|
|
export const LIVE_URL = `${LIVE_BASE_URL}${LIVE_BASE_PATH}`;
|
|
|
|
|
|
2024-05-22 17:31:56 +05:30
|
|
|
export const SUPPORT_EMAIL = process.env.NEXT_PUBLIC_SUPPORT_EMAIL || "";
|
|
|
|
|
|
2024-05-20 12:53:43 +05:30
|
|
|
export const GOD_MODE_URL = encodeURI(`${ADMIN_BASE_URL}${ADMIN_BASE_PATH}/`);
|
2024-05-16 11:35:31 +05:30
|
|
|
|
2023-01-26 23:42:20 +05:30
|
|
|
export const debounce = (func: any, wait: number, immediate: boolean = false) => {
|
|
|
|
|
let timeout: any;
|
2023-03-15 11:44:44 +05:30
|
|
|
|
2023-01-26 23:42:20 +05:30
|
|
|
return function executedFunction(...args: any) {
|
|
|
|
|
const later = () => {
|
|
|
|
|
timeout = null;
|
|
|
|
|
if (!immediate) func(...args);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const callNow = immediate && !timeout;
|
|
|
|
|
|
|
|
|
|
clearTimeout(timeout);
|
|
|
|
|
|
|
|
|
|
timeout = setTimeout(later, wait);
|
|
|
|
|
|
|
|
|
|
if (callNow) func(...args);
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-09-13 20:21:02 +05:30
|
|
|
|
2023-11-23 17:21:47 +05:30
|
|
|
export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));
|
2024-10-08 16:54:02 +05:30
|
|
|
|
|
|
|
|
export const convertRemToPixel = (rem: number): number => rem * 0.9 * 16;
|
2025-01-17 15:41:34 +05:30
|
|
|
|
|
|
|
|
export const getProgress = (completed: number | undefined, total: number | undefined) =>
|
|
|
|
|
total && total > 0 ? Math.round(((completed ?? 0) / total) * 100) : 0;
|