Skip to content

Commit

Permalink
Minor UI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
atharva-kakarot committed Jun 12, 2024
1 parent b07f478 commit 1e5be07
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 7 deletions.
52 changes: 48 additions & 4 deletions js/anime_about.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ function localStorageFunc(str) {
localStorage.setItem("end year", str.endDate.year);
localStorage.setItem("end month", str.endDate.month);
localStorage.setItem("end day", str.endDate.day);
localStorage.setItem("format", str.format);
localStorage.setItem("duration", str.duration);
localStorage.setItem("episodes", str.episodes);
localStorage.setItem("popularity", str.popularity);
Expand Down Expand Up @@ -133,9 +132,22 @@ function localStorageFunc(str) {
}

localStorage.setItem("relation ids", relationIdList);

const format = {
"TV_SHORT": "TV Short",
"MOVIE": "Movie",
"SPECIAL": "Special",
"MUSIC": "Music",
"MANGA": "Manga",
"NOVEL": "Novel",
"ONE_SHOT": "One-shot"
}

str.format = format[str.format] || str.format;
localStorage.setItem("format", str.format);
}

function nullFuncSearch(str) {
function nullfunc(str) {
if (str === null) {
return "N/A";
}
Expand All @@ -153,8 +165,31 @@ function animeContainer(str) {
image.src = str.coverImage.extraLarge;

const format = nullfunc(str.format);

const formatMap = {
"TV_SHORT": "TV Short",
"MOVIE": "Movie",
"SPECIAL": "Special",
"MUSIC": "Music",
"MANGA": "Manga",
"NOVEL": "Novel",
"ONE_SHOT": "One-shot"
}

const updatedFormatString = formatMap[format] || format;

const episodes = nullfunc(str.episodes);
const season = nullfunc(str.season);

const seasonMap = {
"WINTER": "Winter",
"SPRING": "Spring",
"SUMMER": "Summer",
"FALL": "Fall",
};

const updatedSeasonString = seasonMap[season] || season;

const endDate = nullfunc(str.endDate.year);
const averageScore = nullfunc(str.averageScore);

Expand All @@ -164,14 +199,14 @@ function animeContainer(str) {
<h1 class="search-anime-title">${str.title.romaji}</h1>
<table style="margin-left: 7px; height: 100px">
<tr>
<td><i class="fa-solid fa-tv"></i>&nbsp;&nbsp;${format} (${episodes} Episodes)</td>
<td><i class="fa-solid fa-tv"></i>&nbsp;&nbsp;${updatedFormatString} (${episodes} Episodes)</td>
</tr>
<tr>
<td>
<div class="search-anime-details-main-div">
<i class="fa-regular fa-calendar"></i>&nbsp;&nbsp;
<div class="search-anime-details-div">
${season} ${endDate}
${updatedSeasonString} ${endDate}
</div>
</div>
</td>
Expand All @@ -191,6 +226,15 @@ function animeContainer(str) {
});
}

function nullFuncSearch(str) {
if (str === null) {
return "N/A";
}
else {
return str;
}
}


//-----------------------------------------------Adding event listeners to search button-------------------------------------------------

Expand Down
41 changes: 38 additions & 3 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ function localStorageFunc(str) {
localStorage.setItem("end year", str.endDate.year);
localStorage.setItem("end month", str.endDate.month);
localStorage.setItem("end day", str.endDate.day);
localStorage.setItem("format", str.format);
localStorage.setItem("duration", str.duration);
localStorage.setItem("episodes", str.episodes);
localStorage.setItem("popularity", str.popularity);
Expand Down Expand Up @@ -134,6 +133,19 @@ function localStorageFunc(str) {
}

localStorage.setItem("relation ids", relationIdList);

const format = {
"TV_SHORT": "TV Short",
"MOVIE": "Movie",
"SPECIAL": "Special",
"MUSIC": "Music",
"MANGA": "Manga",
"NOVEL": "Novel",
"ONE_SHOT": "One-shot"
}

str.format = format[str.format] || str.format;
localStorage.setItem("format", str.format);
}

function nullfunc(str) {
Expand All @@ -154,8 +166,31 @@ function animeContainer(str) {
image.src = str.coverImage.extraLarge;

const format = nullfunc(str.format);

const formatMap = {
"TV_SHORT": "TV Short",
"MOVIE": "Movie",
"SPECIAL": "Special",
"MUSIC": "Music",
"MANGA": "Manga",
"NOVEL": "Novel",
"ONE_SHOT": "One-shot"
}

const updatedFormatString = formatMap[format] || format;

const episodes = nullfunc(str.episodes);
const season = nullfunc(str.season);

const seasonMap = {
"WINTER": "Winter",
"SPRING": "Spring",
"SUMMER": "Summer",
"FALL": "Fall",
};

const updatedSeasonString = seasonMap[season] || season;

const endDate = nullfunc(str.endDate.year);
const averageScore = nullfunc(str.averageScore);

Expand All @@ -165,14 +200,14 @@ function animeContainer(str) {
<h1 class="search-anime-title">${str.title.romaji}</h1>
<table style="margin-left: 7px; height: 100px">
<tr>
<td><i class="fa-solid fa-tv"></i>&nbsp;&nbsp;${format} (${episodes} Episodes)</td>
<td><i class="fa-solid fa-tv"></i>&nbsp;&nbsp;${updatedFormatString} (${episodes} Episodes)</td>
</tr>
<tr>
<td>
<div class="search-anime-details-main-div">
<i class="fa-regular fa-calendar"></i>&nbsp;&nbsp;
<div class="search-anime-details-div">
${season} ${endDate}
${updatedSeasonString} ${endDate}
</div>
</div>
</td>
Expand Down

0 comments on commit 1e5be07

Please sign in to comment.