-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: make integrator property required
- Loading branch information
Showing
9 changed files
with
80 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/widget/src/components/Insurance/InsuranceSwitch.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { BoxProps } from '@mui/material'; | ||
import { useSwapRoutes } from '../../hooks'; | ||
import type { RouteExecutionStatus } from '../../stores'; | ||
import { useRouteExecutionStore } from '../../stores'; | ||
import { Switch } from '../Switch'; | ||
|
||
export const Insurance: React.FC< | ||
{ | ||
available?: boolean; | ||
routeId: string; | ||
feeAmountUsd?: string; | ||
status?: RouteExecutionStatus; | ||
onChange?: ( | ||
event: React.ChangeEvent<HTMLInputElement>, | ||
checked: boolean, | ||
) => void; | ||
} & Omit<BoxProps, 'onChange'> | ||
> = ({ status, feeAmountUsd, routeId, available, onChange, ...props }) => { | ||
const routeExecution = useRouteExecutionStore( | ||
(state) => state.routes[routeId], | ||
); | ||
const { routes, isLoading } = useSwapRoutes(routeExecution?.route); | ||
|
||
const handleChange = ( | ||
_: React.ChangeEvent<HTMLInputElement>, | ||
checked: boolean, | ||
) => { | ||
// const insuredRoute = routes?.[0]; | ||
// if (insuredRoute && checked) { | ||
// setExecutableRoute(insuredRoute, stateRouteId); | ||
// } | ||
// setRouteId(checked ? insuredRoute?.id : stateRouteId); | ||
// onChange?.(); | ||
}; | ||
|
||
return <Switch onChange={handleChange} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters