Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gatsby-admin): list all pages of site #25744

Merged
merged 1 commit into from
Jul 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions packages/gatsby-admin/src/pages/index.tsx
Original file line number Diff line number Diff line change
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