feat: add toast notifications#1343
Open
TUPM96 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Introduces a global toast/notification system and supports it with shared UI utilities and animations, then wires it into bounty creation/submission flows.
Changes:
- Added
ToastProvider/useToastcontext + UI rendering for toast notifications. - Integrated toast feedback into
SubmissionFormandBountyCreateWizarduser actions. - Added shared
utils+animationsmodules and a Vitest test suite for the toast context.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/main.tsx | Wraps the app with ToastProvider so toasts can be shown anywhere. |
| frontend/src/contexts/ToastContext.tsx | Implements toast state management, rendering, animations, and the useToast hook. |
| frontend/src/components/bounty/SubmissionForm.tsx | Emits toast notifications for verification/submission/copy actions. |
| frontend/src/components/bounty/BountyCreateWizard.tsx | Emits toast notifications for create/verify/publish/copy actions. |
| frontend/src/tests/toast-context.test.tsx | Adds component tests validating toast variants, stacking, manual dismiss, and auto-dismiss. |
| frontend/src/lib/utils.ts | Adds formatting/time helper utilities used across the UI. |
| frontend/src/lib/animations.ts | Adds shared Framer Motion variant presets. |
| .gitignore | Un-ignores frontend/src/lib so new shared modules are tracked. |
Comments suppressed due to low confidence (1)
frontend/src/components/bounty/BountyCreateWizard.tsx:1
- Same clipboard issue as in
SubmissionForm:writeText(...)can reject and currently fails silently. Add a.catch(...)branch to show a toast error and keepcopiedAddrunchanged when the copy fails.
import React, { useState, useCallback } from 'react';
Comment on lines
93
to
97
| navigator.clipboard.writeText(TREASURY).then(() => { | ||
| setCopied(true); | ||
| toast.info('Treasury address copied.'); | ||
| setTimeout(() => setCopied(false), 2000); | ||
| }); |
Comment on lines
+60
to
+73
| it('auto-dismisses after five seconds by default', async () => { | ||
| vi.useFakeTimers(); | ||
| renderHarness(); | ||
|
|
||
| fireEvent.click(screen.getByText('Info')); | ||
| expect(screen.getByRole('alert')).toBeInTheDocument(); | ||
|
|
||
| act(() => { | ||
| vi.advanceTimersByTime(5200); | ||
| }); | ||
|
|
||
| vi.useRealTimers(); | ||
| await waitFor(() => expect(screen.queryByRole('alert')).not.toBeInTheDocument()); | ||
| }); |
| exit={{ opacity: 0, x: 32, scale: 0.98 }} | ||
| transition={{ duration: 0.18, ease: 'easeOut' }} | ||
| role="alert" | ||
| aria-live="assertive" |
Comment on lines
+137
to
+143
| <div className="fixed right-4 top-20 z-[100] flex w-[calc(100vw-2rem)] max-w-sm flex-col gap-3 sm:right-6"> | ||
| <AnimatePresence initial={false}> | ||
| {toasts.map((toast) => ( | ||
| <ToastItem key={toast.id} toast={toast} onDismiss={dismissToast} /> | ||
| ))} | ||
| </AnimatePresence> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #825
Summary
Verification
Wallet