botchan 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -17
- package/dist/cli/index.mjs +10 -9
- package/dist/cli/index.mjs.map +1 -1
- package/dist/tui/index.mjs +10 -9
- package/dist/tui/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/tui/index.mjs
CHANGED
|
@@ -630,9 +630,10 @@ function parsePostContent(text) {
|
|
|
630
630
|
const body = text.slice(firstNewline + 1).trim();
|
|
631
631
|
return { title, body: body || null };
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
|
|
635
|
-
|
|
633
|
+
function truncateText(text, maxLength = 250) {
|
|
634
|
+
const trimmed = text.trim();
|
|
635
|
+
if (trimmed.length <= maxLength) return trimmed;
|
|
636
|
+
return trimmed.slice(0, maxLength - 3) + "...";
|
|
636
637
|
}
|
|
637
638
|
function PostList({
|
|
638
639
|
feedName,
|
|
@@ -686,7 +687,7 @@ function PostList({
|
|
|
686
687
|
const postKey = `${post.sender}:${post.timestamp}`;
|
|
687
688
|
const commentCount = commentCounts.get(postKey) ?? 0;
|
|
688
689
|
const { title, body } = parsePostContent(post.text);
|
|
689
|
-
const displayTitle = title ?
|
|
690
|
+
const displayTitle = title ? truncateText(title) : null;
|
|
690
691
|
const hasMore = body !== null;
|
|
691
692
|
return /* @__PURE__ */ jsxs(
|
|
692
693
|
Box,
|
|
@@ -741,10 +742,10 @@ function formatTimestamp2(timestamp) {
|
|
|
741
742
|
minute: "2-digit"
|
|
742
743
|
});
|
|
743
744
|
}
|
|
744
|
-
function
|
|
745
|
-
const
|
|
746
|
-
if (
|
|
747
|
-
return
|
|
745
|
+
function truncateText2(text, maxLength = 500) {
|
|
746
|
+
const trimmed = text.trim();
|
|
747
|
+
if (trimmed.length <= maxLength) return trimmed;
|
|
748
|
+
return trimmed.slice(0, maxLength - 3) + "...";
|
|
748
749
|
}
|
|
749
750
|
function getTextLines(text, width) {
|
|
750
751
|
const lines = [];
|
|
@@ -845,7 +846,7 @@ function CommentTree({
|
|
|
845
846
|
const { comment, depth } = item;
|
|
846
847
|
const key = `${comment.sender}:${comment.timestamp}`;
|
|
847
848
|
const replyCount = replyCounts.get(key) ?? 0;
|
|
848
|
-
const displayText = comment.text ?
|
|
849
|
+
const displayText = comment.text ? truncateText2(comment.text) : null;
|
|
849
850
|
const indent = " ".repeat(depth);
|
|
850
851
|
const replyIndicator = depth > 0 ? "\u21B3 " : "";
|
|
851
852
|
return /* @__PURE__ */ jsxs(
|