feat: add optimistic UI on TrendingRail primary action with revert on failure (Closes #834) - #849
Closed
waterWang wants to merge 1 commit into
Closed
Conversation
… failure (Closes Predictify-org#834) - Make trending cards clickable with pointer cursor - Add optimistic UI state on card click (highlighted + spinner) - Revert optimistic state on action failure with error toast - Auto-dismiss error toast after 3 seconds - Disable other cards while one is in optimistic state - Add keyboard accessibility (focus-visible, aria-pressed, aria-label) - Add CSS animations for spinner and error toast slide-in - Add comprehensive tests for optimistic UI behavior
|
@waterWang is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
Adds optimistic UI on TrendingRail's primary action (card click) with revert on failure, as requested in issue #834.
Changes
app/components/TrendingRail.tsxtype="button"optimisticIdstate to track which card is being acted uponactionErrorstate for error messageshandlePrimaryActionfunction implementing the optimistic UI pattern:/api/trending/actionPOST endpointaria-labelwith card details andaria-pressedfor accessibilityapp/components/TrendingRail.module.css.cardClickableclass withcursor: pointerand:focus-visibleoutline.cardOptimisticclass with highlighted border, background, and scale transform.optimisticSpinnerwith CSS rotation animation.actionErrorToastwith slide-in animation.cardClickable:disabledfor disabled stateapp/components/TrendingRail.test.tsxdescribe('Optimistic UI on primary action')block with 5 tests:Testing
focus-visible,aria-label,aria-pressedCloses #834