-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix the reloading because of the breadcrumbs
- Loading branch information
1 parent
3e67689
commit e0b7940
Showing
7 changed files
with
96 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/apps/dev-wallet/src/Components/Aside/views/AddNetwork.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { networkRepository } from '@/modules/network/network.repository'; | ||
import { useWallet } from '@/modules/wallet/wallet.hook'; | ||
import { | ||
INetworkWithOptionalUuid, | ||
NetworkForm, | ||
} from '@/pages/networks/Components/network-form'; | ||
import { useLayout } from '@kadena/kode-ui/patterns'; | ||
import { useMemo } from 'react'; | ||
|
||
const getNewNetwork = (): INetworkWithOptionalUuid => ({ | ||
uuid: undefined, | ||
networkId: '', | ||
name: '', | ||
hosts: [ | ||
{ | ||
url: '', | ||
submit: false, | ||
read: false, | ||
confirm: false, | ||
}, | ||
], | ||
}); | ||
|
||
const AddNetwork = ({ networkUuid }: { networkUuid: string }) => { | ||
const { handleSetAsideExpanded } = useLayout(); | ||
const { getNetwork } = useWallet(); | ||
|
||
const network = useMemo(() => { | ||
return getNetwork(networkUuid) ?? getNewNetwork(); | ||
}, [networkUuid]); | ||
|
||
return ( | ||
<> | ||
<NetworkForm | ||
onSave={async (updNetwork) => { | ||
if (updNetwork.uuid) { | ||
await networkRepository.updateNetwork(updNetwork); | ||
} else { | ||
await networkRepository.addNetwork({ | ||
...updNetwork, | ||
uuid: crypto.randomUUID(), | ||
}); | ||
} | ||
handleSetAsideExpanded(false); | ||
}} | ||
network={network} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default AddNetwork; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters