Freddy444 / Songrating-Freddy.Max

MIT License
0 stars 0 forks source link

issue#55-statsModal #109

Closed Freddy444 closed 1 year ago

Freddy444 commented 1 year ago

This React component defines a modal for displaying statistics related to a user's song ratings. The statistics include the user's username, top-rated song and its artist, the total number of songs, the top-rated genre, and the count of the user's ratings. The data is extracted from the component's state (activeItem) and presented in a structured format within the modal. The reactstrap library is used for styling.

Freddy444 commented 1 year ago

This React component, CustomModal, displays statistics about a user's songs and ratings. Here's a breakdown:

Imports:

Imports essential components from "reactstrap" and React. Class Component:

Extends the React Component class. Constructor:

Initializes the state with activeItem from props. handleChange Method:

Updates the state based on user input. findBestRatedSong Method:

Searches for the highest-rated song in the user's song list. userRatingsCount Method:

Calculates the total count of user ratings. songCount Method:

Calculates the total count of songs. popularGenre Method:

Determines the user's most popular genre based on average ratings. renderItems Method:

Displays various statistics: Username. Top-rated song and artist. Total number of songs. Top-rated genre. Total number of user ratings. Render Method:

Renders a modal displaying the statistical information. Props:

Utilizes activeItem and toggle for customization. Modal Configuration:

Open modal with disabled animation.