|
33 | 33 | from zulipterminal.server_url import near_message_url
|
34 | 34 | from zulipterminal.ui_tools.tables import render_table
|
35 | 35 | from zulipterminal.urwid_types import urwid_MarkupTuple, urwid_Size
|
36 |
| -from zulipterminal.widget import find_widget_type |
| 36 | +from zulipterminal.widget import find_widget_type, process_todo_widget |
37 | 37 |
|
38 | 38 |
|
39 | 39 | if typing.TYPE_CHECKING:
|
@@ -731,9 +731,30 @@ def main_view(self) -> List[Any]:
|
731 | 731 | )
|
732 | 732 |
|
733 | 733 | if self.message.get("submessages"):
|
734 |
| - widget_type = find_widget_type( |
735 |
| - self.message.get("submessages") |
736 |
| - ) # noqa: F841 |
| 734 | + widget_type = find_widget_type(self.message.get("submessages")) |
| 735 | + |
| 736 | + if widget_type == "todo": |
| 737 | + title, tasks = process_todo_widget(self.message.get("submessages")) |
| 738 | + |
| 739 | + todo_widget = f"<strong>{title}</strong>" |
| 740 | + |
| 741 | + if tasks: |
| 742 | + for task_id, task_info in tasks.items(): |
| 743 | + task_status = "[✔ ]" if task_info["completed"] else "[ ]" |
| 744 | + task_name = task_info["task"] |
| 745 | + task_description = task_info["desc"] |
| 746 | + |
| 747 | + if task_description == "": |
| 748 | + todo_widget += ( |
| 749 | + f"\n{task_status} <strong>{task_name}</strong>" |
| 750 | + ) |
| 751 | + else: |
| 752 | + todo_widget += ( |
| 753 | + f"\n{task_status} <strong>{task_name}</strong>: " |
| 754 | + f"{task_description}" |
| 755 | + ) |
| 756 | + |
| 757 | + self.message["content"] = todo_widget |
737 | 758 |
|
738 | 759 | # Transform raw message content into markup (As needed by urwid.Text)
|
739 | 760 | content, self.message_links, self.time_mentions = self.transform_content(
|
|
0 commit comments