From 2b636c5f6d003c0584261db2f0b4cb5d62478f1a Mon Sep 17 00:00:00 2001 From: aman035 Date: Fri, 5 Jul 2024 13:42:38 +0530 Subject: [PATCH] chore: fix dapp issues --- .../examples/dnode-dapp/package-lock.json | 8 +- packages/examples/dnode-dapp/package.json | 2 +- packages/examples/dnode-dapp/public/user.png | Bin 0 -> 2331 bytes .../dnode-dapp/src/components/SearchBar.tsx | 19 ++-- .../src/pages/pushscan/[address].tsx | 34 +++++++ .../dnode-dapp/src/pages/pushscan/index.tsx | 94 +++++++++++++++--- 6 files changed, 128 insertions(+), 29 deletions(-) create mode 100644 packages/examples/dnode-dapp/public/user.png create mode 100644 packages/examples/dnode-dapp/src/pages/pushscan/[address].tsx diff --git a/packages/examples/dnode-dapp/package-lock.json b/packages/examples/dnode-dapp/package-lock.json index 1ad0b56ff..006de4114 100644 --- a/packages/examples/dnode-dapp/package-lock.json +++ b/packages/examples/dnode-dapp/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@headlessui/react": "^2.1.1", "@heroicons/react": "^2.1.4", - "@pushprotocol/dnode": "^0.0.2", + "@pushprotocol/dnode": "^0.0.3", "@rainbow-me/rainbowkit": "^2.1.3", "@tailwindcss/forms": "^0.5.7", "@tanstack/react-query": "^5.28.4", @@ -3719,9 +3719,9 @@ } }, "node_modules/@pushprotocol/dnode": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@pushprotocol/dnode/-/dnode-0.0.2.tgz", - "integrity": "sha512-ok+W/RBobXCT1giFkpowwW8Jt2w8x2RWx4f0t5Xw6BbMB545ria/+jPagH5DG7SZN7vAn/VbCo2PkrKecesfIQ==", + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@pushprotocol/dnode/-/dnode-0.0.3.tgz", + "integrity": "sha512-rsE1Czeb/+3lmlPIAlTw/bcM7gxZfWHcRuJQQao4YU6FbzZwD1bXY0bukgt08V73Pvp40heFCnHC7UUeaWmozg==", "dependencies": { "@metamask/eth-sig-util": "^5.0.2", "buffer": "^6.0.3", diff --git a/packages/examples/dnode-dapp/package.json b/packages/examples/dnode-dapp/package.json index 39f9fec23..f96927e72 100644 --- a/packages/examples/dnode-dapp/package.json +++ b/packages/examples/dnode-dapp/package.json @@ -10,7 +10,7 @@ "dependencies": { "@headlessui/react": "^2.1.1", "@heroicons/react": "^2.1.4", - "@pushprotocol/dnode": "^0.0.2", + "@pushprotocol/dnode": "^0.0.3", "@rainbow-me/rainbowkit": "^2.1.3", "@tailwindcss/forms": "^0.5.7", "@tanstack/react-query": "^5.28.4", diff --git a/packages/examples/dnode-dapp/public/user.png b/packages/examples/dnode-dapp/public/user.png new file mode 100644 index 0000000000000000000000000000000000000000..ee78302d079b6fb088d7fba59432280a0e882184 GIT binary patch literal 2331 zcmV+$3FP*PP)wg_O^O65MIeM| zAc87|QcA5NmO>Fr<+zkuZB-&@LvTvszB_i}Hc4rnjkqpp8aqz2xQ=5dj-AC$-MY0M zCtl-ypZU;v*P&VNygbMDd-uLOpL8X!_ntZ5%$d1ozB7+80|NsC0|NsC0|NsC58}>3 zypQK$J{Ne9+p^FS@+h}uvnAw^CFD34vd0qgxMj<&Tp-J`v4~}3UZU+z3WRK=Swf!X zLScHBY_V*)!m{z1M7P1;J>QmZP2c$!UA7#vgv|ZYbNFbY+v7W=3h)^@|575lco=sj zx=p^qP3!PkZc8<5BnSl>4U4mJU839Od6c!|`h89K=RG@Smw*Tfwk%E$ur$_ESLNafMB_3I#_MM76@2N`+N#DE#e! zLS~7I5EcUoYu#)JEE>C!+R%xf6CJ>@bHGeUc;a=1-|kfSO2O5Lz_LWQ+Y@MS$MsD; zsBi2B8oGelA|b292}@BX7;xG@S=#n}kP7qm#geT*HEljzQeq)(_d* z56l$_G!kyrh9fx|%EgT=sOTKVmX0Cd>;N#AB+#6oTOnDt{3{D01_toSo?%RM4FmBY z;kz$t-;|pJnZO$u!2^Ax!1)m%9wg8bRW}!e1a4tL!{9i!_KyMaBtbtRV>t^Nh9=N7 zI1a>O+At(*S+au*x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;I z!eg)NlXjLZH!!b&&RWx*a=v(jLSv8rNXR*)uyDP0@>QNI>gKjA(B({S+xT9smmf&T zsRS13obQC6^~`JFYw?L_y8Z?06ber|&i5(_#ixNs%7B|SlkQaL>7ceUFCvtOuR9;A zqi+Bm%JF88_ej`O2Q1YrH!oUtj)w$pV_rr`;1^f>)C=0R$|`f_hD4LF2#zi3)U$- z@T$UwI;XmwYJg{p1R`MfTfnMAz`ZXkd^t*tcL_Vasd@N5^CMCOzHqIZ^|uzNNX_r# z`<>e0osB?w3vl!tP~Q!-^Z}hyRq<5BUEA*bo+i{SCxO+K!16r`%eE=p5_Lrrb+uD< zQy8CTzArxw<9CS?YVm8hNEt_^PDxeHnjXfdEL-MK)ncL@%=O`Bm~13lS+atv7P*j5 zShhUlp&oyRY)Wd!YeLf!%a+euwmcty$IG6`v%^@DRH5ct5A;qAV==cUv$>Fab^FXS zx@_5R*|LnDVddd#>0!J-(e3swvN10$7hj~K1!ywlLWV6{?zDv5&uv)~`GC(W>xAiN zHS{<1x6c0{lkP$HGIhfS1_lNO1_lNO1_sO{_#aS;3MqpeCXE09002ovPDHLkV1mRy BQN#cM literal 0 HcmV?d00001 diff --git a/packages/examples/dnode-dapp/src/components/SearchBar.tsx b/packages/examples/dnode-dapp/src/components/SearchBar.tsx index 8f8ab9520..936a1530d 100644 --- a/packages/examples/dnode-dapp/src/components/SearchBar.tsx +++ b/packages/examples/dnode-dapp/src/components/SearchBar.tsx @@ -1,18 +1,15 @@ -// components/SearchBar.tsx - import React, { useState } from 'react'; -import { MagnifyingGlassIcon } from '@heroicons/react/24/outline'; // Import MagnifyingGlassIcon from Heroicons v2 - -interface SearchBarProps { - onSearch: (searchTerm: string) => void; // Callback function to handle search -} +import { MagnifyingGlassIcon } from '@heroicons/react/24/outline'; +import { useRouter } from 'next/router'; -const SearchBar: React.FC = ({ onSearch }) => { +const SearchBar: React.FC = () => { const [searchTerm, setSearchTerm] = useState(''); + const router = useRouter(); const handleSearch = () => { if (searchTerm.trim()) { - onSearch(searchTerm); + // Navigate to the search results page + router.push(`/pushscan/${encodeURIComponent(searchTerm.trim())}`); } }; @@ -24,15 +21,13 @@ const SearchBar: React.FC = ({ onSearch }) => { return (
- {' '} - {/* max-w-lg to reduce width */} setSearchTerm(e.target.value)} - onKeyDown={handleKeyDown} // Use onKeyDown instead of onKeyPress + onKeyDown={handleKeyDown} /> + )} + {page * size < total && ( + + )} +
); }