Skip to content

Commit

Permalink
feat: support noAutoConnect && change pool style
Browse files Browse the repository at this point in the history
  • Loading branch information
junjieit committed Oct 25, 2024
1 parent f0542b5 commit 6e2d598
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/dodoex-widgets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dodoex/widgets",
"version": "3.0.0-taiko.25",
"version": "3.0.0-taiko.26",
"description": "DODO Widgets",
"source": "src/index.tsx",
"types": "dist/index.d.ts",
Expand Down
33 changes: 19 additions & 14 deletions packages/dodoex-widgets/src/components/Widget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface WidgetProps
onlyChainId?: ChainId;
noUI?: boolean;
noLangProvider?: boolean;
noAutoConnect?: boolean;
routerPage?: Page;

/** When the winding status changes, no pop-up window will be displayed. */
Expand Down Expand Up @@ -119,22 +120,26 @@ function InitStatus(props: PropsWithChildren<WidgetProps>) {
const autoConnectLoading = useSelector(getAutoConnectLoading);
useEffect(() => {
if (autoConnectLoading === undefined) {
dispatch(setAutoConnectLoading(true));
const connectWallet = async () => {
const defaultChainId = props.defaultChainId;
try {
if (connector?.connectEagerly) {
await connector.connectEagerly(defaultChainId);
} else {
await connector.activate(defaultChainId);
if (props.noAutoConnect) {
dispatch(setAutoConnectLoading(false));
} else {
dispatch(setAutoConnectLoading(true));
const connectWallet = async () => {
const defaultChainId = props.defaultChainId;
try {
if (connector?.connectEagerly) {
await connector.connectEagerly(defaultChainId);
} else {
await connector.activate(defaultChainId);
}
} finally {
dispatch(setAutoConnectLoading(false));
}
} finally {
dispatch(setAutoConnectLoading(false));
}
};
connectWallet();
};
connectWallet();
}
}
}, [connector]);
}, [connector, props.noAutoConnect]);

useEffect(() => {
contractRequests.setGetConfigProvider((getProviderChainId) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/dodoex-widgets/src/locales/en-US.po
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ msgstr "Confirm submission"
msgid "Select pool by tokens"
msgstr "Select pool by tokens"

#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:173
#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:174
msgid "Asset"
msgstr "Asset"

Expand Down Expand Up @@ -1460,7 +1460,7 @@ msgstr "Next"
msgid "Create"
msgstr "Create"

#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:176
#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:177
msgid "Token Amount"
msgstr "Token Amount"

Expand Down Expand Up @@ -1494,7 +1494,7 @@ msgstr "Dynamic slippage is {recommendSlippage}%,the current slippage setting is
msgid "Enter an amount"
msgstr "Enter an amount"

#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:179
#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:180
msgid "Ratio"
msgstr "Ratio"

Expand Down
6 changes: 3 additions & 3 deletions packages/dodoex-widgets/src/locales/zh-CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ msgstr ""
msgid "Select pool by tokens"
msgstr ""

#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:173
#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:174
msgid "Asset"
msgstr ""

Expand Down Expand Up @@ -1460,7 +1460,7 @@ msgstr ""
msgid "Create"
msgstr ""

#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:176
#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:177
msgid "Token Amount"
msgstr ""

Expand Down Expand Up @@ -1494,7 +1494,7 @@ msgstr ""
msgid "Enter an amount"
msgstr "输入代币数量"

#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:179
#: src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.tsx:180
msgid "Ratio"
msgstr ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export function BaseQuotePie({
)}
</div>
<Box
className="symbol-wrapper"
sx={{
display: 'flex',
flexDirection: 'column',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default function TotalLiquidity({
mt: 16,
backgroundColor: 'background.paper',
borderRadius: 16,
overflowX: 'auto',
}}
>
{/* chart */}
Expand Down

0 comments on commit 6e2d598

Please sign in to comment.