|
| 1 | +--- |
| 2 | +title: "DMP’25 Week 02 Update by Justin Charles" |
| 3 | +excerpt: "Completed SVG path logic for all brick types and documented props and rendering states" |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-06-15" |
| 6 | +slug: "2025-06-15-dmp-25-justin212407-week02" |
| 7 | +author: "@/constants/MarkdownFiles/authors/justin-charles.md" |
| 8 | +tags: "dmp25,sugarlabs,week2,justin212407" |
| 9 | +image: "assets/Images/c4gt_DMP.png" |
| 10 | +--- |
| 11 | + |
| 12 | +<!-- markdownlint-disable --> |
| 13 | + |
| 14 | +# Week 2 Progress Report by Safwan Sayeed |
| 15 | + |
| 16 | +**Project:** Music Blocks 4 Program Engine |
| 17 | +**Mentors:** [Anindya Kundu](https://github.com/meganindya/), [Sumit Srivastava](https://github.com/sum2it) |
| 18 | +**Assisting Mentors:** [Devin Ullibari](https://github.com/pikurasa/), [Walter Bender](https://github.com/walterbender) |
| 19 | +**Reporting Period:** 2025-06-09 - 2025-06-15 |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | + |
| 24 | +## Goals for This Week |
| 25 | + |
| 26 | +- Finalize SVG path logic for all three types of bricks |
| 27 | +- Categorize and document all props passed into bricks |
| 28 | +- Identify all visual states a brick can be rendered in |
| 29 | +- Differentiate props and states across brick types |
| 30 | +- Write comprehensive tests to verify correctness |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## This Week’s Highlights |
| 35 | + |
| 36 | +### 1. Full SVG Path Generation Logic |
| 37 | + |
| 38 | +- Completed `generatePath` support for all three brick types (Simple, Expression and Compound) |
| 39 | +- Rendering now properly reflects scaling, argument slots, top/bottom notches, and label widths |
| 40 | +- Edge cases such as bricks with long labels or stacked arguments handled correctly |
| 41 | + |
| 42 | +### 2. Brick Input Prop Categorization |
| 43 | + |
| 44 | +- Catalogued all props across types (`strokeWidth`, `scaleFactor`, `bBoxLabel`, `bBoxArgs`, etc.) |
| 45 | +- Documented their role in layout computation and how they influence final SVG shape |
| 46 | + |
| 47 | +### 3. Brick State Documentation |
| 48 | + |
| 49 | +- Mapped out all possible states a brick can be rendered in (e.g. with/without label, multiple args, missing notches) |
| 50 | +- This will help improve clarity for both debugging and future features |
| 51 | + |
| 52 | +### 4. Type-wise Prop/State Differentiation |
| 53 | + |
| 54 | +- Clearly separated the logic for how each brick type handles its props and rendering states |
| 55 | +- This abstraction allows brick-specific customizations without breaking general rendering flow |
| 56 | + |
| 57 | +### 5. Unified Brick Test File |
| 58 | + |
| 59 | +- Created a comprehensive Jest test file to validate path generation against expected output |
| 60 | +- Covers edge cases like empty arguments, multiple stacked args, and variable heights |
| 61 | + |
| 62 | +📄 Reference: [Props & States Document – Tab 3](https://docs.google.com/document/d/1C0t4iSze2eDEv6lWbloK3MnvJgAa6HvmXmk2sQ0lCZs/edit?tab=t.99d6uc7vheda) |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## Challenges & Solutions |
| 67 | + |
| 68 | +**Challenge: Mismatched Bounding Box Heights in Some Brick Types** |
| 69 | +In initial tests, actual brick heights didn’t match the combined heights of `bBoxLabel` and `bBoxArgs`. |
| 70 | +**Solution:** Identified a calculation flaw in vertical layout stacking. Corrected it by properly summing scaled heights and applying consistent spacing logic in path computation. |
| 71 | + |
| 72 | +**Challenge: Supporting All Brick Variants with Shared Logic** |
| 73 | +Bricks share many layout rules, but also diverge in rendering. |
| 74 | +**Solution:** Broke down `generatePath` into side-specific functions (`_generateLeft`, `_generateRight`, etc.) with override support depending on brick type and features like notches. |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## Key Learnings |
| 79 | + |
| 80 | +- Improved understanding of scalable vector graphics and path-based layout systems |
| 81 | +- Gained hands-on experience in building testable, modular rendering logic |
| 82 | +- Developed systematic thinking around UI state modeling and prop-driven rendering behavior |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## Next Week’s Roadmap |
| 87 | + |
| 88 | +- Create React Components(View) to render the bricks with all its properties. |
| 89 | +- Create the Model components for the different Brick Types. |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +## Resources & References |
| 94 | + |
| 95 | +- [Props & States Document](https://docs.google.com/document/d/1C0t4iSze2eDEv6lWbloK3MnvJgAa6HvmXmk2sQ0lCZs/edit?tab=t.99d6uc7vheda) |
| 96 | +- [musicblocks-v4 Repository](https://github.com/sugarlabs/musicblocks-v4) |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Acknowledgments |
| 101 | + |
| 102 | +Thanks to my mentors for helping review the rendering logic and for encouraging a structured approach to SVG layout systems. Their early feedback made the path code significantly more robust and maintainable. |
| 103 | + |
| 104 | +--- |
0 commit comments