mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-07-27 20:42:19 +02:00
small fixes for wiki
This commit is contained in:
@@ -11,3 +11,8 @@ export function getPageTopic(page: NostrEvent) {
|
|||||||
if (!d) throw new Error("Page missing d tag");
|
if (!d) throw new Error("Page missing d tag");
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getPageSummary(page: NostrEvent) {
|
||||||
|
const summary = page.tags.find((t) => t[0] === "summary")?.[1];
|
||||||
|
return summary || page.content.split("\n")[0];
|
||||||
|
}
|
||||||
|
@@ -4,7 +4,7 @@ import { Link as RouterLink } from "react-router-dom";
|
|||||||
|
|
||||||
import HoverLinkOverlay from "../../../components/hover-link-overlay";
|
import HoverLinkOverlay from "../../../components/hover-link-overlay";
|
||||||
import { getSharableEventAddress } from "../../../helpers/nip19";
|
import { getSharableEventAddress } from "../../../helpers/nip19";
|
||||||
import { getPageTitle } from "../../../helpers/nostr/wiki";
|
import { getPageSummary, getPageTitle } from "../../../helpers/nostr/wiki";
|
||||||
import UserLink from "../../../components/user/user-link";
|
import UserLink from "../../../components/user/user-link";
|
||||||
import Timestamp from "../../../components/timestamp";
|
import Timestamp from "../../../components/timestamp";
|
||||||
|
|
||||||
@@ -17,10 +17,10 @@ export default function WikiPageResult({ page }: { page: NostrEvent }) {
|
|||||||
</HoverLinkOverlay>
|
</HoverLinkOverlay>
|
||||||
</Heading>
|
</Heading>
|
||||||
<Text>
|
<Text>
|
||||||
by <UserLink pubkey={page.pubkey} /> - <Timestamp timestamp={page.created_at} />
|
by <UserLink pubkey={page.pubkey} fontWeight="bold " /> - <Timestamp timestamp={page.created_at} />
|
||||||
</Text>
|
</Text>
|
||||||
<Text color="GrayText" noOfLines={2}>
|
<Text color="GrayText" noOfLines={2}>
|
||||||
{page.content.split("\n")[0]}
|
{getPageSummary(page)}
|
||||||
</Text>
|
</Text>
|
||||||
</LinkBox>
|
</LinkBox>
|
||||||
);
|
);
|
||||||
|
@@ -42,12 +42,16 @@ function WikiPagePage({ page }: { page: NostrEvent }) {
|
|||||||
<MarkdownContent event={page} />
|
<MarkdownContent event={page} />
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Heading size="lg" mt="4">
|
{sorted.length > 0 && (
|
||||||
Other Versions:
|
<>
|
||||||
</Heading>
|
<Heading size="lg" mt="4">
|
||||||
{sorted.slice(0, 6).map((page) => (
|
Other Versions:
|
||||||
<WikiPageResult key={page.id} page={page} />
|
</Heading>
|
||||||
))}
|
{sorted.slice(0, 6).map((page) => (
|
||||||
|
<WikiPageResult key={page.id} page={page} />
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</VerticalPageLayout>
|
</VerticalPageLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user