Skip to content

Commit

Permalink
♻️ refactor(components): nuke more dead components
Browse files Browse the repository at this point in the history
  • Loading branch information
thrownullexception committed Jun 30, 2023
1 parent b157543 commit 67b46af
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 24 deletions.
4 changes: 3 additions & 1 deletion src/__tests__/_/forCodeCoverage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { FOR_CODE_COV as $37 } from "frontend/views/Dashboard/Widget/_manage/typ
import { FOR_CODE_COV as $38 } from "shared/types/dashboard/types";
import { FOR_CODE_COV as $39 } from "shared/types/dashboard/base";
import { FOR_CODE_COV as $40 } from "frontend/design-system/layouts/types";
import { FOR_CODE_COV as $41 } from "frontend/design-system/components/Form/_types";
import { noop } from "shared/lib/noop";

noop(
Expand Down Expand Up @@ -78,7 +79,8 @@ noop(
$37,
$38,
$39,
$40
$40,
$41
);

describe("Code coverage ignores plain types file", () => {
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/components/FEPaginationTable/useFEPagination.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useQuery, UseQueryResult } from "react-query";
import get from "lodash/get";
import {
FieldQueryFilter,
FilterOperators,
Expand Down Expand Up @@ -32,7 +31,7 @@ export function useFEPagination<T>(
return dataState.filters.every(($filter) => {
const filter = $filter as unknown as FieldQueryFilter;
const filterValue = filter.value.value;
const currentValue = get(datum, filter.id);
const currentValue = datum[filter.id];
if (!filterValue) {
return true;
}
Expand Down Expand Up @@ -61,9 +60,10 @@ export function useFEPagination<T>(

if (dataState.sortBy && dataState.sortBy.length > 0) {
const { id, desc } = dataState.sortBy[0];

returnData = returnData.sort((a, b) => {
const value1 = get(desc ? b : a, id);
const value2 = get(desc ? a : b, id);
const value1 = (desc ? b : a)[id];
const value2 = (desc ? a : b)[id];
if (typeof value1 === "number") {
return compareNumbers(value1, value2);
}
Expand Down
16 changes: 0 additions & 16 deletions src/frontend/design-system/components/ComponentIsLoading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import * as React from "react";
import styled, { keyframes } from "styled-components";
import { USE_ROOT_COLOR } from "frontend/design-system/theme/root";

const DELAY_MS = 500;

const ldsRippleAnimation = keyframes`
0% {
top: 36px;
Expand Down Expand Up @@ -50,17 +48,3 @@ export function ComponentIsLoading() {
</div>
);
}

export function DelayedComponentIsLoading() {
const [show, setShow] = React.useState(false);
React.useEffect(() => {
const timeout = setTimeout(() => setShow(true), DELAY_MS);
return () => {
clearTimeout(timeout);
};
}, []);
if (!show) {
return null;
}
return <ComponentIsLoading />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const StyledSelect = styled(AsyncSelect)`
${SelectStyles}
`;

// TODO move to useDebounce
const debouncedSearch = debounce(
async (
inputValue: string,
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/design-system/components/Form/_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ export interface ISharedFormInput {
action: () => void;
}[];
}

export const FOR_CODE_COV = 1;
3 changes: 0 additions & 3 deletions src/frontend/design-system/components/Form/mappers.ts

This file was deleted.

0 comments on commit 67b46af

Please sign in to comment.