From e3cd3756bc40c9a1642153f1cd34f9b82890901d Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Fri, 7 Jun 2024 04:38:26 +0000 Subject: [PATCH] navigate: Convert back to JS. Need to import message_view which is not migrated to TS yet. --- tools/test-js-with-node | 2 +- web/src/{navigate.ts => navigate.js} | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) rename web/src/{navigate.ts => navigate.js} (92%) diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 744d670101..6d3351fef3 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -160,7 +160,7 @@ EXEMPT_FILES = make_set( "web/src/navbar_alerts.ts", "web/src/navbar_help_menu.ts", "web/src/navbar_menus.js", - "web/src/navigate.ts", + "web/src/navigate.js", "web/src/onboarding_steps.ts", "web/src/overlay_util.ts", "web/src/overlays.ts", diff --git a/web/src/navigate.ts b/web/src/navigate.js similarity index 92% rename from web/src/navigate.ts rename to web/src/navigate.js index 7be88cc1b2..4c8404c088 100644 --- a/web/src/navigate.ts +++ b/web/src/navigate.js @@ -4,12 +4,12 @@ import * as message_lists from "./message_lists"; import * as message_viewport from "./message_viewport"; import * as unread_ops from "./unread_ops"; -function go_to_row(msg_id: number): void { +function go_to_row(msg_id) { assert(message_lists.current !== undefined); message_lists.current.select_id(msg_id, {then_scroll: true, from_scroll: true}); } -export function up(): void { +export function up() { assert(message_lists.current !== undefined); message_viewport.set_last_movement_direction(-1); const msg_id = message_lists.current.prev(); @@ -19,7 +19,7 @@ export function up(): void { go_to_row(msg_id); } -export function down(with_centering = false): void { +export function down(with_centering = false) { assert(message_lists.current !== undefined); message_viewport.set_last_movement_direction(1); @@ -45,7 +45,7 @@ export function down(with_centering = false): void { go_to_row(msg_id); } -export function to_home(): void { +export function to_home() { assert(message_lists.current !== undefined); message_viewport.set_last_movement_direction(-1); const first_message = message_lists.current.first(); @@ -53,7 +53,7 @@ export function to_home(): void { message_lists.current.select_id(first_message.id, {then_scroll: true, from_scroll: true}); } -export function to_end(): void { +export function to_end() { assert(message_lists.current !== undefined); const last_message = message_lists.current.last(); assert(last_message !== undefined); @@ -62,7 +62,7 @@ export function to_end(): void { unread_ops.process_visible(); } -function amount_to_paginate(): number { +function amount_to_paginate() { // Some day we might have separate versions of this function // for Page Up vs. Page Down, but for now it's the same // strategy in either direction. @@ -90,7 +90,7 @@ function amount_to_paginate(): number { return delta; } -export function page_up_the_right_amount(): void { +export function page_up_the_right_amount() { // This function's job is to scroll up the right amount, // after the user hits Page Up. We do this ourselves // because we can't rely on the browser to account for certain @@ -102,13 +102,13 @@ export function page_up_the_right_amount(): void { message_viewport.scrollTop(message_viewport.scrollTop() - delta); } -export function page_down_the_right_amount(): void { +export function page_down_the_right_amount() { // see also: page_up_the_right_amount const delta = amount_to_paginate(); message_viewport.scrollTop(message_viewport.scrollTop() + delta); } -export function page_up(): void { +export function page_up() { assert(message_lists.current !== undefined); if (message_viewport.at_rendered_top() && !message_lists.current.visibly_empty()) { if (message_lists.current.view.is_fetched_start_rendered()) { @@ -127,7 +127,7 @@ export function page_up(): void { } } -export function page_down(): void { +export function page_down() { assert(message_lists.current !== undefined); if (message_viewport.at_rendered_bottom() && !message_lists.current.visibly_empty()) { if (message_lists.current.view.is_fetched_end_rendered()) {