notification_settings: Add tooltip to checkboxes in the triggers table.

This commit is contained in:
Sayam Samal 2023-11-28 04:20:45 +05:30 committed by Tim Abbott
parent c01e9b8071
commit e2485b7ee8
4 changed files with 29 additions and 7 deletions

View File

@ -771,6 +771,7 @@ type NotificationSettingCheckbox = {
setting_name: string;
is_disabled: boolean;
is_checked: boolean;
is_mobile_checkbox: boolean;
};
export function get_notifications_table_row_data(
@ -784,6 +785,7 @@ export function get_notifications_table_row_data(
setting_name: "",
is_disabled: true,
is_checked: false,
is_mobile_checkbox: false,
};
}
@ -796,9 +798,11 @@ export function get_notifications_table_row_data(
setting_name,
is_disabled: false,
is_checked: checked,
is_mobile_checkbox: false,
};
if (column === "mobile") {
checkbox.is_disabled = !page_params.realm_push_notifications_enabled;
checkbox.is_mobile_checkbox = true;
}
return checkbox;
});

View File

@ -34,6 +34,7 @@
setting_name=this.setting_name
is_checked=this.is_checked
is_disabled=this.is_disabled
is_mobile_checkbox=this.is_mobile_checkbox
prefix=../../prefix }}
{{/each}}
</tr>

View File

@ -1,9 +1,11 @@
<td>
<label class="checkbox">
<input type="checkbox" name="{{setting_name}}" id="{{prefix}}{{setting_name}}"
{{#if is_disabled}} disabled {{/if}}
{{#if is_checked}}checked="checked"{{/if}} data-setting-widget-type="boolean"
class="{{setting_name}}{{#unless is_disabled}} prop-element{{/unless}}"/>
<span></span>
</label>
<span {{#if (and is_mobile_checkbox (not realm_push_notifications_enabled))}} class="tippy-zulip-tooltip" data-tooltip-template-id="mobile-push-notification-tooltip-template"{{/if}}>
<label class="checkbox">
<input type="checkbox" name="{{setting_name}}" id="{{prefix}}{{setting_name}}"
{{#if is_disabled}} disabled {{/if}}
{{#if is_checked}}checked="checked"{{/if}} data-setting-widget-type="boolean"
class="{{setting_name}}{{#unless is_disabled}} prop-element{{/unless}}"/>
<span></span>
</label>
</span>
</td>

View File

@ -48,26 +48,31 @@ run_test("all_notifications", () => {
{
is_checked: false,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "enable_stream_desktop_notifications",
},
{
is_checked: true,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "enable_stream_audible_notifications",
},
{
is_checked: true,
is_disabled: true,
is_mobile_checkbox: true,
setting_name: "enable_stream_push_notifications",
},
{
is_checked: false,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "enable_stream_email_notifications",
},
{
is_checked: false,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "wildcard_mentions_notify",
},
],
@ -78,26 +83,31 @@ run_test("all_notifications", () => {
{
is_checked: false,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "enable_desktop_notifications",
},
{
is_checked: true,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "enable_sounds",
},
{
is_checked: false,
is_disabled: true,
is_mobile_checkbox: true,
setting_name: "enable_offline_push_notifications",
},
{
is_checked: true,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "enable_offline_email_notifications",
},
{
is_checked: false,
is_disabled: true,
is_mobile_checkbox: false,
setting_name: "",
},
],
@ -108,26 +118,31 @@ run_test("all_notifications", () => {
{
is_checked: false,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "enable_followed_topic_desktop_notifications",
},
{
is_checked: true,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "enable_followed_topic_audible_notifications",
},
{
is_checked: false,
is_disabled: true,
is_mobile_checkbox: true,
setting_name: "enable_followed_topic_push_notifications",
},
{
is_checked: true,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "enable_followed_topic_email_notifications",
},
{
is_checked: false,
is_disabled: false,
is_mobile_checkbox: false,
setting_name: "enable_followed_topic_wildcard_mentions_notify",
},
],