/
effective_wiki
/
web-client
Обзор
Документация
Войти
/
effective_wiki
/
web-client
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
master
src/lib/utils.ts
37 строк
798 B
Max-Sam231
chore: move colors to utils
17 дек 2025, 13:20
17 дек 2025, 13:20
eb965e9
Код
Авторство
О чём код?
import { clsx, type ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; import { v4 as uuidv4 } from "uuid"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } export function generateUniqueBlockId(): string { return uuidv4(); } const CURSOR_COLORS = [ "#ff6b6b", "#4ecdc4", "#45b7d1", "#f9ca24", "#6c5ce7", "#a29bfe", "#fd79a8", ] as const; export function getUserColor(userId?: string): string { const index = (userId?.charCodeAt(0) || 0) % CURSOR_COLORS.length; return CURSOR_COLORS[index]; } let __lastTimestamp = 0; export function nextTimestamp(): number { const t = Date.now(); if (t <= __lastTimestamp) { __lastTimestamp = __lastTimestamp + 1; } else { __lastTimestamp = t; } return __lastTimestamp; }