Skip to content

Commit

Permalink
feat(gatsby-admin): list all pages of site (#25744)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxstbr committed Jul 21, 2020
1 parent de087b0 commit a0c70d0
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions packages/gatsby-admin/src/pages/index.tsx
Expand Up @@ -163,6 +163,11 @@ const Index: React.FC<{}> = () => {
const [{ data, fetching, error }] = useQuery({
query: `
{
allGatsbyPage {
nodes {
path
}
}
allGatsbyPlugin {
nodes {
name
Expand All @@ -182,26 +187,30 @@ const Index: React.FC<{}> = () => {

return (
<Flex gap={7} flexDirection="column" sx={{ paddingY: 7, paddingX: 6 }}>
<SectionHeading>Plugins</SectionHeading>
<Grid gap={6} columns={[1, 1, 1, 2, 3]}>
{data.allGatsbyPlugin.nodes
.filter(plugin => plugin.name.indexOf(`gatsby-plugin`) === 0)
.map(plugin => (
<PluginCard key={plugin.id} plugin={plugin} />
<SectionHeading>Pages</SectionHeading>
<ul sx={{ pl: 0, listStyle: `none` }}>
{data.allGatsbyPage.nodes
.filter(page => page.path.indexOf(`/dev-404-page/`) !== 0)
.sort((a, b) => a.path.localeCompare(b.path))
.map(page => (
<li
key={page.path}
sx={{
py: 1,
}}
>
{page.path}
</li>
))}
</Grid>
<InstallInput for="plugin" />
</ul>

<SectionHeading>Themes</SectionHeading>
<SectionHeading>Installed Plugins</SectionHeading>
<Grid gap={6} columns={[1, 1, 1, 2, 3]}>
{data.allGatsbyPlugin.nodes
.filter(plugin => plugin.name.indexOf(`gatsby-theme`) === 0)
.map(plugin => (
<PluginCard key={plugin.id} plugin={plugin} />
))}
{data.allGatsbyPlugin.nodes.map(plugin => (
<PluginCard key={plugin.id} plugin={plugin} />
))}
</Grid>

<InstallInput for="theme" />
<InstallInput for="plugin" />
</Flex>
)
}
Expand Down

0 comments on commit a0c70d0

Please sign in to comment.