Feat: create a new event gallery page where we display all medical-camp media (photos and videos)
Feature Summary
Create a new page "event gallery" in the medical camp application where we display our camps events media (photos and videos). This needs to be integrated with the corpus server app to make the medical camp application a semi-client to our corpus server so we can support the media uploads directly through the ehrs application itself by hard coding the categories "medical-camp".
Proposed Solution
Use the corpus server api endpoints to support the upoalds through ehrs application and also use the medical-camp category to fetch the records from the corpus to display in the ehrs application.
Test-Driven Development
Acceptance Criteria (Given-When-Then)
Primary User Flow
Scenario 1: [Happy Path - Main Use Case]
Given [user is on specific page/state]
And [user has specific permissions/data]
When [user performs main action]
Then [feature should work as expected]
And [UI should update accordingly]
And [appropriate success message should display]
Alternative Flows
Scenario 2: [Alternative Path]
Given [user is on specific page/state]
And [different condition exists]
When [user performs action]
Then [alternative behavior should occur]
Edge Cases
Scenario 3: [Edge Case - Empty State]
Given [no data exists / empty state]
When [user performs action]
Then [appropriate empty state should display]
Scenario 4: [Edge Case - Validation Error]
Given [user enters invalid data]
When [user submits the form]
Then [validation error should display]
And [form should not submit]
Scenario 5: [Edge Case - Error State]
Given [API returns error]
When [user performs action]
Then [error should be handled gracefully]
And [user-friendly error message should display]
Scenario 6: [Edge Case - Permission Denied]
Given [user lacks required permissions]
When [user attempts action]
Then [action should be blocked]
And [appropriate message should display]
Unit Test Requirements
Components/Functions to Create:
| File Path | Component/Function | Test Coverage Required |
|---|---|---|
src/components/... |
Render, interactions, state changes | |
src/hooks/... |
All hook return values and callbacks | |
src/utils/... |
All utility function outputs | |
src/pages/... |
Page render, data fetching, routing |
Test Assertions Required:
-
Component renders without crashing -
Component renders with correct initial state -
User interactions trigger correct handlers -
Form validation works correctly -
API calls made with correct payload -
Loading states display correctly -
Success states display correctly -
Error states display correctly -
State updates propagate correctly -
Child components receive correct props -
Callbacks are called with correct arguments
Technical Specification
Files to Create/Modify
| File Path | Action | Purpose |
|---|---|---|
src/components/NewComponent.tsx |
Create | Main component |
src/components/NewComponent.test.tsx |
Create | Unit tests |
src/pages/FeaturePage.tsx |
Modify | Add feature route |
src/types/api.ts |
Modify | Add new API types |
src/lib/constants.ts |
Modify | Add new constants |
API Requirements
| Endpoint | Method | Request Body | Response | Status |
|---|---|---|---|---|
/api/v1/... |
POST/GET/PUT/DELETE | {} |
{} |
[ ] Exists [ ] Needs Backend |
API Types to Add:
// Add to src/types/api.ts
interface NewFeatureData {
// Define types here
}
UI/UX Specification
Design Requirements
Mockups/Wireframes:
Responsive Behavior
| Viewport | Behavior |
|---|---|
| Mobile (<576px) | |
| Tablet (576px-991px) | |
| Desktop (≥992px) |
Accessibility Requirements
-
Semantic HTML elements used -
ARIA labels for interactive elements -
Keyboard navigation supported -
Focus states visible -
Screen reader compatible -
Color contrast meets WCAG standards -
Error messages linked to inputs
i18n Requirements
| String Key | Default Value (English) | Context |
|---|---|---|
feature.title |
||
feature.button.submit |
||
feature.message.success |
Definition of Done
Development
-
All acceptance criteria (Given-When-Then) pass -
All test cases (TC-FEAT-*) executed and passing -
Unit tests written with minimum 80% coverage -
Integration tests written (if applicable) -
Code follows project conventions -
No TypeScript errors or anytypes -
No ESLint/Prettier errors -
No console.log() or debugger statements
Testing
-
Manual testing completed on all browsers -
Responsive testing on mobile, tablet, desktop -
Accessibility testing completed -
Performance testing (no significant slowdowns) -
Cross-browser testing (Chrome, Firefox, Safari, Edge)
Documentation
-
README.md updated (if setup changed) -
.env.exampleupdated (if new env vars needed) -
Feature documented for end users (if applicable)
Code Review
-
Code reviewed and approved by at least 1 team member -
Product owner approved (if applicable)