Skip to content

Commit

Permalink
fix build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsrulz committed Aug 28, 2024
1 parent a353fa0 commit 76c1d62
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/components/add-trade.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use client';
import { SearchTickerItem } from '@/lib/socket';
import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Stack, InputAdornment } from '@mui/material';
import { FormContainer, SelectElement, SliderElement, TextFieldElement, TextareaAutosizeElement } from 'react-hook-form-mui';
import { DatePickerElement } from 'react-hook-form-mui/date-pickers';
Expand Down Expand Up @@ -54,6 +53,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import dayjs, { Dayjs } from 'dayjs';
import ky from 'ky';
import { SearchTickerItem } from '@/lib/types';
export const AddTradeDialog = (props: ITickerProps) => {
const { onClose, open, ticker } = props;
const theme = useTheme();
Expand All @@ -63,7 +63,7 @@ export const AddTradeDialog = (props: ITickerProps) => {
const handleSubmit = async (data: any) => {
await ky.post('/api/trades', {
json: data
}).json<{id: string}>();
}).json<{ id: string }>();
onClose();
}

Expand All @@ -75,7 +75,7 @@ export const AddTradeDialog = (props: ITickerProps) => {

const dv = {
symbol: ticker?.symbol,
numberOfContracts: 1,
numberOfContracts: 1,
contractType: 'PUT_SELL',
transactionStartDate: dayjs(),
expiryDate: dayjs().add(7, 'days'),
Expand All @@ -96,7 +96,7 @@ export const AddTradeDialog = (props: ITickerProps) => {
<TextFieldElement name={'symbol'} label={'Symbol'} required />
<SelectElement name={'contractType'} label={'Type'} options={options} fullWidth />
<SliderElement name={"numberOfContracts"} label='Number of contracts' max={20} min={1} />
<Stack direction="row" spacing={2}>
<Stack direction="row" spacing={2}>
<DatePickerElement label="Transaction Start Date" name="transactionStartDate" required disableFuture={true} disablePast={false} />
<DatePickerElement label="Expiry Date" name="contractExpiry" required disableFuture={false} disablePast={false} />
</Stack>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,6 @@ export const useStockPrice = (item: SearchTickerItem) => {
socket.emit('stock-price-unsubscribe-request', item);
socket.off('stock-price-subscribe-response', setOd);
}
}, [item.symbol]);
}, [item]);
return od;
}
2 changes: 1 addition & 1 deletion src/lib/useTrades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const useTrades = () => {
const deleteTrade = useCallback(async (deleteTradeId: string) => {
await ky.delete(`/api/trades/${deleteTradeId}`);
setTrades((v) => v.filter(t => t.id != deleteTradeId));
}, [trades]);
}, []);

const reloadTrade = useCallback((id: string) => {
const existingObject = trades.find(t => t.id == id);
Expand Down

0 comments on commit 76c1d62

Please sign in to comment.