The minimalistic document archiving platform.
feat(command-palette): add "show more results" option to command palette (#761)
Corentin Thomasset2e46c08de330
diff --git a/.changeset/cute-vans-fly.md b/.changeset/cute-vans-fly.mdnew file mode 100644index 00000000..a7c9ecc0--- /dev/null+++ b/.changeset/cute-vans-fly.md@@ -0,0 +1,5 @@+---+"@papra/docker": patch+---++Added a "Show more results" option in quick search when there is more document not displayeddiff --git a/apps/papra-client/src/locales/de.dictionary.ts b/apps/papra-client/src/locales/de.dictionary.tsindex bb0529df..5b24f839 100644--- a/apps/papra-client/src/locales/de.dictionary.ts+++ b/apps/papra-client/src/locales/de.dictionary.ts@@ -677,6 +677,7 @@ export const translations: Partial<TranslationsDictionary> = {'command-palette.no-results': 'Keine Ergebnisse gefunden','command-palette.sections.documents': 'Dokumente','command-palette.sections.theme': 'Thema',+ 'command-palette.show-more-results': '{{ count }} weitere Ergebnisse für "{{ query }}" anzeigen',// API errorsdiff --git a/apps/papra-client/src/locales/en.dictionary.ts b/apps/papra-client/src/locales/en.dictionary.tsindex c6c08694..db989360 100644--- a/apps/papra-client/src/locales/en.dictionary.ts+++ b/apps/papra-client/src/locales/en.dictionary.ts@@ -675,6 +675,7 @@ export const translations = {'command-palette.no-results': 'No results found','command-palette.sections.documents': 'Documents','command-palette.sections.theme': 'Theme',+ 'command-palette.show-more-results': 'Show {{ count }} more results for "{{ query }}"',// API errorsdiff --git a/apps/papra-client/src/locales/es.dictionary.ts b/apps/papra-client/src/locales/es.dictionary.tsindex 94764bac..bf10a55f 100644--- a/apps/papra-client/src/locales/es.dictionary.ts+++ b/apps/papra-client/src/locales/es.dictionary.ts@@ -677,6 +677,7 @@ export const translations: Partial<TranslationsDictionary> = {'command-palette.no-results': 'No se encontraron resultados','command-palette.sections.documents': 'Documentos','command-palette.sections.theme': 'Tema',+ 'command-palette.show-more-results': 'Mostrar {{ count }} resultados más para "{{ query }}"',// API errorsdiff --git a/apps/papra-client/src/locales/fr.dictionary.ts b/apps/papra-client/src/locales/fr.dictionary.tsindex 85f330c8..5c8c3e8e 100644--- a/apps/papra-client/src/locales/fr.dictionary.ts+++ b/apps/papra-client/src/locales/fr.dictionary.ts@@ -677,6 +677,7 @@ export const translations: Partial<TranslationsDictionary> = {'command-palette.no-results': 'Aucun résultat trouvé','command-palette.sections.documents': 'Documents','command-palette.sections.theme': 'Thème',+ 'command-palette.show-more-results': 'Afficher {{ count }} résultats supplémentaires pour "{{ query }}"',// API errorsdiff --git a/apps/papra-client/src/locales/it.dictionary.ts b/apps/papra-client/src/locales/it.dictionary.tsindex 7080d208..5760c754 100644--- a/apps/papra-client/src/locales/it.dictionary.ts+++ b/apps/papra-client/src/locales/it.dictionary.ts@@ -677,6 +677,7 @@ export const translations: Partial<TranslationsDictionary> = {'command-palette.no-results': 'Nessun risultato trovato','command-palette.sections.documents': 'Documenti','command-palette.sections.theme': 'Tema',+ 'command-palette.show-more-results': 'Mostra altri {{ count }} risultati per "{{ query }}"',// API errorsdiff --git a/apps/papra-client/src/locales/nl.dictionary.ts b/apps/papra-client/src/locales/nl.dictionary.tsindex 6907b3fe..96844f2f 100644--- a/apps/papra-client/src/locales/nl.dictionary.ts+++ b/apps/papra-client/src/locales/nl.dictionary.ts@@ -677,6 +677,7 @@ export const translations: Partial<TranslationsDictionary> = {'command-palette.no-results': 'Geen resultaten gevonden','command-palette.sections.documents': 'Documenten','command-palette.sections.theme': 'Thema',+ 'command-palette.show-more-results': '{{ count }} meer resultaten tonen voor "{{ query }}"',// API errorsdiff --git a/apps/papra-client/src/locales/pl.dictionary.ts b/apps/papra-client/src/locales/pl.dictionary.tsindex a93ebc40..db598bea 100644--- a/apps/papra-client/src/locales/pl.dictionary.ts+++ b/apps/papra-client/src/locales/pl.dictionary.ts@@ -677,6 +677,7 @@ export const translations: Partial<TranslationsDictionary> = {'command-palette.no-results': 'Nie znaleziono wyników','command-palette.sections.documents': 'Dokumenty','command-palette.sections.theme': 'Motyw',+ 'command-palette.show-more-results': 'Pokaż {{ count }} więcej wyników dla "{{ query }}"',// API errorsdiff --git a/apps/papra-client/src/locales/pt-BR.dictionary.ts b/apps/papra-client/src/locales/pt-BR.dictionary.tsindex 4beb9fce..b1dd2ad0 100644--- a/apps/papra-client/src/locales/pt-BR.dictionary.ts+++ b/apps/papra-client/src/locales/pt-BR.dictionary.ts@@ -677,6 +677,7 @@ export const translations: Partial<TranslationsDictionary> = {'command-palette.no-results': 'Nenhum resultado encontrado','command-palette.sections.documents': 'Documentos','command-palette.sections.theme': 'Tema',+ 'command-palette.show-more-results': 'Mostrar mais {{ count }} resultados para "{{ query }}"',// API errorsdiff --git a/apps/papra-client/src/locales/pt.dictionary.ts b/apps/papra-client/src/locales/pt.dictionary.tsindex 626f54cb..99db086e 100644--- a/apps/papra-client/src/locales/pt.dictionary.ts+++ b/apps/papra-client/src/locales/pt.dictionary.ts@@ -677,6 +677,7 @@ export const translations: Partial<TranslationsDictionary> = {'command-palette.no-results': 'Nenhum resultado encontrado','command-palette.sections.documents': 'Documentos','command-palette.sections.theme': 'Tema',+ 'command-palette.show-more-results': 'Mostrar mais {{ count }} resultados para "{{ query }}"',// API errorsdiff --git a/apps/papra-client/src/locales/ro.dictionary.ts b/apps/papra-client/src/locales/ro.dictionary.tsindex a42af7d6..63c8d51a 100644--- a/apps/papra-client/src/locales/ro.dictionary.ts+++ b/apps/papra-client/src/locales/ro.dictionary.ts@@ -677,6 +677,7 @@ export const translations: Partial<TranslationsDictionary> = {'command-palette.no-results': 'Niciun rezultat gasit','command-palette.sections.documents': 'Documente','command-palette.sections.theme': 'Temă',+ 'command-palette.show-more-results': 'Arată încă {{ count }} rezultate pentru "{{ query }}"',// API errorsdiff --git a/apps/papra-client/src/locales/zh.dictionary.ts b/apps/papra-client/src/locales/zh.dictionary.tsindex 1cf880eb..cce3b8ad 100644--- a/apps/papra-client/src/locales/zh.dictionary.ts+++ b/apps/papra-client/src/locales/zh.dictionary.ts@@ -677,6 +677,7 @@ export const translations: Partial<TranslationsDictionary> = {'command-palette.no-results': '未找到结果','command-palette.sections.documents': '文档','command-palette.sections.theme': '主题',+ 'command-palette.show-more-results': '显示另外 {{ count }} 个"{{ query }}"的结果',// API errorsdiff --git a/apps/papra-client/src/modules/command-palette/command-palette.provider.tsx b/apps/papra-client/src/modules/command-palette/command-palette.provider.tsxindex 216aa5b8..e6188294 100644--- a/apps/papra-client/src/modules/command-palette/command-palette.provider.tsx+++ b/apps/papra-client/src/modules/command-palette/command-palette.provider.tsx@@ -2,7 +2,7 @@ import type { Accessor, ParentComponent } from 'solid-js';import { safely } from '@corentinth/chisels';import { useNavigate, useParams } from '@solidjs/router';import { createContext, createEffect, createSignal, For, on, onCleanup, onMount, Show, useContext } from 'solid-js';-import { getDocumentIcon } from '../documents/document.models';+import { getDocumentIcon, makeDocumentSearchPermalink } from '../documents/document.models';import { searchDocuments } from '../documents/documents.services';import { useI18n } from '../i18n/i18n.provider';import { cn } from '../shared/style/cn';@@ -31,6 +31,7 @@ export const CommandPaletteProvider: ParentComponent = (props) => {const [getMatchingDocuments, setMatchingDocuments] = createSignal<{ id: string; name: string }[]>([]);const [getSearchQuery, setSearchQuery] = createSignal('');const [getIsLoading, setIsLoading] = createSignal(false);+ const [getMatchingDocumentsTotalCount, setMatchingDocumentsTotalCount] = createSignal(0);const params = useParams();const { t } = useI18n();@@ -57,6 +58,7 @@ export const CommandPaletteProvider: ParentComponent = (props) => {const [result] = await safely(searchDocuments({ searchQuery, organizationId: params.organizationId, pageIndex: 0, pageSize: 5 }));setMatchingDocuments(result?.documents ?? []);+ setMatchingDocumentsTotalCount(result?.totalCount ?? 0);setIsLoading(false);}, 300);@@ -64,6 +66,7 @@ export const CommandPaletteProvider: ParentComponent = (props) => {getSearchQuery,(searchQuery) => {setMatchingDocuments([]);+ setMatchingDocumentsTotalCount(0);if (searchQuery.length > 1) {setIsLoading(true);searchDocs({ searchQuery });@@ -76,6 +79,7 @@ export const CommandPaletteProvider: ParentComponent = (props) => {(isCommandPaletteOpen) => {if (isCommandPaletteOpen) {setMatchingDocuments([]);+ setMatchingDocumentsTotalCount(0);}},));@@ -88,12 +92,23 @@ export const CommandPaletteProvider: ParentComponent = (props) => {{label: t('command-palette.sections.documents'),forceMatch: true,- options: getMatchingDocuments().map(document => ({- label: document.name,- icon: getDocumentIcon({ document }),- action: () => navigate(`/organizations/${params.organizationId}/documents/${document.id}`),- forceMatch: true,- })),+ options: [+ ...getMatchingDocuments().map(document => ({+ label: document.name,+ icon: getDocumentIcon({ document }),+ action: () => navigate(`/organizations/${params.organizationId}/documents/${document.id}`),+ forceMatch: true,+ })),++ ...(getMatchingDocumentsTotalCount() > getMatchingDocuments().length+ ? [{+ label: t('command-palette.show-more-results', { count: getMatchingDocumentsTotalCount() - getMatchingDocuments().length, query: getSearchQuery() }),+ icon: 'i-tabler-search',+ action: () => navigate(makeDocumentSearchPermalink({ organizationId: params.organizationId, search: { query: getSearchQuery() } })),+ forceMatch: true,+ }]+ : []),+ ],},{label: t('command-palette.sections.theme'),