prepared for ver 0.1.0
This commit is contained in:
@@ -6,7 +6,7 @@ import { ImageCard } from '@components/note/content/preview/imageCard';
|
||||
import { Video } from '@components/note/content/preview/video';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import ReactPlayer from 'react-player';
|
||||
|
||||
const MarkdownPreview = dynamic(() => import('@uiw/react-markdown-preview'), {
|
||||
@@ -14,7 +14,7 @@ const MarkdownPreview = dynamic(() => import('@uiw/react-markdown-preview'), {
|
||||
loading: () => <div className="h-4 w-36 animate-pulse rounded bg-zinc-700" />,
|
||||
});
|
||||
|
||||
export default function Content({ data }: { data: any }) {
|
||||
export const Content = memo(function Content({ data }: { data: any }) {
|
||||
const [preview, setPreview] = useState({});
|
||||
|
||||
const content = useRef(data.content);
|
||||
@@ -96,4 +96,4 @@ export default function Content({ data }: { data: any }) {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { UserWithUsername } from '@components/note/atoms/userWithUsername';
|
||||
import Content from '@components/note/content';
|
||||
import { Content } from '@components/note/content';
|
||||
import NoteReply from '@components/note/modal/noteReply';
|
||||
|
||||
import { useNostrEvents } from 'nostr-react';
|
||||
@@ -24,7 +24,7 @@ const Modal = ({ event }: { event: any }) => {
|
||||
<div className="relative h-full overflow-auto rounded-lg border-[0.5px] border-white/30 bg-zinc-800 p-4 shadow-inner">
|
||||
<div className="flex flex-col gap-4">
|
||||
<UserWithUsername pubkey={event.pubkey} />
|
||||
<Content data={event.content} />
|
||||
<Content data={event} />
|
||||
</div>
|
||||
<div className="flex flex-col gap-2 divide-y divide-zinc-700">
|
||||
{events.map((item) => (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { User } from '@components/note/atoms/user';
|
||||
import Content from '@components/note/content';
|
||||
import { Content } from '@components/note/content';
|
||||
|
||||
export default function NoteReply({ event }: { event: any }) {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { UserRepost } from '@components/note/atoms/userRepost';
|
||||
import Content from '@components/note/content';
|
||||
import { Content } from '@components/note/content';
|
||||
import { Placeholder } from '@components/note/placeholder';
|
||||
|
||||
import RepostIcon from '@assets/icons/Repost';
|
||||
@@ -24,7 +24,7 @@ export const Repost = memo(function Repost({ root, user }: { root: any; user: st
|
||||
},
|
||||
});
|
||||
|
||||
if (events !== null) {
|
||||
if (events !== null && Object.keys(events).length > 0) {
|
||||
return (
|
||||
<Dialog.Root>
|
||||
<Dialog.Trigger>
|
||||
@@ -35,12 +35,12 @@ export const Repost = memo(function Repost({ root, user }: { root: any; user: st
|
||||
<UserRepost pubkey={user} />
|
||||
</div>
|
||||
</div>
|
||||
<Content data={events[0]} />
|
||||
{events[0].content && <Content data={events[0]} />}
|
||||
</div>
|
||||
<Dialog.Portal>
|
||||
<Dialog.Overlay className="fixed inset-0 bg-black bg-opacity-30 backdrop-blur-sm data-[state=open]:animate-overlayShow" />
|
||||
<Dialog.Content className="fixed inset-0 overflow-y-auto">
|
||||
<Modal event={events[0]} />
|
||||
{events[0].content && <Modal event={events[0]} />}
|
||||
</Dialog.Content>
|
||||
</Dialog.Portal>
|
||||
</Dialog.Trigger>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import Content from '@components/note/content';
|
||||
import { Content } from '@components/note/content';
|
||||
|
||||
import * as Dialog from '@radix-ui/react-dialog';
|
||||
import dynamic from 'next/dynamic';
|
||||
@@ -12,8 +12,6 @@ const Modal = dynamic(() => import('@components/note/modal'), {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const Single = memo(function Single({ event }: { event: any }) {
|
||||
console.log(event);
|
||||
|
||||
return (
|
||||
<Dialog.Root>
|
||||
<Dialog.Trigger asChild>
|
||||
|
||||
@@ -4,7 +4,7 @@ import OnboardingLayout from '@layouts/onboardingLayout';
|
||||
|
||||
import { motion } from 'framer-motion';
|
||||
import { useRouter } from 'next/router';
|
||||
import { getPublicKey, nip19 } from 'nostr-tools';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { JSXElementConstructor, ReactElement, ReactFragment, ReactPortal } from 'react';
|
||||
import { Resolver, useForm } from 'react-hook-form';
|
||||
|
||||
@@ -36,17 +36,15 @@ export default function Page() {
|
||||
} = useForm<FormValues>({ resolver });
|
||||
|
||||
const onSubmit = async (data: any) => {
|
||||
let privKey = data['key'];
|
||||
let privkey = data['key'];
|
||||
|
||||
if (privKey.substring(0, 4) === 'nsec') {
|
||||
privKey = nip19.decode(privKey).data;
|
||||
if (privkey.substring(0, 4) === 'nsec') {
|
||||
privkey = nip19.decode(privkey).data;
|
||||
}
|
||||
|
||||
try {
|
||||
const pubKey = getPublicKey(privKey);
|
||||
|
||||
if (pubKey) {
|
||||
router.push(`/onboarding/profile/${privKey}`);
|
||||
if (privkey) {
|
||||
router.push(`/onboarding/profile/${privkey}`);
|
||||
}
|
||||
} catch (error) {
|
||||
setError('key', {
|
||||
|
||||
Reference in New Issue
Block a user