Skip to content

Commit

Permalink
Merge pull request #68 from rahulpoonia29/Ascii-Issue
Browse files Browse the repository at this point in the history
Fixed issue 67
  • Loading branch information
Satyam1923 authored May 12, 2024
2 parents 3250870 + 66972a5 commit 891d56f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
9 changes: 9 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"axios": "^1.6.8",
"he": "^1.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-h5-audio-player": "^3.9.1"
Expand Down
27 changes: 22 additions & 5 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import AudioPlayer from "react-h5-audio-player";
import "react-h5-audio-player/lib/styles.css";
import "./App.css";
import axios from "axios";
import he from "he";

const App = () => {
const [data, setData] = useState(null);
Expand All @@ -11,6 +12,10 @@ const App = () => {
const [timePassed, setTimePassed] = useState(0);
const [currplaying, setCurrplaying] = useState(0);

const decodeEntities = (str) => {
return he.decode(str);
};

const fetchSongData = async () => {
try {
const response = await axios.get(
Expand Down Expand Up @@ -61,11 +66,20 @@ const App = () => {
</div>
<ul className="details">
<li className="name">
{data && data.length > 0 && data[currplaying].name}
{data &&
data.length > 0 &&
data[currplaying] &&
decodeEntities(data[currplaying].name)}
</li>
<li className="author">
{data && data[currplaying].artist}{" "}
{data && data[currplaying].year}
{data &&
data.length > 0 &&
data[currplaying] &&
decodeEntities(data[currplaying].artist)}{" "}
{data &&
data.length > 0 &&
data[currplaying] &&
data[currplaying].year}
</li>
</ul>
{data && (
Expand Down Expand Up @@ -124,9 +138,12 @@ const App = () => {
width="20px"
/>
<div className="search-details">
<h4 id="elementname">{element.name}</h4>
<h4 id="elementname">
{decodeEntities(element.name)}
</h4>
<p>
{element.artist} - {element.year}
{decodeEntities(element.artist)} -{" "}
{element.year}
</p>
</div>
</div>
Expand Down

0 comments on commit 891d56f

Please sign in to comment.