Skip to content

Commit

Permalink
fix: fixed by cr
Browse files Browse the repository at this point in the history
  • Loading branch information
Onizuka-wl committed Oct 2, 2024
1 parent 8713a49 commit 051c63d
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/config/Theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const getCustomThemes = () => {
light: lightTheme,
dark: darkTheme,
},
mui: getMuiThemeConfig,
getMui: getMuiThemeConfig,
rainbow: rainbowTheme,
};
};
16 changes: 7 additions & 9 deletions src/config/env.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Env } from '~/types';

export const getEnv = (): Env => {
const NEXT_PUBLIC_RPC_URL = process.env.NEXT_PUBLIC_RPC_URL;
const NEXT_PUBLIC_PROJECT_ID = process.env.NEXT_PUBLIC_PROJECT_ID;
const NEXT_PUBLIC_ALCHEMY_KEY = process.env.NEXT_PUBLIC_ALCHEMY_KEY;
const env: Env = {
RPC_URL: process.env.NEXT_PUBLIC_RPC_URL as string,
PROJECT_ID: process.env.NEXT_PUBLIC_PROJECT_ID as string,
ALCHEMY_KEY: process.env.NEXT_PUBLIC_ALCHEMY_KEY as string,
};

return {
RPC_URL: NEXT_PUBLIC_RPC_URL as string,
PROJECT_ID: NEXT_PUBLIC_PROJECT_ID as string,
ALCHEMY_KEY: NEXT_PUBLIC_ALCHEMY_KEY as string,
};
export const getEnv = (): Env => {
return env;
};
6 changes: 3 additions & 3 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const publicClient = createPublicClient({
});

export const getConfig = (): Config => ({
...getEnv(),
...getConstants(),
...getCustomThemes(),
env: getEnv(),
constants: getConstants(),
customThemes: getCustomThemes(),
});
2 changes: 1 addition & 1 deletion src/providers/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface StateProps {
export const ThemeContext = createContext({} as ContextType);

export const ThemeProvider = ({ children }: StateProps) => {
const getMuiThemeConfig = getConfig().mui;
const { getMui: getMuiThemeConfig } = getConfig().customThemes;

const defaultTheme = 'dark';

Expand Down
6 changes: 5 additions & 1 deletion src/types/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ export interface Constants {
//...
}

export interface Config extends Env, Constants, CustomThemes {}
export interface Config {
env: Env;
constants: Constants;
customThemes: CustomThemes;
}
2 changes: 1 addition & 1 deletion src/types/Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export interface CustomThemes {
light: Theme;
dark: Theme;
};
mui: (currentTheme: Theme, themeName: ThemeName) => MuiTheme;
getMui: (currentTheme: Theme, themeName: ThemeName) => MuiTheme;
rainbow: RainbowTheme;
}
2 changes: 1 addition & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createConfig, http, cookieStorage, createStorage } from 'wagmi';
import { localhost, sepolia } from 'wagmi/chains';
import { getConfig } from '~/config';

const { PROJECT_ID } = getConfig();
const { PROJECT_ID } = getConfig().env;

const getWallets = () => {
if (PROJECT_ID) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/getTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getConfig } from '~/config';
import { Theme, ThemeName } from '~/types';

export const getTheme = (theme?: ThemeName): Theme => {
const { dark, light } = getConfig().main;
const { dark, light } = getConfig().customThemes.main;

switch (theme) {
case 'light':
Expand Down

0 comments on commit 051c63d

Please sign in to comment.