Skip to content

Commit

Permalink
disable auto and custom liquidity range
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-d committed Jun 13, 2024
1 parent efbf574 commit 96cd709
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion web/src/components/StakeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -649,11 +649,13 @@ export const StakeForm = ({ mode, poolId, positionId }: StakeFormProps) => {
label: "Auto",
value: "auto",
ref: useRef(),
disabled: true,
},
{
label: "Custom",
value: "custom",
ref: useRef(),
disabled: true,
},
]}
/>
Expand Down Expand Up @@ -697,7 +699,7 @@ export const StakeForm = ({ mode, poolId, positionId }: StakeFormProps) => {
}}
ref={chartRef}
onChartReady={(chart) => {
if (liquidityRangeType === "custom") {
if (liquidityRangeType === "full-range") {
chart.dispatchAction({
type: "brush",
areas: [
Expand Down
8 changes: 5 additions & 3 deletions web/src/components/ui/segmented-control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface Segment<T extends string> {
label: React.ReactNode;
value: T;
ref: React.MutableRefObject<any>;
disabled?: boolean
}

export interface SegmentedControlProps<T extends string>
Expand Down Expand Up @@ -69,7 +70,7 @@ const SegmentedControl = <T extends string>({
ref={controlRef}
>
<div className={cn(segmentedControlVariants({ variant }))}>
{segments?.map((item: any, i: number) => (
{segments?.map((item: Segment<T>, i: number) => (
<div
key={item.value}
className={"relative z-10 w-full text-center"}
Expand All @@ -79,17 +80,18 @@ const SegmentedControl = <T extends string>({
type="radio"
value={item.value}
id={`${name}-${item.value}`}
disabled={item.disabled}
onChange={() => onInputChange(item.value, i)}
checked={i === activeIndex}
name={name}
className={
"absolute inset-0 m-0 size-full cursor-pointer opacity-0"
cn("cursor-pointer disabled:cursor-not-allowed absolute inset-0 m-0 size-full opacity-0")
}
/>
<label
id={`${name}-${item.value}`}
className={cn(
"mx-[6px] block cursor-pointer text-nowrap font-medium transition-colors",
`mx-[6px] block text-nowrap font-medium transition-colors ${item.disabled ? "text-gray-500" : ""}`,
{
invert: i === activeIndex,
},
Expand Down

0 comments on commit 96cd709

Please sign in to comment.