Conversation
…ed user experience
There was a problem hiding this comment.
Pull request overview
This PR enhances the Demo module landing page by surfacing the latest Blog posts (when the Blog module is enabled) and aligns supporting infrastructure (navigation ordering and CI dependencies) to accommodate the new cross-module integration.
Changes:
- Fetch the 3 most recent published Blog posts (with category + author) in
DemoControllerand pass them to the Inertia page aslatestPosts. - Render a new
LatestPostsSectionon the Demo index page whenlatestPostsis present. - Update landing navigation item ordering and expand CI workflow dependencies for the Demo module.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
app/Http/Controllers/DemoController.php |
Adds backend query + DTO mapping for latest blog posts and exposes them to the Demo Inertia page. |
resources/js/pages/Index.vue |
Accepts latestPosts prop and conditionally renders LatestPostsSection. |
routes/navigation.php |
Adjusts ordering of Docs/GitHub navigation entries. |
.github/workflows/test.yml |
Adds explicit module dependencies for the Demo module CI run. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import HeroSection from './sections/HeroSection.vue'; | ||
| import Testimonial from './sections/Testimonial.vue'; | ||
|
|
||
| defineProps<{ | ||
| products?: Product[]; | ||
| latestPosts?: Modules.Blog.Data.PostData[]; |
There was a problem hiding this comment.
The latestPosts prop is typed as Modules.Blog.Data.PostData[], but this module doesn’t define that ambient Modules.* TypeScript namespace anywhere (and the existing products prop uses an explicit import). This is likely to break TS type-checking unless a global declaration is guaranteed. Prefer importing a PostData (or Post) type from the Blog module’s TS types (or add an explicit declare namespace Modules type definition that’s reliably present when Demo is built).
| import HeroSection from './sections/HeroSection.vue'; | |
| import Testimonial from './sections/Testimonial.vue'; | |
| defineProps<{ | |
| products?: Product[]; | |
| latestPosts?: Modules.Blog.Data.PostData[]; | |
| import type { PostData } from '@modules/Blog/resources/js/types'; | |
| import HeroSection from './sections/HeroSection.vue'; | |
| import Testimonial from './sections/Testimonial.vue'; | |
| defineProps<{ | |
| products?: Product[]; | |
| latestPosts?: PostData[]; |
| if (app('modules')->isEnabled('Blog')) { | ||
| $posts = Post::published() | ||
| ->with(['category', 'author']) | ||
| ->orderByDesc('published_at') | ||
| ->limit(3) | ||
| ->get(); | ||
|
|
||
| $data['latestPosts'] = $posts->map(fn (Post $post) => PostData::fromPost($post)); | ||
| } |
There was a problem hiding this comment.
New behavior fetches and renders latest posts, but there are no assertions covering this path. Consider extending the existing Playwright test (or adding a new one) to verify that when the Blog module is enabled and posts exist, the latest posts section is rendered (and that it stays hidden when there are no posts / Blog is disabled).
This pull request introduces the display of the latest blog posts on the demo page and makes several related improvements. The main changes involve fetching and passing recent blog posts from the backend to the frontend, updating the demo page to render these posts, and adjusting navigation ordering.
Demo Page Enhancements:
DemoController.php) now fetches the three most recent published blog posts (with category and author) and passes them to the frontend aslatestPostswhen the Blog module is enabled. [1] [2]Index.vue) receives and renders thelatestPostsprop via the newLatestPostsSectioncomponent, which is displayed if there are any posts. [1] [2]Workflow and Navigation Updates:
.github/workflows/test.yml) now explicitly lists additional dependencies for the Demo module, including Blog, Billing, and others.