Skip to content

Commit

Permalink
remove links from datagraph root
Browse files Browse the repository at this point in the history
  • Loading branch information
Southclaws committed Jun 23, 2024
1 parent d461508 commit 65fd737
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
19 changes: 19 additions & 0 deletions web/src/components/directory/DirectoryEmptyState.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Empty } from "src/components/site/Empty";

import { Center } from "@/styled-system/jsx";

export function DirectoryEmptyState() {
return (
<Center h="full">
<Empty>
This community knowledgebase is empty.
<br />
{session ? (
<>Be the first to contribute!</>
) : (
<>Please log in to contribute.</>
)}
</Empty>
</Center>
);
}
45 changes: 12 additions & 33 deletions web/src/screens/directory/datagraph/DatagraphIndexScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import { Breadcrumbs } from "src/components/directory/datagraph/Breadcrumbs";
import { NodeCardRows } from "src/components/directory/datagraph/NodeCardList";
import { LinkResultList } from "src/components/directory/links/LinkIndexView/LinkResultList";
import { Empty } from "src/components/site/Empty";
import { Unready } from "src/components/site/Unready";

import { DirectoryEmptyState } from "@/components/directory/DirectoryEmptyState";
import { Heading } from "@/components/ui/heading";
import { Center, VStack } from "@/styled-system/jsx";
import { LStack, VStack } from "@/styled-system/jsx";

import { Props, useDatagraphIndexScreen } from "./useDatagraphIndexScreen";

Expand All @@ -16,46 +15,26 @@ export function Client(props: Props) {

if (!ready) return <Unready {...error} />;

const { nodes, links } = data;
const { nodes } = data;

return (
<VStack w="full" alignItems="start" gap="4">
<LStack gap="4">
<Breadcrumbs directoryPath={[]} visibility="draft" create="show" />

{empty ? (
<Center h="full">
<Empty>
This community knowledgebase is empty.
<br />
{session ? (
<>Be the first to contribute!</>
) : (
<>Please log in to contribute.</>
)}
</Empty>
</Center>
<DirectoryEmptyState />
) : (
<p>You can browse the community&apos;s knowledgebase here.</p>
)}

{links.data.results > 0 && (
<VStack w="full" alignItems="start">
<Heading>New links</Heading>
<LinkResultList links={links.data} show={3} />
</VStack>
)}

{nodes.data.nodes.length > 0 && (
<VStack w="full" alignItems="start">
<Heading>Knowledgebase</Heading>
<NodeCardRows
directoryPath={[]}
context="directory"
size="small"
{...nodes.data}
/>
</VStack>
<NodeCardRows
directoryPath={[]}
context="directory"
size="small"
{...nodes.data}
/>
)}
</VStack>
</LStack>
);
}

0 comments on commit 65fd737

Please sign in to comment.