From 7eae988704ebc8b510975e505967983269130995 Mon Sep 17 00:00:00 2001 From: Amogh Bharadwaj Date: Mon, 18 Mar 2024 23:35:33 +0530 Subject: [PATCH] Revert "UI: Redirect to peers page by default, add buttons there" (#1500) Reverts PeerDB-io/peerdb#1498 --- ui/app/peers/page.tsx | 68 ++++--------------------------------- ui/app/peers/peersTable.tsx | 3 +- ui/next.config.js | 9 ----- 3 files changed, 9 insertions(+), 71 deletions(-) diff --git a/ui/app/peers/page.tsx b/ui/app/peers/page.tsx index 48394acde7..d7812e54c0 100644 --- a/ui/app/peers/page.tsx +++ b/ui/app/peers/page.tsx @@ -15,8 +15,7 @@ import useSWR from 'swr'; import { fetcher } from '../utils/swr'; export default function Peers() { - const peers: any[] = []; - const { data, error, isLoading } = useSWR('/api/peers', fetcher); + const { data: peers, error, isLoading } = useSWR('/api/peers', fetcher); return ( @@ -40,10 +39,6 @@ export default function Peers() { > Peers - {isLoading && ( @@ -51,61 +46,12 @@ export default function Peers() { )} - {!isLoading && - (peers && peers.length == 0 ? ( -
- - - -
- ) : ( - peer)} /> - ))} + {!isLoading && ( + peer)} + /> + )}
); diff --git a/ui/app/peers/peersTable.tsx b/ui/app/peers/peersTable.tsx index a592d232f3..a49cbd2e53 100644 --- a/ui/app/peers/peersTable.tsx +++ b/ui/app/peers/peersTable.tsx @@ -33,7 +33,7 @@ function PeerRow({ peer }: { peer: Peer }) { ); } -function PeersTable({ peers }: { peers: Peer[] }) { +function PeersTable({ title, peers }: { title: string; peers: Peer[] }) { const [searchQuery, setSearchQuery] = useState(''); const [filteredType, setFilteredType] = useState( undefined @@ -65,6 +65,7 @@ function PeersTable({ peers }: { peers: Peer[] }) { return ( {title}} toolbar={{ left: <>, right: ( diff --git a/ui/next.config.js b/ui/next.config.js index 5212d4780c..a42a10c727 100644 --- a/ui/next.config.js +++ b/ui/next.config.js @@ -3,15 +3,6 @@ const nextConfig = { compiler: { styledComponents: true, }, - async redirects() { - return [ - { - source: '/', - destination: '/peers', - permanent: false, - }, - ]; - }, reactStrictMode: true, swcMinify: true, output: 'standalone',