generated from coulomb/repo-seed
refactor: use abstract ITEM placeholders with dynamic property mapping
Changed from fixed TASK placeholders to flexible ITEM placeholders that
automatically map all CSV fields to template placeholders.
Key changes:
- Renamed task-template → item-template in all templates
- Changed TASK_* → ITEM_* placeholder naming
- Implemented dynamic placeholder generation from item properties
- Any field in fieldMapping now creates ITEM_{FIELD} placeholder
- Updated all tests and documentation
Naming convention: CSV field → item.property → ITEM_PROPERTY
Example: "assignee" → item.assignee → {{ITEM_ASSIGNEE}}
This enables users to add custom fields without modifying generator code:
- Add "assignee": "Assignee" to fieldMapping
- Use {{ITEM_ASSIGNEE}} in template
- No code changes required
Benefits:
- More flexible and extensible
- Clearer abstraction (items vs tasks)
- Consistent naming convention
- Better documented
All 56 tests passing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -61,9 +61,9 @@ export const createSampleTemplate = () => `<svg xmlns="http://www.w3.org/2000/sv
|
||||
</g>
|
||||
|
||||
<!-- Task template -->
|
||||
<g id="task-template" style="display:none">
|
||||
<circle cx="{{TASK_X}}" cy="{{TASK_Y}}" r="6" fill="#1976D2"/>
|
||||
<text x="{{TEXT_X}}" y="{{TEXT_Y}}" font-family="Arial" font-size="11" fill="#424242">{{TASK_ID}} {{TASK_TITLE}}</text>
|
||||
<g id="item-template" style="display:none">
|
||||
<circle cx="{{ITEM_X}}" cy="{{ITEM_Y}}" r="6" fill="#1976D2"/>
|
||||
<text x="{{TEXT_X}}" y="{{TEXT_Y}}" font-family="Arial" font-size="11" fill="#424242">{{ITEM_ID}} {{ITEM_TITLE}}</text>
|
||||
</g>
|
||||
</defs>
|
||||
|
||||
@@ -80,8 +80,8 @@ export const createMalformedTemplate = (missingElement = 'month-template') => {
|
||||
<g id="lane-template" style="display:none">
|
||||
<rect x="{{LANE_X}}" y="{{LANE_Y}}" width="{{LANE_WIDTH}}" height="{{LANE_HEIGHT}}" fill="#FAFAFA"/>
|
||||
</g>
|
||||
<g id="task-template" style="display:none">
|
||||
<circle cx="{{TASK_X}}" cy="{{TASK_Y}}" r="6" fill="#1976D2"/>
|
||||
<g id="item-template" style="display:none">
|
||||
<circle cx="{{ITEM_X}}" cy="{{ITEM_Y}}" r="6" fill="#1976D2"/>
|
||||
</g>
|
||||
</defs>
|
||||
{{MONTHS}}
|
||||
@@ -92,14 +92,14 @@ export const createMalformedTemplate = (missingElement = 'month-template') => {
|
||||
<g id="month-template" style="display:none">
|
||||
<line x1="{{MONTH_X}}" y1="{{GRID_TOP}}" x2="{{MONTH_X}}" y2="{{GRID_BOTTOM}}" stroke="#E0E0E0"/>
|
||||
</g>
|
||||
<g id="task-template" style="display:none">
|
||||
<circle cx="{{TASK_X}}" cy="{{TASK_Y}}" r="6" fill="#1976D2"/>
|
||||
<g id="item-template" style="display:none">
|
||||
<circle cx="{{ITEM_X}}" cy="{{ITEM_Y}}" r="6" fill="#1976D2"/>
|
||||
</g>
|
||||
</defs>
|
||||
{{MONTHS}}
|
||||
{{LANES}}
|
||||
</svg>`,
|
||||
'task-template': `<svg xmlns="http://www.w3.org/2000/svg">
|
||||
'item-template': `<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<g id="month-template" style="display:none">
|
||||
<line x1="{{MONTH_X}}" y1="{{GRID_TOP}}" x2="{{MONTH_X}}" y2="{{GRID_BOTTOM}}" stroke="#E0E0E0"/>
|
||||
|
||||
Reference in New Issue
Block a user