feat: replace tv show icon

This commit is contained in:
2023-08-09 13:32:28 +02:00
parent fb96e9f71a
commit 95525406d1
11 changed files with 36 additions and 37 deletions

View File

@ -20,7 +20,7 @@ export const addSeriesInfo: MenuEntry = {
const json = await response.json() as TMDBSeries[];
console.log({ json });
console.log("Result", json);
const menuID = `result/${series.name}`;
@ -42,8 +42,12 @@ export const addSeriesInfo: MenuEntry = {
})),
};
await new Promise((res) => setTimeout(res, 20));
state.activeMenu.value = menuID;
await new Promise((res) => setTimeout(res, 20));
state.activeState.value = "normal";
},
visible: () => {

View File

@ -78,7 +78,7 @@ export const SearchResultList = (
};
const Search = (
{ q, type }: { q: string; type?: string },
{ q = "*", type }: { q: string; type?: string },
) => {
const [searchQuery, setSearchQuery] = useState(q);
const [data, setData] = useState<SearchResult>();
@ -99,9 +99,7 @@ const Search = (
window.history.replaceState({}, "", u);
}
console.log({ showSeen: showSeenStatus.value });
const fetchData = async (query: string) => {
const fetchData = async (query: string, showSeen: boolean) => {
try {
setIsLoading(true);
const fetchUrl = new URL(window.location.href);
@ -111,7 +109,7 @@ const Search = (
} else {
return;
}
if (showSeenStatus.value) {
if (showSeen) {
fetchUrl.searchParams.set("status", "not-seen");
}
if (type) {
@ -139,12 +137,15 @@ const Search = (
const target = event.target as HTMLInputElement;
if (target.value !== searchQuery) {
setSearchQuery(target.value);
debouncedFetchData(target.value); // Call the debounced fetch function with the updated search query
}
};
useEffect(() => {
debouncedFetchData(q);
debouncedFetchData(searchQuery, showSeenStatus.value); // Call the debounced fetch function with the updated search query
}, [searchQuery, showSeenStatus.value]);
useEffect(() => {
debouncedFetchData(q, showSeenStatus.value);
}, []);
return (