Merge branch 'master' of https://github.com/thecodingwizard/usaco-training-2.0
fix stuff
This commit is contained in:
commit
714139c94e
4 changed files with 61 additions and 2 deletions
35
README.md
35
README.md
|
@ -3,3 +3,38 @@
|
|||
A collection of curated, high-quality resources to take you from Bronze to Platinum.
|
||||
|
||||
All markdown files belong in `content/`. Other files are for the front-end dashboard interface.
|
||||
|
||||
Todo list:
|
||||
- Sidebar for compact modules
|
||||
|
||||
Example Markdown
|
||||
|
||||
```
|
||||
---
|
||||
slug: /intro/getting-started
|
||||
title: Getting Started
|
||||
author: Nathan Wang
|
||||
order: 1
|
||||
prerequisites:
|
||||
-
|
||||
- Dummy prerequisite
|
||||
- https://dummy.prerequisite.link.com/
|
||||
-
|
||||
- Another Prerequisite
|
||||
---
|
||||
|
||||
<ul class="syllabus-only">
|
||||
<li>Contest Format</li>
|
||||
<li>Choosing a Language</li>
|
||||
<li>Practicing and Debugging</li>
|
||||
<li>Contest Strategies</li>
|
||||
</ul>
|
||||
|
||||
<!-- END DESCRIPTION -->
|
||||
|
||||
<details>
|
||||
<summary>Show Solution</summary>
|
||||
|
||||
// Insert OP benq solution here
|
||||
</details>
|
||||
```
|
|
@ -3,6 +3,12 @@ slug: /intro/getting-started
|
|||
title: Getting Started
|
||||
author: Nathan Wang
|
||||
order: 1
|
||||
prerequisites:
|
||||
-
|
||||
- Dummy prerequisite
|
||||
- https://dummy.prerequisite.link.com/
|
||||
-
|
||||
- Another Prerequisite
|
||||
---
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,17 @@ const renderProblem = (problem, idx) => {
|
|||
);
|
||||
};
|
||||
|
||||
const SyllabusModule = ({ title, children, author, problems, url }) => {
|
||||
const renderPrerequisite = (prerequisite) => {
|
||||
const link = prerequisite.length > 1 ? prerequisite[1] : null;
|
||||
return (
|
||||
<li key={prerequisite[0]}>
|
||||
{link && <a href={link} className="text-blue-600">{prerequisite[0]}</a>}
|
||||
{!link && prerequisite[0]}
|
||||
</li>
|
||||
)
|
||||
};
|
||||
|
||||
const SyllabusModule = ({ title, children, author, problems, prerequisites, url }) => {
|
||||
// in the future, fetch this data either from localStorage or from server.
|
||||
const isComplete = title === "Prerequisites" || title === "Getting Started";
|
||||
|
||||
|
@ -42,6 +52,8 @@ const SyllabusModule = ({ title, children, author, problems, url }) => {
|
|||
<div className="px-4 py-4 sm:p-6">
|
||||
{children}
|
||||
|
||||
{prerequisites&&(<>Prerequisites:<ul className="ml-8 list-disc">{prerequisites.map(renderPrerequisite)}</ul></>)}
|
||||
|
||||
{problems&&(<>Problems:<ul className="ml-3 space-y-1 py-2">{problems.map(renderProblem)}</ul></>)}
|
||||
|
||||
{author&&<p className="mt-2">Author: {author}</p>}
|
||||
|
|
|
@ -16,6 +16,7 @@ const renderModule = ({ node }) => {
|
|||
url={data.slug}
|
||||
key={data.slug}
|
||||
problems={data.problems}
|
||||
prerequisites={data.prerequisites}
|
||||
author={data.author}
|
||||
>
|
||||
<Markdown htmlAst={node.excerptAst} className="markdown--syllabus" />
|
||||
|
@ -182,6 +183,7 @@ export const query = graphql`
|
|||
author
|
||||
problems
|
||||
order
|
||||
prerequisites
|
||||
}
|
||||
excerptAst
|
||||
}
|
||||
|
@ -197,6 +199,7 @@ export const query = graphql`
|
|||
author
|
||||
problems
|
||||
order
|
||||
prerequisites
|
||||
}
|
||||
excerptAst
|
||||
}
|
||||
|
@ -212,6 +215,7 @@ export const query = graphql`
|
|||
author
|
||||
problems
|
||||
order
|
||||
prerequisites
|
||||
}
|
||||
excerptAst
|
||||
}
|
||||
|
@ -227,6 +231,7 @@ export const query = graphql`
|
|||
author
|
||||
problems
|
||||
order
|
||||
prerequisites
|
||||
}
|
||||
excerptAst
|
||||
}
|
||||
|
@ -242,6 +247,7 @@ export const query = graphql`
|
|||
author
|
||||
problems
|
||||
order
|
||||
prerequisites
|
||||
}
|
||||
excerptAst
|
||||
}
|
||||
|
|
Reference in a new issue