Skip to content

Commit

Permalink
passes linting
Browse files Browse the repository at this point in the history
  • Loading branch information
davemarco committed Sep 19, 2024
1 parent 78d5949 commit 2229fda
Show file tree
Hide file tree
Showing 6 changed files with 236 additions and 183 deletions.
21 changes: 12 additions & 9 deletions new-log-viewer/src/components/MenuBar/NavigationBar.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import React, {useContext, useMemo} from "react";
import React, {
useContext,
useMemo,
} from "react";

import NavigateBefore from "@mui/icons-material/NavigateBefore";
import NavigateNext from "@mui/icons-material/NavigateNext";
import SkipNext from "@mui/icons-material/SkipNext";
import SkipPrevious from "@mui/icons-material/SkipPrevious";

import {StateContext} from "../../contexts/StateContextProvider";
import {CONFIG_KEY} from "../../typings/config";
import {
ACTION_NAME,
handleAction,
} from "../../utils/actions";
import {getConfig} from "../../utils/config";
import {getChunkNum} from "../../utils/math";
import PageNumInput from "./PageNumInput";
import SmallIconButton from "./SmallIconButton";

import {getConfig} from "../../utils/config";
import {CONFIG_KEY} from "../../typings/config";
import {
getChunkNum,
} from "../../utils/math";


/**
* Renders a navigation bar for page switching actions.
Expand All @@ -27,8 +27,11 @@ import {
*/
const NavigationBar = () => {
const {pageNum, numFilteredEvents, loadPage} = useContext(StateContext);
let numPages: number =
useMemo(() => getChunkNum(numFilteredEvents, getConfig(CONFIG_KEY.PAGE_SIZE)),[numFilteredEvents]);
const numPages: number =
useMemo(
() => getChunkNum(numFilteredEvents, getConfig(CONFIG_KEY.PAGE_SIZE)),
[numFilteredEvents]
);
const handleNavButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
const {actionName} = event.currentTarget.dataset as { actionName: ACTION_NAME };
if (Object.values(ACTION_NAME).includes(actionName)) {
Expand Down
18 changes: 9 additions & 9 deletions new-log-viewer/src/components/MenuBar/PageNumInput.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import React, {
useContext,
useEffect,
useMemo,
useRef,
useState,
useMemo,
} from "react";

import {getConfig} from "../../utils/config";
import {CONFIG_KEY} from "../../typings/config";
import {
getChunkNum,
} from "../../utils/math";

import {Typography} from "@mui/joy";
import Input from "@mui/joy/Input";

import {StateContext} from "../../contexts/StateContextProvider";
import {CONFIG_KEY} from "../../typings/config";
import {getConfig} from "../../utils/config";
import {getChunkNum} from "../../utils/math";

import "./PageNumInput.css";

Expand All @@ -30,8 +27,11 @@ const PAGE_NUM_INPUT_FIT_EXTRA_WIDTH = 2;
*/
const PageNumInput = () => {
const {loadPage, numFilteredEvents, pageNum} = useContext(StateContext);
let numPages: number =
useMemo(() => getChunkNum(numFilteredEvents, getConfig(CONFIG_KEY.PAGE_SIZE)),[numFilteredEvents]);
const numPages: number =
useMemo(
() => getChunkNum(numFilteredEvents, getConfig(CONFIG_KEY.PAGE_SIZE)),
[numFilteredEvents]
);

const adjustedPageNum = (null === pageNum) ?
0 :
Expand Down
Loading

0 comments on commit 2229fda

Please sign in to comment.