create function for displaying query result toasts to reduce code duplication

This commit is contained in:
maxDorninger
2025-10-27 21:49:26 +01:00
parent 994e558090
commit b846480b84
3 changed files with 13 additions and 4 deletions

View File

@@ -99,3 +99,10 @@ export function formatSecondsToOptimalUnit(seconds: number): string {
return '0s';
}
export function handleQueryNotificationToast(count: number = 0, query: string = "") {
if (count > 0 && query.length > 0) toast.success(`Found ${count} ${count > 1 ? 'result' : 'results'} for search term "${query}".`);
else if (count == 0) toast.info(`No results found for "${query}".`);
}