AlfredoCU/pql-instructions
Premier Quidditch League (PQL) Coding Challenge Instructions
π§βπ» Install
npm installπ Environment Variables
Create the .env.local file.
VITE_API_HOST=http://localhost:3001ππ»ββοΈ Getting Started
First, run the development server.
npm run devOpen http://localhost:5173 with your browser to see the result.
β Test
npm run testTest coverage.
npm run test:coverageProject
Build the Lineup for the Premier Quidditch League (PQL)
Hey Wizard! π§ββοΈ
Grab your wand and broomstick because it's time to set the stage for the Premier Quidditch League (PQL)! We're looking for a masterful potion of code to help our league managers create the newest Quidditch teams and assign those undrafted wizards and witches to fly high in the PQL.
Your Enchanted Mission:
Your challenge is to create a bewitching interface where our magisters (league managers) can not only form new teams like "Gryffindor" or "Slytherin" but also manage which wizards and witches are up in the air and which are still waiting for their chance to soar. π§Ή
- Magical Team Formation Interface:
- Team Incantation (Creation) Form: Cast a spell with a form to create a team by naming it.
- Name
- Required.
- Unique.
- Description
- Optional
- Name
- Scroll of Available Players: Simultaneously, reveal a parchment (table) listing of all players not yet committed to a broomstick (not assigned to a team yet). This scroll should detail their name, age, and desired position in the skies (Seeker, Beater, Keeper, or Chaser).
- Once invoked (submitted), this team should appear in a mystical dropdown. π
- Team Incantation (Creation) Form: Cast a spell with a form to create a team by naming it.
- Player Management Spellwork (Tasks):
- Selective Player Removal: Beside each playerβs name in the table, place a βRemoveβ button. Clicking this button does not assign the player to the newly created team but merely removes them from the list of players for this specific team creation session. This action should not affect their availability for future team creations; they remain in the pool of unassigned players for other teams.
- Player Special Abilities: Enhance the player management by allowing selection of special abilities that are dependent on the player's position. This should be dynamically populated (automatically filled) based on the position selected, with abilities like "Enhanced Vision" for Seekers or "Power Swing" for Beaters. π§ββοΈ
- Enchanting Interface Design:
- Visual Spellwork: Employ CSS or a framework like Bootstrap to ensure the interface is not only functional but also visually appealing, befitting the grandeur of Quidditch. β¨
- Backend Broomsticks and Frontend Firebolts:
- Summoning Player Data: Use Axios or Fetch API to fetch the list of unassigned players from the
/api/players/unassignedendpoint. - Team Creation: Post new team data to the
/api/teamsendpoint when a team is created.
- Summoning Player Data: Use Axios or Fetch API to fetch the list of unassigned players from the
- Testing the Enchantments:
- Defensive Spells Against Bugs (Mistakes): Utilize Jest and React Testing Library to test the functionality and interactivity of the form, ensuring robustness and reliability. π‘οΈ Preferably use TDD for your development process.
Required Wizarding Tools:
- Frontend Wandwork:
React&Typescriptπͺ - Spellcasting for Data:
AxiosorFetch APIfor fetching and updating data π‘ - Magical State Management: React's Context API or useState/useReducer for managing state π
- Potion Testing:
JestandReact Testing Libraryfor ensuring all magical components work as expected π§ͺ
Optional Wizarding Enhancements:
- Consider using
@tanstack/react-tablefor an enhanced player listing experience, allowing features such as sorting and filtering. - Implement
react-hook-formalongsideyuporzodfor streamlined form management and robust data validation.
Backend Broomsticks and Frontend Firebolts:
To connect your frontend to the backend API, follow these instructions:
-
API Documentation and Endpoints:
- All the instructions for the API and its documentation are located inside the
Apifolder in this repository. - This folder contains detailed information on how to interact with the endpoints, including how to fetch the list of unassigned players and how to post new team data.
- All the instructions for the API and its documentation are located inside the
-
Summoning Player Data:
- Use the endpoints specified in the
Apifolder to fetch the list of unassigned players. - Example endpoint:
/api/players/unassigned.
- Use the endpoints specified in the
-
Team Creation:
- Follow the instructions in the
Apifolder to post new team data. - Example endpoint:
/api/teams.
- Follow the instructions in the
Ensure your development server is running and accessible at the appropriate base URL (e.g., http://localhost:3000). For more detailed instructions and examples, please refer to the Api folder.
Happy coding, and may your API connections be as seamless as a well-cast spell! πͺ
π° EXTRA EXTRA!!!
Wizarding Challenges for Seasoned Developers (Optional):
β¨ If you believe you're the chosen one and the previous mission is merely a warm-up for your extraordinary talents, then by all means, conjure up some magic by tackling one (or more) of the following advanced challenges to enhance your solution.
These tasks are not required, but they will certainly leave us spellbound if you can master them. β¨
-
Performance Enhancements:
- Optimize performance by implementing code-splitting and lazy loading of components using React's
React.lazyandSuspense. β‘
- Optimize performance by implementing code-splitting and lazy loading of components using React's
-
Advanced State Management:
- Use a more advanced state management library such as Redux or Zustand to handle complex state logic and ensure a scalable solution as the application grows. π
-
Internationalization Spell:
- Add internationalization support using libraries like
react-i18nextto make the application accessible to magisters from different regions. π
- Add internationalization support using libraries like
-
Responsive Design:
- Ensure the interface is fully responsive and works seamlessly on a variety of devices, from desktops to tablets to mobile phones. π±
-
Drag-and-Drop Enchantment:
- Implement a drag-and-drop interface using a library like
react-beautiful-dndorreact-dndto allow magisters to easily assign players to teams. This should support both adding and removing players from teams. π§²
- Implement a drag-and-drop interface using a library like
-
Innovate:
- Introduce a unique feature that showcases a skill only you possess. π
Prepare your wands and let your creativity soar! We can't wait to see the magical solutions you'll conjure. Take on this challenge, infuse it with your unique talents, and leave us all spellbound with your ingenuity. Good luck, and may your code be as flawless as a perfectly cast spell! πͺ

