refactor: move all app state into a common folder
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { runtimeCtx$ } from "@/chain.state"
|
||||
import { runtimeCtx$ } from "@/state/chains/chain.state"
|
||||
import { byteArraysAreEqual } from "@/utils/byteArray"
|
||||
import { CodecComponentType, CodecComponentValue } from "@polkadot-api/react-builder"
|
||||
import {
|
||||
CodecComponentType,
|
||||
CodecComponentValue,
|
||||
} from "@polkadot-api/react-builder"
|
||||
import { state, useStateObservable } from "@react-rxjs/core"
|
||||
import { Codec } from "polkadot-api"
|
||||
import { ComponentProps, FC, useEffect, useRef, useState } from "react"
|
||||
|
||||
@@ -4,7 +4,7 @@ import { createRoot } from "react-dom/client"
|
||||
import { BrowserRouter } from "react-router-dom"
|
||||
import { merge } from "rxjs"
|
||||
import App from "./App.tsx"
|
||||
import { dynamicBuilder$ } from "./chain.state.ts"
|
||||
import { dynamicBuilder$ } from "@/state/chains/chain.state"
|
||||
import { TooltipProvider } from "./components/Tooltip.tsx"
|
||||
import "./index.css"
|
||||
import { explorer$ } from "./pages/Explorer"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { lookup$, runtimeCtx$ } from "@/chain.state"
|
||||
import { lookup$, runtimeCtx$ } from "@/state/chains/chain.state"
|
||||
import { ViewCodec } from "@/codec-components/ViewCodec"
|
||||
import { ButtonGroup } from "@/components/ButtonGroup"
|
||||
import { DocsRenderer } from "@/components/DocsRenderer"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { runtimeCtx$ } from "@/chain.state"
|
||||
import { runtimeCtx$ } from "@/state/chains/chain.state"
|
||||
import { CircularProgress } from "@/components/CircularProgress"
|
||||
import { groupBy } from "@/lib/groupBy"
|
||||
import { state, useStateObservable } from "@react-rxjs/core"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { chainHead$ } from "@/chain.state"
|
||||
import { chainHead$ } from "@/state/chains/chain.state"
|
||||
import { CopyText } from "@/components/Copy"
|
||||
import { Popover } from "@/components/Popover"
|
||||
import { state, useStateObservable } from "@react-rxjs/core"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { chainHead$ } from "@/chain.state"
|
||||
import { chainHead$ } from "@/state/chains/chain.state"
|
||||
import { CircularProgress } from "@/components/CircularProgress"
|
||||
import { state, useStateObservable } from "@react-rxjs/core"
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { runtimeCtx$ } from "@/chain.state"
|
||||
import { runtimeCtx$ } from "@/state/chains/chain.state"
|
||||
import { CopyBinary } from "@/codec-components/ViewCodec/CopyBinary"
|
||||
import { AccountIdDisplay } from "@/components/AccountIdDisplay"
|
||||
import { ExpandBtn } from "@/components/Expand"
|
||||
|
||||
@@ -11,7 +11,11 @@ import {
|
||||
withLatestFrom,
|
||||
} from "rxjs"
|
||||
import { targetBlockTime$ } from "./blockTime.state"
|
||||
import { chainClient$, chainHead$, runtimeCtx$ } from "@/chain.state"
|
||||
import {
|
||||
chainClient$,
|
||||
chainHead$,
|
||||
runtimeCtx$,
|
||||
} from "@/state/chains/chain.state"
|
||||
import { groupBy } from "@/lib/groupBy"
|
||||
|
||||
const bestBlock$ = chainHead$.pipeState(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { chainHead$, runtimeCtx$ } from "@/chain.state"
|
||||
import { chainHead$, runtimeCtx$ } from "@/state/chains/chain.state"
|
||||
import { FC, PropsWithChildren } from "react"
|
||||
import { map, switchMap } from "rxjs"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { chainClient$, chainHead$ } from "@/chain.state"
|
||||
import { chainClient$, chainHead$ } from "@/state/chains/chain.state"
|
||||
import {
|
||||
ChainHead$,
|
||||
PinnedBlocks,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { chainClient$, runtimeCtx$ } from "@/chain.state"
|
||||
import { chainClient$, runtimeCtx$ } from "@/state/chains/chain.state"
|
||||
import { groupBy } from "@/lib/groupBy"
|
||||
import { state } from "@react-rxjs/core"
|
||||
import { map, of, switchMap, withLatestFrom } from "rxjs"
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { runtimeCtx$ } from "@/chain.state"
|
||||
import { runtimeCtx$ } from "@/state/chains/chain.state"
|
||||
import { BinaryDisplay } from "@/codec-components/LookupTypeEdit"
|
||||
import { ButtonGroup } from "@/components/ButtonGroup"
|
||||
import { LoadingMetadata } from "@/components/Loading"
|
||||
import { withSubscribe } from "@/components/withSuspense"
|
||||
import { CodecComponentType, CodecComponentValue } from "@polkadot-api/react-builder"
|
||||
import {
|
||||
CodecComponentType,
|
||||
CodecComponentValue,
|
||||
} from "@polkadot-api/react-builder"
|
||||
import { Binary } from "@polkadot-api/substrate-bindings"
|
||||
import { state, useStateObservable } from "@react-rxjs/core"
|
||||
import { useState } from "react"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { unsafeApi$ } from "@/chain.state"
|
||||
import { unsafeApi$ } from "@/state/chains/chain.state"
|
||||
import { ActionButton } from "@/components/ActionButton"
|
||||
import { onNexTx } from "@/pages/Transactions"
|
||||
import { useStateObservable } from "@react-rxjs/core"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { lookup$ } from "@/chain.state"
|
||||
import { lookup$ } from "@/state/chains/chain.state"
|
||||
import { LookupTypeEdit } from "@/codec-components/LookupTypeEdit"
|
||||
import { getTypeComplexity } from "@/utils/shape"
|
||||
import { state, useStateObservable } from "@react-rxjs/core"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { lookup$, metadata$ } from "@/chain.state"
|
||||
import { lookup$, metadata$ } from "@/state/chains/chain.state"
|
||||
import { LookupTypeEdit } from "@/codec-components/LookupTypeEdit"
|
||||
import { ButtonGroup } from "@/components/ButtonGroup"
|
||||
import { JsonDisplay } from "@/components/JsonDisplay"
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
onChangeChain,
|
||||
SelectedChain,
|
||||
selectedChain$,
|
||||
} from "@/chain.state"
|
||||
} from "@/state/chains/chain.state"
|
||||
import {
|
||||
Accordion,
|
||||
AccordionContent,
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { dynamicBuilder$, lookup$, unsafeApi$ } from "@/chain.state"
|
||||
import {
|
||||
dynamicBuilder$,
|
||||
lookup$,
|
||||
unsafeApi$,
|
||||
} from "@/state/chains/chain.state"
|
||||
import {
|
||||
InlineLookupTypeEdit,
|
||||
LookupTypeEdit,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { lookup$ } from "@/chain.state"
|
||||
import { lookup$ } from "@/state/chains/chain.state"
|
||||
import { DocsRenderer } from "@/components/DocsRenderer"
|
||||
import { LoadingMetadata } from "@/components/Loading"
|
||||
import { SearchableSelect } from "@/components/Select"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { lookup$ } from "@/chain.state"
|
||||
import { lookup$ } from "@/state/chains/chain.state"
|
||||
import { ButtonGroup } from "@/components/ButtonGroup"
|
||||
import { SearchableSelect } from "@/components/Select"
|
||||
import { withSubscribe } from "@/components/withSuspense"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { dynamicBuilder$ } from "@/chain.state"
|
||||
import { dynamicBuilder$ } from "@/state/chains/chain.state"
|
||||
import { ActionButton } from "@/components/ActionButton"
|
||||
import { NOTIN } from "@polkadot-api/react-builder"
|
||||
import { state, useStateObservable } from "@react-rxjs/core"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { dynamicBuilder$, runtimeCtx$, unsafeApi$ } from "@/chain.state"
|
||||
import {
|
||||
dynamicBuilder$,
|
||||
runtimeCtx$,
|
||||
unsafeApi$,
|
||||
} from "@/state/chains/chain.state"
|
||||
import { EditCodec } from "@/codec-components/EditCodec"
|
||||
import { ActionButton } from "@/components/ActionButton"
|
||||
import { BinaryEditButton } from "@/components/BinaryEditButton"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { dynamicBuilder$, metadata$ } from "@/chain.state"
|
||||
import { dynamicBuilder$, metadata$ } from "@/state/chains/chain.state"
|
||||
import { ViewCodec } from "@/codec-components/ViewCodec"
|
||||
import { CopyBinary } from "@/codec-components/ViewCodec/CopyBinary"
|
||||
import { ButtonGroup } from "@/components/ButtonGroup"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { chainClient$ } from "@/chain.state"
|
||||
import { chainClient$ } from "@/state/chains/chain.state"
|
||||
import { state } from "@react-rxjs/core"
|
||||
import { combineKeys, createSignal, partitionByKey } from "@react-rxjs/utils"
|
||||
import { HexString, InvalidTxError, TxBroadcastEvent } from "polkadot-api"
|
||||
|
||||
@@ -5,10 +5,10 @@ import {
|
||||
} from "@polkadot-api/descriptors"
|
||||
import { state } from "@react-rxjs/core"
|
||||
import { Binary, createClient, SS58String } from "polkadot-api"
|
||||
import { chainSpec } from "./chainspecs/polkadot_people"
|
||||
import { chainSpec } from "./chains/chainspecs/polkadot_people"
|
||||
import { catchError, map, of, tap } from "rxjs"
|
||||
import { getProvider } from "./chain.state"
|
||||
import { localStorageSubject } from "./utils/localStorageSubject"
|
||||
import { getProvider } from "./chains/chain.state"
|
||||
import { localStorageSubject } from "@/utils/localStorageSubject"
|
||||
|
||||
export interface Identity {
|
||||
displayName: string
|
||||
Reference in New Issue
Block a user