Skip to content

feat: add instructions guide link and update demo instructions - #1603

Merged
maxelkins merged 10 commits into
mainfrom
instructions-guide-link
Aug 20, 2026
Merged

feat: add instructions guide link and update demo instructions#1603
maxelkins merged 10 commits into
mainfrom
instructions-guide-link

Conversation

@maxelkins

@maxelkins maxelkins commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🤖 Created with AI assistance
👨‍💻 Edited, reviewed and steered by @maxelkins

Summary

Teachers writing project instructions had no pointer from the editor to the help centre guide on writing them, so the instructions panel header now links to it. The link is gated on instructionsEditable, which hosts set only for people authoring instructions, so students never see it.

Changes

  • Add a headerContent prop to SidebarPanel so panels can put arbitrary content in their header, not just buttons
  • Link the instructions panel header to the help centre guide whenever instructions are editable
  • Style the link with the design system's rpf-link rather than a bespoke class
  • Add the instructionsPanel.guideLink string to en.json
    • Checked formatting with Sasha

Note

The instruction styles aren't great. There is weird spacing etc. But thats a bigger job for another issue.

Screenshots

Screenshot 2026-08-20 at 11 32 31 Screenshot 2026-08-20 at 11 32 21 Screenshot 2026-08-20 at 11 32 56 Screenshot 2026-08-20 at 11 33 19

@maxelkins
maxelkins temporarily deployed to previews/1603/merge August 18, 2026 14:32 — with GitHub Actions Inactive
@maxelkins
maxelkins force-pushed the instructions-guide-link branch from e01afaa to 2b005b5 Compare August 18, 2026 14:50
@maxelkins
maxelkins temporarily deployed to previews/1603/merge August 18, 2026 14:50 — with GitHub Actions Inactive
@maxelkins
maxelkins temporarily deployed to previews/1603/merge August 19, 2026 10:03 — with GitHub Actions Inactive
@maxelkins
maxelkins temporarily deployed to previews/1603/merge August 20, 2026 10:25 — with GitHub Actions Inactive
@maxelkins
maxelkins temporarily deployed to previews/1603/merge August 20, 2026 10:26 — with GitHub Actions Inactive
@maxelkins
maxelkins temporarily deployed to previews/1603/merge August 20, 2026 10:27 — with GitHub Actions Inactive
@maxelkins
maxelkins temporarily deployed to previews/1603/merge August 20, 2026 10:32 — with GitHub Actions Inactive
@maxelkins
maxelkins marked this pull request as ready for review August 20, 2026 10:35
maxelkins and others added 7 commits August 20, 2026 11:46
Panels could only add buttons to their header. A `headerContent` node prop lets a panel put anything else there - a link, status text, a filter control - rendered as-is below the heading and buttons, with the panel owning its styling.

The alternative was to keep reusing the existing `buttons` slot, which does accept arbitrary nodes, but it is named and laid out for buttons and forms part of the host sidebar-plugin contract, so overloading it would blur both. `buttons` is left untouched, so the other panels and existing plugins are unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Teachers writing project instructions had no pointer from the editor to the help centre guide on how to write them, so the instructions panel header now links to it.

The link is gated on `instructionsEditable` rather than a new teacher flag. There is no role concept in this codebase; hosts set `editable_instructions` only for people authoring instructions, so it is already the de facto teacher signal, and reusing it keeps the gate consistent with the rest of the panel's edit UI. A dedicated attribute would have meant plumbing through web-component.jsx, WebComponentLoader and WebComponentProject for no difference in behaviour today.

Styled with the design system's `rpf-link` rather than a bespoke class, so it picks up link colours and focus states in both themes for free.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The demo instructions a teacher gets when they first enable instructions described three Markdown features and demonstrated none of them. Because the panel renders the content, the document can be its own worked example: a teacher toggling between Edit and View sees the syntax and the result side by side, with no screenshots to keep in sync. The rewrite covers every feature the renderer actually supports — text styling, headings, paragraphs and line breaks, lists, links, inline code, code blocks, block-type colouring, real blocks, and escaping — and opens by telling the teacher to replace the text, since many will start typing at the top and never scroll.

Every line of prose is a translation key, so translators receive whole sentences rather than fragments to reassemble. The alternative was keeping the Markdown markers in the template and keying only the words between them, which would stop a translator breaking a `**` pair, but it splits most sentences into two or three keys and makes the template hard to read. Whole lines won on clarity.

The human-facing strings inside the two code examples are translated too, but the surrounding code is not: scratchblocks only draws real blocks when the block wording matches the editor exactly, so a translated `say` or `when green flag clicked` would render as an unrecognised grey block.

The Python greeting uses an f-string, `print(f"{{...pythonGreeting}}")` with the key holding `Hello, {name}`, rather than the concatenation it replaces. Keying `"Hello, "` for use with `+ name` would have put grammar in the template and a trailing space at the end of a translation string, where it is likely to be trimmed. The f-string hands the translator the punctuation, the spacing and the word order together. `populateMarkdownTemplate` only substitutes double-braced placeholders, so the single-braced `{name}` reaches the rendered Python untouched.

Only en.json is updated; Crowdin overwrites the other locales, and missing keys fall back to English until it syncs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@maxelkins
maxelkins force-pushed the instructions-guide-link branch from 512a8c4 to f7e32c3 Compare August 20, 2026 10:46
@maxelkins
maxelkins temporarily deployed to previews/1603/merge August 20, 2026 10:46 — with GitHub Actions Inactive

@cocomarine cocomarine left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/assets/markdown/demoInstructions.md Outdated
Comment on lines +49 to +62
## {{instructionsPanel.demoInstructions.colouringHeading}}

{{instructionsPanel.demoInstructions.colouring}}

## {{instructionsPanel.demoInstructions.realBlocksHeading}}

{{instructionsPanel.demoInstructions.realBlocks}}

```blocks
when green flag clicked
say [{{instructionsPanel.demoInstructions.blocksGreeting}}] for (2) seconds
```

{{instructionsPanel.demoInstructions.blockSyntaxReference}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be confusing to people adding instruction to python/html projects?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah take your point. We could have different instructions per project type. But I think I'm comfortable enough for it to stay in for now but I'll add a bit about it being useful in Blocks projects.

@maxelkins maxelkins changed the title feat: add instructions guide link feat: add instructions guide link and update demo instructions Aug 20, 2026
@maxelkins
maxelkins temporarily deployed to previews/1603/merge August 20, 2026 13:12 — with GitHub Actions Inactive
@maxelkins
maxelkins temporarily deployed to previews/1603/merge August 20, 2026 13:16 — with GitHub Actions Inactive
@maxelkins
maxelkins merged commit 77a22c1 into main Aug 20, 2026
11 checks passed
@maxelkins
maxelkins deleted the instructions-guide-link branch August 20, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants