Skip to content
Source
Sign inSign up
pingdotgg/t3code

Pause live output follow while reading #3936

Closedlnieuwenhuis(GitHub profile, opens in a new tab)wants to merge 20 commits intomain fromrefs/pull/3936/headopened View on GitHub

Showing 6 changed files with 89 additions and 1 deletion (loading 5).

x
0 of 6 viewed, 6 left
89 additions and 1 deletionapps/web/src/components/chat/MessagesTimeline.logic.tsModified
View file
@@ -16,13 +16,101 @@
export const TIMELINE_CONTENT_MAX_WIDTH = 768;
export const TIMELINE_MINIMAP_PERSISTENT_GUTTER = 48;
​
+export type TimelineNavigationInput =
+ | { readonly type: "wheel"; readonly deltaY: number }
+ | { readonly type: "touch"; readonly previousY: number | null; readonly currentY: number | null }
+ | { readonly type: "keyboard"; readonly key: string; readonly shiftKey: boolean };
+​
+export function timelineNavigationInputMovesTowardHistory(input: TimelineNavigationInput) {
+ switch (input.type) {
+ case "wheel":
+ return input.deltaY < 0;
+ case "touch":
+ return (
+ input.previousY !== null && input.currentY !== null && input.currentY > input.previousY
+ );
+ case "keyboard":
+ return (
+ input.key === "ArrowUp" ||
+ input.key === "PageUp" ||
+ input.key === "Home" ||
+ (input.key === " " && input.shiftKey)
+ );
+ }
+}
+​
+export interface TimelineScrollableNodeState {
+ readonly clientHeight: number;
+ readonly scrollHeight: number;