feat: add react-router-dom v6.x dependency and configuration to M3
Key changes: - Added react-router-dom as required dependency (v6.x) - App.tsx now includes BrowserRouter wrapper with Routes - Route definitions map pages to URLs (/ → Home, /articles → ArticlePage, /categories → CategoriesPage) - Header navigation uses React Router <Link> components instead of anchor tags - Updated scoring rubric: 49 total points - New critical requirement: Agent must install BOTH lucide-react AND react-router-dom
This commit is contained in:
1 parent
b627ddc418
commit
091c7dc673
2 files changed
+127
-102
No files matched your search
@@ -35,7 +35,7 @@ Create the frontend infrastructure for **newzy** news web application using Reac
|
|||||||
│ │ │ ├── Header.test.tsx
|
│ │ │ ├── Header.test.tsx
|
||||||
│ │ │ ├── ArticleCard.test.tsx
|
│ │ │ ├── ArticleCard.test.tsx
|
||||||
│ │ │ └── components/
|
│ │ │ └── components/
|
||||||
│ │ ├── App.tsx # Root component with routing setup
|
│ │ ├── App.tsx # Root component with React Router setup
|
||||||
│ │ └── main.tsx # React entry point
|
│ │ └── main.tsx # React entry point
|
||||||
│ ├── playwright/
|
│ ├── playwright/
|
||||||
│ │ └── e2e/
|
│ │ └── e2e/
|
||||||
@@ -44,7 +44,7 @@ Create the frontend infrastructure for **newzy** news web application using Reac
|
|||||||
│ ├── .gitignore
|
│ ├── .gitignore
|
||||||
│ ├── Dockerfile
|
│ ├── Dockerfile
|
||||||
│ ├── docker-compose.yml # Frontend service config
|
│ ├── docker-compose.yml # Frontend service config
|
||||||
│ ├── package.json # Include lucide-react dependency
|
│ ├── package.json # Include react-router-dom dependency
|
||||||
│ ├── tsconfig.json
|
│ ├── tsconfig.json
|
||||||
│ ├── vite.config.ts
|
│ ├── vite.config.ts
|
||||||
│ └── README.md # Setup and API documentation
|
│ └── README.md # Setup and API documentation
|
||||||
@@ -52,9 +52,10 @@ Create the frontend infrastructure for **newzy** news web application using Reac
|
|||||||
|
|
||||||
2. Initialize Vite project with React, TypeScript template:
|
2. Initialize Vite project with React, TypeScript template:
|
||||||
- Use Node.js 18 or later
|
- Use Node.js 18 or later
|
||||||
- Install dependencies including lucide-react for icons:
|
- Install dependencies including lucide-react for icons AND react-router-dom for routing:
|
||||||
- react, react-dom, typescript, @types/react, @types/react-dom, vite
|
- react, react-dom, typescript, @types/react, @types/react-dom, vite
|
||||||
- lucide-react (for UI icons)
|
- lucide-react (for UI icons)
|
||||||
|
- react-router-dom v6.x (for client-side routing)
|
||||||
- class-variance-authority, clsx, tailwind-merge (for utility classes)
|
- class-variance-authority, clsx, tailwind-merge (for utility classes)
|
||||||
|
|
||||||
3. Install and configure Playwright and Vitest:
|
3. Install and configure Playwright and Vitest:
|
||||||
@@ -67,7 +68,7 @@ Create the frontend infrastructure for **newzy** news web application using Reac
|
|||||||
- Base path configuration
|
- Base path configuration
|
||||||
- Build output directory (dist/)
|
- Build output directory (dist/)
|
||||||
- Development server on port 5173
|
- Development server on port 5173
|
||||||
- Tailwind CSS integration if applicable
|
- React Router DOM plugin configuration if using router v6 dynamic imports
|
||||||
|
|
||||||
5. Create TypeScript type definitions in `src/types/`:
|
5. Create TypeScript type definitions in `src/types/`:
|
||||||
- Article interface (id, title, content, author, category, published, createdAt)
|
- Article interface (id, title, content, author, category, published, createdAt)
|
||||||
@@ -78,13 +79,13 @@ Create the frontend infrastructure for **newzy** news web application using Reac
|
|||||||
6. Create UI components with lucide-react icons in `src/components/ui/`:
|
6. Create UI components with lucide-react icons in `src/components/ui/`:
|
||||||
- **Header.tsx**:
|
- **Header.tsx**:
|
||||||
- Logo/text brand representation
|
- Logo/text brand representation
|
||||||
- Navigation placeholder links (Home, Articles, About)
|
- Navigation links that use React Router for navigation
|
||||||
- Use Lucide icons: Home, FileText, Settings for navigation
|
- Use Lucide icons: Home, FileText, Settings for navigation items
|
||||||
- Responsive design with mobile menu consideration
|
- Responsive design with mobile menu consideration
|
||||||
|
|
||||||
- **Layout.tsx**:
|
- **Layout.tsx**:
|
||||||
- Wrapper component for page structure
|
- Wrapper component for page structure
|
||||||
- Header integration
|
- Header integration via routing-aware navigation
|
||||||
- Content area placeholder
|
- Content area placeholder
|
||||||
- Footer section placeholder
|
- Footer section placeholder
|
||||||
|
|
||||||
@@ -102,60 +103,68 @@ Create the frontend infrastructure for **newzy** news web application using Reac
|
|||||||
|
|
||||||
- **ArticlePage.tsx** and **CategoriesPage.tsx**: Basic layouts for future pages
|
- **ArticlePage.tsx** and **CategoriesPage.tsx**: Basic layouts for future pages
|
||||||
|
|
||||||
9. Set up API client in `src/api/client.ts`:
|
9. Set up React Router in `App.tsx` with:
|
||||||
- Base URL configuration (relative path /api)
|
- BrowserRouter wrapper at root level
|
||||||
- Fetch wrapper with error handling
|
- Route definitions mapping pages to URLs
|
||||||
- Type-safe request/response functions
|
- Proper route-to-page component imports
|
||||||
|
- Link navigation using react-router-dom's `<Link>` component (not anchor tags)
|
||||||
|
|
||||||
10. Create component tests using Vitest:
|
10. Set up API client in `src/api/client.ts`:
|
||||||
- Test Header renders correctly with lucide icons
|
- Base URL configuration (relative path /api)
|
||||||
|
- Fetch wrapper with error handling
|
||||||
|
- Type-safe request/response functions
|
||||||
|
|
||||||
|
11. Create component tests using Vitest:
|
||||||
|
- Test Header renders correctly with lucide icons and routing links
|
||||||
- Test ArticleCard displays data correctly
|
- Test ArticleCard displays data correctly
|
||||||
- Test Layout structure is properly implemented
|
- Test Layout structure is properly implemented
|
||||||
- Use @testing-library/react for rendering
|
- Use @testing-library/react for rendering
|
||||||
|
|
||||||
11. Create Playwright E2E tests:
|
12. Create Playwright E2E tests:
|
||||||
- Test home page accessibility and layout
|
- Test home page accessibility and layout
|
||||||
- Test article list renders with data
|
- Test article list renders with data
|
||||||
- Test navigation between pages works
|
- Test navigation between pages works (via React Router Links)
|
||||||
|
|
||||||
12. Create `package.json` scripts:
|
13. Create `package.json` scripts:
|
||||||
- dev, build, preview, test, e2e, lint
|
- dev, build, preview, test, e2e, lint
|
||||||
|
|
||||||
13. Create `.gitignore` to exclude node_modules, dist/, .env files, IDE configs, playwright trace files
|
14. Create `.gitignore` to exclude node_modules, dist/, .env files, IDE configs, playwright trace files
|
||||||
|
|
||||||
14. Create `Dockerfile` with Nginx for serving static files in production (multi-stage)
|
15. Create `Dockerfile` with Nginx for serving static files in production (multi-stage)
|
||||||
|
|
||||||
15. Update `docker-compose.yml` at project root with frontend service:
|
16. Update `docker-compose.yml` at project root with frontend service:
|
||||||
- Port mapping 3000:80
|
- Port mapping 3000:80
|
||||||
- Links to backend service for API calls
|
- Links to backend service for API calls
|
||||||
|
|
||||||
16. Document setup process in `frontend/README.md` with examples and lucide-react icon documentation
|
17. Document setup process in `frontend/README.md` with examples and lucide-react icon documentation
|
||||||
|
|
||||||
17. Configure ESLint rules for React and TypeScript best practices
|
18. Configure ESLint rules for React, TypeScript, and react-router best practices
|
||||||
|
|
||||||
Remember: Focus ONLY on frontend infrastructure. No complex UI features required yet.
|
Remember: Focus ONLY on frontend infrastructure. No complex UI features required yet.
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
This milestone sets up the React + TypeScript frontend for newzy news application using Vite as the build tool. The scope includes project scaffolding, lucide-react icons integration, type definitions, properly structured components, and comprehensive testing setup with Playwright E2E tests—no complex UI implementations or user interactions.
|
This milestone sets up the React + TypeScript frontend for newzy news application using Vite as the build tool. The scope includes project scaffolding, lucide-react icons integration, React Router setup for navigation, type definitions, properly structured components, and comprehensive testing setup with Playwright E2E tests—no complex UI implementations or user interactions.
|
||||||
|
|
||||||
**Purpose**: Create a responsive, type-safe frontend ready to consume the backend API built in M2, with robust test coverage from both unit and E2E perspectives.
|
**Purpose**: Create a responsive, type-safe frontend ready to consume the backend API built in M2, with robust test coverage from both unit and E2E perspectives.
|
||||||
|
|
||||||
**Target Audience**: Frontend developers who need to understand the structure and extend components for features in subsequent milestones.
|
**Target Audience**: Frontend developers who need to understand the structure and extend components for features in subsequent milestones.
|
||||||
|
|
||||||
**Expected Outcomes**: A functioning React application that can load from browser or Docker container, with lucide-react icons integrated, typed interfaces matching backend models, properly separated page and component code, basic page layout in place, and a complete testing setup (unit tests + Playwright E2E).
|
**Expected Outcomes**: A functioning React application that can load from browser or Docker container, with lucide-react icons integrated, React Router configured for client-side navigation, typed interfaces matching backend models, properly separated page and component code, basic page layout in place, and a complete testing setup (unit tests + Playwright E2E).
|
||||||
|
|
||||||
## Acceptance Criteria
|
## Acceptance Criteria
|
||||||
|
|
||||||
- [ ] Vite project initialized with React, TypeScript, and lucide-react
|
- [ ] Vite project initialized with React, TypeScript, lucide-react, AND react-router-dom v6.x
|
||||||
- [ ] Project structure includes: public/, src/, assets/, components/, pages/, types/, api/, tests/ folders
|
- [ ] Project structure includes: public/, src/, assets/, components/, pages/, types/, api/, tests/ folders
|
||||||
- [ ] Clear separation between `pages/` (page-level routing) and `components/` (reusable UI)
|
- [ ] Clear separation between `pages/` (page-level routing) and `components/` (reusable UI)
|
||||||
- [ ] Lucide-react installed with icons: Home, FileText, Settings, Search
|
- [ ] React Router DOM properly configured in App.tsx with BrowserRouter wrapper
|
||||||
|
- [ ] Route definitions mapped to page components in src/pages/
|
||||||
|
- [ ] lucide-react installed with icons: Home, FileText, Settings, Search
|
||||||
- [ ] TypeScript type definitions for Article, Author, Category models
|
- [ ] TypeScript type definitions for Article, Author, Category models
|
||||||
- [ ] Header component created with lucide icons and navigation placeholder
|
- [ ] Header component created with lucide icons and React Router navigation links
|
||||||
- [ ] Layout wrapper component implemented with proper structure
|
- [ ] Layout wrapper component implemented with proper structure
|
||||||
- [ ] Reusable article components: ArticleCard, AuthorAvatar, CategoryBadge
|
- [ ] Reusable article components: ArticleCard, AuthorAvatar, CategoryBadge
|
||||||
- [ ] Page components: Home.tsx with article grid layout
|
- [ ] Page components: Home.tsx with article grid layout using router Links
|
||||||
- [ ] API client configured with base URL and fetch wrapper
|
- [ ] API client configured with base URL and fetch wrapper
|
||||||
- [ ] Unit tests in src/tests/ using Vitest (react-testing-library)
|
- [ ] Unit tests in src/tests/ using Vitest (react-testing-library)
|
||||||
- [ ] Playwright E2E tests in playwright/e2e/ covering core flows
|
- [ ] Playwright E2E tests in playwright/e2e/ covering core flows
|
||||||
@@ -163,7 +172,7 @@ This milestone sets up the React + TypeScript frontend for newzy news applicatio
|
|||||||
- [ ] .gitignore excludes node_modules, dist/, IDE configs, and playwright artifacts
|
- [ ] .gitignore excludes node_modules, dist/, IDE configs, and playwright artifacts
|
||||||
- [ ] Dockerfile builds production-ready static files with Nginx serving
|
- [ ] Dockerfile builds production-ready static files with Nginx serving
|
||||||
- [ ] docker-compose.yml includes frontend service linked to backend
|
- [ ] docker-compose.yml includes frontend service linked to backend
|
||||||
- [ ] ESLint rules configured and passing
|
- [ ] ESLint rules configured and passing for react-router best practices
|
||||||
|
|
||||||
## Technical Details
|
## Technical Details
|
||||||
|
|
||||||
@@ -180,7 +189,7 @@ newzy/
|
|||||||
│ │ │ └── logo.svg # Brand logo (placeholder)
|
│ │ │ └── logo.svg # Brand logo (placeholder)
|
||||||
│ │ ├── components/
|
│ │ ├── components/
|
||||||
│ │ │ ├── ui/ # Generic UI components with lucide icons
|
│ │ │ ├── ui/ # Generic UI components with lucide icons
|
||||||
│ │ │ │ ├── Header.tsx # Navigation with icons
|
│ │ │ │ ├── Header.tsx # Navigation with icons and router Links
|
||||||
│ │ │ │ └── Layout.tsx # Page wrapper layout
|
│ │ │ │ └── Layout.tsx # Page wrapper layout
|
||||||
│ │ │ └── articles/ # Domain-specific components
|
│ │ │ └── articles/ # Domain-specific components
|
||||||
│ │ │ ├── ArticleCard.tsx # Article preview component
|
│ │ │ ├── ArticleCard.tsx # Article preview component
|
||||||
@@ -198,7 +207,7 @@ newzy/
|
|||||||
│ │ │ ├── Header.test.tsx
|
│ │ │ ├── Header.test.tsx
|
||||||
│ │ │ ├── ArticleCard.test.tsx
|
│ │ │ ├── ArticleCard.test.tsx
|
||||||
│ │ │ └── components/
|
│ │ │ └── components/
|
||||||
│ │ ├── App.tsx # Root with Router setup
|
│ │ ├── App.tsx # Root with BrowserRouter and routes
|
||||||
│ │ └── main.tsx # React entry point
|
│ │ └── main.tsx # React entry point
|
||||||
│ ├── playwright/
|
│ ├── playwright/
|
||||||
│ │ └── e2e/ # E2E tests (Playwright)
|
│ │ └── e2e/ # E2E tests (Playwright)
|
||||||
@@ -207,7 +216,7 @@ newzy/
|
|||||||
│ ├── .gitignore
|
│ ├── .gitignore
|
||||||
│ ├── Dockerfile
|
│ ├── Dockerfile
|
||||||
│ ├── docker-compose.yml # Frontend service config
|
│ ├── docker-compose.yml # Frontend service config
|
||||||
│ ├── package.json # Dependencies including lucide-react
|
│ ├── package.json # Dependencies including react-router-dom
|
||||||
│ ├── tsconfig.json
|
│ ├── tsconfig.json
|
||||||
│ ├── vite.config.ts
|
│ ├── vite.config.ts
|
||||||
│ └── README.md # Setup and API documentation
|
│ └── README.md # Setup and API documentation
|
||||||
@@ -262,6 +271,7 @@ export interface ApiResponse<T> {
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-router-dom": "^6.20.0", /* ← React Router v6.x */
|
||||||
"typescript": "^5.0.0",
|
"typescript": "^5.0.0",
|
||||||
"@types/react": "^18.2.0",
|
"@types/react": "^18.2.0",
|
||||||
"@types/react-dom": "^18.2.0",
|
"@types/react-dom": "^18.2.0",
|
||||||
@@ -280,49 +290,37 @@ export interface ApiResponse<T> {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Lucide React Icons Usage
|
### React Router Configuration in App.tsx
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import { Home, FileText, Settings, Search } from 'lucide-react';
|
import { BrowserRouter, Routes, Route, Link } from 'react-router-dom';
|
||||||
|
import Home from './pages/Home';
|
||||||
|
import ArticlePage from './pages/ArticlePage';
|
||||||
|
import CategoriesPage from './pages/CategoriesPage';
|
||||||
|
import Layout from './components/ui/Layout';
|
||||||
|
|
||||||
// In Header component
|
function App() {
|
||||||
<Header>
|
|
||||||
<LogoIcon className="w-6 h-6">/* brand logo */</LogoIcon>
|
|
||||||
<NavButton icon={<Home />} label="Home" />
|
|
||||||
<NavButton icon={<FileText />} label="Articles" />
|
|
||||||
<NavButton icon={<Settings />} label="Settings" />
|
|
||||||
<SearchPlaceholder />
|
|
||||||
</Header>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Component Structure Examples
|
|
||||||
|
|
||||||
**ArticleCard.tsx:**
|
|
||||||
```tsx
|
|
||||||
import { Article } from '../types';
|
|
||||||
import { FileText } from 'lucide-react';
|
|
||||||
import AuthorAvatar from './AuthorAvatar';
|
|
||||||
import CategoryBadge from './CategoryBadge';
|
|
||||||
|
|
||||||
interface ArticleCardProps {
|
|
||||||
article: Article;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function ArticleCard({ article }: ArticleCardProps) {
|
|
||||||
return (
|
return (
|
||||||
<article className="card">
|
<BrowserRouter>
|
||||||
<h2>{article.title}</h2>
|
<Layout>
|
||||||
<AuthorAvatar author={article.author} />
|
<Routes>
|
||||||
<CategoryBadge category={article.category} />
|
<Route path="/" element={<Home />} />
|
||||||
<FileText className="read-time-icon" />
|
<Route path="/articles" element={<ArticlePage />} />
|
||||||
</article>
|
<Route path="/categories" element={<CategoriesPage />} />
|
||||||
|
</Routes>
|
||||||
|
</Layout>
|
||||||
|
</BrowserRouter>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Header.tsx:**
|
### Header Component with React Router Links
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import { Home, FileText, Settings } from 'lucide-react';
|
import { Home, FileText, Settings } from 'lucide-react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
interface HeaderProps {}
|
interface HeaderProps {}
|
||||||
|
|
||||||
@@ -331,9 +329,16 @@ export function Header({}: HeaderProps) {
|
|||||||
<header className="nav">
|
<header className="nav">
|
||||||
<h1>newzy</h1>
|
<h1>newzy</h1>
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/"><Home /></a>
|
{/* Navigation uses react-router-dom Link, not anchor tags */}
|
||||||
<a href="/articles"><FileText /></a>
|
<Link to="/">
|
||||||
<a href="/settings"><Settings /></a>
|
<Home className="w-5 h-5" />
|
||||||
|
</Link>
|
||||||
|
<Link to="/articles">
|
||||||
|
<FileText className="w-5 h-5" />
|
||||||
|
</Link>
|
||||||
|
<Link to="/categories">
|
||||||
|
<Settings className="w-5 h-5" />
|
||||||
|
</Link>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
@@ -343,25 +348,25 @@ export function Header({}: HeaderProps) {
|
|||||||
### Page Separation Strategy
|
### Page Separation Strategy
|
||||||
|
|
||||||
**pages/ (routing - one per route):**
|
**pages/ (routing - one per route):**
|
||||||
- Home.tsx → / (main landing page)
|
- `Home.tsx` → `/` (main landing page with featured article)
|
||||||
- ArticlePage.tsx → /articles/:id (individual article)
|
- `ArticlePage.tsx` → `/articles/:id` (individual article view with useParams)
|
||||||
- CategoriesPage.tsx → /categories (list of categories)
|
- `CategoriesPage.tsx` → `/categories` (list of categories placeholder)
|
||||||
|
|
||||||
**components/ui/ (generic UI with icons):**
|
**components/ui/ (generic UI with icons):**
|
||||||
- Header.tsx → Navigation with lucide icons
|
- `Header.tsx` → Navigation with lucide icons AND React Router `<Link>` components
|
||||||
- Layout.tsx → Page wrapper structure
|
- `Layout.tsx` → Page wrapper structure accepting props from App routes
|
||||||
|
|
||||||
**components/articles/ (domain-specific):**
|
**components/articles/ (domain-specific):**
|
||||||
- ArticleCard.tsx → Article preview component
|
- `ArticleCard.tsx` → Article preview component for Home page
|
||||||
- AuthorAvatar.tsx → Author profile indicator
|
- `AuthorAvatar.tsx` → Author profile indicator
|
||||||
- CategoryBadge.tsx → Category label pill
|
- `CategoryBadge.tsx` → Category label pill
|
||||||
|
|
||||||
## QA Notes
|
## QA Notes
|
||||||
|
|
||||||
### Unit Testing Checklist (Vitest + React Testing Library)
|
### Unit Testing Checklist (Vitest + React Testing Library)
|
||||||
- [ ] Tests discover and run correctly with `npm test`
|
- [ ] Tests discover and run correctly with `npm test`
|
||||||
- [ ] Header renders with lucide icons correctly
|
- [ ] Header renders with lucide icons and router Links correctly
|
||||||
- [ ] Layout component structure verified
|
- [ ] Layout component structure verified with routing context available
|
||||||
- [ ] ArticleCard displays data properly
|
- [ ] ArticleCard displays data properly
|
||||||
- [ ] Component props are type-safe
|
- [ ] Component props are type-safe
|
||||||
- [ ] Test coverage >50% on tested components
|
- [ ] Test coverage >50% on tested components
|
||||||
@@ -369,12 +374,12 @@ export function Header({}: HeaderProps) {
|
|||||||
### E2E Testing Checklist (Playwright)
|
### E2E Testing Checklist (Playwright)
|
||||||
- [ ] Playwright configured in playwright.config.ts
|
- [ ] Playwright configured in playwright.config.ts
|
||||||
- [ ] Tests discover and run with `npm run e2e`
|
- [ ] Tests discover and run with `npm run e2e`
|
||||||
- [ ] Home page accessibility verified (a11y checks pass)
|
- [ ] Home page accessibility verified (a11y checks pass for Links)
|
||||||
- [ ] Article list renders with data
|
- [ ] Article list renders with data
|
||||||
- [ ] Navigation between pages works via lucide icons
|
- [ ] Navigation between pages works via React Router Links (not anchor tags)
|
||||||
- [ ] API requests complete successfully via browser
|
- [ ] API requests complete successfully via browser
|
||||||
- [ ] Browser console has no errors during E2E tests
|
- [ ] Browser console has no errors during E2E tests
|
||||||
- [ ] Tests use proper selectors and wait conditions
|
- [ ] Tests use proper selectors for routing elements
|
||||||
|
|
||||||
### Performance Considerations
|
### Performance Considerations
|
||||||
- Vite uses ESBuild for fast HMR during development
|
- Vite uses ESBuild for fast HMR during development
|
||||||
@@ -383,6 +388,7 @@ export function Header({}: HeaderProps) {
|
|||||||
- Multi-stage Docker builds reduce image size
|
- Multi-stage Docker builds reduce image size
|
||||||
- Playwright tests run in headless mode for faster execution
|
- Playwright tests run in headless mode for faster execution
|
||||||
- Lucide-react icons use SVG format (no font download)
|
- Lucide-react icons use SVG format (no font download)
|
||||||
|
- React Router uses client-side navigation (no page reloads)
|
||||||
|
|
||||||
### Security Notes
|
### Security Notes
|
||||||
- No sensitive data in client-side code
|
- No sensitive data in client-side code
|
||||||
@@ -397,6 +403,7 @@ export function Header({}: HeaderProps) {
|
|||||||
- Vite HMR doesn't work in Docker without hot-reload support
|
- Vite HMR doesn't work in Docker without hot-reload support
|
||||||
- TypeScript path aliases not configured (using relative imports)
|
- TypeScript path aliases not configured (using relative imports)
|
||||||
- Playwright E2E tests may fail when backend service not available
|
- Playwright E2E tests may fail when backend service not available
|
||||||
|
- React Router state preservation not implemented
|
||||||
|
|
||||||
### Success Metrics
|
### Success Metrics
|
||||||
- `npm run dev` starts within 30 seconds
|
- `npm run dev` starts within 30 seconds
|
||||||
@@ -409,3 +416,4 @@ export function Header({}: HeaderProps) {
|
|||||||
- E2E tests complete in under 1 minute for core flows
|
- E2E tests complete in under 1 minute for core flows
|
||||||
- Playwright traces and video artifacts excluded from version control
|
- Playwright traces and video artifacts excluded from version control
|
||||||
- Lucide-react icons render correctly without fallback errors
|
- Lucide-react icons render correctly without fallback errors
|
||||||
|
- React Router navigation works without full page reloads
|
||||||
@@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
| Score | Criteria |
|
| Score | Criteria |
|
||||||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| 0 | Agent failed to implement acceptance criteria:<br>- No Vite/React project created<br>- TypeScript not configured<br>- Missing multiple required folders<br>- Components incomplete<br>- Missing tests (unit + E2E)<br>- Missing lucide-react icons<br>- No Dockerfile or docker-compose missing |
|
| 0 | Agent failed to implement acceptance criteria:<br>- No Vite/React project created<br>- TypeScript not configured<br>- Missing multiple required folders<br>- Components incomplete<br>- Missing tests (unit + E2E)<br>- Missing lucide-react icons<br>- Missing React Router setup<br>- No Dockerfile or docker-compose missing |
|
||||||
| 1 | Agent partially implemented acceptance criteria that builds successfully:<br>- Basic React app with vite but no lucide-icons<br>- Missing page/component separation<br>- Components render but have errors<br>- npm scripts incomplete<br>- No test setup at all |
|
| 1 | Agent partially implemented acceptance criteria that builds successfully:<br>- Basic React app with vite but no lucide-icons<br>- Missing react-router-dom dependency<br>- Missing page/component separation<br>- Components render but have errors<br>- npm scripts incomplete<br>- No test setup at all |
|
||||||
| 2 | Agent fully implemented acceptance criteria that builds successfully:<br>- Vite + React + TypeScript project in frontend/ folder<br>- All required directories (assets/, components/, pages/, types/, api/, tests/) created<br>- lucide-react installed with core icons (Home, FileText, Settings, Search)<br>- Article, Author, Category TypeScript interfaces defined<br>- Header component with navigation placeholder and lucide icons<br- package.json scripts (dev, build, preview, test, e2e) working<br>- .gitignore excludes node_modules, dist/, IDE configs<br>- Playwright installed and configured |
|
| 2 | Agent fully implemented acceptance criteria that builds successfully:<br>- Vite + React + TypeScript project in frontend/ folder<br>- All required directories (assets/, components/, pages/, types/, api/, tests/) created<br>- lucide-react installed with core icons (Home, FileText, Settings, Search)<br>- react-router-dom v6.x installed and imported correctly<br- Article, Author, Category TypeScript interfaces defined<br>- Header component with navigation placeholder and lucide icons AND router Links<br- package.json scripts (dev, build, preview, test, e2e) working<br>- .gitignore excludes node_modules, dist/, IDE configs<br>- Playwright installed and configured |
|
||||||
| 3 | Agent fully implemented acceptance criteria that builds successfully, includes reusable article components created<br>- ArticleCard.tsx displays article data correctly<br- Layout wrapper component with proper structure<br- lucide-react icons integrated properly in Header |
|
| 3 | Agent fully implemented acceptance criteria that builds successfully, includes reusable article components created<br>- ArticleCard.tsx displays article data correctly<br- Layout wrapper component with proper structure<br- React Router BrowserRouter wrapper in App.tsx configured |
|
||||||
| 4 | Agent fully implemented acceptance criteria that builds successfully, includes comprehensive unit tests covering:<br>- Header rendering and icon display<br- Layout structure and header integration<br- API client error handling scenarios<br- Test coverage >50% on components |
|
| 4 | Agent fully implemented acceptance criteria that builds successfully, includes comprehensive unit tests covering:<br>- Header rendering and icon display<br- Layout structure and header integration<br- API client error handling scenarios<br- React Router Link components render correctly<br- Test coverage >50% on components |
|
||||||
| 5 | Agent fully implemented acceptance criteria that builds successfully, includes all content from Score 4 AND:<br>- Playwright E2E tests in playwright/e2e/ passing successfully<br- E2E tests verify homepage layout and lucide icon navigation<br- API client makes requests correctly via browser<br- Combined test coverage >60% across unit and E2E tests<br- All tests execute without errors |
|
| 5 | Agent fully implemented acceptance criteria that builds successfully, includes all content from Score 4 AND:<br>- Playwright E2E tests in playwright/e2e/ passing successfully<br- E2E tests verify homepage layout and lucide icon navigation links<br- API client makes requests correctly via browser<br- React Router routing works without full page reloads<br- Combined test coverage >60% across unit and E2E tests<br- All tests execute without errors |
|
||||||
|
|
||||||
## Scoring Breakdown by Criterion
|
## Scoring Breakdown by Criterion
|
||||||
|
|
||||||
@@ -18,12 +18,13 @@
|
|||||||
- **1 pt**: Basic React app created but structure incomplete<br>- Missing pages/, components/ separation
|
- **1 pt**: Basic React app created but structure incomplete<br>- Missing pages/, components/ separation
|
||||||
- **2 pts**: Complete directory structure with all required folders (public/, src/, assets/, components/, pages/, types/, api/, tests/)
|
- **2 pts**: Complete directory structure with all required folders (public/, src/, assets/, components/, pages/, types/, api/, tests/)
|
||||||
|
|
||||||
### TypeScript & Dependencies (Max 4 points)
|
### TypeScript & Dependencies (Max 5 points)
|
||||||
- **0 pts**: No TypeScript or tsconfig.json<br>- lucide-react not installed
|
- **0 pts**: No TypeScript or tsconfig.json<br>- Neither lucide-react nor react-router-dom installed
|
||||||
- **1 pt**: TypeScript enabled but no type definitions<br>- Partial interfaces
|
- **1 pt**: TypeScript enabled but no type definitions<br>- Partial interfaces<br>- Missing react-router-dom
|
||||||
- **2 pts**: Article, Author, Category interfaces properly defined<br>- lucide-react with core icons imported correctly
|
- **2 pts**: Article, Author, Category interfaces properly defined<br>- lucide-react with core icons imported correctly
|
||||||
- **3 pts**: Comprehensive types including ApiResponse<T>, function signatures<br>- Proper type exports across modules
|
- **3 pts**: Comprehensive types including ApiResponse<T>, function signatures<br- react-router-dom v6.x dependencies present in package.json<br- All type exports across modules
|
||||||
- **4 pts**: All type definitions validated and used in components<br- No TypeScript errors on build
|
- **4 pts**: All type definitions validated and used in components<br> No TypeScript errors on build
|
||||||
|
- **5 pts**: React Router Link components typed correctly with proper navigation types
|
||||||
|
|
||||||
### UI Components (Max 5 points)
|
### UI Components (Max 5 points)
|
||||||
- **0 pts**: No UI components or Header missing<br>- Application doesn't render properly
|
- **0 pts**: No UI components or Header missing<br>- Application doesn't render properly
|
||||||
@@ -33,11 +34,19 @@
|
|||||||
- **4 pts**: ArticleCard renders article data properly with all sub-components<br- Layout component integrates header and content sections
|
- **4 pts**: ArticleCard renders article data properly with all sub-components<br- Layout component integrates header and content sections
|
||||||
- **5 pts**: All UI components responsive and accessible<br- Lucide icons use correct semantic HTML
|
- **5 pts**: All UI components responsive and accessible<br- Lucide icons use correct semantic HTML
|
||||||
|
|
||||||
|
### React Router Configuration (Max 5 points) ⭐ NEW
|
||||||
|
- **0 pts**: No React Router setup<br>- App.tsx missing BrowserRouter or Routes
|
||||||
|
- **1 pt**: react-router-dom imported but no configuration<br>- Link components not working
|
||||||
|
- **2 pts**: BrowserRouter wrapper exists in App.tsx<br>- Basic routes defined (at least / and /articles)
|
||||||
|
- **3 pts**: Route definitions mapped to page components<br- Proper imports from src/pages/
|
||||||
|
- **4 pts**: Navigation uses React Router `<Link>` components instead of anchor tags<br- Header navigation functional
|
||||||
|
- **5 pts**: Full routing setup with all three routes (/ → Home, /articles → ArticlePage, /categories → CategoriesPage)<br- Client-side navigation works without page reloads
|
||||||
|
|
||||||
### Page Components (Max 3 points)
|
### Page Components (Max 3 points)
|
||||||
- **0 pts**: No page separation or Home.tsx missing<br>- Routes not defined in App.tsx
|
- **0 pts**: No page separation or Home.tsx missing<br>- Routes not defined in App.tsx
|
||||||
- **1 pt**: Only Home page created<br- ArticlePage, CategoriesPage placeholders missing
|
- **1 pt**: Only Home page created<br- ArticlePage, CategoriesPage placeholders missing
|
||||||
- **2 pts**: All three page components implemented (Home, ArticlePage, CategoriesPage)<br- Proper folder organization under pages/
|
- **2 pts**: All three page components implemented (Home, ArticlePage, CategoriesPage)<br- Proper folder organization under pages/
|
||||||
- **3 pts**: Page components properly separated from component library<br- Clear route-to-page mapping in App.tsx
|
- **3 pts**: Page components properly separated from component library<br- Clear route-to-page mapping in App.tsx with React Router
|
||||||
|
|
||||||
### API Integration (Max 2 points)
|
### API Integration (Max 2 points)
|
||||||
- **0 pts**: No API client or fetch not configured<br>- Cannot make requests to backend
|
- **0 pts**: No API client or fetch not configured<br>- Cannot make requests to backend
|
||||||
@@ -49,7 +58,7 @@
|
|||||||
- **1 pt**: Tests folder exists but no actual tests<br>- Test runner not configured in package.json
|
- **1 pt**: Tests folder exists but no actual tests<br>- Test runner not configured in package.json
|
||||||
- **2 pts**: Vitest configured, Header.test.tsx created<br- Basic icon/component rendering tests
|
- **2 pts**: Vitest configured, Header.test.tsx created<br- Basic icon/component rendering tests
|
||||||
- **3 pts**: Multiple unit tests covering components and API client<br- Uses @testing-library/react for DOM queries
|
- **3 pts**: Multiple unit tests covering components and API client<br- Uses @testing-library/react for DOM queries
|
||||||
- **4 pts**: Unit tests pass with >=50% coverage on tested components<br- Tests verify lucide icon rendering
|
- **4 pts**: Unit tests pass with >=50% coverage on tested components<br- Tests verify lucide icon rendering AND React Router Link navigation
|
||||||
|
|
||||||
### E2E Testing (Max 6 points)
|
### E2E Testing (Max 6 points)
|
||||||
- **0 pts**: No Playwright installed or configured<br>- playwright.config.ts missing
|
- **0 pts**: No Playwright installed or configured<br>- playwright.config.ts missing
|
||||||
@@ -57,8 +66,8 @@
|
|||||||
- **2 pts**: playwright/e2e folder created with home.spec.ts and api.spec.ts<br- Tests discoverable by npm run e2e
|
- **2 pts**: playwright/e2e folder created with home.spec.ts and api.spec.ts<br- Tests discoverable by npm run e2e
|
||||||
- **3 pts**: E2E tests verify homepage layout renders correctly<br- Basic accessibility checks pass for lucide icons
|
- **3 pts**: E2E tests verify homepage layout renders correctly<br- Basic accessibility checks pass for lucide icons
|
||||||
- **4 pts**: E2E tests verify API client makes requests and backend responds<br- Proper selectors used with lucide icon elements
|
- **4 pts**: E2E tests verify API client makes requests and backend responds<br- Proper selectors used with lucide icon elements
|
||||||
- **5 pts**: Navigation between pages tested via icon-based menus<br- All page routes accessible from home
|
- **5 pts**: Navigation between pages tested via React Router Links (not anchor tags)<br- All page routes accessible from home without full page reloads
|
||||||
- **6 pts**: Full user flow verified (home → article click → article page)<br- Comprehensive accessibility compliance
|
- **6 pts**: Full user flow verified (home → article click → article page)<br- Comprehensive accessibility compliance and routing validation
|
||||||
|
|
||||||
### Docker Configuration (Max 3 points)
|
### Docker Configuration (Max 3 points)
|
||||||
- **0 pts**: No Dockerfile or .dockerignore<br>- Cannot containerize frontend
|
- **0 pts**: No Dockerfile or .dockerignore<br>- Cannot containerize frontend
|
||||||
@@ -69,15 +78,15 @@
|
|||||||
### Code Quality (Max 2 points)
|
### Code Quality (Max 2 points)
|
||||||
- **0 pts**: No ESLint or linting fails<br>- Poor code organization
|
- **0 pts**: No ESLint or linting fails<br>- Poor code organization
|
||||||
- **1 pt**: Basic ESLint rules configured but warnings present<br>- Inconsistent formatting
|
- **1 pt**: Basic ESLint rules configured but warnings present<br>- Inconsistent formatting
|
||||||
- **2 pts**: ESLint passing with zero critical warnings<br>- Consistent React + TypeScript best practices
|
- **2 pts**: ESLint passing with zero critical warnings<br>- Consistent React + TypeScript + react-router best practices
|
||||||
|
|
||||||
### Documentation (Max 3 points)
|
### Documentation (Max 3 points)
|
||||||
- **0 pts**: No README.md or incomplete<br>- No setup instructions
|
- **0 pts**: No README.md or incomplete<br>- No setup instructions
|
||||||
- **1 pt**: README exists with basic info only<br>- Missing lucide-react documentation
|
- **1 pt**: README exists with basic info only<br>- Missing lucide-react documentation
|
||||||
- **2 pts**: Comprehensive README with setup guide, API documentation, and usage examples<br- Icons documented
|
- **2 pts**: Comprehensive README with setup guide, API documentation, and usage examples<br- Icons documented<br- React Router setup explained
|
||||||
- **3 pts**: Complete component documentation with prop types and lucide icon usage guide |
|
- **3 pts**: Complete component documentation with prop types and lucide icon + react-router usage guide |
|
||||||
|
|
||||||
## Total Possible Score: 40 points
|
## Total Possible Score: 49 points
|
||||||
|
|
||||||
## Evaluation Notes
|
## Evaluation Notes
|
||||||
- Partial credit given for incomplete but working implementations (Score 1)
|
- Partial credit given for incomplete but working implementations (Score 1)
|
||||||
@@ -85,16 +94,24 @@
|
|||||||
- Higher scores require additional value-add content beyond baseline requirements
|
- Higher scores require additional value-add content beyond baseline requirements
|
||||||
- Score 0 indicates agent did not attempt the task or application won't run
|
- Score 0 indicates agent did not attempt the task or application won't run
|
||||||
|
|
||||||
|
## Critical Requirements Checklist
|
||||||
|
For an agent to achieve any score above 1, they MUST:
|
||||||
|
- [x] Install both `lucide-react` AND `react-router-dom` as dependencies
|
||||||
|
- [x] Configure BrowserRouter in App.tsx
|
||||||
|
- [x] Define Routes that map to page components
|
||||||
|
- [x] Use `<Link>` components for navigation (not anchor tags)
|
||||||
|
|
||||||
## Bonus Points Consideration
|
## Bonus Points Consideration
|
||||||
|
|
||||||
**+1 point** for:
|
**+1 point** for:
|
||||||
- ESLint rules properly configured and enforcing React/TypeScript best practices
|
- ESLint rules properly configured and enforcing React/TypeScript + react-router best practices
|
||||||
- .eslintrc.cjs or vite.config.ts includes meaningful linting rules
|
- .eslintrc.cjs or vite.config.ts includes meaningful linting rules
|
||||||
|
|
||||||
**+2 points** for:
|
**+2 points** for:
|
||||||
- TypeScript strict mode enabled in tsconfig.json
|
- TypeScript strict mode enabled in tsconfig.json with react-router types
|
||||||
- Components use proper TypeScript generics and props typing with lucide icons typed
|
- Components use proper TypeScript generics and props typing with lucide icons typed as ReactNode
|
||||||
|
|
||||||
**+3 points** for:
|
**+3 points** for:
|
||||||
- docker-compose.yml at project root orchestrating both services
|
- docker-compose.yml at project root orchestrating both services
|
||||||
- Nginx configuration properly routes SPA (try_files with index.html fallback)
|
- Nginx configuration properly routes SPA (try_files with index.html fallback)
|
||||||
|
- E2E tests verify client-side routing without page reloads
|
||||||
Reference in new issue
Block a user