The entire skate-spots codebase was accidentally copied into src/src/ and public/public/ instead of src/ and public/ directly. This left the real src/ directory as blank MKStack template stubs, explaining why the landing page showed the default template instead of SkateSpots. Changes made: - Copied all files from src/src/ up to src/ (App.tsx, AppRouter.tsx, main.tsx, all pages, components, hooks, contexts, lib, i18n, test) - Copied all files from public/public/ up to public/ (images, manifest, etc.) - Deleted src/src/ and public/public/ nested directories - Removed HelloWorld.tsx template stub from pages/ - Retained the previously fixed index.css (Tailwind v3 directives) Full skate-spots feature set is now active: - All 30+ routes (map, events, spots, coaches, marketplace, wallet, etc.) - NWCProvider, LanguageProvider, PWAInstallPrompt, AmberCallbackHandler - Skate community relays (goskatespots.nostr1.com, wotr.relatr.xyz, etc.) - Outfit Variable font, Amber pre-check in main.tsx - All hooks (useSkateSpots, useCoaches, useZaps, etc.) - i18n support (en/es) Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
34 lines
No EOL
1.3 KiB
TypeScript
34 lines
No EOL
1.3 KiB
TypeScript
/** Generate a deterministic user display name based on a string seed. */
|
|
export function genUserName(seed: string | undefined | null): string {
|
|
// Guard against undefined/null seed
|
|
if (!seed) {
|
|
return 'Anonymous';
|
|
}
|
|
|
|
// Use a simple hash of the pubkey to generate consistent adjective + noun combinations
|
|
const adjectives = [
|
|
'Swift', 'Bright', 'Calm', 'Bold', 'Wise', 'Kind', 'Quick', 'Brave',
|
|
'Cool', 'Sharp', 'Clear', 'Strong', 'Smart', 'Fast', 'Keen', 'Pure',
|
|
'Noble', 'Gentle', 'Fierce', 'Steady', 'Clever', 'Proud', 'Silent', 'Wild'
|
|
];
|
|
|
|
const nouns = [
|
|
'Fox', 'Eagle', 'Wolf', 'Bear', 'Lion', 'Tiger', 'Hawk', 'Owl',
|
|
'Deer', 'Raven', 'Falcon', 'Lynx', 'Otter', 'Whale', 'Shark', 'Dolphin',
|
|
'Phoenix', 'Dragon', 'Panther', 'Jaguar', 'Cheetah', 'Leopard', 'Puma', 'Cobra'
|
|
];
|
|
|
|
// Create a simple hash from the pubkey
|
|
let hash = 0;
|
|
for (let i = 0; i < seed.length; i++) {
|
|
const char = seed.charCodeAt(i);
|
|
hash = ((hash << 5) - hash) + char;
|
|
hash = hash & hash; // Convert to 32-bit integer
|
|
}
|
|
|
|
// Use absolute value to ensure positive index
|
|
const adjIndex = Math.abs(hash) % adjectives.length;
|
|
const nounIndex = Math.abs(hash >> 8) % nouns.length;
|
|
|
|
return [adjectives[adjIndex], nouns[nounIndex]].join(' ');
|
|
} |