From 52cf2f4d5f31cf5a877a37f9c734f84a9d618ac8 Mon Sep 17 00:00:00 2001 From: jose-donato <43375532+jose-donato@users.noreply.github.com> Date: Tue, 4 Apr 2023 14:29:33 +0100 Subject: [PATCH] table fixes (#4666) * fix: table fixes * fix: tablaroni * fix: pagination protection * fix: dm much more * fix: colors * fix: colors * fix: colors * fix Timestamp on stocks `get_quote` * fix `call_tob` having `quote` as prog/docstring --------- Co-authored-by: teh_coderer --- .../src/components/Table/Pagination.tsx | 27 ++++-- .../tables/src/components/Table/Timestamp.tsx | 2 +- .../tables/src/components/Table/index.tsx | 52 +++++----- .../tables/src/utils/useLocalStorage.tsx | 6 +- openbb_terminal/core/plots/table.html | 94 +++++++++---------- openbb_terminal/stocks/stocks_controller.py | 4 +- openbb_terminal/stocks/stocks_model.py | 6 ++ 7 files changed, 109 insertions(+), 82 deletions(-) diff --git a/frontend-components/tables/src/components/Table/Pagination.tsx b/frontend-components/tables/src/components/Table/Pagination.tsx index 80193f81c21..65372267216 100644 --- a/frontend-components/tables/src/components/Table/Pagination.tsx +++ b/frontend-components/tables/src/components/Table/Pagination.tsx @@ -1,8 +1,21 @@ import clsx from "clsx"; -import { useState } from "react"; -import { DEFAULT_ROWS_PER_PAGE } from "."; -import useLocalStorage from "../../utils/useLocalStorage"; import Select from "../Select"; +import { DEFAULT_ROWS_PER_PAGE } from "."; + +export function validatePageSize( + pageSize: any +) { + if (typeof pageSize !== "number") { + if (typeof pageSize === "string" && pageSize.includes("All")) { + return pageSize + } + return DEFAULT_ROWS_PER_PAGE + } + if (pageSize < 1) { + return DEFAULT_ROWS_PER_PAGE + } + return pageSize +} export default function Pagination({ table, @@ -20,9 +33,11 @@ export default function Pagination({