@pioneer-platform/pioneer-react 0.2.34 → 0.2.36

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.
@@ -14,15 +14,33 @@ import { usePioneer } from "lib/context/Pioneer";
14
14
  import AssetSelect from "lib/components/AssetSelect";
15
15
  import BlockchainSelect from "lib/components/BlockchainSelect";
16
16
  import WalletSelect from "lib/components/WalletSelect";
17
+ import Onboarding from "lib/components/Onboarding";
17
18
 
18
19
  const Home = () => {
19
20
  const { state } = usePioneer();
20
- const { api, app, context, assetContext, blockchainContext, pubkeyContext } =
21
+ const { api, app, context, assetContext, blockchainContext, pubkeyContext, modals } =
21
22
  state;
22
23
  const [address, setAddress] = useState("");
23
24
  const [modalType, setModalType] = useState("");
24
25
  const { isOpen, onOpen, onClose } = useDisclosure();
25
26
 
27
+ const onStart = async function(){
28
+ try{
29
+ console.log("onStart")
30
+ let isOnboarded = await localStorage.getItem("isOnboarded")
31
+ if(!isOnboarded){
32
+ console.log("Starting onboarding process")
33
+ openModal("Onboarding")
34
+ }
35
+ }catch(e){
36
+ console.error(e)
37
+ }
38
+ }
39
+ useEffect(() => {
40
+ onStart()
41
+ }, []);
42
+
43
+
26
44
  useEffect(() => {
27
45
  console.log("2 pubkeyContext: ", pubkeyContext);
28
46
  setAddress(pubkeyContext.master || pubkeyContext.pubkey || pubkeyContext);
@@ -33,6 +51,13 @@ const Home = () => {
33
51
  onOpen();
34
52
  };
35
53
 
54
+ let refresh = async () => {
55
+ //TODO why do I need to press refresh?
56
+ console.log("2 pubkeyContext: ", pubkeyContext);
57
+ setAddress(pubkeyContext.master || pubkeyContext.pubkey || pubkeyContext);
58
+ console.log("assetContext: ",assetContext)
59
+ }
60
+
36
61
  return (
37
62
  <div>
38
63
  <Modal isOpen={isOpen} onClose={() => onClose()} size="xl">
@@ -58,6 +83,16 @@ const Home = () => {
58
83
  </div>
59
84
  )}
60
85
  {modalType === "View Address" && <div>address: {address}</div>}
86
+ {modalType === "Select Outbound" && (
87
+ <div>
88
+ <BlockchainSelect onClose={onClose}></BlockchainSelect>
89
+ </div>
90
+ )}
91
+ {modalType === "Onboarding" && (
92
+ <div>
93
+ <Onboarding onClose={onClose}></Onboarding>
94
+ </div>
95
+ )}
61
96
  </ModalBody>
62
97
  <ModalFooter>
63
98
  <Button colorScheme="blue" onClick={onClose}>
@@ -66,7 +101,7 @@ const Home = () => {
66
101
  </ModalFooter>
67
102
  </ModalContent>
68
103
  </Modal>
69
- Context: {context}
104
+ Wallet Context: {context}
70
105
  <Button onClick={() => openModal("Select wallet")}>Select wallet</Button>
71
106
  <br />
72
107
  Asset Context: {assetContext?.name}
@@ -77,9 +112,13 @@ const Home = () => {
77
112
  Select Blockchain
78
113
  </Button>
79
114
  <br />
80
- Address: {address}
115
+ Address for context: {address}
81
116
  <Button onClick={() => openModal("View Address")}>View Address</Button>
82
117
  <br />
118
+ Outbound asset context: {address}
119
+ <Button onClick={() => openModal("Select Outbound")}>Select asset</Button>
120
+ <br />
121
+ <Button onClick={refresh}>refresh</Button>
83
122
  </div>
84
123
  );
85
124
  };