Skip to content

Commit

Permalink
Knip (#3925)
Browse files Browse the repository at this point in the history
* Closes FE-1188

* Closes FE-1009

* lowercase open orders

* hide nav bar title

* optimize rendering

* SSR swap tool

* clean up limit order ff & bg

* remove old swap tool code

* add knip JSON

* knip & lint

* fix translations test

* fix packages

* fix

* clean up localizations
  • Loading branch information
jonator authored Oct 31, 2024
1 parent 414bf41 commit 5277eab
Show file tree
Hide file tree
Showing 104 changed files with 1,084 additions and 2,376 deletions.
6 changes: 3 additions & 3 deletions packages/web/__tests__/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { WalletStatus } from "@cosmos-kit/core";
import { superjson } from "@osmosis-labs/server";
import { AccountStore } from "@osmosis-labs/stores";
import type { AvailableFlags } from "@osmosis-labs/types";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { Queries, render, RenderHookOptions } from "@testing-library/react";
import { renderHook } from "@testing-library/react";
Expand All @@ -12,17 +13,16 @@ import { ReactNode } from "react";

import { TestWallet, testWalletInfo } from "~/__tests__/test-wallet";
import { MultiLanguageProvider } from "~/hooks/language/context";
import { AvailableFlags } from "~/hooks/use-feature-flags";
import { WalletSelectProvider } from "~/hooks/use-wallet-select";
import { AppRouter } from "~/server/api/root-router";
import { storeContext, StoreProvider } from "~/stores";
import { RootStore } from "~/stores/root";

export const trpcReact = createTRPCReact<AppRouter>();
const trpcReact = createTRPCReact<AppRouter>();
let testRootStore: RootStore;

const queryClient = new QueryClient();
export const withTRPC = ({ children }: { children?: ReactNode }) => {
const withTRPC = ({ children }: { children?: ReactNode }) => {
return (
<MultiLanguageProvider defaultLanguage="en">
<StoreProvider>
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/ad-banner/ad-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Icon } from "~/components/assets";
import { Step, Stepper } from "~/components/stepper/index";
import { useTranslation } from "~/hooks";

export type Ad = SwapAdBannerResponse["banners"][number] & {
type Ad = SwapAdBannerResponse["banners"][number] & {
onClick?: () => void;
};
interface AdBannersProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/alert/cypher-card-toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Pill } from "~/components/indicators/pill";
import { IconButton } from "~/components/ui/button";
import { Breakpoint, useTranslation, useWindowSize } from "~/hooks";

export const CypherCardFloatingBannerDoNotShowKey =
const CypherCardFloatingBannerDoNotShowKey =
"cypher-card-floating-banner-do-not-show";

export function CypherCardToast() {
Expand Down
4 changes: 2 additions & 2 deletions packages/web/components/alert/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Button } from "~/components/buttons";
import { Checkbox } from "~/components/ui/checkbox";
import { t } from "~/hooks";

export type ToastOptions = Partial<ReactToastifyOptions> & {
type ToastOptions = Partial<ReactToastifyOptions> & {
updateToastId?: Id;
};

Expand Down Expand Up @@ -221,7 +221,7 @@ const OneClickTradingToast: FunctionComponent<Alert> = ({
export const AlloyedAssetsToastDoNotShowKey =
"do-not-show-alloyed-assets-toast";

export const AlloyedAssetsToast: FunctionComponent<
const AlloyedAssetsToast: FunctionComponent<
Alert & { closeToast: () => void }
> = ({ titleTranslationKey, captionTranslationKey, closeToast }) => {
const [, setDoNotShowAgain] = useLocalStorage(
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/assets/highlights-categories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function highlightUpcomingReleaseAsset(asset: UpcomingReleaseAsset) {
};
}

export const AssetHighlights: FunctionComponent<
const AssetHighlights: FunctionComponent<
{
title: string;
subtitle?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ enum WalletSelectScreens {
SendToAnotherAddress = "send-to-another-address",
}

export const BridgeWalletSelectScreens: FunctionComponent<
const BridgeWalletSelectScreens: FunctionComponent<
BridgeWalletSelectProps & {
onClose: () => void;
setRemoveMinHeight?: (nextValue: boolean) => void;
Expand Down
6 changes: 3 additions & 3 deletions packages/web/components/bridge/deposit-address-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ const TransferDetails: FunctionComponent<{
);
};

export const EstimatedTimeRow: FunctionComponent<{
const EstimatedTimeRow: FunctionComponent<{
depositData: RouterOutputs["bridgeTransfer"]["getDepositAddress"]["depositData"];
isRefetchingQuote: boolean;
}> = ({ depositData, isRefetchingQuote }) => {
Expand All @@ -509,7 +509,7 @@ export const EstimatedTimeRow: FunctionComponent<{
);
};

export const ProviderFeesRow: FunctionComponent<{
const ProviderFeesRow: FunctionComponent<{
depositData: RouterOutputs["bridgeTransfer"]["getDepositAddress"]["depositData"];
isRefetchingQuote: boolean;
}> = ({ depositData, isRefetchingQuote }) => {
Expand All @@ -524,7 +524,7 @@ export const ProviderFeesRow: FunctionComponent<{
);
};

export const NetworkFeeRow: FunctionComponent<{
const NetworkFeeRow: FunctionComponent<{
depositData: RouterOutputs["bridgeTransfer"]["getDepositAddress"]["depositData"];
isRefetchingQuote: boolean;
fromChainName?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/buttons/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ButtonHTMLAttributes, forwardRef } from "react";
import { Spinner } from "~/components/loaders";
import { CustomClasses } from "~/components/types";

export const buttonCVA = cva(
const buttonCVA = cva(
"flex w-full group place-content-center items-center py-2 text-center transition-colors disabled:cursor-default",
{
variants: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import React, { FunctionComponent } from "react";

import { theme } from "~/tailwind.config";

export type DepthData = {
type DepthData = {
price: number;
depth: number;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ export interface ChartControllerParams<
onCrosshairMove?: (param: MouseEventParams<K>) => void;
}

export type ChartControllerEvents<
T = TimeChartOptions,
K = Time,
N = Series
> = {
type ChartControllerEvents<T = TimeChartOptions, K = Time, N = Series> = {
crosshairMove: (param: MouseEventParams<K>) => void;
init: (params: ChartControllerParams<T, K, N>) => void;
remove: (params: ChartControllerParams<T, K, N>) => void;
Expand Down
4 changes: 2 additions & 2 deletions packages/web/components/chart/light-weight-charts/chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function resizeSubscribe(callback: (this: Window, ev: UIEvent) => unknown) {
};
}

export const defaultOptions: DeepPartial<TimeChartOptions> = {
const defaultOptions: DeepPartial<TimeChartOptions> = {
layout: {
fontFamily: theme.fontFamily.caption.join(","),
background: {
Expand Down Expand Up @@ -189,7 +189,7 @@ const defaultOptionsWithSeries = (
},
});

export interface ChartProps<T extends TimeChartOptions, K extends Time> {
interface ChartProps<T extends TimeChartOptions, K extends Time> {
options?: DeepPartial<T>;
series?: Series[];
Controller: new (
Expand Down
4 changes: 2 additions & 2 deletions packages/web/components/complex/pool/create/select-type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { IS_TESTNET, SpriteIconId } from "~/config";
import { useTranslation } from "~/hooks";
import { useStore } from "~/stores";

export type PoolType = ObservableQueryPool["type"];
type PoolType = ObservableQueryPool["type"];

export interface PoolTypeConfig {
interface PoolTypeConfig {
imageSrc: string;
caption: string;
iconId?: SpriteIconId;
Expand Down
16 changes: 8 additions & 8 deletions packages/web/components/complex/pools-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { api, RouterOutputs } from "~/utils/trpc";

import { Tooltip } from "../tooltip";

export type Pool = RouterOutputs["edge"]["pools"]["getPools"]["items"][number];
type Pool = RouterOutputs["edge"]["pools"]["getPools"]["items"][number];
/** UI doesn't support cosmwasm pools as first class so exclude it from list of filter options. */
export type PoolTypeFilter = Exclude<Pool["type"], "cosmwasm">;
export type PoolIncentiveFilter = NonNullable<
Expand All @@ -55,7 +55,7 @@ export const marketIncentivePoolsSortKeys = [
"incentives.aprBreakdown.total.upper",
] as const;

export type MarketIncentivePoolsSortKey =
type MarketIncentivePoolsSortKey =
(typeof marketIncentivePoolsSortKeys)[number];

export const incentiveTypes: PoolIncentiveFilter[] = [
Expand All @@ -77,7 +77,7 @@ export interface PoolsTabelSortParams {
allPoolsSortDir: SortDirection;
}

export interface PoolsTableProps {
interface PoolsTableProps {
topOffset?: number;
quickAddLiquidity?: (poolId: string) => void;
limit?: number;
Expand Down Expand Up @@ -500,11 +500,11 @@ export const PoolsTable = (props: PropsWithChildren<PoolsTableProps>) => {
);
};

export type PoolCellComponent<TProps = {}> = FunctionComponent<
type PoolCellComponent<TProps = {}> = FunctionComponent<
CellContext<Pool, Pool> & TProps
>;

export const PoolCompositionCell: PoolCellComponent = ({
const PoolCompositionCell: PoolCellComponent = ({
row: {
original: { id, type, spreadFactor, reserveCoins },
},
Expand Down Expand Up @@ -577,7 +577,7 @@ export const PoolCompositionCell: PoolCellComponent = ({
);
};

export function getPoolLink(pool: Pool): string {
function getPoolLink(pool: Pool): string {
if (pool.type === "cosmwasm-transmuter") {
return `https://celatone.osmosis.zone/osmosis-1/pools/${pool.id}`;
}
Expand All @@ -592,7 +592,7 @@ export function getPoolLink(pool: Pool): string {
return `/pool/${pool.id}`;
}

export function getPoolTypeTarget(pool: Pool) {
function getPoolTypeTarget(pool: Pool) {
if (
pool.type === "cosmwasm-transmuter" ||
pool.type === "cosmwasm-astroport-pcl" ||
Expand All @@ -603,7 +603,7 @@ export function getPoolTypeTarget(pool: Pool) {
return "";
}

export const AprBreakdownCell: PoolCellComponent = ({
const AprBreakdownCell: PoolCellComponent = ({
row: {
original: { incentives },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { FunctionComponent, useMemo } from "react";
import { useTranslation } from "~/hooks";

import { AllocationOptions } from "./types";
export interface AllocationTabProps {

interface AllocationTabProps {
setTab: (tab: AllocationOptions) => void;
activeTab: AllocationOptions;
}
Expand Down
1 change: 0 additions & 1 deletion packages/web/components/control/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export * from "./language-select";
export * from "./menu-dropdown";
export * from "./menu-toggle";
export * from "./radio";
export * from "./sort-menu";
export * from "./stake-tab";
export * from "./token-select";
export * from "./types";
2 changes: 1 addition & 1 deletion packages/web/components/control/language-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useTranslation } from "~/hooks";
import { useStore } from "~/stores";
import { LanguageUserSetting } from "~/stores/user-settings";

export type LanguageSelectProps = {
type LanguageSelectProps = {
options: { value: string; display: string }[];
};

Expand Down
110 changes: 0 additions & 110 deletions packages/web/components/control/sort-menu.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions packages/web/components/control/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { ReactNode } from "react";

import { InputProps } from "~/components/types";

export interface ToggleProps<T = boolean> {
isOn: boolean;
onToggle: (value: T) => void;
Expand All @@ -19,11 +17,6 @@ export interface MenuSelectProps {
onSelect: (optionId: string) => void;
}

export interface NumberSelectProps extends InputProps<number> {
min: number;
max: number;
}

export interface MenuDropdownIconItemProps {
value: string;
display: string;
Expand Down
Loading

0 comments on commit 5277eab

Please sign in to comment.