Skip to content

Commit 59ab83b

Browse files
committed
react: remove react-i18n dependency
1 parent 010c5f4 commit 59ab83b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+446
-480
lines changed

.changeset/famous-glasses-sleep.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@treasure-dev/tdk-react": minor
33
---
44

5-
Removed `tailwind-merge` dependency for ~70Kb savings in gzipped package
5+
Removed `tailwind-merge` dependency for ~7Kb savings in gzipped package

.changeset/kind-mails-agree.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@treasure-dev/tdk-react": minor
3+
---
4+
5+
Removed `react-i18n` dependency for ~20Kb savings in gzipped package

packages/react/.storybook/preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Preview } from "@storybook/react";
33
import React from "react";
44
import { ThirdwebProvider } from "thirdweb/react";
55

6-
import { TreasureProvider } from "../src/contexts/treasure";
6+
import { TreasureProvider } from "../src/providers/treasure";
77

88
import "../src/globals.css";
99

packages/react/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@
4747
"@treasure-dev/launcher": "workspace:*",
4848
"class-variance-authority": "catalog:",
4949
"clsx": "catalog:",
50-
"i18next": "catalog:",
51-
"i18next-browser-languagedetector": "catalog:",
52-
"input-otp": "catalog:",
53-
"react-i18next": "catalog:"
50+
"input-otp": "catalog:"
5451
},
5552
"devDependencies": {
5653
"@storybook/addon-essentials": "catalog:",

packages/react/src/components/ui/Dialog.tsx

Lines changed: 0 additions & 55 deletions
This file was deleted.

packages/react/src/hooks/useContractAddress.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import {
33
getContractAddress,
44
getContractAddresses,
55
} from "@treasure-dev/tdk-core";
6-
import { useTreasure } from "../contexts/treasure";
6+
7+
import { useTreasure } from "../providers/treasure";
78

89
export const useContractAddress = ({
910
chainId,

packages/react/src/i18n.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/react/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import "./globals.css";
22

33
export type * from "@treasure-dev/tdk-core";
44

5-
export { ConnectButton } from "./components/connect/ConnectButton";
6-
export { ConnectModal } from "./components/connect/ConnectModal";
7-
export { Button } from "./components/ui/Button";
8-
export { TreasureProvider, useTreasure } from "./contexts/treasure";
9-
export { useConnect } from "./hooks/useConnect";
5+
export { ConnectButton } from "./ui/ConnectButton/ConnectButton";
6+
export { ConnectModal } from "./ui/ConnectModal/ConnectModal";
7+
export { Button } from "./ui/components/Button";
8+
export { TreasureProvider, useTreasure } from "./providers/treasure";
9+
export { useConnect } from "./ui/hooks/useConnect";
1010
export {
1111
useContractAddress,
1212
useContractAddresses,

packages/react/src/contexts/treasure.tsx renamed to packages/react/src/providers/treasure.tsx

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
useMemo,
2727
useState,
2828
} from "react";
29-
import { I18nextProvider } from "react-i18next";
3029
import { ZERO_ADDRESS, defineChain } from "thirdweb";
3130
import {
3231
useActiveWallet,
@@ -39,9 +38,8 @@ import {
3938
import { isZkSyncChain } from "thirdweb/utils";
4039
import { type Wallet, ecosystemWallet } from "thirdweb/wallets";
4140

42-
import { useLauncher } from "../hooks/useLauncher";
43-
import { i18n } from "../i18n";
4441
import type { AnalyticsEvent, Config, ContextValues } from "../types";
42+
import { useLauncher } from "../ui/hooks/useLauncher";
4543
import {
4644
EVT_TREASURECONNECT_CONNECTED,
4745
EVT_TREASURECONNECT_DISCONNECTED,
@@ -68,8 +66,9 @@ export const useTreasure = () => {
6866

6967
type Props = PropsWithChildren<Config>;
7068

71-
const TreasureProviderInner = ({
69+
export const TreasureProvider = ({
7270
children,
71+
language,
7372
appName,
7473
appIconUri,
7574
apiUri = DEFAULT_TDK_API_BASE_URI,
@@ -360,6 +359,7 @@ const TreasureProviderInner = ({
360359
return (
361360
<Context.Provider
362361
value={{
362+
language,
363363
appName,
364364
appIconUri,
365365
chain,
@@ -409,17 +409,3 @@ const TreasureProviderInner = ({
409409
</Context.Provider>
410410
);
411411
};
412-
413-
export const TreasureProvider = (props: Props) => {
414-
useEffect(() => {
415-
if (props.language) {
416-
i18n.changeLanguage(props.language);
417-
}
418-
}, [props.language]);
419-
420-
return (
421-
<I18nextProvider i18n={i18n}>
422-
<TreasureProviderInner {...props} />
423-
</I18nextProvider>
424-
);
425-
};

packages/react/src/translations/en.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)