feat: add login screen

This commit is contained in:
reya
2024-07-23 14:18:40 +07:00
parent 462837565e
commit 7cd5f06122
22 changed files with 837 additions and 27 deletions

23
src/commons.ts Normal file
View File

@@ -0,0 +1,23 @@
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function npub(pubkey: string, len: number) {
if (pubkey.length <= len) return pubkey;
const separator = " ... ";
const sepLen = separator.length;
const charsToShow = len - sepLen;
const frontChars = Math.ceil(charsToShow / 2);
const backChars = Math.floor(charsToShow / 2);
return (
pubkey.substring(0, frontChars) +
separator +
pubkey.substring(pubkey.length - backChars)
);
}