Skip to content

Commit

Permalink
Merge pull request #212 from CarmineOptions/feature/rework-price-guard
Browse files Browse the repository at this point in the history
fix: remove unused dependencies
  • Loading branch information
DaveVodrazka authored Aug 16, 2024
2 parents 93abb66 + 318f0e4 commit e26f5d3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 29 deletions.
5 changes: 0 additions & 5 deletions src/components/PriceGuard/PriceGuard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export const PriceGuard = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
const callWithDelay = useCallback(
debounce((size: number, controller: AbortController) => {
console.log("DEBOUNCING", data);
if (!data) {
return;
}
Expand All @@ -77,19 +76,15 @@ export const PriceGuard = () => {
(o) => o.maturity === expiry && o.strike === currentStrike
)!;

console.log("OPTION MAYBE", pickedOption);
if (!pickedOption) {
return;
}
console.log("GETTING PRICE GUARD");
setPriceLoading(true);
getPremia(pickedOption, size, false)
.then((res) => {
console.log("GOT PRICE GUARD", res);
if (controller.signal.aborted) {
return;
}
console.log("PAST CONTROLLER PRICE GUARD", res);
setPrice(res as bigint);
setPriceLoading(false);
})
Expand Down
5 changes: 5 additions & 0 deletions src/components/PriceGuard/priceguard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
flex-flow: column;
}

.assetamount option {
color: white;
background-color: black;
}

.assetamount>div>div {
display: flex;
flex-flow: row;
Expand Down
6 changes: 0 additions & 6 deletions src/hooks/useBuyPriceGuardData.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/redux/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
GovernanceSubpage,
PortfolioParamType,
ReferralSent,
setBuyPriceGuardModalState,
setCloseOptionState,
setGovernanceSubpageState,
setParamState,
Expand All @@ -20,7 +19,6 @@ import { store } from "./store";
import { Settings } from "../types/settings";
import { NetworkState } from "../types/network";
import { OptionWithPosition } from "../classes/Option";
import { BuyPriceGuardModalData } from "../components/PriceGuard/BuyPriceGuardModal";
import { TransferData } from "../components/Transfer/transfer";
import {
addTxReducer,
Expand Down Expand Up @@ -64,9 +62,6 @@ export const openSlippageDialog = () =>
export const openCloseOptionDialog = () =>
openDialogWithContent(DialogContentElem.CloseOption);

export const openBuyPriceGuardDialog = () =>
openDialogWithContent(DialogContentElem.BuyPriceGuard);

export const openAccountDialog = () =>
openDialogWithContent(DialogContentElem.Account);

Expand All @@ -84,8 +79,6 @@ export const setSlippage = (n: number) => store.dispatch(setSlippageState(n));
export const setCloseOption = (option: OptionWithPosition) =>
store.dispatch(setCloseOptionState(option));

export const setBuyPriceGuardModal = (data: BuyPriceGuardModalData) =>
store.dispatch(setBuyPriceGuardModalState(data));
export const setPortfolioParam = (option: PortfolioParamType) =>
store.dispatch(setParamState(option));

Expand Down
11 changes: 0 additions & 11 deletions src/redux/reducers/ui.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createSlice } from "@reduxjs/toolkit";

import { OptionWithPosition } from "../../classes/Option";
import { BuyPriceGuardModalData } from "../../components/PriceGuard/BuyPriceGuardModal";
import { TransferData } from "../../components/Transfer/transfer";

export enum DialogContentElem {
Expand All @@ -10,7 +9,6 @@ export enum DialogContentElem {
NetworkMismatch = "NetworkMismatch",
Slippage = "Slippage",
CloseOption = "CloseOption",
BuyPriceGuard = "BuyPriceGuard",
MetamaskMissing = "MetamaskMissing",
NotEnoughUnlocked = "NotEnoughUnlocked",
TransferCapital = "TransferCapital",
Expand Down Expand Up @@ -52,7 +50,6 @@ export interface UiState {
dialogContent: DialogContentElem;
toastState: ToastState;
activeCloseOption?: OptionWithPosition;
buyPriceGuardModalData?: BuyPriceGuardModalData;
transferData?: TransferData;
transferDialogShown: boolean;
portfolioParam?: PortfolioParamType;
Expand Down Expand Up @@ -84,13 +81,6 @@ export const ui = createSlice({
state.activeCloseOption = action.payload;
return state;
},
setBuyPriceGuardModalState: (
state,
action: { payload: BuyPriceGuardModalData }
) => {
state.buyPriceGuardModalData = action.payload;
return state;
},
setToastState: (state, action: { payload: Partial<ToastState> }) => {
state.toastState = { ...state.toastState, ...action.payload };
return state;
Expand Down Expand Up @@ -125,7 +115,6 @@ export const ui = createSlice({

export const {
toggleDialog,
setBuyPriceGuardModalState,
setCloseOptionState,
setToastState,
setTransferDataModalState,
Expand Down

0 comments on commit e26f5d3

Please sign in to comment.