Skip to content

Commit

Permalink
substring ib content in learn view
Browse files Browse the repository at this point in the history
  • Loading branch information
mochar committed Sep 28, 2024
1 parent 60708c4 commit 23f7dbe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/learn/LearnView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function LearnView() {
<HeaderComponent></HeaderComponent>

<div className={`${theme.BORDER} rounded`}>
<IbItem qib={currentQib}></IbItem>
<IbItem qib={currentQib} nChars={270}></IbItem>
</div>

<PriorityComponent></PriorityComponent>
Expand Down
6 changes: 4 additions & 2 deletions src/widgets/IbItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import { interpolateColor } from "../utils/utils";
import * as theme from "../utils/theme";
import { QueueIb } from "../learn/learnSlice";

export default function
IbItem({ qib }: { qib: QueueIb }) {
export default function IbItem({ qib, nChars }: { qib: QueueIb, nChars?: number }) {

// If block is page property block, then it has no content field.
// At least the one i checked..
let content = qib.content;
if (content) {
content = content.split('\n')[0];
if (nChars && content.length > nChars) {
content = content.substring(0, nChars) + '...';
}
}

const bgColor = interpolateColor(PRIORITY_PALETTE, 1-qib.priority);
Expand Down

0 comments on commit 23f7dbe

Please sign in to comment.