Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-orbs committed Dec 19, 2023
1 parent 3566dd4 commit d2dd266
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 11 deletions.
28 changes: 25 additions & 3 deletions packages/dapp-example/src/SyncSwap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,29 @@ import BN from "bignumber.js";
const config = Configs.SyncSwap;

const palletes = [
{
name: "light",
options: {
normal: "#060828",
primary: "#5155a6", // #4E529A // zkSync official color darker
secondary: "#474ba3", // #4E529A #494c91
banner: "#e4e2ff",

overlay: "#ffffff",
overlay2: "#F6F5FA",
//overlay3: '#f0f0f5',

error: "#d50000",
info: "#6f7183", // rgb(110, 114, 125)
light: "#e5e5e5",
light2: "#dbdbdb",
disable: "#505050",

background: "theme-background-light",
banner2: "theme-banner-light",
portfolio: "theme-portfolio-light",
},
},
{
name: "bitcoin",
options: {
Expand Down Expand Up @@ -180,8 +203,7 @@ const usePallete = () => {
const useGasPrice = () => {
const { library } = useWeb3React();
return useCallback(async () => {
if (!library) return;
return library.eth.getGasPrice();
return library?.eth.getGasPrice();
}, [library]);
};

Expand All @@ -202,7 +224,7 @@ const TWAPComponent = ({ limit }: { limit?: boolean }) => {
dstToken={store.dstToken}
dappTokens={tokens}
getProvider={() => library}
useGasPrice={getGasPrice}
useGasPrice={library ? getGasPrice : undefined}
limit={limit}
openTokenSelectModal={store.openTokenSelectModal}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/src/components/base/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Button({ children, disabled = false, onClick, loading = false, classNam
<StyledContainer onClick={onClick} className={`twap-button ${loading ? "twap-button-loading" : ""} ${disabled ? "twap-button-disabled" : ""} ${className}`} disabled={disabled}>
{loading && (
<StyledLoader className="twap-button-loader">
<CircularProgress style={{ zoom: 0.8 }} className="twap-button-loader" />
<CircularProgress className="twap-button-loader" />
</StyledLoader>
)}
<Fade in={!loading}>
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export const useCreateOrder = () => {
fillDelayMillis,
store.srcUsd,
askDataParams,
priorityFeePerGas,
priorityFeePerGas || zero,
maxFeePerGas
);
},
Expand Down
7 changes: 3 additions & 4 deletions packages/syncswap/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ interface SyncSwapProps extends TWAPProps {
connect: () => void;
themeOptions: SyncSwapPallete;
openTokenSelectModal: (value?: any) => void;
useGasPrice: () => Promise<any>;
useGasPrice?: () => Promise<any>;
}

const config = Configs.SyncSwap;
Expand Down Expand Up @@ -196,7 +196,7 @@ const useGasPriceQuery = (props: Props) => {
return useQuery(
["useGasPriceQuerySynswap"],
async () => {
const res = await props.useGasPrice();
const res = await props.useGasPrice?.();
return res?.toString() || "";
},
{
Expand Down Expand Up @@ -332,8 +332,7 @@ const ChangeTokensOrder = () => {
};

const SubmitButton = ({ isMain }: { isMain?: boolean }) => {
const { loading, disabled, text, onClick } = hooks.useSubmitButton(isMain);

const { disabled, loading, text, onClick } = hooks.useSubmitButton(isMain);
const _onClick = () => {
if (onClick) return onClick();
return () => {};
Expand Down
13 changes: 11 additions & 2 deletions packages/syncswap/src/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const StyledPoweredBy = styled(Components.PoweredBy)(({ theme }) => ({
}));

export const StyledSubmitButton = styled(Button)({
minHeight: 40,
borderRadius: 10,
textTransform: "none",
".MuiCircularProgress-root": {
Expand Down Expand Up @@ -267,6 +268,11 @@ export function hexToRGB(hex: string, alpha: number) {
export const configureStyles = (pallete: SyncSwapPallete) => {
return {
...uiHelper.handleSwitchStyles({ thumb: pallete.normal, thumbActive: pallete.primary, track: pallete.light, trackActive: pallete.light }),
".twap-spinner": {
"*": {
color: `${pallete.primary}!important`,
},
},
".twap-loader": {
opacity: "1!important",
},
Expand Down Expand Up @@ -561,10 +567,13 @@ export const configureStyles = (pallete: SyncSwapPallete) => {
background: pallete.overlay2,
borderRadius: "10px",
"*": {
color: pallete.normal,
boxSizing: "border-box",
},

".twap-card": {
"*": {
color: pallete.normal,
},
},
".twap-orders-summary-token-display": {
overflow: "hidden",
textOverflow: "ellipsis",
Expand Down

0 comments on commit d2dd266

Please sign in to comment.