Commit Graph

36 Commits

Author SHA1 Message Date
Karl Stolley
dcb7acfde3 compose: Show or hide scrolling buttons on scroll event.
Fixes: #31215
2025-01-14 15:52:02 -08:00
Karl Stolley
cf29edaa65 compose: Flatten a popover-free formatting bar. 2025-01-14 15:52:02 -08:00
Anders Kaseorg
77f97762c6
eslint: Fix unicorn/explicit-length-check. (#32666)
Signed-off-by: Anders Kaseorg <[email protected]>
2024-12-11 09:19:46 -08:00
opmkumar
88727862b4 compose: Refactor functions for handling max length limits.
Refactors `check_overflow_text` and `validate_message_length` functions.
This commit ensures that there won't be any change in the existing UI
of the compose box with the refactoring of the above functions.
2024-12-04 11:44:51 -08:00
Anders Kaseorg
ec3177c834 web: Add explicit extensions to imports.
Signed-off-by: Anders Kaseorg <[email protected]>
2024-11-13 09:18:56 -08:00
opmkumar
1ddc1d2d12
search: Refactor how close buttons are handled.
We refactor the following inputs to use a `placeholder-shown` CSS selector to
show/hide the close button, rather than custom JS logic:
- Filter topics field in the left sidebar
- Filter direct messages field under direct messages
- Stream message topic
2024-09-23 16:04:10 -07:00
evykassirer
dba1af84e0 filter: Use stream id instead of stream name. 2024-09-18 13:08:14 -07:00
Prakhar Pratyush
df7ed437c2 compose: Show banner to explain interleaved view messages fading.
In an interleaved view when composing a message we fade messages
which the user is not replying to, to reduce the chance they send
a message to a recipient they didn't intend to.
Also, it reduces the visual/cognitive processing required
to figure out where their message is going to go.

But, it's not necessarily clear to users that what the
fading means, so this commit adds a one-time compose banner
to explain what's going on the first time this comes up.

Fixes part of #29076.
2024-07-16 13:52:30 -07:00
Prakhar Pratyush
35380b095f compose: Show banner to explain non interleaved view messages fading.
In a non interleaved view when composing a message to another
conversation we fade messages which the user is not replying to,
to reduce the chance they send a message to a recipient they didn't
intend to. Also, it reduces the visual/cognitive processing required
to figure out where their message is going to go.

But, it's not necessarily clear to users that what the
fading means, so this commit adds a one-time compose banner
to explain what's going on the first time this comes up.

Fixes part of #29076.
2024-07-16 13:52:29 -07:00
Kislay Verma
f58728d3e6 compose: Renarrow to unresolved topic.
When posting a message in an empty resolved
topic, the `Unresolve topic` button in the
compose banner unresolves the topic
and then renarrows to the unresolved topic
if currently viewing the old (resolved) topic.
2024-06-27 17:10:15 -07:00
N-Shar-ma
9bc1eb4bb9 compose: Allow 3-way compose box resizing with new fixed expanded state.
Apart from the normal (collapsed) and full screen sizes, a new expanded
state with the same size as the maximum a normal compose box can stretch
to when full (40% of the screen height) is now available. Now a user can
expand the compose box without it covering the full screen with a click.
The vertical resize icon in the bottom right corner of the compose box
is rendered useless so has been removed.

All three states can be cycled through by clicking the compose resize
button in the order: collapsed -> 40% of the screen -> full screen. When
a message naturally causes the compose box in its normal state to expand
up to 40% of the screen, clicking the resize button will take it to full
screen state.

Fixes: #29966.
2024-06-26 16:36:52 -07:00
N-Shar-ma
ac3b5b3b04 compose: Redesign and relocate compose expand / collapse button.
The compose expand / collapse button is moved from the top right of the
compose area to the top right corner inside the compose textarea /
preview.

The textarea / preview and the button area shares the same grid parent.
25px extra padding is added to and margin is subtracted from the right
of the element so the button is visually inside it. It appears only on
hovering the compose area, and uses a new custom icon.

Fixes: #28791.
2024-06-11 14:13:10 -07:00
evykassirer
346dc7d79d compose: Auto-close unchanged auto-opened drafts on narrow change.
Fixes #30104.
2024-06-07 10:38:20 -07:00
Aman Agrawal
f58c586bee narrow: Rename to message_view.
This brings it in sync with other libraries like `message_list`
and `message_list_data`.
2024-06-05 12:03:59 -07:00
Prakhar Pratyush
22f3aebb33 compose: Show a one-time banner for jump to sent message conversation.
We immediately navigate the user to the conversation they just
sent a message to if they are not already in the appropriate
conversation view.

This commit adds a first-time banner to explain the same.

Fixes #29575.
2024-06-05 09:31:17 -07:00
Aman Agrawal
a30029c8ad upload: Don't render upload button instead of hiding.
Doesn't make sense to hide the upload button button later when
we can just not show it if the browser doesn't has support for
it.
2024-05-14 12:21:49 -07:00
Anders Kaseorg
3fc5800d53 compose_ui: Fix implicit use of any.
Signed-off-by: Anders Kaseorg <[email protected]>
2024-05-06 16:12:27 -07:00
Anders Kaseorg
64c2d442ac web: Convert .data("user-id") to .attr.
Signed-off-by: Anders Kaseorg <[email protected]>
2024-05-03 12:45:46 -07:00
Anders Kaseorg
455f8a9c53 web: Convert .data("stream-id") to .attr.
Signed-off-by: Anders Kaseorg <[email protected]>
2024-05-03 12:45:46 -07:00
Prakhar Pratyush
d7a9523170 compose_banner: Replace the close button with "Got it" button.
For onboarding banners, we replace the close button with
"Got it" button.

Also, the banner is marked as read for the user only after
the "Got it" button is clicked. Earlier it was marked as read
as soon as it was displayed.
2024-05-02 12:48:22 -07:00
evykassirer
0e369e7ff3 compose_send_menu_popover: Rename module to reflect broader uses. 2024-04-20 13:27:25 -07:00
evykassirer
2014c25cb4 compose_actions: Include message type in opts for start. 2024-04-04 16:34:42 -07:00
Kislay Verma
454f2f2d95 compose: Fix unresolve button for empty topics.
When composing to an empty topic, only the compose box topic is
changed to remove the tick-prefix from it.

Fixes #29182.
2024-03-15 18:00:10 -07:00
Sayam Samal
a7e7176aae uploads: Improve abstraction of upload.js by removing object exports.
The `upload_objects_by_message_edit_row` map object was being exported
to handle the uploads during the editing of a message. To improve the
abstraction, we move the logic being used to access
`upload_objects_by_message_edit_row` and itself into `upload.js`.

Similarly, the `compose_upload_object` constant which was being exported
to handle the cancelling of compose uploads. This commit removes this
export and instead defines a new method `compose_upload_cancel` to
handle the same.
2024-02-23 16:46:40 -08:00
N-Shar-ma
536ab78587 refactor: Extract new function show_preview_area for the compose box.
The code responsible for switching from edit mode to preview mode from
`compose_setup.js` is now extracted into a new function in `compose.js`,
to facilitate reuse.

This is a prep commit for introducing a hotkey to toggle between edit
and preview mode for the compose box.
2024-01-25 10:51:25 -08:00
N-Shar-ma
9d3a606bfb compose: Add banner to go to conversation when replying in search view.
When a user is replying to a message while in a search view, we now warn
them that the full conversation is not visible and urge them to go to
the conversation they are composing to, so they can see the complete
conversation. On narrowing to that conversation, the banner is removed.

Fixes: #25893.
2023-11-28 16:55:05 -08:00
N-Shar-ma
143db56992 polls: Add option for modal to create polls.
Earlier the `/poll` slash command was the only way to create polls.
To increase user friendliness with a GUI, a button to launch a modal
to create a poll, has been added to the compose box. This button is
enabled only when the compose box is empty, to avoid complexities with
losing / having to save as draft any message already being composed.

The modal has a form which on submission frames a message using the
`/poll` syntax and the data input in the form, and sets the content of
the compose box to that message, which the user can then send. The
question field is mandatory for form submission.

Fixes: #20304.
2023-11-21 21:01:17 -08:00
Prakhar Pratyush
768be7d46d topic_mentions: Fix the incorrect large @-mention notification warning.
Earlier, a 'large @-mention notification' warning that pops up
for stream wildcard mentions was shown for topic wildcard mentions
too, which is incorrect.

This commit fixes the incorrect behavior. We no longer show the
banner for @-topic mentions.

We don't need a banner for @-topic mentions, as those are much less
likely to be used without thinking about it and would rarely be spammy
for a lot of people.

Fixes #27767.
2023-11-21 09:20:56 -08:00
Karl Stolley
9f00b513f7 compose_box: Improve structures around compose buttons. 2023-11-13 12:45:13 -08:00
Anders Kaseorg
d6be353299 compose_state: Make get_or_set accept a full selector.
Signed-off-by: Anders Kaseorg <[email protected]>
2023-11-02 14:06:04 -07:00
Prakhar Pratyush
d1f82c47fd compose_banner: Show banner when automatically follow or unmute topic.
When we send a message and that causes a topic to be automatically
followed or unmuted due to the automatic visibility policy settings,
we tell the user via a post-send-message compose banner.

The "notify_unmute" banner is not shown when the topic has already
been unmuted or followed due to these policies.

Fixes part of #26900.
2023-10-19 10:13:04 -07:00
Aman Agrawal
b605042312 compose_setup: Hide compose formatting popover clicking an option.
Fixes #27015
2023-10-15 19:51:04 -07:00
evykassirer
77fc836edf stream_id: Replace empty string with undefined.
This commit also limits `stream_bar.decorate` to only
be able to be called for stream messages, since it's
an undefined string_id is no longer a sign that
you're dealing with a DM.
2023-10-12 11:03:49 -07:00
Karl Stolley
5b82a62b26 compose: Add button to clear topic box.
Fixes part of #24889.

Co-Authored-By: Daniil Fadeev <[email protected]>
2023-10-10 17:37:03 -07:00
Anders Kaseorg
881da05cd3 stream_settings_ui: Extract stream_settings_components module.
Signed-off-by: Anders Kaseorg <[email protected]>
2023-10-10 12:09:15 -07:00
Anders Kaseorg
e8a2a5ce36 compose: Move initialize to new compose_setup module.
Signed-off-by: Anders Kaseorg <[email protected]>
2023-10-05 14:42:19 -07:00