A modern, animated lucky draw application built with React, TypeScript, and Vite. Features smooth animations, participant management, and a visually engaging drawing process.
- Smooth Drawing Animation: Names cycle through with dynamic speed transitions
- Participant Management: Add and remove participants easily
- Winner Celebration: Special animation when revealing the winner
- Flexible Storage: Choose between local storage or jsonbin.io for data persistence
- Responsive Design: Works on all screen sizes
- Git Info Display: Shows current commit hash and QR code to repository
- React 18
- TypeScript
- Vite
- Tailwind CSS
- Framer Motion
- Zustand (State Management)
- QRCode.react
- Clone the repository:
git clone https://github.com/mattdlong/groove-lucky-draw.git
cd lucky-draw
- Install dependencies:
npm install
- Configure environment variables:
Create a
.env.local
file with the following:
# Storage Configuration
# For local storage:
VITE_JSONBIN_API_KEY=local
# For jsonbin.io storage:
# Note: Escape $ signs with \ in the API key
# Example: VITE_JSONBIN_API_KEY=\$2a\$10\$syjjYBWFQ96TCq.T6QeCYOMr7jso38OFeV8jmORwAEqsZPlpZDPlS
# Git commit hash will be automatically added/updated when running npm run dev or npm run build
- Start the development server:
npm run dev
- Open http://localhost:5173 in your browser
The application uses the following environment variables:
VITE_GIT_COMMIT_HASH
: Current git commit hash (automatically managed)- Automatically updated when running npm run dev or npm run build
- You don't need to set this manually
VITE_JSONBIN_API_KEY
: Storage configuration key- Set to "local" for browser's localStorage
- Set to your jsonbin.io API key for remote storage (remember to escape $ signs)
- This value persists between dev/build runs
- Set
VITE_JSONBIN_API_KEY=local
in your .env.local file - Data persists in the browser's localStorage
- Data is isolated to the current browser
- Set
VITE_JSONBIN_API_KEY
to your jsonbin.io API key - Remember to escape $ signs in the API key with backslashes
- Data persists remotely and can be accessed across different browsers/devices
- Automatically creates and manages storage bins
- Add participants by entering names in the right sidebar
- Click "Draw" to start the lucky draw
- Watch as names cycle through with dynamic speed
- The winner is revealed with a celebratory animation
- Click "Next Draw" to continue with remaining participants
- Names cycle through with varying speeds
- Starts fast and gradually slows down
- Winner appears in black first, then transitions to pink
- 3-second pause before showing the winner modal
- Add multiple participants at once
- Automatic duplicate removal
- Flexible storage options (local or remote)
- Real-time participant count display
- Shows current commit hash
- Includes QR code linking to repository
- Updates automatically during development/build
- Clean, modern interface
- Responsive design
- Smooth animations
- Clear visual feedback
src/
├── components/
│ ├── draw/
│ │ ├── DrawingFrame.tsx
│ │ ├── ParticipantList.tsx
│ │ └── WinnerModal.tsx
│ ├── GitInfo.tsx
│ └── QRCode.tsx
├── store/
│ ├── drawStore.ts
│ └── storage.ts
├── App.tsx
└── main.tsx
Uses Zustand for state management with the following features:
- Participant list management
- Drawing state control
- Winner selection
- Modal control
- Persistent storage with local/remote options
react
: ^18.2.0 - Core React libraryreact-dom
: ^18.2.0 - React DOM renderingframer-motion
: ^11.0.3 - Animation libraryqrcode.react
: ^3.1.0 - QR code generationzustand
: ^4.5.0 - State management
typescript
: ^5.2.2 - TypeScript supportvite
: ^5.0.8 - Build tool and dev server@vitejs/plugin-react
: ^4.2.1 - React support for Vitetailwindcss
: ^3.4.1 - Utility-first CSS frameworkpostcss
: ^8.4.33 - CSS processingautoprefixer
: ^10.4.17 - CSS vendor prefixingeslint
: ^8.55.0 - Code linting- Various TypeScript and ESLint plugins for development
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details