Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

drafts: Replace notification when saving a draft.

Tim Abbott6a374d6d28af
diff --git a/static/js/drafts.js b/static/js/drafts.js
index feebe505909..7c0944888c9 100644
--- a/static/js/drafts.js
+++ b/static/js/drafts.js
@@ -1,6 +1,7 @@
import {subDays} from "date-fns";
import Handlebars from "handlebars/runtime";
import $ from "jquery";
+import tippy from "tippy.js";
import render_draft_table_body from "../templates/draft_table_body.hbs";
@@ -137,8 +138,17 @@ export function restore_message(draft) {
}
function draft_notify() {
- $(".alert-draft").css("display", "inline-block");
- $(".alert-draft").delay(1000).fadeOut(500);
+ // Display a tooltip to notify the user about the saved draft.
+ const instance = tippy(".compose_drafts_button", {
+ content: $t({defaultMessage: "Saved as draft"}),
+ arrow: true,
+ placement: "top",
+ })[0];
+ instance.show();
+ function remove_instance() {
+ instance.destroy();
+ }
+ setTimeout(remove_instance, 1500);
}
export function update_draft() {
diff --git a/static/styles/compose.css b/static/styles/compose.css
index 45b170ab4bf..95861677133 100644
--- a/static/styles/compose.css
+++ b/static/styles/compose.css
@@ -24,14 +24,6 @@
.message-control-link {
float: left;
}
-
- .alert-draft {
- font-size: 14px;
- color: hsl(170, 48%, 54%);
- padding: 0 12px;
- font-weight: 400;
- display: none;
- }
}
.reply_button_container {
diff --git a/static/templates/compose.hbs b/static/templates/compose.hbs
index 9e16b02631f..5a17f9cc136 100644
--- a/static/templates/compose.hbs
+++ b/static/templates/compose.hbs
@@ -44,7 +44,6 @@
<a class="drafts-link no-underline button small rounded compose_drafts_button" href="#drafts" title="{{t 'Drafts' }} (d)">
{{t 'Drafts' }}
</a>
- <span class="alert-draft pull-left">{{t 'Saved as draft' }}</span>
</span>
</div>
</div>