[add] Recipe & Policy pages migrated from OSB main site#1
Conversation
TechQuery
left a comment
There was a problem hiding this comment.
@copilot /pages/wiki 抄哪儿去了?如果你没抄漏的话,你就不会擅自修改这里:
https://github.com/Open-Source-Bazaar/Open-Source-Bazaar.github.io/blob/cd2371d89ee329f958908f0288359b0ca5467cc6/models/Wiki.ts#L22-L28
已补充遗漏的内容(commit
|
已修复(commit |
There was a problem hiding this comment.
Pull request overview
This PR ports the wiki/recipe/policy page stack from the main site into this repo, adding GitHub-backed content models/stores, shared tree UI, new routes for browsing/rendering Markdown content, and the required i18n keys.
Changes:
- Added GitHub
ContentModel-based stores and extended content typing (XContent) alongside existing Lark wiki/document stores. - Introduced recipe and policy index/detail pages that statically render GitHub-hosted Markdown (with front-matter metadata).
- Added a shared
ContentTreecomponent and expanded translations (en-US / zh-CN / zh-TW).
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| translation/zh-TW.ts | Adds Wiki/Recipe translation keys (Traditional Chinese). |
| translation/zh-CN.ts | Adds Wiki/Recipe translation keys (Simplified Chinese). |
| translation/en-US.ts | Adds Wiki/Recipe translation keys (English). |
| pages/wiki/index.tsx | Updates wiki store import to named export. |
| pages/wiki/[node_token]/index.tsx | Switches document/wiki store imports to new exports in models/Wiki.ts. |
| pages/wiki/[node_token]/debugger.tsx | Switches document/wiki store imports to new exports in models/Wiki.ts. |
| pages/recipe/index.tsx | Adds recipe index page with GitHub-backed tree listing. |
| pages/recipe/[...slug].tsx | Adds recipe detail page rendering Markdown + metadata + GitHub links. |
| pages/policy/index.tsx | Adds policy index page with GitHub-backed tree listing. |
| pages/policy/[...slug].tsx | Adds policy detail page rendering Markdown + metadata + GitHub links. |
| pages/api/core.ts | Adds filterMarkdownFiles() helper and parses front-matter into meta. |
| models/Wiki.ts | Adds GitHub content stores and consolidates wiki/document stores into this module. |
| models/Document.ts | Removes now-redundant document store module (moved into models/Wiki.ts). |
| components/Layout/ContentTree.tsx | Adds reusable recursive tree renderer for content nodes + metadata badges. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| <Alert variant="info" className="mb-4"> | ||
| 本菜谱原创自 | ||
| <Alert.Link href="https://www.lxjchina.com.cn/display_4226.html" target="_blank"> |
| 《老乡鸡菜品溯源报告》 | ||
| </Alert.Link> | ||
| ,并由{' '} | ||
| <Alert.Link href="https://github.com/Gar-b-age/CookLikeHOC" target="_blank"> |
| <Alert variant="info" className="mb-4"> | ||
| 本菜谱原创自 | ||
| <Alert.Link href="https://www.lxjchina.com.cn/display_4226.html" target="_blank"> | ||
| 《老乡鸡菜品溯源报告》 | ||
| </Alert.Link> |
| .filter( | ||
| ({ type, name, path }) => | ||
| type === 'file' && !name.startsWith('.') && !path.startsWith('index.'), | ||
| ) |
| </div> | ||
| </header> | ||
|
|
||
| <div dangerouslySetInnerHTML={{ __html: content || '' }} className="markdown-body" /> |
| export const filterMarkdownFiles = (nodes: Content[]) => | ||
| nodes | ||
| .filter( | ||
| ({ path, type, name }) => | ||
| !path.startsWith('.') && |
[optimize] update Upstream packages
…ES decorator [remove] useless Rich-text Editor example page & packages
Ports the
wiki,recipe, andpolicypage stack fromOpen-Source-Bazaar/Open-Source-Bazaar.github.iointo this repo, including data-access models, utility helpers, a shared component, and all three locale translation keys.Models & API helpers
models/Wiki.ts: AddedXContent(extendsmobx-githubContentwithmetaandchildren),policyContentStore(fpsig/open-source-policy),recipeContentStore(Gar-b-age/CookLikeHOC), and namedwikiStoreexport (default export preserved for existing wiki pages)pages/api/core.ts: AddedfilterMarkdownFiles()— filters a GitHub content tree to markdown files and pre-parses front-matter intometaNew component
components/Layout/ContentTree.tsx: Recursive tree renderer for GitHub content nodes; shows metadata as aBadgeper node, used by both recipe and policy index pagesNew pages
/recipe/recipe/[...slug]/policy/policy/[...slug]Translation keys (en-US / zh-CN / zh-TW)
Added under
// Wikiand// Recipesections:knowledge_base,contribute_content,no_docs_available,docs_auto_load_from_github,policy,creation_date,publication_date,edit_on_github,view_original,github_document_description,view_or_edit_on_github,recipe,servings,preparation_timeOriginal prompt
Human changes