From 4158c7d744673e209487d68e84f57655583f00cf Mon Sep 17 00:00:00 2001 From: John Pham Date: Fri, 3 Jan 2025 16:08:48 -0800 Subject: [PATCH] Update types and add docs for releasing --- README.md | 6 ++++++ package.json | 4 ++-- src/lib/orders/OrderDisplay.tsx | 23 +++++++++++++++++++++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 02c9494..e72f71d 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,9 @@ sf --version # 0.1.0 - `deno run devv` to test against local API - `deno run prod` to test against production API - The `deno run ` is an alias to the user facing `sf` command. So if you wanted to run `sf login` locally against the local API, run `deno run devv login` + +## New Release + +This is ran locally + +- `deno run release ` diff --git a/package.json b/package.json index 1283c8d..8f0615b 100644 --- a/package.json +++ b/package.json @@ -42,5 +42,5 @@ "peerDependencies": { "typescript": "^5.6.2" }, - "version": "0.1.10" -} + "version": "0.1.11" +} \ No newline at end of file diff --git a/src/lib/orders/OrderDisplay.tsx b/src/lib/orders/OrderDisplay.tsx index af0e722..4dff309 100644 --- a/src/lib/orders/OrderDisplay.tsx +++ b/src/lib/orders/OrderDisplay.tsx @@ -220,7 +220,23 @@ export function OrderDisplay(props: { ); } -const reducer = (state, action) => { +interface ScrollState { + innerHeight: number; + height: number; + scrollTop: number; +} + +type ScrollAction = + | { type: "SET_INNER_HEIGHT"; innerHeight: number } + | { type: "SCROLL_DOWN" } + | { type: "SCROLL_DOWN_BULK" } + | { type: "SCROLL_UP" } + | { type: "SCROLL_UP_BULK" } + | { type: "SCROLL_TO_TOP" } + | { type: "SCROLL_TO_BOTTOM" } + | { type: "SWITCHED_TAB" }; + +const reducer = (state: ScrollState, action: ScrollAction): ScrollState => { switch (action.type) { case "SET_INNER_HEIGHT": return { @@ -297,9 +313,12 @@ export function ScrollArea({ sellOrdersCount: number; buyOrdersCount: number; }) { - const [state, dispatch] = React.useReducer(reducer, { + const [state, dispatch] = React.useReducer< + React.Reducer + >(reducer, { height, scrollTop: 0, + innerHeight: 0, }); const innerRef = React.useRef(null);