mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
42 lines
961 B
TypeScript
42 lines
961 B
TypeScript
import { nip19 } from 'nostr-tools';
|
|
import { useParams } from 'react-router-dom';
|
|
import NotFound from './NotFound';
|
|
|
|
export function NIP19Page() {
|
|
const { nip19: identifier } = useParams<{ nip19: string }>();
|
|
|
|
if (!identifier) {
|
|
return <NotFound />;
|
|
}
|
|
|
|
let decoded;
|
|
try {
|
|
decoded = nip19.decode(identifier);
|
|
} catch {
|
|
return <NotFound />;
|
|
}
|
|
|
|
const { type } = decoded;
|
|
|
|
switch (type) {
|
|
case 'npub':
|
|
case 'nprofile':
|
|
// AI agent should implement profile view here
|
|
return <div>Profile placeholder</div>;
|
|
|
|
case 'note':
|
|
// AI agent should implement note view here
|
|
return <div>Note placeholder</div>;
|
|
|
|
case 'nevent':
|
|
// AI agent should implement event view here
|
|
return <div>Event placeholder</div>;
|
|
|
|
case 'naddr':
|
|
// AI agent should implement addressable event view here
|
|
return <div>Addressable event placeholder</div>;
|
|
|
|
default:
|
|
return <NotFound />;
|
|
}
|
|
}
|