New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
todo_list: Add option for modal to create todo-lists. #29806
base: main
Are you sure you want to change the base?
Conversation
07f8c95
to
9f89ef3
Compare
b61635e
to
ecef2b8
Compare
@N-Shar-ma can please review this PR :) |
Thanks! Let always call it a "to-do list", not just "todo" (in the tooltips, help center). |
I think we should allow posting todo lists without a title. It's fine for it to just have the default title ("Task list"). |
ecef2b8
to
4009cb4
Compare
@alya made the changes and update screenshots in PR description. |
ffb04e0
to
60fb41d
Compare
5b83e6a
to
ba05d4b
Compare
@N-Shar-ma made the changes in PR. You can take a look now :) |
f2e4c01
to
8d46022
Compare
@N-Shar-ma made changes according to your feedback and left one comment above :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested some more changes for handling the mandatory task title but optional task description behaviour better.
Also, just a general bit of advice - try keeping inline conditionals minimal. Aim for clarity over brevity
web/src/widget_modal.ts
Outdated
} | ||
|
||
export function frame_todo_message_content(): string { | ||
const title = $<HTMLInputElement>("input#todo-title-input").val()?.toString().trim() ?? ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of empty string, make the fallback "Task list"
web/src/widget_modal.ts
Outdated
|
||
export function frame_todo_message_content(): string { | ||
const title = $<HTMLInputElement>("input#todo-title-input").val()?.toString().trim() ?? ""; | ||
const todo_str = title ? `/todo ${title}\n` : "/todo Task list\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then write this plainly without need for conditionals
web/src/widget_modal.ts
Outdated
const todo = | ||
todo_name && todo_description | ||
? `${todo_name}: ${todo_description}` | ||
: todo_name || todo_description; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is really hard to read. If I understand correctly, in the absence of a task title, we assign it the value in the description. But that's not the behavior we want.
We should aim for consistency between this modal UI and the pre-existing widget UI. Since task titles are mandatory, we do not want to consider tasks without task title. To discourage only filling in the description field, we should considering enabling the input only when the corresponding task title input is non empty. In case you like, feel free to discuss this detail more on CZO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently we have two option:
- Enable the description input only when the task title has values:
- Stay consistent with the current widget (which is displayed after the /todo command is sent) in which you can add a value to the description, but the "Add task" button will not work.
todo.mp4
- In my opinion, what you have suggested sounds better than the second option. We should not allow users to write values in the description if the task title is empty in the first place. However, in that case, it will not be consistent with the pre-existing modal.
started discussion at https://chat.zulip.org/#narrow/stream/6-frontend/topic/description.20field.20in.20todo.20modal/near/1792835
}); | ||
$todo_options_list.on("input", "input.todo-description-input", (event) => { | ||
add_option_row(event, "TODO"); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to add a row on detecting input in the description field. The task title should be enough
8d46022
to
c2bc2af
Compare
This commit change the location of poll icon into their own section in the right just before `?`.
c2bc2af
to
07c4288
Compare
07c4288
to
b88e2f0
Compare
Previously, the `/todo` slash command was the sole method for creating todos. Now, a button has been introduced to launch a modal for creating todo-lists directly from the compose box. This button becomes enabled only when the compose box is empty, thereby avoiding complexities associated with losing or having to save drafts of any messages already being composed. The modal features a form that, upon submission, generates a message using the `/todo` syntax and the data inputted in the form. Subsequently, the content of the compose box is set to this message, which the user can then send. This modal closely parallels the UI for adding a poll; therefore, the poll and todo code has been shifted to a newly created file named `widget.ts`, and `poll_modal.ts` is now deprecated. Fixes: zulip#29779.
b88e2f0
to
d37e79f
Compare
I think puppeteer tests is failing due to https://chat.zulip.org/#narrow/stream/43-automated-testing/topic/main.20failing/near/1790147 |
Previously, the
/todo
slash command was the sole method for creating todos. Now, a button has been introduced to launch a modal for creating todo-lists directly from the compose box. This button becomes enabled only when the compose box is empty, thereby avoiding complexities associated with losing or having to save drafts of any messages already being composed.The modal features a form that, upon submission,
generates a message using the
/todo
syntax and the data inputted in the form. Subsequently, the content of the compose box is set to this message, which the user can then send.This modal closely parallels the UI for adding a poll.
Fixes: #29779.
UI Changes
Documentation changes
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: