Create separate component for item status

This commit is contained in:
Nikhil Nawgiri 2024-11-02 18:22:12 +01:00
parent cfad242ab8
commit 84ed033a8d
2 changed files with 22 additions and 9 deletions

View file

@ -0,0 +1,19 @@
const statusIcons = {
available: "✅",
requested: "⏳",
missing: " ",
}
interface ItemStatusInLibraryProps {
imdbId: string,
};
const ItemStatusInLibrary = ({}: ItemStatusInLibraryProps) => {
return (
<div>
{Object.values(statusIcons)[Math.floor(Math.random() * Object.values(statusIcons).length)]}
</div>
);
}
export default ItemStatusInLibrary

View file

@ -1,3 +1,5 @@
import ItemStatusInLibrary from "../item/ItemStatusInLibrary";
interface SearchResultItemProps {
title: string,
image: string,
@ -12,12 +14,6 @@ const itemTypeIcons = {
series: "📺",
}
const itemStatusInLibrary = {
available: "✅",
requested: "⏳",
missing: " ",
}
// todo add link to movie if available
const SearchResultItem = ({
title,
@ -41,9 +37,7 @@ const SearchResultItem = ({
<div>
{itemTypeIcons[type]}
</div>
<div>
{Object.values(itemStatusInLibrary)[Math.floor(Math.random() * Object.values(itemStatusInLibrary).length)]}
</div>
<ItemStatusInLibrary imdbId={imdbId} />
</div>
<div className="search-result-item-year">
{year.substring(0, 4)}