-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Type
Reusable Component · UI Logic · Escrow Visualization
Difficulty
Medium
Track
Escrows · Milestones · UI Components
Target repo
https://github.com/Trustless-Work/clonable-backoffice
Overview
Create a Progress Indicator component based on the Trustless Work block:
https://blocks.trustlesswork.com/blocks/indicators-balance-progress
The component must render a progress bar based on an escrow’s milestones.
The progress must be calculated dynamically depending on a required prop:
"released" | "approved"
The component must calculate progress as a ratio between:
- Total milestones
- Milestones matching the selected state
Example:
If an escrow has 10 milestones:
- If mode is "released" → progress is based on how many milestones are released
- If mode is "approved" → progress is based on how many milestones are approved
Important Constraints
- For "released" mode → the escrow MUST be multi-release
- For "approved" mode → the escrow may be single-release or multi-release
This must be validated internally and handled safely.
User Personas
Service Provider / Freelancer
“How much of this escrow has been completed or released?”
Client / Buyer
“How many milestones have been approved so far?”
Required Links (Read First)
-
Progress Indicator Block Reference
https://blocks.trustlesswork.com/blocks/indicators-balance-progress -
Trustless Work Docs
https://docs.trustlesswork.com/
Goal
Build a reusable progress bar component that:
- Receives an escrow object
- Receives a required mode prop: "released" | "approved"
- Calculates progress based on milestone states
- Validates release rules based on escrow type
- Follows the UI structure of the referenced block
- Can be embedded across different escrow views
Scope
In Scope
- Create a reusable progress bar component
- Accept escrow data as input
- Accept a required mode prop: "released" | "approved"
- Compute progress based on milestone count
- Enforce multi-release requirement for "released" mode
- Match visual structure of the reference block
Out of Scope
- Backend changes
- Smart contract modifications
- API changes
- Indexer modifications
- Financial calculations beyond milestone counting
Global Requirements
- Follow existing code patterns in the repository
- Follow existing UI/UX patterns
- Follow Trustless Work documentation
- Maintain strict typing
- Avoid duplicated logic
- Do not introduce architectural inconsistencies
Functional Requirements
The component must:
-
Receive an escrow object
-
Receive a required prop:
- "released"
- "approved"
-
Detect total number of milestones
-
Count milestones matching the selected mode
-
Compute progress as:
matching milestones / total milestones
-
Render a progress bar reflecting the calculated percentage
Validation Rules
Mode: "released"
- Escrow must be multi-release
- If escrow is single-release:
- The component must safely handle the case
- Must not produce incorrect progress
- Must not break rendering
Mode: "approved"
- Escrow may be single-release or multi-release
- Progress is calculated based on milestone approval states
UI Requirements
The component must:
- Visually follow the referenced balance-progress block
- Display:
- A progress bar
- A percentage indicator
- Optional textual indicator (e.g., “3 of 10 milestones”)
- Maintain consistent spacing and typography
- Match existing color patterns for status indicators
The design must prioritize:
- Clarity
- Readability
- Accurate visual representation
Component Responsibilities
Suggested name (you may choose a better one):
EscrowMilestoneProgress
Responsibilities:
- Accept escrow data
- Accept mode prop
- Validate release rules
- Compute progress
- Render progress bar
- Remain reusable across different views
Edge Cases
- Escrow with zero milestones
- Escrow single-release used in "released" mode
- All milestones completed
- No milestones completed
- Partially completed milestones
The component must handle all cases safely without runtime errors.
Testing (Required)
Local Testing
-
Test with multi-release escrow:
- Multiple released milestones
- Partial release
- Fully released
-
Test with single-release escrow:
- Approved milestones
- Attempted "released" mode
-
Validate progress percentages manually
Learning Outcomes (Why This Task Exists)
By completing this task, contributors will learn:
- How milestone states impact escrow visualization
- How multi-release logic differs from single-release
- How to design safe reusable UI components
- How to enforce business rules at the UI layer
- How to align implementation with Trustless Work documentation
Acceptance Criteria
- Component follows existing repository patterns
- Component matches the referenced block visually
- Progress is correctly calculated
- "released" mode only works correctly for multi-release escrows
- "approved" mode works for both escrow types
- Edge cases are handled safely
- Component is reusable
- Lint and typecheck pass
Notes for Contributors
This task focuses on correct milestone logic and reusable UI design.
Be precise in calculations.
Do not assume milestone states.
Follow Trustless Work documentation strictly.
Ensure safe behavior for invalid combinations.