Skip to content

Completed Task#567

Merged
ritik4ever merged 5 commits into
ritik4ever:mainfrom
Enemuo-debug:main
Jun 3, 2026
Merged

Completed Task#567
ritik4ever merged 5 commits into
ritik4ever:mainfrom
Enemuo-debug:main

Conversation

@Enemuo-debug
Copy link
Copy Markdown
Contributor

@Enemuo-debug Enemuo-debug commented Jun 2, 2026

What changed

Testing done

Related issues

Closes #249

Checklist

  • I kept the change focused on the related issue.
  • I added or updated tests where useful.
  • I updated documentation where behavior changed.
  • I verified the app still builds or explained why verification was skipped.

Summary by CodeRabbit

  • New Features

    • Stream creation functionality is now integrated directly into the dashboard with a toggle button to switch between views.
    • Empty dashboard state displays a "Create your first stream" prompt and button.
  • Bug Fixes

    • Minimum stream duration requirement reduced from 1 hour to 1 minute.
    • Improved error messaging and UI formatting for end-time label display.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

@Enemuo-debug is attempting to deploy a commit to the ritik4ever's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c2bb6729-5a95-4bc1-8430-f6d68c8106c1

📥 Commits

Reviewing files that changed from the base of the PR and between 2e9cd1a and 8aa2d2a.

📒 Files selected for processing (2)
  • frontend/src/components/CreateStreamForm.tsx
  • frontend/src/components/SenderDashboard.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/src/components/CreateStreamForm.tsx
  • frontend/src/components/SenderDashboard.tsx

📝 Walkthrough

Walkthrough

Integrates CreateStreamForm into SenderDashboard with a 1-minute duration validation and styled estimated-end preview. Adds showCreateForm/createError state, handleCreate to submit and refresh streams, refactors empty-state UI with a creation CTA, includes Vitest tests, and adds JSDoc comments.

Changes

Stream Creation Dashboard Integration

Layer / File(s) Summary
CreateStreamForm validation and styling
frontend/src/components/CreateStreamForm.tsx
Adds JSDoc for humaniseApiError, AccountHint, and CreateStreamForm; changes "Invalid duration" hint to require ≥60 seconds; wraps estimatedEndLabel in a styled div.
Dashboard state and create handler
frontend/src/components/SenderDashboard.tsx
Imports createStream and CreateStreamForm; adds showCreateForm and createError state; implements handleCreate to call createStream, refresh via listStreams, close form on success, and surface errors.
Dashboard UI: empty state and create flows
frontend/src/components/SenderDashboard.tsx
Gates empty-dashboard rendering to when no streams and form hidden; adds "Create your first stream" CTA and a header toggle; conditionally renders CreateStreamForm or metrics/tables.
Dashboard test suite
frontend/src/components/SenderDashboard.test.tsx
Vitest suite with MSW-mocked API validates mixed active/completed streams metrics, empty-state CTA, create-form toggle, and API 500 error message rendering.
Form validation documentation
frontend/src/hooks/useFormValidation.ts
JSDoc added for isStellarAccount, FormValues, and validateForm.

Sequence Diagram

sequenceDiagram
  participant User
  participant Dashboard
  participant CreateStreamForm
  participant API
  User->>Dashboard: View dashboard or click Create
  Dashboard->>Dashboard: set showCreateForm = true
  Dashboard->>CreateStreamForm: Render form
  User->>CreateStreamForm: Fill and submit (duration ≥ 60s)
  CreateStreamForm->>API: POST /api/streams (createStream)
  API-->>CreateStreamForm: Success or error
  alt Creation succeeds
    CreateStreamForm->>Dashboard: invoke handleCreate callback
    Dashboard->>API: GET /api/streams (listStreams)
    API-->>Dashboard: Updated streams list
    Dashboard->>Dashboard: close form, clear createError
    Dashboard->>User: Show updated dashboard
  else Creation fails
    Dashboard->>Dashboard: set createError
    Dashboard->>User: Display error message (HTTP code)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

A rabbit hops to fix the form, so swift and neat,
One minute now, no hour to meet,
A tiny hint, a styled little view,
Dashboard blooms and tests pass through,
🐰✨ Streams begin with a happy beat.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'Completed Task' is vague and does not describe the actual changes; it reads like a checklist item rather than a meaningful commit message. Replace with a concise, descriptive title that summarizes the main change, e.g., 'Add SenderDashboard tests and create-stream integration' or 'Test SenderDashboard metrics and create flow'.
Out of Scope Changes check ⚠️ Warning The PR includes significant changes beyond issue #249: CreateStreamForm.tsx (duration validation change), SenderDashboard.tsx (create-form UI integration), and useFormValidation.ts (documentation) are not required by the linked issue. Clarify whether these changes are related to enabling the test requirements, or split them into separate PRs aligned with their respective issues.
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR fully implements issue #249: comprehensive SenderDashboard.test.tsx with metric verification, empty-state testing, create-flow navigation, and error-handling coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/src/components/CreateStreamForm.tsx (1)

496-500: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Render the estimated end hint once.

estimatedEndLabel is already shown inside the duration field. The new block duplicates the same text in the UI.

Proposed fix
-      {estimatedEndLabel && (
-        <div className="field-hint" style={{ marginTop: "-0.5rem", marginBottom: "1rem", color: "var(--color-success-text, `#2e7d32`)", fontWeight: 500 }}>
-          {estimatedEndLabel}
-        </div>
-      )}

Also applies to: 545-549

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/components/CreateStreamForm.tsx` around lines 496 - 500, The
estimated end text is being rendered twice in CreateStreamForm: once inside the
duration field and again via the separate span block that uses estimatedEndLabel
(the span with id "duration-hint"); remove the duplicate span render so
estimatedEndLabel is only shown inside the duration field. Locate the
conditional rendering that checks estimatedEndLabel (the block that returns
<span id="duration-hint" className="field-hint"
aria-live="polite">{estimatedEndLabel}</span>) and delete it (also remove the
duplicate block around lines showing the same pattern later), leaving the single
in-field usage of estimatedEndLabel intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/components/CreateStreamForm.tsx`:
- Around line 24-29: Move the misplaced JSDoc comments so they document the
correct declarations: attach the comment describing "Converts raw API error
messages into user-friendly titles and hints" to the humaniseApiError function,
and attach the comment describing the component behavior to the CreateStreamForm
component (instead of FeePreview and buildCreateStreamPayload). Update or
relocate the existing JSDoc blocks that currently sit above the FeePreview
interface and buildCreateStreamPayload so their text appears immediately above
the humaniseApiError function and the CreateStreamForm declaration respectively,
ensuring IDE hovers show the correct docs for those symbols.

In `@frontend/src/components/SenderDashboard.tsx`:
- Around line 99-102: The totalsByAsset calculation currently sums s.totalAmount
for every entry in streams, which incorrectly counts canceled streams; update
the useMemo so it filters out canceled streams (e.g., only include streams where
s.status !== 'canceled') or, if the metric should reflect actual outgoing value,
sum the vested amount field (e.g., s.vestedAmount) instead of s.totalAmount;
adjust the reducer referenced as totalsByAsset and the dependency on streams
accordingly and ensure the chosen condition/field matches how Stream objects
represent cancellation and vested value.
- Around line 110-122: The createPath mixes creation and refresh in one
try/catch causing refresh errors to be reported as create failures; change
handleCreate so createStream(payload) is awaited in its own try/catch (catch
sets setCreateError and rethrows or returns), and perform listStreams({ sender:
senderAddress! }) in a separate try/catch that does not overwrite create errors
— update setStreams and setShowCreateForm on successful create regardless of
refresh outcome and handle refresh failures separately (e.g., set a different
error state or log) so creation success is never misreported; refer to
handleCreate, createStream, listStreams, setCreateError, setStreams, and
setShowCreateForm to locate and adjust the logic.

---

Outside diff comments:
In `@frontend/src/components/CreateStreamForm.tsx`:
- Around line 496-500: The estimated end text is being rendered twice in
CreateStreamForm: once inside the duration field and again via the separate span
block that uses estimatedEndLabel (the span with id "duration-hint"); remove the
duplicate span render so estimatedEndLabel is only shown inside the duration
field. Locate the conditional rendering that checks estimatedEndLabel (the block
that returns <span id="duration-hint" className="field-hint"
aria-live="polite">{estimatedEndLabel}</span>) and delete it (also remove the
duplicate block around lines showing the same pattern later), leaving the single
in-field usage of estimatedEndLabel intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 67deafbd-739c-4bc4-a440-601c03c338b4

📥 Commits

Reviewing files that changed from the base of the PR and between 9e1f411 and 2e9cd1a.

📒 Files selected for processing (4)
  • frontend/src/components/CreateStreamForm.tsx
  • frontend/src/components/SenderDashboard.test.tsx
  • frontend/src/components/SenderDashboard.tsx
  • frontend/src/hooks/useFormValidation.ts

Comment thread frontend/src/components/CreateStreamForm.tsx
Comment thread frontend/src/components/SenderDashboard.tsx
Comment thread frontend/src/components/SenderDashboard.tsx
@Enemuo-debug
Copy link
Copy Markdown
Contributor Author

@ritik4ever

@ritik4ever ritik4ever merged commit 113a586 into ritik4ever:main Jun 3, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for SenderDashboard – stream list, metrics display, and create flow

2 participants