mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-04-10 04:39:19 +02:00
handle list and emoji pack links
This commit is contained in:
parent
7a5a4b1753
commit
9f80a68935
@ -2,6 +2,8 @@ import { Alert, AlertIcon, AlertTitle } from "@chakra-ui/react";
|
||||
import { Navigate, useParams } from "react-router-dom";
|
||||
import { nip19 } from "nostr-tools";
|
||||
import { STREAM_KIND } from "../../helpers/nostr/stream";
|
||||
import { EMOJI_PACK_KIND } from "../../helpers/nostr/emoji-packs";
|
||||
import { NOTE_LIST_KIND, PEOPLE_LIST_KIND } from "../../helpers/nostr/lists";
|
||||
|
||||
export default function NostrLinkView() {
|
||||
const { link } = useParams() as { link?: string };
|
||||
@ -26,12 +28,15 @@ export default function NostrLinkView() {
|
||||
return <Navigate to={`/n/${cleanLink}`} replace />;
|
||||
case "naddr":
|
||||
if (decoded.data.kind === STREAM_KIND) return <Navigate to={`/streams/${cleanLink}`} replace />;
|
||||
if (decoded.data.kind === EMOJI_PACK_KIND) return <Navigate to={`/emojis/${cleanLink}`} replace />;
|
||||
if (decoded.data.kind === NOTE_LIST_KIND) return <Navigate to={`/lists/${cleanLink}`} replace />;
|
||||
if (decoded.data.kind === PEOPLE_LIST_KIND) return <Navigate to={`/lists/${cleanLink}`} replace />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Alert status="warning">
|
||||
<AlertIcon />
|
||||
<AlertTitle>Unknown type "{decoded.type}"</AlertTitle>
|
||||
<AlertTitle>Unknown type</AlertTitle>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user