Recent Snippets
"use client";
import {
Breadcrumb,
BreadcrumbList,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbSeparator,import { createContext, useContext, useEffect, useState } from "react";
type Theme = "dark" | "light" | "system";
type ThemeProviderProps = {
children: React.ReactNode;
defaultTheme?: Theme;
storageKey?: string;"use client";
import { ProductInterface } from "@/interfaces/product";
import { useRouter } from "next/navigation";
import {
createContext,
useContext,
useEffect,import { useCallback, useState } from "react";
import type { Dispatch, SetStateAction } from "react";
type UseBooleanReturn = {
value: boolean;
setValue: Dispatch<SetStateAction<boolean>>;
setTrue: () => void;/* eslint-disable @typescript-eslint/no-explicit-any */
import { useRef, useCallback } from "react";
function useDebounce<T extends (...args: any[]) => any>(
callback: T,
delay: number
) {
const timer = useRef<NodeJS.Timeout | null>(null);#!/bin/bash
# this script looks for env file with the name in $ENV_FILE below
# from the root directory of repository and set variables based on it
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'#!/bin/bash
# This script reads local .env or .env.example and updates GitLab variables via API
# For sensitive data, you should leave it empty as is and set it manually later
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'interface DownloadFileConfig {
fileName?: string;
fileType?: string;
ignoreFileType?: boolean;
}
export const downloadFile = (
response: Blob,import Currency from "currency.js";
export function formatNumber(value: number, opts?: Currency.Options) {
return Currency(value, {
pattern: "#",
negativePattern: "-#",
precision: value % 2 === 0 ? 0 : 2,
...opts,export function capitalizeFirstLetter(text?: string) {
if (!text) return "";
return String(text).charAt(0).toUpperCase() + String(text).slice(1);
}export function convertStringSpace(
text?: string,
separator = "-",
newSeparator = " "
) {
if (!text) return "";
return String(text).replace(separator, newSeparator);
}export const renderDetail = (data?: unknown): string => {
if (!data || typeof data !== "string") return "-";
return data;
};import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}