mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-04-10 12:49:29 +02:00
small fixes for reports view
This commit is contained in:
parent
35bb0e3704
commit
4c4eb87e31
@ -1,5 +1,5 @@
|
||||
import { useOutletContext } from "react-router-dom";
|
||||
import { Divider, Flex, Heading, SimpleGrid, Text } from "@chakra-ui/react";
|
||||
import { Heading, SimpleGrid } from "@chakra-ui/react";
|
||||
|
||||
import { useAdditionalRelayContext } from "../../providers/additional-relay-context";
|
||||
import useTimelineLoader from "../../hooks/use-timeline-loader";
|
||||
@ -33,10 +33,9 @@ export default function UserEmojiPacksTab() {
|
||||
<VerticalPageLayout>
|
||||
{packs.length > 0 && (
|
||||
<>
|
||||
<Heading size="md" mt="2">
|
||||
<Heading size="lg" mt="2">
|
||||
Created packs
|
||||
</Heading>
|
||||
<Divider />
|
||||
<SimpleGrid columns={{ base: 1, lg: 2 }} spacing="2">
|
||||
{packs.map((pack) => (
|
||||
<EmojiPackCard key={getEventUID(pack)} pack={pack} />
|
||||
@ -46,10 +45,9 @@ export default function UserEmojiPacksTab() {
|
||||
)}
|
||||
{favorites.length > 0 && (
|
||||
<>
|
||||
<Heading size="md" mt="2">
|
||||
<Heading size="lg" mt="2">
|
||||
Favorite packs
|
||||
</Heading>
|
||||
<Divider />
|
||||
<SimpleGrid columns={{ base: 1, lg: 2 }} spacing="2">
|
||||
{favorites.map((event) => (
|
||||
<EmojiPackCard key={getEventUID(event)} pack={event} />
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { useRef } from "react";
|
||||
import { Flex, Text } from "@chakra-ui/react";
|
||||
import { useOutletContext } from "react-router-dom";
|
||||
import { Kind } from "nostr-tools";
|
||||
|
||||
import { NoteLink } from "../../components/note-link";
|
||||
import { UserLink } from "../../components/user-link";
|
||||
@ -24,13 +25,15 @@ function ReportEvent({ report }: { report: NostrEvent }) {
|
||||
useRegisterIntersectionEntity(ref, getEventUID(report));
|
||||
|
||||
return (
|
||||
<Flex gap="2">
|
||||
<Flex gap="2" ref={ref}>
|
||||
<UserLink pubkey={report.pubkey} color="blue.500" />
|
||||
<Text>reported</Text>
|
||||
{reportedEvent ? (
|
||||
<>
|
||||
<NoteLink noteId={reportedEvent} />
|
||||
{reportedPubkey && (
|
||||
<>
|
||||
<Text>From</Text>
|
||||
<Text>by</Text>
|
||||
<UserLink pubkey={reportedPubkey} color="blue.500" />
|
||||
</>
|
||||
)}
|
||||
@ -38,7 +41,7 @@ function ReportEvent({ report }: { report: NostrEvent }) {
|
||||
) : (
|
||||
<UserLink pubkey={reportedPubkey} color="blue.500" />
|
||||
)}
|
||||
<Text>{reason}</Text>
|
||||
{reason && <Text>for {reason}</Text>}
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
@ -47,10 +50,16 @@ export default function UserReportsTab() {
|
||||
const { pubkey } = useOutletContext() as { pubkey: string };
|
||||
const contextRelays = useAdditionalRelayContext();
|
||||
|
||||
const timeline = useTimelineLoader(`${pubkey}-reports`, contextRelays, {
|
||||
authors: [pubkey],
|
||||
kinds: [1984],
|
||||
});
|
||||
const timeline = useTimelineLoader(`${pubkey}-reports`, contextRelays, [
|
||||
{
|
||||
authors: [pubkey],
|
||||
kinds: [Kind.Report],
|
||||
},
|
||||
{
|
||||
"#p": [pubkey],
|
||||
kinds: [Kind.Report],
|
||||
},
|
||||
]);
|
||||
|
||||
const events = useSubject(timeline.timeline);
|
||||
const callback = useTimelineCurserIntersectionCallback(timeline);
|
||||
|
Loading…
x
Reference in New Issue
Block a user