1
1
import React , { PropsWithChildren } from "react" ;
2
2
import { QueryClient , QueryClientProvider } from "react-query" ;
3
- import { controllerConfigs } from "@cartridge/presets" ;
4
3
import { mainnet } from "@starknet-react/chains" ;
5
4
import { StarknetConfig , publicProvider , voyager } from "@starknet-react/core" ;
6
- import { useThemeEffect } from "@cartridge/ui-next" ;
7
5
import { BrowserRouter } from "react-router-dom" ;
8
6
import { ConnectionContext } from "../src/components/provider/connection" ;
9
7
import { UIProvider } from "../src/components/provider/ui" ;
10
8
import { StoryParameters , useMockedConnection } from "./mock" ;
11
- import {
12
- ControllerThemeContext ,
13
- VerifiableControllerTheme ,
14
- } from "../src/context/theme" ;
15
9
import { TokensProvider } from "../src/components/provider/tokens" ;
16
10
17
11
export function Provider ( {
18
12
children,
19
13
parameters,
20
14
} : { parameters : StoryParameters } & PropsWithChildren ) {
21
- const connection = useMockedConnection ( parameters . connection ) ;
22
-
23
- if ( parameters . preset ) {
24
- const config = controllerConfigs [ parameters . preset ] ;
25
-
26
- if ( parameters . preset === "cartridge" && config . theme ) {
27
- ( config . theme as VerifiableControllerTheme ) . verified = true ;
28
- }
29
-
30
- connection . theme = config . theme || connection . theme ;
31
- connection . policies = config . policies || connection . policies ;
32
- }
15
+ const connection = useMockedConnection ( parameters ) ;
33
16
34
17
return (
35
18
< StarknetConfig
@@ -41,9 +24,7 @@ export function Provider({
41
24
< ConnectionContext . Provider value = { connection } >
42
25
< UIProvider >
43
26
< TokensProvider >
44
- < ControllerThemeProvider theme = { connection . theme } >
45
- < BrowserRouter > { children } </ BrowserRouter >
46
- </ ControllerThemeProvider >
27
+ < BrowserRouter > { children } </ BrowserRouter >
47
28
</ TokensProvider >
48
29
</ UIProvider >
49
30
</ ConnectionContext . Provider >
@@ -53,16 +34,3 @@ export function Provider({
53
34
}
54
35
55
36
const queryClient = new QueryClient ( ) ;
56
-
57
- function ControllerThemeProvider ( {
58
- children,
59
- theme,
60
- } : PropsWithChildren < { theme : VerifiableControllerTheme } > ) {
61
- useThemeEffect ( { theme, assetUrl : "" } ) ;
62
-
63
- return (
64
- < ControllerThemeContext . Provider value = { { ...theme } } >
65
- { children }
66
- </ ControllerThemeContext . Provider >
67
- ) ;
68
- }
0 commit comments