@xyo-network/os-react-runtime 4.2.0-rc.12 → 4.2.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/os-react-runtime",
|
|
3
|
-
"version": "4.2.0-rc.
|
|
3
|
+
"version": "4.2.0-rc.13",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -48,23 +48,23 @@
|
|
|
48
48
|
"@xylabs/react-shared": "^5.3.14",
|
|
49
49
|
"@xyo-network/archivist-indexeddb": "^3.6.6",
|
|
50
50
|
"@xyo-network/archivist-model": "^3.6.6",
|
|
51
|
-
"@xyo-network/bios-browser": "^4.2.0-rc.
|
|
52
|
-
"@xyo-network/bios-model": "^4.2.0-rc.
|
|
51
|
+
"@xyo-network/bios-browser": "^4.2.0-rc.13",
|
|
52
|
+
"@xyo-network/bios-model": "^4.2.0-rc.13",
|
|
53
53
|
"@xyo-network/diviner-boundwitness-indexeddb": "^3.6.6",
|
|
54
54
|
"@xyo-network/diviner-model": "^3.6.6",
|
|
55
55
|
"@xyo-network/diviner-payload-generic": "^3.6.6",
|
|
56
56
|
"@xyo-network/diviner-payload-indexeddb": "^3.6.6",
|
|
57
57
|
"@xyo-network/diviner-payload-model": "^3.6.6",
|
|
58
|
-
"@xyo-network/kernel": "^4.2.0-rc.
|
|
59
|
-
"@xyo-network/kernel-model": "^4.2.0-rc.
|
|
58
|
+
"@xyo-network/kernel": "^4.2.0-rc.13",
|
|
59
|
+
"@xyo-network/kernel-model": "^4.2.0-rc.13",
|
|
60
60
|
"@xyo-network/module-event-emitter": "^3.6.6",
|
|
61
61
|
"@xyo-network/module-events": "^3.6.6",
|
|
62
62
|
"@xyo-network/module-factory-locator": "^3.6.6",
|
|
63
63
|
"@xyo-network/node-model": "^3.6.6",
|
|
64
|
-
"@xyo-network/os-model": "^4.2.0-rc.
|
|
65
|
-
"@xyo-network/os-react-debug": "^4.2.0-rc.
|
|
66
|
-
"@xyo-network/os-react-model": "^4.2.0-rc.
|
|
67
|
-
"@xyo-network/os-runtime": "^4.2.0-rc.
|
|
64
|
+
"@xyo-network/os-model": "^4.2.0-rc.13",
|
|
65
|
+
"@xyo-network/os-react-debug": "^4.2.0-rc.13",
|
|
66
|
+
"@xyo-network/os-react-model": "^4.2.0-rc.13",
|
|
67
|
+
"@xyo-network/os-runtime": "^4.2.0-rc.13",
|
|
68
68
|
"@xyo-network/payload-model": "^3.6.6",
|
|
69
69
|
"@xyo-network/react-archivist": "^4.3.1",
|
|
70
70
|
"@xyo-network/react-card": "^4.3.1",
|
package/src/DappPathSwitcher.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { animated, useTransition } from '@react-spring/web'
|
|
2
2
|
import { ErrorRender } from '@xylabs/react-error'
|
|
3
3
|
import type { ReactNode } from 'react'
|
|
4
|
-
import React
|
|
4
|
+
import React from 'react'
|
|
5
5
|
|
|
6
6
|
export interface PathToComponent<PathNames extends string = string> {
|
|
7
7
|
component: ReactNode
|
|
@@ -23,17 +23,9 @@ export const DappPathSwitcher: React.FC<DappPathSwitcherProps> = ({ activePath,
|
|
|
23
23
|
const possibleZIndex = pathToComponent?.findIndex(item => item.path === activePath)
|
|
24
24
|
const zIndex = possibleZIndex !== -1 && possibleZIndex !== undefined ? possibleZIndex : 1
|
|
25
25
|
|
|
26
|
-
const activeComponent = useMemo(() => {
|
|
27
|
-
const activeIndex = pathToComponent?.findIndex(({ path: componentPath }) => activePath === componentPath)
|
|
28
|
-
const activeItem = pathToComponent && activeIndex !== -1 && activeIndex !== undefined ? pathToComponent[activeIndex] : undefined
|
|
29
|
-
return activeItem
|
|
30
|
-
? activeItem.component
|
|
31
|
-
: <ErrorRender error={new Error(`No component found for path: ${activePath}`)} scope="DappPathSwitcher" />
|
|
32
|
-
}, [activePath, pathToComponent])
|
|
33
|
-
|
|
34
26
|
return (
|
|
35
27
|
<>
|
|
36
|
-
{transitions(transitionProps => (
|
|
28
|
+
{transitions((transitionProps, activePathRef) => (
|
|
37
29
|
<animated.div
|
|
38
30
|
style={{
|
|
39
31
|
...transitionProps,
|
|
@@ -51,7 +43,13 @@ export const DappPathSwitcher: React.FC<DappPathSwitcherProps> = ({ activePath,
|
|
|
51
43
|
zIndex,
|
|
52
44
|
}}
|
|
53
45
|
>
|
|
54
|
-
{
|
|
46
|
+
{(() => {
|
|
47
|
+
const activeIndex = pathToComponent?.findIndex(({ path: componentPath }) => activePathRef === componentPath)
|
|
48
|
+
const activeItem = pathToComponent && activeIndex !== -1 && activeIndex !== undefined ? pathToComponent[activeIndex] : undefined
|
|
49
|
+
return activeItem
|
|
50
|
+
? activeItem.component
|
|
51
|
+
: <ErrorRender error={new Error(`No component found for path: ${activePathRef}`)} scope="DappPathSwitcher" />
|
|
52
|
+
})()}
|
|
55
53
|
</animated.div>
|
|
56
54
|
))}
|
|
57
55
|
</>
|