feat: Implement and refine a Toast notification system, and replace the copy pack toast with an animated button.

This commit is contained in:
2025-12-17 02:22:53 +01:00
parent b0dc734859
commit 3194be382f
8 changed files with 227 additions and 57 deletions

View File

@@ -67,3 +67,7 @@
- [Change Default Filter Flags](./devlog/2025-12-17-025500_change_default_flags.md): Completed. Updated client and server defaults for "Ignore Basic Lands", "Ignore Commander Sets", and "Ignore Tokens" to be unchecked (false).
- [Sidebar Max Width](./devlog/2025-12-17-031000_sidebar_max_width.md): Completed. Constrained the left sidebar in Cube Manager to a maximum width of 400px on large screens to improve layout balance.
- [Strict Pack Generation Logic](./devlog/2025-12-17-030600_fix_strict_pack_generation.md): Succeeded. Enforced strict 14-card (Standard) and 13-card (Peasant) limits, removing fallback logic to prevent invalid pack generation.
- [Toast Notification Replacement](./devlog/2025-12-17-022000_replace_alert_with_toast.md): Completed. Replaced invasive alerts with a custom Toast notification system for smoother UX.
- [Enhanced Toast Visibility](./devlog/2025-12-17-023000_enhanced_toast_visibility.md): Completed. Updated toasts to be top-center, animated, and highly visible with premium styling.
- [Unified Toast Design](./devlog/2025-12-17-023500_unified_toast_design.md): Completed. Refined toast aesthetics to match the global dark/slate theme with subtle colored accents.
- [Animated Copy Button](./devlog/2025-12-17-024000_animated_copy_button.md): Completed. Replaced copy toast with an in-place animated tick button for immediate feedback.

View File

@@ -0,0 +1,16 @@
### Replaced Alert with Toast Notification
**Status**: Completed
**Date**: 2025-12-17
**Description**
Replaced the invasive `alert()` on the "Copy Pack" button with a non-intrusive Toast notification.
**Changes**
1. Created `src/client/src/components/Toast.tsx` with a `ToastProvider` and `useToast` hook.
2. Wrapped `App.tsx` with `ToastProvider`.
3. Updated `PackCard.tsx` to use `showToast` instead of `alert`.
**Next Steps**
- Consider replacing other alerts in `CubeManager` with Toasts for consistency.

View File

@@ -0,0 +1,21 @@
### Enhanced Toast Visibility
**Status**: Completed
**Date**: 2025-12-17
**Description**
Updated the Toast notification to be more prominent and centrally located, as per user feedback.
**Changes**
1. **Position**: Moved from bottom-right to top-center (`top-6 left-1/2 -translate-x-1/2`).
2. **Animation**: Changed to `slide-in-from-top-full` with a slight zoom-in effect.
3. **Styling**:
- Increased padding (`px-6 py-4`).
- Increased border width (`border-2`) and brightness.
- Added stronger shadows (`shadow-2xl`).
- Increased contrast for text and background.
- Increased font weight to `bold`.
**Effect**
Notifications are now impossible to miss, appearing top-center with a premium, game-like alert style.

View File

@@ -0,0 +1,17 @@
### Unified Toast Design
**Status**: Completed
**Date**: 2025-12-17
**Description**
Refined the Toast notification design to align perfectly with the "Dark Gaming Aesthetic" of the platform.
**Changes**
1. **Consistent Palette**: Switched to `bg-slate-800` (cards) with `border-slate-700` equivalents, using colored accents only for borders and icons.
2. **Icon Enclosure**: Icons are now housed in a circular, semi-transparent colored background (`bg-emerald-500/10`) for a polished look.
3. **Typography**: Reverted to standard font weights used in other UI cards (`font-medium`) for better readability and consistency.
4. **Shadows**: Tuned shadows to be deep but subtle (`shadow-2xl shadow-emerald-900/20`), matching the ambient lighting of the app.
**Effect**
The Toast now feels like a native part of the UI rather than a generic alert overlay.

View File

@@ -0,0 +1,20 @@
### Animated Copy Button
**Status**: Completed
**Date**: 2025-12-17
**Description**
Replaced the toast notification for the copy action with a self-contained, animated button state.
**Changes**
1. **Removed Toast Usage**: Detached `useToast` from `PackCard.tsx`.
2. **Local State**: Implemented `copied` state in `PackCard`.
3. **UI Feedback**:
- Button transitions from "Copy" (slate) to "Check" (emerald/green) on click.
- Added `animate-in zoom-in spin-in-12` for a satisfying "tick" animation.
- Button background and border glow green to confirm success.
- Auto-reverts after 2 seconds.
**Effect**
Provides immediate, localized feedback for the copy action without clogging the global UI with notifications.