How yannick-nq/secret-friend-game works
Project Type and Purpose
• This is a single-page web application (front-end only) for conducting a "Secret Friend" (Amigo Secreto) lottery. The app allows users to add or remove friends and then randomly select a secret friend, displaying the result with animations.
• The README and file tree reveal that this is not a full-stack or multi-service project but a lightweight interactive web app built primarily with HTML, CSS, and JavaScript.
Analyzing the File Structure
• The top-level files include:
• README.md – which gives the project details, screenshots, and instructions.
• index.html – the main entry point for the front-end interface.
• style.css – providing the styling for the interface.
• app.js – the core JavaScript file containing the logic for managing the list of friends, handling events (adding, removing, sorting), and displaying modals.
• The assets directory includes fonts and images used within the UI.
• Because there are no back-end directories (like “backend”, “server”, “api”, etc.), the application’s logic and data management are encapsulated on the client side.
Key Components
a. User Interface (UI):
• This is represented by the HTML (index.html) and CSS (style.css).
• Components such as the form for friend entry, buttons with animations, participant cards, and modals for displaying the secret friend.
• Assets (fonts and images) support the UI visuals and styling.
b. Business/Presentation Logic:
• app.js contains the logic to add and remove friends, process the list, and perform the random selection (sorteo).
• Event handling as well as business rules (e.g., ensuring proper input format and triggering appropriate animations).
c. External and Static Resources:
• The assets folder holds static resources including fonts (e.g., “DragonHunter”) and images used in the interface, along with any SVG references.
• Although not connected to an external API, these assets are essential to the user experience.
Relationships and Architectural Interaction
• The style layer (style.css) will apply to both static HTML elements and dynamically generated nodes, so represent it as an underlying layer affecting the UI.
• That assets are loaded by the HTML file and used by both CSS and JavaScript to display the correct images and fonts.
Architectural Patterns or Principles
• While not explicitly using a strict MVC framework, the project naturally separates concerns:
• The HTML/CSS act as the “View”.
• The JavaScript (app.js) functions as the “Controller”, handling user events and managing the application’s state.