Plan: Build GoodWidget packages/savings-widget package
Context & Goals
This issue tracks the initial creation of packages/savings-widget in GoodWidget, enabling a GoodDollar savings experience:
1. Reference: Key Files & Features
A. GoodSDKs/packages/savings-widget (Web Component Implementation)
src/GooddollarSavingsWidget.ts:
Core UI, flows, and state management (deposit, withdraw tabs, provider connection, display of savings balances, tab switching, deposit/withdraw input forms, success/error/loading UI)
README.md:
Shows main flows, required props (web3Provider, connectWallet action)
- Uses Lit/LitElement, but the UI state shows:
- Tabbed interface: Deposit/Withdraw
- Onboarding: Wallet connect
- Shows user balance, accepts user input/amount
- Executes deposit/withdraw using SDK, provides visual feedback (pending/success/error)
- Uses a compact card/container with themeable styling, responsive design, and clear feedback
B. GoodDollar/GoodWalletV2/src/sections/Swap/ (Design System/Composites)
SwapView.tsx, SwapOverlay.tsx:
Shows multi-step workflow, modal/sheet design, styled input, token selectors, confirmation slider, and various feedback mechanisms.
- Component patterns:
- Asset (token) select box
- Amount input box
- Multi-step panel or overlay (with back/close)
- Loading and error overlays/toasts
- CSS - shows padding, layout, responsive design tokens.
C. GoodWidget/packages/ui (Reusable Primitives)
src/index.ts:
Reusable Card, Button, Spinner, Toast, Drawer, Icon, Input, Select, Dialog, theme presets, ActionSheet, TokenInput, etc.
src/theme.ts, src/presets.ts:
Theming tokens mapped to GoodWalletV2, brand-compliant by default.
2. Imports & Implementation Guidance
- All GoodDollar org packages may be locally imported via monorepo/workspace references (even if private/unpublished).
- Strict: No copy-pasting code—import and compose only!
- Use live SDK APIs (
@gooddollar/savings-sdk) for protocol logic.
3. New Component & Flow Mapping
Core Widget Structure
SavingsWidgetContainer (main panel/card, themed)
DepositTab (deposit flow)
WithdrawTab (withdraw flow)
WalletConnectPrompt (if !provider)
AmountInput (reuse if present, extend if not; see Swap/AmountInputBox)
TokenSelect (reuse if present, otherwise create; see Swap/AssetSelectBox)
ActionButton (import from ui)
Feedback/Toast (import from ui)
Spinner/LoadingState (import from ui)
Success/Error/EmptyState panels (compose with Card/Text/Icon from ui)
Storybook for all primitives/extensions
Component Placement
- If primitive is generic/reusable: Add to
packages/ui
- If specific to savings-widget: Add to
packages/savings-widget
4. Required Flows, States, and Behaviors
- On mount, widget fetches savings data for connected user (via SDK)
- Shows onboarding if provider/wallet is not connected
- Deposit flow:
- Enter amount
- Confirm and sign via provider
- Shows pending/error/success states
- Withdraw flow:
- Enter amount (only up to balance)
- Confirm/sign/pending/success error
- General:
- Responsive styling (card layout)
- All async states use skeleton/spinner
- All errors handled with feedback (Toast/Alert)
- Reuse design tokens/components for all UI
5. Execution Plan
- Scaffold
packages/savings-widget structure (index/entry, Card container, hooks)
- Add peer/local dependency on
@gooddollar/savings-sdk
- Map minimal viable UI by recreating Lit webcomponent flows in React using local primitives
- Compose new flows by reusing primitives from
packages/ui
- For missing UI, spec & build components based on GoodWalletV2 Swap section (add to ui if reusable)
- Ensure provider/wallet logic is passed as props for host integration (mirroring webcomponent)
- Write Storybook coverage for every new primitive
- Document all public types/props
- Add tests (unit + flows)
- Provide example usage at package root
6. Acceptance Criteria
7. Human-Reviewer Checklist
This plan is based only on the first page of code search results. For full reference, see:
Plan: Build GoodWidget
packages/savings-widgetpackageContext & Goals
This issue tracks the initial creation of
packages/savings-widgetin GoodWidget, enabling a GoodDollar savings experience:@gooddollar/savings-sdk(logic: see GoodSDKs/packages/savings-sdks)packages/uicomponents as much as possible1. Reference: Key Files & Features
A. GoodSDKs/packages/savings-widget (Web Component Implementation)
src/GooddollarSavingsWidget.ts:Core UI, flows, and state management (deposit, withdraw tabs, provider connection, display of savings balances, tab switching, deposit/withdraw input forms, success/error/loading UI)
README.md:Shows main flows, required props (
web3Provider,connectWalletaction)B. GoodDollar/GoodWalletV2/src/sections/Swap/ (Design System/Composites)
SwapView.tsx,SwapOverlay.tsx:Shows multi-step workflow, modal/sheet design, styled input, token selectors, confirmation slider, and various feedback mechanisms.
C. GoodWidget/packages/ui (Reusable Primitives)
src/index.ts:Reusable Card, Button, Spinner, Toast, Drawer, Icon, Input, Select, Dialog, theme presets, ActionSheet, TokenInput, etc.
src/theme.ts,src/presets.ts:Theming tokens mapped to GoodWalletV2, brand-compliant by default.
2. Imports & Implementation Guidance
@gooddollar/savings-sdk) for protocol logic.3. New Component & Flow Mapping
Core Widget Structure
SavingsWidgetContainer(main panel/card, themed)DepositTab(deposit flow)WithdrawTab(withdraw flow)WalletConnectPrompt(if !provider)AmountInput(reuse if present, extend if not; see Swap/AmountInputBox)TokenSelect(reuse if present, otherwise create; see Swap/AssetSelectBox)ActionButton(import from ui)Feedback/Toast(import from ui)Spinner/LoadingState(import from ui)Success/Error/EmptyStatepanels (compose with Card/Text/Icon from ui)Storybookfor all primitives/extensionsComponent Placement
packages/uipackages/savings-widget4. Required Flows, States, and Behaviors
5. Execution Plan
packages/savings-widgetstructure (index/entry, Card container, hooks)@gooddollar/savings-sdkpackages/ui6. Acceptance Criteria
@gooddollar/savings-sdkpackages/uiif reusable7. Human-Reviewer Checklist
This plan is based only on the first page of code search results. For full reference, see: