Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searchfield for help #4691

Merged
merged 17 commits into from
Feb 27, 2025
Merged

Searchfield for help #4691

merged 17 commits into from
Feb 27, 2025

Conversation

nicodh
Copy link
Member

@nicodh nicodh commented Feb 21, 2025

This PR adds a search field to the help page, using pagefind which generates an index which is then used to search and disply results in the static help page.

Needs latest main of https://github.com/deltachat/deltachat-pages/

image

image

Copy link
Member

@Simon-Laux Simon-Laux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. For the translation keys I think it makes more sense to use the existing substitution pattern, you can convert it to the custom one in bin/help/help-translations.js.

  • reasons: reusability and consistency

Comment on lines +27 to +18
echo
echo "☝️ Compliance Warning: Add the following line to CHANGELOG.md:"
echo "- Update local help ("`date "+%Y-%m-%d"`")"
echo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice detail 👍

Copy link
Member

@Simon-Laux Simon-Laux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not work out of the box and I agree with the idea that pagefind.js and wasm.unknown.pagefind should not be duplicated - maybe they could be imported via import statement from start-pagefind.js?

@Simon-Laux
Copy link
Member

maybe https://pagefind.app/docs/ui/#bundle-path could help, Pagefind (the lib not ui) also has a basePath option

@nicodh
Copy link
Member Author

nicodh commented Feb 26, 2025

does not work out of the box and I agree with the idea that pagefind.js and wasm.unknown.pagefind should not be duplicated - maybe they could be imported via import statement from start-pagefind.js?

Sorry - the problem was, that I didn't commit the changes needed after the update of deltachat-pages

@nicodh
Copy link
Member Author

nicodh commented Feb 26, 2025

Concerning the redundant files: pagefind expects the wasm files to be at the same path as pagefind-ui.js & pagefind.js.
All together build the "bundle-path". The paths to the data are obviously relative.

What I did now is: copy the needed files to static/help/ and remove them from /static/help//pagefind/ in build process.
Then copy them to the current language dir on runtime when needed. (when language is switched)

@Simon-Laux
Copy link
Member

Simon-Laux commented Feb 26, 2025

Then copy them to the current language dir on runtime when needed. (when language is switched)

bad idea, app files at runtime should be treated immutable. what you can do is making a custom uri schema for the help and match on the name to return the same file in all sub directories, similar to how webxdc.js is served.
Or try understand how Pagefind works and adjust it to work the way we want, that would be the ideal solution.

@nicodh
Copy link
Member Author

nicodh commented Feb 27, 2025

I found a solution: added a lang attribute to each help page and moved the pagefind indexing one level up, so all data goes into one pagefind directory while pagefind assigns the index per language and shows only appropriate matches

@nicodh nicodh removed the request for review from r10s February 27, 2025 11:21
@Simon-Laux
Copy link
Member

Simon-Laux commented Feb 27, 2025

Bildschirmfoto 2025-02-27 um 14 47 39

Icon/char for clear search is not loaded, but that no blocker in my eyes

@nicodh
Copy link
Member Author

nicodh commented Feb 27, 2025

Icon/char for clear search is not loaded, but that no blocker in my eyes

You have an idea why? It's just a Unicode 🞫 ?

@Simon-Laux
Copy link
Member

You have an idea why? It's just a Unicode 🞫 ?

you need to load a font that supports it

@nicodh
Copy link
Member Author

nicodh commented Feb 27, 2025

You have an idea why? It's just a Unicode 🞫 ?

you need to load a font that supports it

You mean it depends if your system font supports it? Does it makes sense to look for another sign with better support? Maybe https://en.wikipedia.org/wiki/Multiplication_sign ?

@Simon-Laux
Copy link
Member

Simon-Laux commented Feb 27, 2025

  • either add a font that supports it to the css of the help file
  • use just the "X" letter character
  • use a string/button with the text "clear"
  • or use an image/icon.

@nicodh nicodh merged commit 44acc43 into main Feb 27, 2025
12 checks passed
@nicodh nicodh deleted the searchfield-for-help branch February 27, 2025 22:12
@r10s
Copy link
Member

r10s commented Mar 1, 2025

this PR has reverted the help to a pretty old state, i'll did an update at #4725 , not sure, if pagefine script ran correctly there, that should be double-checked

@r10s r10s mentioned this pull request Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants