Skip to content

Feat/issues 662 663 664 665 - #708

Merged
Austinaminu2 merged 4 commits into
FlowwStar:mainfrom
OZILSOLAR:feat/issues-662-663-664-665
Aug 30, 2026
Merged

Feat/issues 662 663 664 665#708
Austinaminu2 merged 4 commits into
FlowwStar:mainfrom
OZILSOLAR:feat/issues-662-663-664-665

Conversation

@OZILSOLAR

Copy link
Copy Markdown
Contributor

Summary

This PR implements four interconnected improvements across the FlowStar smart contract and frontend UI component library:

🔗 Smart Contract Enhancements (Soroban/Rust)

🎨 Frontend Infrastructure


Detailed Changes

Issue #662: Add timestamp field to TopUpEvent and StreamTransferEvent

Problem: While most stream lifecycle events (StreamCreatedEvent, WithdrawEvent, CancelEvent, etc.) included timestamp fields, TopUpEvent and
StreamTransferEvent were missing this property. This inconsistency broke event indexing for downstream consumers.

Solution:

  • Added timestamp: u64 field to TopUpEvent struct
  • Added timestamp: u64 field to StreamTransferEvent struct
  • Updated both event emit calls to capture env.ledger().timestamp() and include it in the event payload
  • Ensures all stream lifecycle events maintain consistent event-shape for proper indexing

Files Modified:

  • contracts/streaming/src/lib.rs (struct definitions + emit calls)

Issue #663: Extract require_admin() helper and replace repeated validation

Problem: Four functions (initialize(), pause(), unpause(), and migrate()) contained repeated admin-check and initialization validation
logic, leading to code duplication and harder maintenance.

Solution:

  • Created private require_admin(env: &Env) -> Result<Address, StreamError> helper function that:
    • Retrieves admin address from storage
    • Returns NotInitialized error if admin not found
    • Requires authorization from the admin address
    • Returns the admin address on success
  • Replaced all three instances of repeated pattern in pause(), unpause(), and migrate()
  • Reduces code duplication and improves maintainability without changing behavior

Files Modified:

  • contracts/streaming/src/lib.rs (new helper function + updated function implementations)

Issue #664: Set up Storybook and add first stories for button component

Problem: The project lacked Storybook configuration and isolated component browsing capabilities, making it difficult for developers to view
components in different states.

Solution:

  • Created .storybook/main.ts - Main Storybook configuration for Next.js with proper story resolution and addon setup
  • Created .storybook/preview.ts - Global preview configuration with Tailwind CSS and globals styling
  • Added Storybook dependencies to package.json:
    • @storybook/nextjs
    • @storybook/react
    • @storybook/addon-essentials
    • @storybook/addon-interactions
    • @storybook/addon-links
    • storybook (CLI)
  • Added npm scripts: storybook (dev) and storybook:build (production)
  • Created components/ui/button.stories.tsx with comprehensive coverage:
    • All 6 button variants: default, outline, secondary, ghost, destructive, link
    • All size options: xs, sm, default, lg, icon, icon-xs, icon-sm, icon-lg
    • Disabled state examples for multiple variants
    • 19 individual stories covering variant+size combinations
    • Full documentation with argTypes and interactive controls

Files Created/Modified:

  • .storybook/main.ts (new)
  • .storybook/preview.ts (new)
  • components/ui/button.stories.tsx (new - 180 lines)
  • package.json (updated with Storybook deps and scripts)

Issue #665: Add Storybook stories for badge component

Problem: No Storybook stories existed for the badge component, making it difficult to explore all color and variant combinations.

Solution:

  • Created components/ui/badge.stories.tsx with complete documentation:
    • Individual stories for all 6 variants: default, secondary, destructive, outline, ghost, link
    • AllVariants showcase story displaying all variants side-by-side
    • Text length variations (long and short text examples)
    • Status badge examples: Active, Inactive, Error, Warning
    • Tag-like badge use cases: React, TypeScript, CSS
    • Comprehensive VariantShowcase story combining all patterns
    • Full documentation with argTypes and interactive controls

Files Created:

  • components/ui/badge.stories.tsx (new - 178 lines)

Testing Recommendations

Smart Contract Changes

  • Verify TopUpEvent and StreamTransferEvent are emitted with correct timestamp values
  • Test admin functions (pause, unpause, migrate) still behave identically after refactoring
  • Confirm NotInitialized error still returns correctly when admin not set

Storybook

  • Run npm run storybook to start Storybook dev server
  • Navigate to http://localhost:6006 to view all component stories
  • Test all button variant+size combinations for visual correctness
  • Test all badge variants for proper styling and documentation

Summary of Files Changed

.storybook/main.ts | 19 +++++++++++++++++++
.storybook/preview.ts | 16 +++++++++++++++
components/ui/badge.stories.tsx | 178 ++++++++++++++++++++++++++++++++
components/ui/button.stories.tsx | 180 ++++++++++++++++++++++++++++++++
contracts/streaming/src/lib.rs | 41 +++++---
package.json | 10 +-
6 files changed, 425 insertions(+), 19 deletions(-)


Commits Included

  1. d5b53ef - feat(Add a timestamp field to TopUpEvent and StreamTransferEvent for event-shape consistency #662): Add timestamp field to TopUpEvent and StreamTransferEvent
  2. 2e1b215 - feat(Extract require_admin() helper in the contract and replace repeated init/pause/migrate panics with typed errors #663): Extract require_admin() helper and consolidate admin checks
  3. 603f621 - feat(Set up Storybook and add first stories for components/ui/button.tsx #664): Set up Storybook and add first stories for button component
  4. 8c5eb97 - feat(Add Storybook stories for components/ui/badge.tsx #665): Add Storybook stories for badge component

Closes #662
Closes #663
Closes #664
Closes #665

…sferEvent

- Add timestamp field to TopUpEvent struct for event-shape consistency
- Add timestamp field to StreamTransferEvent struct for event-shape consistency
- Update both emit calls to capture and include the current ledger timestamp
- This ensures all stream lifecycle events have a timestamp field for proper event indexing
…dmin checks

- Create private require_admin(env: &Env) -> Result<Address, StreamError> helper
- Replace repeated admin validation pattern in pause(), unpause(), and migrate()
- Consolidates retrieval of admin address, NotInitialized error, and auth requirement
- Reduces code duplication and improves maintainability
…n component

- Create .storybook directory with main.ts and preview.ts configuration
- Configure Storybook for Next.js with Tailwind CSS support
- Add Storybook and related dependencies to package.json
- Create comprehensive button.stories.tsx covering all variants and sizes
- Include stories for: default, ghost, secondary, destructive variants
- Cover all size options: xs, sm, default, lg, icon variants
- Add disabled state examples and documentation
- Create comprehensive badge.stories.tsx with all color and variant combinations
- Cover all badge variants: default, secondary, destructive, outline, ghost, link
- Include practical examples for status badges (active, inactive, error, warning)
- Add tag-like badge examples for common use cases
- Include showcase story displaying all variants and common patterns
- Provide reference documentation for component usage
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@OZILSOLAR Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants