Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small fix #562

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/basic-features/typescript for more information.
44 changes: 25 additions & 19 deletions src/components/Settings/ProtocolsSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import Row, { RowBetween } from 'components/Row';
import { BodySmall } from 'components/Text';
import { AppContext } from 'contexts';
import { useRouterSDK } from 'functions/generateRoute';
import React, { useContext, useEffect, useState } from 'react'
import React, { useContext, useEffect, useState } from 'react';
import { Box, styled, Switch, SwitchProps, Typography, useTheme } from 'soroswap-ui';
import { useSWRConfig } from 'swr';


export const CustomSwitch = styled((props: SwitchProps) => (
<Switch sx={{ my: 1 }} focusVisibleClassName=".Mui-focusVisible" disableRipple {...props} />
))(({ theme }) => ({
Expand Down Expand Up @@ -56,10 +55,9 @@ export const CustomSwitch = styled((props: SwitchProps) => (
},
}));


const firstLetterUppercase = (string: string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
}
};
const ProtocolsSettings = () => {
const { resetRouterSdkCache } = useRouterSDK();
const theme = useTheme();
Expand Down Expand Up @@ -88,12 +86,10 @@ const ProtocolsSettings = () => {
undefined,
{ revalidate: true },
);
}
else return;
}
} else return;
};

return (

<Expand
testId="protocols-settings"
isOpen={isOpen}
Expand All @@ -104,7 +100,8 @@ const ProtocolsSettings = () => {
<QuestionHelper
text={
<div>
The protocols Soroswap.finance will use to calculate the most efficient path for your transaction.
The protocols Soroswap.finance will use to calculate the most efficient path for
your transaction.
</div>
}
/>
Expand All @@ -113,21 +110,30 @@ const ProtocolsSettings = () => {
button={<></>}
>
<RowBetween gap="md" width={'100%'}>
<Box sx={{ ml: 2 }} width={'100%'} >
<Box sx={{ ml: 2 }} width={'100%'}>
{protocolsStatus.map((option, index) => {
return (
<Row key={index} gap="4px" justify='space-between' align='center'>
<BodySmall fontWeight={100} color={theme.palette.secondary.main} >{firstLetterUppercase(option.key)}</BodySmall>
<CustomSwitch checked={option.value} onClick={() => { switchProtocolValue(option.key) }} color="secondary" />
<Row key={index} gap="4px" justify="space-between" align="center">
<BodySmall fontWeight={100} color={theme.palette.secondary.main}>
{firstLetterUppercase(option.key)}
</BodySmall>
<CustomSwitch
checked={option.value}
onClick={() => {
switchProtocolValue(option.key);
}}
color="secondary"
/>
</Row>
)
);
})}
<BodySmall fontWeight={100} color={theme.palette.secondary.main}>
Use Phoenix at your own risk
</BodySmall>
</Box>
</RowBetween>

</Expand>
);
};

)
}

export default ProtocolsSettings
export default ProtocolsSettings;
Loading