Skip to content

frontend: dashboard based on financial data #18

@grantfox-oss

Description

@grantfox-oss

Type

Feature · Dashboard · Data Visualization

Difficulty

Medium

Track

Escrows · Analytics · Indexer · UI

Target repo

https://github.com/Trustless-Work/clonable-backoffice


Overview

Create a Dashboard view based on the Trustless Work block:

https://blocks.trustlesswork.com/blocks/dashboard-dashboard-01

The dashboard must visualize financial data for escrows where the connected wallet is the receiver, using:

useGetEscrowsFromIndexerByRole

The dashboard must display charts showing:

  • Total Released
  • Total Balance
  • Total Amount

The logic must correctly handle:

  • Multi-release escrows → calculated based on milestones
  • Single-release escrows → calculated based on the escrow as a whole

The implementation must strictly follow existing repository patterns and Trustless Work documentation.


User Personas

Service Provider / Freelancer

“I want to understand how much I’ve earned, how much has been released, and how much is still pending.”

Platform Operator

“I need a high-level financial overview of escrow activity.”


Required Links (Read First)


Goal

Build a financial dashboard that:

  • Retrieves escrows using the Trustless Work Indexer
  • Filters by receiver role
  • Calculates financial aggregates correctly
  • Distinguishes between single-release and multi-release escrows
  • Displays totals using structured charts
  • Matches the UI/UX patterns of the referenced dashboard block

Scope

In Scope

  • Fetch escrows using useGetEscrowsFromIndexerByRole
  • Filter results by receiver role
  • Compute:
    • Total Released
    • Total Balance
    • Total Amount
  • Handle milestone-based calculations for multi-release escrows
  • Render charts based on aggregated values
  • Reuse existing dashboard layout and UI components

Out of Scope

  • Backend changes
  • Smart contract modifications
  • Custom indexer logic
  • API changes
  • New financial metrics beyond those specified

Global Requirements

  • Follow existing code patterns in the repository
  • Follow existing UI/UX patterns
  • Follow Trustless Work documentation
  • Do not introduce architectural deviations
  • Maintain clean typing and readable structure
  • Ensure consistent financial formatting

Data Requirements

The implementation must:

  • Use useGetEscrowsFromIndexerByRole exactly as documented
  • Retrieve escrows where the connected wallet is the receiver
  • Correctly differentiate between:
    • Multi-release escrows (milestone-based calculations)
    • Single-release escrows (escrow-level calculations)
  • Aggregate financial values accurately
  • Handle loading, empty, and error states properly

Financial Logic Requirements

Multi-Release Escrows

  • Totals must be calculated based on individual milestones
  • Released amounts must reflect milestone release states
  • Remaining balance must reflect unreleased milestone amounts

Single-Release Escrows

  • Totals must be calculated at the escrow level
  • Released amount must reflect escrow release status
  • Balance must reflect unreleased escrow funds

All calculations must be derived from indexer data and must not rely on assumptions outside documented behavior.


UI Requirements

The dashboard must:

  • Be visually aligned with the referenced Dashboard Block
  • Include structured charts for:
    • Total Released
    • Total Balance
    • Total Amount
  • Present financial values clearly and consistently
  • Follow existing spacing, typography, and card patterns
  • Maintain readability and financial clarity

Charts must:

  • Clearly differentiate values
  • Use consistent formatting
  • Avoid misleading representations

Component Responsibilities

Suggested name (you may choose a better one):

FinancialDashboardView

Responsibilities:

  • Retrieve escrows using the indexer hook
  • Filter by receiver role
  • Aggregate financial metrics
  • Distinguish single-release vs multi-release logic
  • Render chart components
  • Handle loading, empty, and error states

Functional Requirements

  • Uses useGetEscrowsFromIndexerByRole correctly
  • Filters escrows by receiver
  • Correctly handles multi-release escrow calculations
  • Correctly handles single-release escrow calculations
  • Displays Total Released
  • Displays Total Balance
  • Displays Total Amount
  • Matches existing dashboard UI patterns
  • No smart contract changes
  • No API changes
  • Lint and typecheck must pass

Developer Workflow (Required)

  • Create a new branch:

feature/financial-dashboard

  • Open a PR into main
  • Include screenshots showing:
    • Loading state
    • Empty state
    • Dashboard populated with data
    • Charts displaying correct totals

Testing (Required)

Local Testing

  • Run the app locally
  • Connect a wallet with receiver escrows
  • Verify correct aggregation for:
    • Single-release escrows
    • Multi-release escrows
  • Validate financial totals manually against raw data
  • Verify visual consistency

Edge Cases

  • No escrows returned
  • Only single-release escrows
  • Only multi-release escrows
  • Mixed escrow types
  • Partially released milestones

Learning Outcomes (Why This Task Exists)

By completing this task, contributors will learn:

  • How to use the Trustless Work Indexer hook
  • How multi-release escrow logic differs from single-release
  • How milestone states impact financial aggregation
  • How to build accurate financial dashboards
  • How to maintain architectural and UI consistency

Acceptance Criteria

  • Escrows are fetched using the official indexer hook
  • Results are filtered by receiver role
  • Multi-release escrows are calculated based on milestones
  • Single-release escrows are calculated at escrow level
  • Total Released, Total Balance, and Total Amount are accurate
  • The dashboard matches existing UI patterns
  • Loading and empty states are handled correctly
  • Code follows repository standards
  • Lint and typecheck pass

Notes for Contributors

This task focuses on financial accuracy, correct aggregation logic, and UI consistency.

Be precise.
Be consistent.
Follow Trustless Work documentation strictly.
Avoid assumptions in financial calculations.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions