mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-04-12 21:59:16 +02:00
small fixes for wiki
This commit is contained in:
parent
03bec50ad7
commit
74feb01c45
@ -11,3 +11,8 @@ export function getPageTopic(page: NostrEvent) {
|
||||
if (!d) throw new Error("Page missing d tag");
|
||||
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 { 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 Timestamp from "../../../components/timestamp";
|
||||
|
||||
@ -17,10 +17,10 @@ export default function WikiPageResult({ page }: { page: NostrEvent }) {
|
||||
</HoverLinkOverlay>
|
||||
</Heading>
|
||||
<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 color="GrayText" noOfLines={2}>
|
||||
{page.content.split("\n")[0]}
|
||||
{getPageSummary(page)}
|
||||
</Text>
|
||||
</LinkBox>
|
||||
);
|
||||
|
@ -42,12 +42,16 @@ function WikiPagePage({ page }: { page: NostrEvent }) {
|
||||
<MarkdownContent event={page} />
|
||||
</Box>
|
||||
|
||||
<Heading size="lg" mt="4">
|
||||
Other Versions:
|
||||
</Heading>
|
||||
{sorted.slice(0, 6).map((page) => (
|
||||
<WikiPageResult key={page.id} page={page} />
|
||||
))}
|
||||
{sorted.length > 0 && (
|
||||
<>
|
||||
<Heading size="lg" mt="4">
|
||||
Other Versions:
|
||||
</Heading>
|
||||
{sorted.slice(0, 6).map((page) => (
|
||||
<WikiPageResult key={page.id} page={page} />
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</VerticalPageLayout>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user