Skip to content

Add confetti animation to shopping basket button#84

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-9072a94c-946c-41e2-a850-62bf3f8b343e
Draft

Add confetti animation to shopping basket button#84
Copilot wants to merge 2 commits intomainfrom
copilot/fix-9072a94c-946c-41e2-a850-62bf3f8b343e

Conversation

Copy link

Copilot AI commented Oct 2, 2025

Summary

This PR adds a celebratory confetti animation that fires across the entire screen whenever a user adds an item to their shopping basket. The animation is implemented exclusively for the web version of the eShop application.

Implementation Details

The implementation uses the lightweight canvas-confetti library (v1.9.2) loaded via CDN. When a user clicks the "Add to shopping bag" button, a spectacular multi-burst confetti animation is triggered with 200 particles that cascade across the screen with varying spreads, velocities, and decay rates.

Changes Made

  1. App.razor - Added script references for the canvas-confetti library and custom confetti handler
  2. ItemPage.razor - Injected IJSRuntime and added JavaScript interop call to trigger confetti after successfully adding item to basket
  3. confetti.js (new) - Created JavaScript function that orchestrates a 5-burst confetti sequence for maximum visual impact

Key Features

  • Spectacular Effect - Multi-burst animation with 200 particles for a celebratory experience
  • 🎯 Reliable Triggering - Fires every time the add-to-basket action succeeds
  • 🌐 Web-Only Implementation - Isolated to WebApp; HybridApp remains unchanged
  • 🪶 Minimal Footprint - Lightweight library (~11KB minified) loaded from CDN
  • 🔧 Clean Integration - Uses standard Blazor JavaScript interop patterns

Testing

  • ✅ WebApp builds successfully with no errors or warnings
  • ✅ JavaScript syntax validated
  • ✅ HybridApp verified to be unaffected by changes
  • ✅ Demo page created to visualize the confetti effect

Demo

Confetti Demo

The screenshot shows the demo page with the "Add to shopping bag" button. When clicked, a vibrant confetti animation fills the entire screen, creating a delightful user experience that celebrates the shopping action.

Fixes #[issue-number]

Original prompt

This section details on the original issue you should resolve

<issue_title>More confetti</issue_title>
<issue_description>Whenever I put a item into the basket on the website, I want to fire off a huge confetti animation across the entire screen. Make sure to activate the confetti every time, I click the add to basket button and only implement this on the web version of this eShop.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #83

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: robinmanuelthiel <5874465+robinmanuelthiel@users.noreply.github.com>
Copilot AI changed the title [WIP] More confetti Add confetti animation to shopping basket button Oct 2, 2025
Copilot AI requested a review from robinmanuelthiel October 2, 2025 14:02
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.

More confetti

2 participants