tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
render quote content from subpages
awarm.space
5 months ago
5cc7518d
2228a52b
+13
-1
1 changed file
expand all
collapse all
unified
split
app
lish
[did]
[publication]
[rkey]
Interactions
Quotes.tsx
+13
-1
app/lish/[did]/[publication]/[rkey]/Interactions/Quotes.tsx
···
19
19
import { useActiveHighlightState } from "../useHighlight";
20
20
import { PostContent } from "../PostContent";
21
21
import { ProfileViewBasic } from "@atproto/api/dist/client/types/app/bsky/actor/defs";
22
22
+
import { flushSync } from "react-dom";
23
23
+
import { openPage } from "../PostPages";
22
24
23
25
export const Quotes = (props: {
24
26
quotes: { link: string; bsky_posts: { post_view: Json } | null }[];
···
90
92
const data = useContext(PostPageContext);
91
93
92
94
let record = data?.data as PubLeafletDocument.Record;
93
93
-
let page = record.pages[0] as PubLeafletPagesLinearDocument.Main;
95
95
+
let page: PubLeafletPagesLinearDocument.Main | undefined = (
96
96
+
props.position.pageId
97
97
+
? record.pages.find(
98
98
+
(p) =>
99
99
+
(p as PubLeafletPagesLinearDocument.Main).id ===
100
100
+
props.position.pageId,
101
101
+
)
102
102
+
: record.pages[0]
103
103
+
) as PubLeafletPagesLinearDocument.Main;
94
104
// Extract blocks within the quote range
95
105
const content = extractQuotedBlocks(page.blocks || [], props.position, []);
96
106
return (
···
106
116
<div
107
117
className="quoteSectionQuote text-secondary text-sm text-left hover:cursor-pointer"
108
118
onClick={(e) => {
119
119
+
if (props.position.pageId)
120
120
+
flushSync(() => openPage(undefined, props.position.pageId!));
109
121
let scrollMargin = isMobile
110
122
? 16
111
123
: e.currentTarget.getBoundingClientRect().top;