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
27
pulls
pipelines
fix facet issue on quotes page
awarm.space
5 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
95
});
96
96
97
97
// Sort by engagement: likes count 1, replies and quotes count 1.5
98
98
-
const byEngagement = (
99
99
-
a: { uri: string },
100
100
-
b: { uri: string },
101
101
-
) => {
98
98
+
const byEngagement = (a: { uri: string }, b: { uri: string }) => {
102
99
const scoreA = engagementScore(postViewMap.get(a.uri));
103
100
const scoreB = engagementScore(postViewMap.get(b.uri));
104
101
return scoreB - scoreA;
···
354
351
parentPath: number[],
355
352
): PubLeafletBlocksUnorderedList.ListItem[] {
356
353
const result: PubLeafletBlocksUnorderedList.ListItem[] = [];
354
354
+
if (!Array.isArray(items)) return [];
357
355
358
356
items.forEach((item, index) => {
359
357
const itemPath = [...parentPath, index];
···
448
446
PubLeafletBlocksText.isMain(block.block) ||
449
447
PubLeafletBlocksHeader.isMain(block.block)
450
448
) {
451
451
-
adjustedFacets = block.block?.facets
452
452
-
?.map((facet) => {
453
453
-
const facetStart = facet.index.byteStart;
454
454
-
const facetEnd = facet.index.byteEnd;
449
449
+
adjustedFacets = !Array.isArray(block.block?.facets)
450
450
+
? []
451
451
+
: (block.block?.facets
452
452
+
?.map((facet) => {
453
453
+
const facetStart = facet.index.byteStart;
454
454
+
const facetEnd = facet.index.byteEnd;
455
455
456
456
-
// Skip facets outside the quoted range
457
457
-
if (facetEnd <= startOffset || facetStart >= endOffset) {
458
458
-
return null;
459
459
-
}
456
456
+
// Skip facets outside the quoted range
457
457
+
if (facetEnd <= startOffset || facetStart >= endOffset) {
458
458
+
return null;
459
459
+
}
460
460
461
461
-
// Adjust facet indices
462
462
-
return {
463
463
-
...facet,
464
464
-
index: {
465
465
-
byteStart: Math.max(0, facetStart - startOffset),
466
466
-
byteEnd: Math.min(quotedText.length, facetEnd - startOffset),
467
467
-
},
468
468
-
};
469
469
-
})
470
470
-
.filter((f) => f !== null) as typeof block.block.facets;
461
461
+
// Adjust facet indices
462
462
+
return {
463
463
+
...facet,
464
464
+
index: {
465
465
+
byteStart: Math.max(0, facetStart - startOffset),
466
466
+
byteEnd: Math.min(quotedText.length, facetEnd - startOffset),
467
467
+
},
468
468
+
};
469
469
+
})
470
470
+
.filter((f) => f !== null) as typeof block.block.facets);
471
471
}
472
472
473
473
return {