fix: surface search failures
This commit is contained in:
@@ -160,8 +160,8 @@ export const removeContinueWatchingItem = (item: CommandPaletteItem): void => {
|
||||
removeContinueWatchingCard(animeID);
|
||||
renderItems(getResultItems().filter((candidate) => candidate.id !== item.id));
|
||||
})
|
||||
.catch((err: unknown) => {
|
||||
console.error("Continue watching remove error:", err);
|
||||
.catch(() => {
|
||||
window.showToast?.({ message: "Failed to remove from Continue Watching." });
|
||||
});
|
||||
};
|
||||
|
||||
@@ -316,6 +316,30 @@ export const renderEmptyState = (query: string): void => {
|
||||
searchResults.replaceChildren(empty);
|
||||
};
|
||||
|
||||
export const renderSearchErrorState = (query: string): void => {
|
||||
if (!searchResults) {
|
||||
return;
|
||||
}
|
||||
|
||||
const empty = document.createElement("div");
|
||||
empty.className =
|
||||
"mx-auto flex min-h-80 w-full max-w-5xl flex-col justify-center px-5 py-14 text-center md:px-8";
|
||||
|
||||
const title = document.createElement("div");
|
||||
title.className = "text-2xl font-semibold text-foreground";
|
||||
title.textContent = "Search is unavailable right now";
|
||||
empty.appendChild(title);
|
||||
|
||||
const subtitle = document.createElement("p");
|
||||
subtitle.className = "mx-auto mt-3 max-w-lg text-sm leading-6 text-foreground-muted";
|
||||
subtitle.textContent = query
|
||||
? "Try again in a moment or narrow the search query."
|
||||
: "Try again in a moment.";
|
||||
empty.appendChild(subtitle);
|
||||
|
||||
searchResults.replaceChildren(empty);
|
||||
};
|
||||
|
||||
const groupedItems = (items: CommandPaletteItem[]): Map<string, CommandPaletteItem[]> => {
|
||||
const groups = new Map<string, CommandPaletteItem[]>();
|
||||
items.forEach((item) => {
|
||||
|
||||
Reference in New Issue
Block a user