Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sujalshah-bit
Copy link
Collaborator

@sujalshah-bit sujalshah-bit commented Apr 21, 2024

GSoC`2024 Participant

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
Light Dark
image image
Icons Tooltips
Icon image
image
Documentation changes
Current Changes
image image
Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

@zulipbot zulipbot added size: XL area: compose (UI & widgets) Scheduled messages, giphy, send later, etc. new feature A proposed new feature for the product labels Apr 21, 2024
@sujalshah-bit sujalshah-bit force-pushed the ui-todo-list branch 5 times, most recently from b61635e to ecef2b8 Compare April 22, 2024 06:39
@sujalshah-bit sujalshah-bit marked this pull request as ready for review April 22, 2024 07:02
@sujalshah-bit
Copy link
Collaborator Author

@N-Shar-ma can please review this PR :)

@alya
Copy link
Contributor

alya commented Apr 22, 2024

Thanks! Let always call it a "to-do list", not just "todo" (in the tooltips, help center).

@alya
Copy link
Contributor

alya commented Apr 22, 2024

I think we should allow posting todo lists without a title. It's fine for it to just have the default title ("Task list").

@sujalshah-bit
Copy link
Collaborator Author

@alya made the changes and update screenshots in PR description.

@sujalshah-bit sujalshah-bit force-pushed the ui-todo-list branch 2 times, most recently from ffb04e0 to 60fb41d Compare April 22, 2024 07:52
web/shared/icons/todo-list.svg:Zone.Identifier Outdated Show resolved Hide resolved
web/src/tippyjs.ts Outdated Show resolved Hide resolved
web/src/todo_list_modal.ts Outdated Show resolved Hide resolved
web/templates/compose_control_buttons.hbs Show resolved Hide resolved
@sujalshah-bit sujalshah-bit force-pushed the ui-todo-list branch 4 times, most recently from 5b83e6a to ba05d4b Compare April 27, 2024 09:06
@sujalshah-bit
Copy link
Collaborator Author

@N-Shar-ma made the changes in PR. You can take a look now :)

web/src/widget.ts Outdated Show resolved Hide resolved
web/src/compose.js Outdated Show resolved Hide resolved
web/src/compose_setup.js Outdated Show resolved Hide resolved
web/src/widget.ts Outdated Show resolved Hide resolved
web/src/widget.ts Outdated Show resolved Hide resolved
web/src/widget.ts Outdated Show resolved Hide resolved
@sujalshah-bit
Copy link
Collaborator Author

@N-Shar-ma made changes according to your feedback and left one comment above :)

Copy link
Collaborator

@N-Shar-ma N-Shar-ma left a 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

}

export function frame_todo_message_content(): string {
const title = $<HTMLInputElement>("input#todo-title-input").val()?.toString().trim() ?? "";
Copy link
Collaborator

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"


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";
Copy link
Collaborator

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

const todo =
todo_name && todo_description
? `${todo_name}: ${todo_description}`
: todo_name || todo_description;
Copy link
Collaborator

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

Copy link
Collaborator Author

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:

  1. Enable the description input only when the task title has values:
    image
  2. 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");
});
Copy link
Collaborator

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

@sujalshah-bit
Copy link
Collaborator Author

Also I notice that buttons are not disable when access through three dot menu
image

Do you know why this is happening? I'm trying to find out, though.

This commit change the location of poll icon into their own
section in the right just before `?`.
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.
@sujalshah-bit
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: compose (UI & widgets) Scheduled messages, giphy, send later, etc. new feature A proposed new feature for the product size: XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI for creating a todo list
4 participants