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

Algolia #239

Closed
wants to merge 9 commits into from
Closed

Algolia #239

wants to merge 9 commits into from

Conversation

suprith-hub
Copy link
Contributor

I tried fuse search and it was successful, please check if this works,
IF yes next will be:
searchbar positioning
Implement same for vocabulary page and dialect page
Customize fuseOptions much better

Copy link
Member

Choose a reason for hiding this comment

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

What is this file? We shouldn't be committing generated files in this project. You can get Hugo to generate a JSON file automatically from the site content

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I saw that auto generation didn't work for me so I copied the information manually. Let me try it again to auto-generate

@@ -13,3 +13,4 @@ jsonschema = 'https://json-schema.org'
[markup.highlight]
lineNos = false
noClasses = false

Copy link
Member

Choose a reason for hiding this comment

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

Empty line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, .toml files shouldn't have empty lines in the end?? I and any config file?.. I'll change it,

Copy link
Member

Choose a reason for hiding this comment

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

I don't think any file format as a requirement of an empty line at the end that I'm aware of

assets/main.scss Outdated
@@ -146,3 +146,16 @@ details:not([open]) summary i {
@extend .d-inline-block;
transform: rotate(-90deg);
}

/* Customizing the search button color */
.btn-outline-success {
Copy link
Member

Choose a reason for hiding this comment

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

You should never override Bootstrap classes. Bootstrap provides a way to override main colors through SCSS variables and also supports plenty of helpers to customize colors, border colors, etc of arbitrary elements.

@@ -5,3 +5,68 @@ import Tooltip from './vendor/bootstrap/js/src/tooltip.js';
for (const element of document.querySelectorAll('[data-bs-toggle="tooltip"]')) {
new Tooltip(element);
}

// Fuse search options
var fuseOptions = {
Copy link
Member

Choose a reason for hiding this comment

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

var is an old and no longer used JavaScript construct. You should use const or let


<form class="d-flex justify-self-end" id="search-form">
<input class="form-control me-2" type="search" name="q" id="search-query" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
Copy link
Member

Choose a reason for hiding this comment

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

Probably no need to have a submit button, as it is not a form you would be submitting anyway. Ideally we just have the search input and we search as the user types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

" Search as the user inputs" means we will keep redirecting as user inputs or keep changing suggestions like in JSON Schema website as user inputs ?? 1 or 2?

Copy link
Member

Choose a reason for hiding this comment

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

No redirection. Exactly like in the JSON Schema official website: we dynamically change the dropdown with the search results

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, that means the dropdown has to be displayed dynamically, and stop so that user can chose... I don't know how it works with Fuse. In JSON Schema.org they use React library from Algolia itself to have that functionality.
Are there any suggestions..? That how dynamic search and listing can be done in UI

Copy link
Member

Choose a reason for hiding this comment

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

You should be able to doing with plain JavaScript + Bootstrap. i.e. load a Bootstrap dropdown upon search results. Or if you can create a JavaScript function that gives you the search results given a search term as an array I can help doing the UI

<button class="btn btn-outline-success" type="submit">Search</button>
</form>

<div class="navbar-nav d-flex ">
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<div class="navbar-nav d-flex ">
<div class="navbar-nav d-flex">

Copy link
Member

@jviotti jviotti left a comment

Choose a reason for hiding this comment

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

I left a few comments have various comments about the JavaScript part, but it doesn't seem to work for me at all. I don't see anything if I type on the search bar or submit, as if nothing happens at all. Does it work for you?

@suprith-hub
Copy link
Contributor Author

I left a few comments have various comments about the JavaScript part, but it doesn't seem to work for me at all. I don't see anything if I type on the search bar or submit, as if nothing happens at all. Does it work for you?

This is the recording of the working : it redirects directly, ..

search-bar.mp4

@jviotti
Copy link
Member

jviotti commented May 26, 2024

I don't get the dropdown at all. What browser are you using? Maybe try other ones?

Untitled.mov

@suprith-hub
Copy link
Contributor Author

I don't get the dropdown at all. What browser are you using? Maybe try other ones?

Untitled.mov

That dropdown isn't code defined, yeah its because of the browser - Chrome browser.

I don't get the dropdown at all. What browser are you using? Maybe try other ones?

Untitled.mov

That dropdown is a browser behavior. Right now it works only if the search button is clicked. Let's implement listing functionality too..

@suprith-hub
Copy link
Contributor Author

@jviotti I have made the major changes, styling and html should be polished.
Currently(functionality):

  1. I have made it such that it clears everything on clicking outside, maybe we can give top suggestions
  2. listing out top 10 results.
    Change suggestions on these?

@jviotti
Copy link
Member

jviotti commented May 28, 2024

Seems to be shaping up but still doesn't work for me. It cannot find the JSON index file

Screenshot 2024-05-28 at 9 51 40 AM

Also, can you resolve the git conflicts?

@suprith-hub
Copy link
Contributor Author

suprith-hub commented May 28, 2024

@jviotti autogeneration is happening now, can you check for the funtionality.. then we can go ahead with UI then code correction
The interesting thing was - json files having that kind format/content was valid which was confusing

@jviotti
Copy link
Member

jviotti commented Jun 3, 2024

Woah! Super cool already! One small UI suggestion: when displaying a keyword, can you also showcase what dialect and vocabulary they belong to?

@jviotti
Copy link
Member

jviotti commented Jun 3, 2024

Can you extract the parts of this PR that generate the JSON index as a separate PR? I think we can get that merged now while we focus on polishing the rest

<script defer src="{{ $js.Permalink }}"></script>
<script async src="{{ $js.Permalink }}"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.6.2/fuse.min.js" integrity="sha512-Nqw1tH3mpavka9cQCc5zWWEZNfIPdOYyQFjlV1NvflEtQ0/XI6ZQ+H/D3YgJdqSUJlMLAPRj/oXlaHCFbFCjoQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Copy link
Member

Choose a reason for hiding this comment

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

Can we pull these dependencies using NPM on package.json?

@suprith-hub
Copy link
Contributor Author

Woah! Super cool already! One small UI suggestion: when displaying a keyword, can you also showcase what dialect and vocabulary they belong to?

Okay.. I got the reason for it . For the UI shall I include both of them in right as a smaller size text ? I may have to override bootstrap I guess

@jviotti
Copy link
Member

jviotti commented Jun 3, 2024

Not sure about the style. Give it your best shot while changing the least amount of possible in Bootstrap and then I'll help!

@suprith-hub
Copy link
Contributor Author

@jviotti I have made the changes, I have updated package.json too, should I have another PR for index.json... 100%?

@jviotti
Copy link
Member

jviotti commented Jun 4, 2024

Yeah, let's do a separate PR. A sequence of smaller PRs is always better than 1 bigger PR! At least we have the JSON part out of the way, and we focus on the rest.

@suprith-hub suprith-hub closed this Jul 1, 2024
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.

2 participants