remotion-dev/remotion

Implement DocSearch in Quick Actions Modal #1432

JonnyBurger posted onGitHub

šŸŽƒ This issue is part of our Hacktoberfest campaign! šŸ“š Read more about Hacktoberfest here ā²ļø This issue is currently assigned to @uragirii! šŸ’° Thanks to CodeChem for sponsoring this issue!

I have implemented a Quick Switcher for Remotion, that can be invoked with Cmd+K / Ctrl+K:

<img width="1466" alt="image" src="https://user-images.githubusercontent.com/1629785/197333403-10f853f0-a4de-4990-a4d4-f34f3f394122.png">

It currently imports two modes:

  1. If you enter a string, it shows a list of compositions that match this query.
  2. If you enter a string and prefix it with "> ", it shows actions that can be taken from a menu:

<img width="626" alt="image" src="https://user-images.githubusercontent.com/1629785/197333499-381459dd-886f-477c-bf77-e876c46d71cd.png">

This task is about implementing a third mode that allows you to find a Documentation page for Remotion.

The following request:

const query = "spring"
await fetch(
    'https://plsduol1ca-dsn.algolia.net/1/indexes/*/queries?x-algolia-agent=' +
        encodeURIComponent('Remotion Preview DocSearch') +
        '&x-algolia-api-key=3e42dbd4f895fe93ff5cf40d860c4a85&x-algolia-application-id=PLSDUOL1CA',
    {
        headers: {
            'content-type': 'application/x-www-form-urlencoded',
        },
        body: JSON.stringify({
            requests: [
                {
                    query,
                    indexName: 'remotion',
                    params:
                        'attributesToRetrieve=["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url"]&attributesToSnippet=["hierarchy.lvl1:10","hierarchy.lvl2:10","hierarchy.lvl3:10","hierarchy.lvl4:10","hierarchy.lvl5:10","hierarchy.lvl6:10","content:10"]&snippetEllipsisText=ā€¦&highlightPreTag=<mark>&highlightPostTag=</mark>&hitsPerPage=20&facetFilters=[]',
                },
            ],
        }),
        method: 'POST',
    }
).then((res) => res.json());

will return documentation results for spring.

Acceptance criteria

  • Implement a third mode in the Quick Actions modal to find documentation pages based on a query. It does not have to support nesting as Algolia DocSearch, but you can take inspiration from it:

<img width="683" alt="image" src="https://user-images.githubusercontent.com/1629785/197334198-88eb9d0f-609f-42a0-8464-825c73a11f0f.png">

  • Do not introduce new dependencies, keep it minimalistic and rather have fewer features than introduce much complexity
  • Make it so that you can prefix any query with "? " to switch to the DocSearch mode, similar to how you can enter > to search for Actions.

@remotion-dev has funded $223.00 to this issue.


posted by issuehunt-app[bot] over 2 years ago

Can I work on this?

posted by uragirii over 2 years ago

@jonnyburger has rewarded $200.70 to @uragirii. See it on IssueHunt

  • :moneybag: Total deposit: $223.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $22.30
posted by issuehunt-app[bot] over 2 years ago

Fund this Issue

$223.00
Rewarded

Rewarded pull request

Recent activities

uragirii was rewarded by jonnyburger for remotion-dev/remotion# 1432
over 2 years ago
jonnyburger submitted an output to  remotion-dev/ remotion# 1432
over 2 years ago