feat(mobile): add flat pages#393
Conversation
Add a pages module split (web + native) over the shared pages/common fragments/queries, mirroring the comments module. Web: move PageComponent (Markdown body + admin links + comments) into the package so apps consume it from @baseapp-frontend/components/pages/web. Native: PageComponent renders the page title + HTML body via @native-html/render in a scroll view, with web-like vertical rhythm (tight tagsStyles + experimental margin collapsing). The native module exports only PageComponent; the urlPath -> component dispatch is left to consumers so each project can map target types (including custom ones). Adds a native CommentsIcon (ported from web), declares @native-html/render, highlight.js and rehype-highlight on the components package, and exports ./pages/web and ./pages/native. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014UEeymHwwPE1jQKtGpVUAx
Handle <a> taps in the native PageComponent: hrefs starting with '/' route through expo-router; everything else (http, mailto, …) opens via Linking. Port the remaining web navigation icons to native (Forum, Authentication, FlatPage, FeatureRequests, Feedback, ActivityLog) so the mobile sidebar can mirror the web nav. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014UEeymHwwPE1jQKtGpVUAx
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds new “flat pages” UI support to the shared components package, including web + native page rendering and several new native design-system icons that can be used in mobile navigation/menus.
Changes:
- Added multiple new native icons (Activity Log, Authentication, Comments, Feature Requests, Feedback, Flat Page, Forum) and exported them from the native icon barrel.
- Introduced
pages/webandpages/nativemodules withPageComponentimplementations (web usesMarkdownwith syntax highlighting; native renders HTML via@native-html/render). - Updated
packages/componentspackage exports and dependencies to support the new page modules and highlighting/rendering libraries.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/design-system/components/native/icons/index.ts | Exports newly added native icons via the barrel. |
| packages/design-system/components/native/icons/ForumIcon/index.tsx | Adds Forum icon SVG component. |
| packages/design-system/components/native/icons/FlatPageIcon/index.tsx | Adds Flat Page icon SVG component. |
| packages/design-system/components/native/icons/FeedbackIcon/index.tsx | Adds Feedback icon SVG component. |
| packages/design-system/components/native/icons/FeatureRequestsIcon/index.tsx | Adds Feature Requests icon SVG component. |
| packages/design-system/components/native/icons/CommentsIcon/index.tsx | Adds Comments icon SVG component. |
| packages/design-system/components/native/icons/AuthenticationIcon/index.tsx | Adds Authentication icon SVG component. |
| packages/design-system/components/native/icons/ActivityLogIcon/index.tsx | Adds Activity Log icon SVG component. |
| packages/components/package.json | Exposes pages modules and adds deps for native HTML render + code highlighting. |
| packages/components/modules/pages/web/PageComponent/types.ts | Defines Relay fragment prop typing for web PageComponent. |
| packages/components/modules/pages/web/PageComponent/index.tsx | Renders a page on web with Markdown + highlighting and admin links. |
| packages/components/modules/pages/web/index.ts | Exports the web pages module entrypoint. |
| packages/components/modules/pages/native/PageComponent/types.ts | Defines Relay fragment prop typing for native PageComponent. |
| packages/components/modules/pages/native/PageComponent/styles.ts | Adds native styles for page layout/typography. |
| packages/components/modules/pages/native/PageComponent/index.tsx | Renders a page on native using @native-html/render and custom link handling. |
| packages/components/modules/pages/native/PageComponent/constants.ts | Adds native HTML tag spacing constants for consistent layout. |
| packages/components/modules/pages/native/index.ts | Exports the native pages module entrypoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Internal links (href starting with "/") route through expo-router; everything else | ||
| // (http(s), mailto, tel, …) opens in the device's default handler / browser. | ||
| const handleLinkPress = (href?: string) => { | ||
| if (!href) return | ||
| if (href.startsWith('/')) { | ||
| router.push(href as Href) | ||
| } else { | ||
| Linking.openURL(href) | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <ScrollView contentContainerStyle={styles.container}> | ||
| {!!page.title && ( | ||
| <Text variant="h2" style={styles.title}> | ||
| {page.title} | ||
| </Text> | ||
| )} | ||
| <RenderHtml | ||
| contentWidth={width - CONTENT_HORIZONTAL_PADDING * 2} | ||
| source={{ html: page.body ?? '' }} | ||
| baseStyle={styles.body} | ||
| tagsStyles={HTML_TAGS_STYLES} | ||
| renderersProps={{ a: { onPress: (_event, href) => handleLinkPress(href) } }} |
There was a problem hiding this comment.
Fixed in 7ade389 — external links now go through openExternalUrl (utils.ts): only allow-listed schemes (http/https/mailto/tel) are opened, after a Linking.canOpenURL check, and the promise is awaited/caught so file:/custom schemes from page content can't be invoked and there's no unhandled rejection.
The flat-pages feature added @native-html/render, highlight.js, and rehype-highlight to packages/components but never defined their catalog entries in pnpm-workspace.yaml, leaving pnpm-lock.yaml out of date. CI install (--frozen-lockfile) failed, blocking build, unit, and component test jobs. - Add @native-html/render ^1.0.3 to the react-native catalog - Add highlight.js ^11.11.1 and rehype-highlight ^7.0.2 to design-system - Regenerate pnpm-lock.yaml Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- web: Delete admin link pointed at /change/ (the edit page); point it at /delete/ so it opens Django's delete confirmation. - native: harden external link handling — restrict to an allow-list of schemes (http/https/mailto/tel), check Linking.canOpenURL, and await/catch the result so untrusted page content can't invoke file:/custom schemes or trigger unhandled promise rejections. Scheme list lives in constants.ts and the open helper in utils.ts per file-structure conventions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|



No description provided.