Skip to content

Commit

Permalink
remove overview from sidebar and default to /network
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Nov 17, 2023
1 parent 9e8c950 commit 91429b6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const EphemeralSection = () => {
return (
<SidebarLink
className="group relative w-full"
to={`network/34`}
to="./network"
key={index}
>
<SidebarIcon name="Globe" />
Expand Down
6 changes: 3 additions & 3 deletions interface/app/$libraryId/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import clsx from 'clsx';
import { Suspense, useEffect, useMemo, useRef } from 'react';
import { Navigate, Outlet, useNavigate } from 'react-router-dom';
import { Navigate, Outlet, useLocation, useNavigate } from 'react-router-dom';
import {
ClientContextProvider,
initPlausible,
Expand Down Expand Up @@ -47,8 +47,8 @@ const Layout = () => {
if (library === null && libraries.data) {
const firstLibrary = libraries.data[0];

if (firstLibrary) return <Navigate to={`/${firstLibrary.uuid}/overview`} replace />;
else return <Navigate to="/" replace />;
if (firstLibrary) return <Navigate to={`/${firstLibrary.uuid}`} replace />;
else return <Navigate to="./network" replace />;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion interface/app/$libraryId/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const explorerRoutes: RouteObject[] = [
{ path: 'location/:id', lazy: () => import('./location/$id') },
{ path: 'node/:id', lazy: () => import('./node/$id') },
{ path: 'tag/:id', lazy: () => import('./tag/$id') },
{ path: 'network/:id', lazy: () => import('./network') }
{ path: 'network', lazy: () => import('./network') }
// { path: 'search/:id', lazy: () => import('./search') }
];

Expand Down
17 changes: 2 additions & 15 deletions interface/app/$libraryId/network.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { memo, Suspense, useDeferredValue, useMemo } from 'react';
import { useMemo } from 'react';
import { useDiscoveredPeers } from '@sd/client';
import { PathParamsSchema, type PathParams } from '~/app/route-schemas';
import { Icon } from '~/components';
import { useZodSearchParams } from '~/hooks';
import { useRouteTitle } from '~/hooks/useRouteTitle';

import Explorer from './Explorer';
Expand All @@ -12,7 +10,7 @@ import { DefaultTopBarOptions } from './Explorer/TopBarOptions';
import { useExplorer, useExplorerSettings } from './Explorer/useExplorer';
import { TopBarPortal } from './TopBar/Portal';

const Network = memo((props: { args: PathParams }) => {
export const Component = () => {
const title = useRouteTitle('Network');

const discoveredPeers = useDiscoveredPeers();
Expand Down Expand Up @@ -71,15 +69,4 @@ const Network = memo((props: { args: PathParams }) => {
/>
</ExplorerContextProvider>
);
});

export const Component = () => {
const [pathParams] = useZodSearchParams(PathParamsSchema);
const path = useDeferredValue(pathParams);

return (
<Suspense>
<Network args={path} />
</Suspense>
);
};
2 changes: 1 addition & 1 deletion interface/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Index = () => {

const libraryId = currentLibrary ? currentLibrary.uuid : libraries.data[0]?.uuid;

return <Navigate to={`${libraryId}/ephemeral/0`} replace />;
return <Navigate to={`${libraryId}/network`} replace />;
};

const Wrapper = () => {
Expand Down

0 comments on commit 91429b6

Please sign in to comment.