Improve no results for search (#8786)

This commit is contained in:
Elian Doran 2026-02-21 19:55:40 +02:00 committed by GitHub
commit 286720bdbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 15 deletions

View File

@ -1824,7 +1824,8 @@
},
"search_result": {
"no_notes_found": "No notes have been found for given search parameters.",
"search_not_executed": "Search has not been executed yet. Click on \"Search\" button above to see the results."
"search_not_executed": "Search has not been executed yet.",
"search_now": "Search now"
},
"spacer": {
"configure_launchbar": "Configure Launchbar"

View File

@ -7,9 +7,11 @@
padding: 0.75em;
color: var(--muted-text-color);
height: 100%;
text-align: center;
.tn-icon {
font-size: 3em;
font-size: 4em;
margin-bottom: 1rem;
}
button {

View File

@ -1,8 +1,6 @@
.search-result-widget {
flex-grow: 100000;
flex-shrink: 100000;
height: 100%;
overflow: auto;
contain: none !important;
}
@ -10,7 +8,7 @@
padding: 10px;
}
.search-no-results, .search-not-executed-yet {
margin: 20px;
padding: 20px !important;
}
.note-split.type-search .scrolling-container {
display: flex;
flex-direction: column;
}

View File

@ -1,9 +1,13 @@
import { useEffect, useState } from "preact/hooks";
import { t } from "../services/i18n";
import Alert from "./react/Alert";
import { useNoteContext, useTriliumEvent } from "./react/hooks";
import "./search_result.css";
import clsx from "clsx";
import { useEffect, useState } from "preact/hooks";
import { t } from "../services/i18n";
import { SearchNoteList } from "./collections/NoteList";
import Button from "./react/Button";
import { useNoteContext, useTriliumEvent } from "./react/hooks";
import NoItems from "./react/NoItems";
enum SearchResultState {
NO_RESULTS,
@ -42,13 +46,15 @@ export default function SearchResult() {
});
return (
<div className={`search-result-widget ${!state ? "hidden-ext" : ""}`}>
<div className={clsx("search-result-widget", state === undefined && "hidden-ext")}>
{state === SearchResultState.NOT_EXECUTED && (
<Alert type="info" className="search-not-executed-yet">{t("search_result.search_not_executed")}</Alert>
<NoItems icon="bx bx-file-find" text={t("search_result.search_not_executed")}>
<Button text={t("search_result.search_now")} triggerCommand="searchNotes" />
</NoItems>
)}
{state === SearchResultState.NO_RESULTS && (
<Alert type="info" className="search-no-results">{t("search_result.no_notes_found")}</Alert>
<NoItems icon="bx bx-rectangle" text={t("search_result.no_notes_found")} />
)}
{state === SearchResultState.GOT_RESULTS && (