Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions apps/api/interfaces/partial-meta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface PartialMeta {
name: string;
dashedName: string;
blockLabel?: string;
challengeOrder: { id: string; title: string }[];
}
4 changes: 3 additions & 1 deletion apps/api/utils/get-steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type StepLocation = {
steps: Step[];
currentBlock: string;
currentSuperBlock: string;
currentBlockLabel?: string;
};

export const getSteps = async (
Expand Down Expand Up @@ -76,6 +77,7 @@ export const getSteps = async (
return {
steps: steps,
currentBlock: blockMetaData.name,
currentSuperBlock: introData[sup]?.title
currentSuperBlock: introData[sup]?.title,
currentBlockLabel: blockMetaData.blockLabel
};
};
1 change: 1 addition & 0 deletions apps/client/interfaces/challenge-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export interface ChallengeDataWithBlock {
steps: ChallengeData[];
currentBlock: string;
currentSuperBlock: string;
currentBlockLabel?: string;
}
66 changes: 54 additions & 12 deletions apps/client/src/components/block/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const Block = () => {
const [items, setItems] = useState([] as ChallengeData[]);
const [blockName, setBlockName] = useState('');
const [superBlockName, setSuperBlockName] = useState('');
const [blockLabel, setBlockLabel] = useState('');
const params = useParams() as { superblock: string; block: string };

useEffect(() => {
Expand All @@ -46,6 +47,7 @@ const Block = () => {
setItems(superblocks.steps);
setBlockName(superblocks.currentBlock);
setSuperBlockName(superblocks.currentSuperBlock);
setBlockLabel(superblocks.currentBlockLabel || '');
},
(error: Error) => {
setLoading(false);
Expand All @@ -65,9 +67,11 @@ const Block = () => {
params.superblock
);

const isTaskBasedSuperblock = taskBasedSuperblocks.includes(
params.superblock
);
const isWorkshopBlock = blockLabel === 'workshop' || isStepBasedSuperblock;

// quiz blocks have a single challenge and don't use task-style scripts
const isTaskBasedBlock =
taskBasedSuperblocks.includes(params.superblock) && blockLabel !== 'quiz';

return (
<div>
Expand All @@ -76,7 +80,7 @@ const Block = () => {
<ul className='step-grid'>
{items.map((challenge, i) => (
<li key={challenge.name}>
{!isStepBasedSuperblock && <span>{`${i + 1}: `}</span>}
{!isWorkshopBlock && <span>{`${i + 1}: `}</span>}
<Link
to={`/${params.superblock}/${params.block}/${challenge.path}`}
>
Expand All @@ -90,14 +94,52 @@ const Block = () => {
</p>
<hr />
<h2>Project Controls</h2>
{isStepBasedSuperblock ? (
<p>
Looking to add, remove, or edit steps?{' '}
<Link to={`/${params.superblock}/${params.block}/_tools`}>
Use the step tools.
</Link>
</p>
) : isTaskBasedSuperblock ? (
{isWorkshopBlock ? (
<>
<p>
Looking to add or remove workshop steps? Navigate to <br />
<code>
curriculum/challenges/english/blocks
{`/${params.block}`}
</code>
<br />
in your terminal and run the following commands:
</p>
<ul>
<li>
<code>pnpm create-next-step</code>: Create a new step at the end
of this workshop.
</li>
<li>
<code>pnpm create-empty-steps &lt;n&gt;</code>: Create{' '}
<code>n</code> empty steps at the end of this workshop.
</li>
<li>
<code>pnpm insert-step &lt;n&gt;</code>: Insert a new step at
position <code>n</code> in this workshop.
</li>
<li>
<code>pnpm delete-step &lt;n&gt;</code>: Delete step{' '}
<code>n</code> from this workshop.
</li>
<li>
<code>pnpm update-step-titles</code>: Reorder step titles after
changes.
</li>
</ul>
<p>
Or{' '}
<Link to={`/${params.superblock}/${params.block}/_tools`}>
use the step tools in this editor
</Link>
.
</p>
<p>
Refresh the page after running a command to see the changes
reflected.
</p>
</>
) : isTaskBasedBlock ? (
<>
<p>
Looking to add or remove challenges? Navigate to <br />
Expand Down
67 changes: 55 additions & 12 deletions apps/client/src/components/chapter-based-block/chapter-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const stepBasedSuperblocks = [
const taskBasedSuperblocks = [
'a2-english-for-developers',
'b1-english-for-developers',
'a1-professional-spanish',
'a2-professional-spanish',
'a2-professional-chinese',
'a1-professional-chinese'
Expand All @@ -27,6 +28,7 @@ const ChapterBasedBlock = () => {
const [loading, setLoading] = useState(false);
const [blockName, setBlockName] = useState('');
const [superBlockName, setSuperBlockName] = useState('');
const [blockLabel, setBlockLabel] = useState('');
const [items, setItems] = useState([] as ChallengeData[]);
const params = useParams() as {
superblock: string;
Expand All @@ -50,6 +52,7 @@ const ChapterBasedBlock = () => {
setItems(superblocks.steps);
setBlockName(superblocks.currentBlock);
setSuperBlockName(superblocks.currentSuperBlock);
setBlockLabel(superblocks.currentBlockLabel || '');
},
(error: Error) => {
setLoading(false);
Expand All @@ -69,9 +72,11 @@ const ChapterBasedBlock = () => {
params.superblock
);

const isTaskBasedSuperblock = taskBasedSuperblocks.includes(
params.superblock
);
const isWorkshopBlock = blockLabel === 'workshop' || isStepBasedSuperblock;

// quiz blocks have a single challenge and don't use task-style scripts
const isTaskBasedBlock =
taskBasedSuperblocks.includes(params.superblock) && blockLabel !== 'quiz';

return (
<div>
Expand All @@ -80,7 +85,7 @@ const ChapterBasedBlock = () => {
<ul className='step-grid'>
{items.map((challenge, i) => (
<li key={challenge.name}>
{!isStepBasedSuperblock && <span>{`${i + 1}: `}</span>}
{!isWorkshopBlock && <span>{`${i + 1}: `}</span>}
<Link
to={`/${params.superblock}/${params.block}/${challenge.path}`}
>
Expand All @@ -94,14 +99,52 @@ const ChapterBasedBlock = () => {
</p>
<hr />
<h2>Project Controls</h2>
{isStepBasedSuperblock ? (
<p>
Looking to add, remove, or edit steps?{' '}
<Link to={`/${params.superblock}/${params.block}/_tools`}>
Use the step tools.
</Link>
</p>
) : isTaskBasedSuperblock ? (
{isWorkshopBlock ? (
<>
<p>
Looking to add or remove workshop steps? Navigate to <br />
<code>
curriculum/challenges/english/blocks
{`/${params.block}`}
</code>
<br />
in your terminal and run the following commands:
</p>
<ul>
<li>
<code>pnpm create-next-step</code>: Create a new step at the end
of this workshop.
</li>
<li>
<code>pnpm create-empty-steps &lt;n&gt;</code>: Create{' '}
<code>n</code> empty steps at the end of this workshop.
</li>
<li>
<code>pnpm insert-step &lt;n&gt;</code>: Insert a new step at
position <code>n</code> in this workshop.
</li>
<li>
<code>pnpm delete-step &lt;n&gt;</code>: Delete step{' '}
<code>n</code> from this workshop.
</li>
<li>
<code>pnpm update-step-titles</code>: Reorder step titles after
changes.
</li>
</ul>
<p>
Or{' '}
<Link to={`/${params.superblock}/${params.block}/_tools`}>
use the step tools in this editor
</Link>
.
</p>
<p>
Refresh the page after running a command to see the changes
reflected.
</p>
</>
) : isTaskBasedBlock ? (
<>
<p>
Looking to add or remove challenges? Navigate to <br />
Expand Down
Loading