diff --git a/src/pages/NIP19Page.tsx b/src/pages/NIP19Page.tsx index 09d4055..6cbd0fb 100644 --- a/src/pages/NIP19Page.tsx +++ b/src/pages/NIP19Page.tsx @@ -1,14 +1,7 @@ import { nip19 } from 'nostr-tools'; import { useParams } from 'react-router-dom'; import { Layout } from '@/components/Layout'; -import { ProfileHeader } from '@/components/profile/ProfileHeader'; -import { MinimalPictureCard } from '@/components/feed/MinimalPictureCard'; -import { useAuthor } from '@/hooks/useAuthor'; -import { useUserPictures } from '@/hooks/useUserPictures'; -import { Button } from '@/components/ui/button'; -import { Card, CardContent } from '@/components/ui/card'; -import { Skeleton } from '@/components/ui/skeleton'; -import { Loader2 } from 'lucide-react'; +import { ProfileView } from './ProfileView'; import NotFound from './NotFound'; export function NIP19Page() { @@ -79,79 +72,4 @@ export function NIP19Page() { default: return ; } -} - -function ProfileView({ pubkey }: { pubkey: string }) { - const author = useAuthor(pubkey); - const { - data, - fetchNextPage, - hasNextPage, - isFetchingNextPage, - isLoading, - } = useUserPictures(pubkey); - - const pictures = data?.pages.flat() || []; - - return ( -
-
- {/* Profile Header */} - - - {/* Pictures Section */} -
-

Pictures

- - {isLoading ? ( -
- {[...Array(8)].map((_, i) => ( - - ))} -
- ) : pictures.length === 0 ? ( - - -

- No pictures found for this user. -

-
-
- ) : ( - <> -
- {pictures.map((event) => ( - - ))} -
- - {hasNextPage && ( -
- -
- )} - - )} -
-
-
- ); } \ No newline at end of file diff --git a/src/pages/ProfileView.tsx b/src/pages/ProfileView.tsx new file mode 100644 index 0000000..526eb4e --- /dev/null +++ b/src/pages/ProfileView.tsx @@ -0,0 +1,83 @@ +import { useAuthor } from '@/hooks/useAuthor'; +import { useUserPictures } from '@/hooks/useUserPictures'; +import { Button } from '@/components/ui/button'; +import { Card, CardContent } from '@/components/ui/card'; +import { Skeleton } from '@/components/ui/skeleton'; +import { Loader2 } from 'lucide-react'; +import { ProfileHeader } from '@/components/profile/ProfileHeader'; +import { MinimalPictureCard } from '@/components/feed/MinimalPictureCard'; + +export function ProfileView({ pubkey }: { pubkey: string }) { + const author = useAuthor(pubkey); + const { + data, + fetchNextPage, + hasNextPage, + isFetchingNextPage, + isLoading, + } = useUserPictures(pubkey); + + const pictures = data?.pages.flat() || []; + + return ( +
+
+ {/* Profile Header */} + + + {/* Pictures Section */} +
+

Pictures

+ + {isLoading ? ( +
+ {[...Array(8)].map((_, i) => ( + + ))} +
+ ) : pictures.length === 0 ? ( + + +

+ No pictures found for this user. +

+
+
+ ) : ( + <> +
+ {pictures.map((event) => ( + + ))} +
+ + {hasNextPage && ( +
+ +
+ )} + + )} +
+
+
+ ); +}