Files
dynamic-preauth/frontend/src/util.ts
2024-12-23 13:35:56 -06:00

21 lines
605 B
TypeScript

import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export { type ClassValue };
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function plural(text: string, count: number) {
return `${text}${count === 1 ? "" : "s"}`;
}
export type Platform = "windows" | "mac" | "linux";
export function os(): Platform | "other" {
if (navigator.userAgent.includes("win")) return "windows";
else if (navigator.userAgent.includes("mac")) return "mac";
else if (navigator.userAgent.includes("linux")) return "linux";
return "other";
}