Skip to content

Commit

Permalink
Fix: 667 (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecnivtwelve authored Jan 21, 2025
2 parents 5fe6b84 + 80eac7c commit 5f39e0c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/views/account/Home/Elements/HomeworksElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ const HomeworksElement: React.FC<HomeworksElementProps> = ({ navigation, onImpor
const hwSemaineActuelle = homeworks[dateToEpochWeekNumber(actualDay)]?.filter(
(hw) => hw.due / 1000 >= startTime && hw.due / 1000 <= endTime
) ?? [];
const truncateContent = (content: string) => {
if (content.length <= 120) {
return content;
}
const truncated = content.slice(0, 120);
const lastSpaceIndex = truncated.lastIndexOf(" ");
return `${truncated.slice(0, lastSpaceIndex)}...`;
};
hwSemaineActuelle.forEach(hw => {
hw.content = truncateContent(hw.content);
});
const hwSemaineProchaine = homeworks[dateToEpochWeekNumber(actualDay) + 1]?.filter(
(hw) => hw.due / 1000 >= startTime && hw.due / 1000 <= endTime
) ?? [];
Expand Down

0 comments on commit 5f39e0c

Please sign in to comment.