diff --git a/src/pages/AppShell.tsx b/src/pages/AppShell.tsx index a0de606..0d9f77a 100644 --- a/src/pages/AppShell.tsx +++ b/src/pages/AppShell.tsx @@ -112,7 +112,7 @@ export const AppShell: FC = ({ children }) => {
setSidebarOpen(true)} />
-
+
{children}
diff --git a/src/pages/Storage/BlockPicker.tsx b/src/pages/Storage/BlockPicker.tsx index 271791a..a91f993 100644 --- a/src/pages/Storage/BlockPicker.tsx +++ b/src/pages/Storage/BlockPicker.tsx @@ -83,7 +83,7 @@ export const BlockPicker = () => { return (
setValue(evt.target.value)} diff --git a/src/pages/Storage/Storage.tsx b/src/pages/Storage/Storage.tsx index 8e86aa2..d792ad0 100644 --- a/src/pages/Storage/Storage.tsx +++ b/src/pages/Storage/Storage.tsx @@ -1,95 +1,26 @@ import { ButtonGroup } from "@/components/ButtonGroup" -import { DocsRenderer } from "@/components/DocsRenderer" import { Chopsticks } from "@/components/Icons" import { LoadingMetadata } from "@/components/Loading" -import { SearchableSelect } from "@/components/Select" import { withSubscribe } from "@/components/withSuspense" import { createState } from "@/lib/externalState" import { canSetStorage$ } from "@/state/chains/chain.state" -import { state, useStateObservable } from "@react-rxjs/core" +import { useStateObservable } from "@react-rxjs/core" import { FC } from "react" import { Route, Routes } from "react-router-dom" -import { map } from "rxjs" -import { BlockPicker, selectedBlock$ } from "./BlockPicker" -import { partialEntry$, selectedEntry$, selectEntry } from "./storage.state" import { StorageDecode } from "./StorageDecode" import { StorageQuery } from "./StorageQuery" import { StorageSet } from "./StorageSet" import { StorageSubscriptions } from "./StorageSubscriptions" -const metadataStorage$ = state( - selectedBlock$.pipe( - map(({ ctx }) => ({ - lookup: ctx.lookup, - entries: Object.fromEntries( - ctx.lookup.metadata.pallets - .filter((p) => p.storage) - .map((p) => [ - p.name, - Object.fromEntries( - p.storage!.items.map((item) => [item.name, item.type]), - ), - ]), - ), - })), - ), -) - export const Storage = withSubscribe( - () => { - const { entries } = useStateObservable(metadataStorage$) - const partialEntry = useStateObservable(partialEntry$) - const selectedEntry = useStateObservable(selectedEntry$) - - return ( -
-
- -
- - {partialEntry.pallet && entries[partialEntry.pallet] && ( - - )} -
-
- {selectedEntry?.docs.length ? ( -
- Docs - -
- ) : null} - - - } /> - -
- ) - }, + () => ( +
+ + + } /> + +
+ ), { fallback: , }, @@ -98,21 +29,18 @@ export const Storage = withSubscribe( export const [mode$, setMode] = createState<"query" | "decode" | "set">("query") const StorageEntry: FC = () => { - const selectedEntry = useStateObservable(selectedEntry$) const canSetStorage = useStateObservable(canSetStorage$) const mode = useStateObservable(mode$) - if (!selectedEntry) return null - return ( - <> +
{ value: "set", content: ( <> - Set + Set Value { : []), ]} /> - {mode === "query" ? ( - - ) : mode === "decode" ? ( - - ) : ( - - )} - +
+ {mode === "query" ? ( + + ) : mode === "decode" ? ( + + ) : ( + + )} +
+
) } diff --git a/src/pages/Storage/StorageDecode.tsx b/src/pages/Storage/StorageDecode.tsx index b1faf5b..d7991f0 100644 --- a/src/pages/Storage/StorageDecode.tsx +++ b/src/pages/Storage/StorageDecode.tsx @@ -8,6 +8,8 @@ import { FC } from "react" import { combineLatest, firstValueFrom, map } from "rxjs" import { selectedBlock$ } from "./BlockPicker" import { addStorageSubscription, selectedEntry$ } from "./storage.state" +import { StorageEntryPicker } from "./StorageEntryPicker" +import { Textarea } from "@/components/ui/textarea" export const [value$, setValue] = createState("") @@ -52,13 +54,17 @@ export const StorageDecode: FC = () => { } return ( -
-