tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
288
fork
atom
a tool for shared writing and social publishing
288
fork
atom
overview
issues
27
pulls
pipelines
fix facet issue on quotes page
awarm.space
6 days ago
42795c92
a54ab8c6
+22
-22
1 changed file
expand all
collapse all
unified
split
app
lish
[did]
[publication]
[rkey]
Interactions
Quotes.tsx
+22
-22
app/lish/[did]/[publication]/[rkey]/Interactions/Quotes.tsx
···
95
});
96
97
// Sort by engagement: likes count 1, replies and quotes count 1.5
98
-
const byEngagement = (
99
-
a: { uri: string },
100
-
b: { uri: string },
101
-
) => {
102
const scoreA = engagementScore(postViewMap.get(a.uri));
103
const scoreB = engagementScore(postViewMap.get(b.uri));
104
return scoreB - scoreA;
···
354
parentPath: number[],
355
): PubLeafletBlocksUnorderedList.ListItem[] {
356
const result: PubLeafletBlocksUnorderedList.ListItem[] = [];
0
357
358
items.forEach((item, index) => {
359
const itemPath = [...parentPath, index];
···
448
PubLeafletBlocksText.isMain(block.block) ||
449
PubLeafletBlocksHeader.isMain(block.block)
450
) {
451
-
adjustedFacets = block.block?.facets
452
-
?.map((facet) => {
453
-
const facetStart = facet.index.byteStart;
454
-
const facetEnd = facet.index.byteEnd;
0
0
455
456
-
// Skip facets outside the quoted range
457
-
if (facetEnd <= startOffset || facetStart >= endOffset) {
458
-
return null;
459
-
}
460
461
-
// Adjust facet indices
462
-
return {
463
-
...facet,
464
-
index: {
465
-
byteStart: Math.max(0, facetStart - startOffset),
466
-
byteEnd: Math.min(quotedText.length, facetEnd - startOffset),
467
-
},
468
-
};
469
-
})
470
-
.filter((f) => f !== null) as typeof block.block.facets;
471
}
472
473
return {
···
95
});
96
97
// Sort by engagement: likes count 1, replies and quotes count 1.5
98
+
const byEngagement = (a: { uri: string }, b: { uri: string }) => {
0
0
0
99
const scoreA = engagementScore(postViewMap.get(a.uri));
100
const scoreB = engagementScore(postViewMap.get(b.uri));
101
return scoreB - scoreA;
···
351
parentPath: number[],
352
): PubLeafletBlocksUnorderedList.ListItem[] {
353
const result: PubLeafletBlocksUnorderedList.ListItem[] = [];
354
+
if (!Array.isArray(items)) return [];
355
356
items.forEach((item, index) => {
357
const itemPath = [...parentPath, index];
···
446
PubLeafletBlocksText.isMain(block.block) ||
447
PubLeafletBlocksHeader.isMain(block.block)
448
) {
449
+
adjustedFacets = !Array.isArray(block.block?.facets)
450
+
? []
451
+
: (block.block?.facets
452
+
?.map((facet) => {
453
+
const facetStart = facet.index.byteStart;
454
+
const facetEnd = facet.index.byteEnd;
455
456
+
// Skip facets outside the quoted range
457
+
if (facetEnd <= startOffset || facetStart >= endOffset) {
458
+
return null;
459
+
}
460
461
+
// Adjust facet indices
462
+
return {
463
+
...facet,
464
+
index: {
465
+
byteStart: Math.max(0, facetStart - startOffset),
466
+
byteEnd: Math.min(quotedText.length, facetEnd - startOffset),
467
+
},
468
+
};
469
+
})
470
+
.filter((f) => f !== null) as typeof block.block.facets);
471
}
472
473
return {