https://github.com/shobhit-nagpal/digitalxc-assignment
Secret Santa Automation - Take home assignment for DigitalXC
https://github.com/shobhit-nagpal/digitalxc-assignment
nextjs typescript vitest
Last synced: 5 months ago
JSON representation
Secret Santa Automation - Take home assignment for DigitalXC
- Host: GitHub
- URL: https://github.com/shobhit-nagpal/digitalxc-assignment
- Owner: Shobhit-Nagpal
- Created: 2025-01-28T13:41:51.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-01-30T11:52:54.000Z (8 months ago)
- Last Synced: 2025-02-17T05:17:16.292Z (8 months ago)
- Topics: nextjs, typescript, vitest
- Language: TypeScript
- Homepage: https://digitalxc.shobhitnagpal.com
- Size: 298 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Secret Santa Generator
A web application built with Next.js that helps organize Secret Santa gift exchanges. Upload your participants' data in Excel, and get randomized Secret Santa assignments while ensuring no one gets the same person as last year!
## Tech Stack
- **Frontend:** Next.js with TypeScript
- **Styling:** Tailwind CSS with shadcn/ui components
- **State Management:** React Hooks (Custom hooks for modularity)
- **Testing:** Vitest## Features
- Upload participant data via Excel file
- Generate Secret Santa assignments with constraints:
- No self-assignments
- No repeat assignments from previous year
- Download results as Excel file
- Clean, modern UI with shadcn components
- Responsive design## Setup
1. Clone the repository
```bash
git clone https://github.com/Shobhit-Nagpal/digitalxc-assignment.git
cd digitalxc-assignment
```2. Install dependencies
```bash
npm install
```3. Start the development server:
```bash
npm run dev
```The application should now be running at `http://localhost:3000`
## Project Structure
### Frontend
- Custom hooks for better code organization:
- `useXLSX`: Handles Excel file processing
- `useSecretSanta`: Manages Secret Santa logic and API calls### Backend
- API endpoint for Secret Santa generation
- Object-Oriented implementation with two main classes:
- `SecretSantaEmployee`: Manages individual participant data
- `SecretSantaManager`: Handles assignment generation algorithm## How to Use
1. Prepare your Excel file with the following format:
- Required columns: Employee_Name, Employee_EmailID
- Optional columns: Secret_Child_Name, Secret_Child_EmailID2. Upload the Excel file through the web interface
3. The system will:
- Validate the file format
- Generate new Secret Santa assignments
- Ensure no one gets the same person as last year
- Return assignments that you can download as Excel## Development
```bash
# Install dependencies
npm install# Run development server
npm run dev# Run tests
npm test
```## Algorithm
The Secret Santa assignment uses:
- Adjacency Matrix for tracking valid assignments
- DFS (Depth-First Search) with backtracking to find valid assignments
- Hamiltonian Cycle to ensure everyone gives and receives exactly one gift