Code Monkey home page Code Monkey logo

sdk-react's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdk-react's Issues

Remove duplicate searches

SDK should only search once per react render. This could be achieved by only searching on the first componentDidUpdate after a render.

Simplify main ui-components.

Although the majority of the ui-components are included because they will avoid people from repeating the same boilerplate. However, they also serve as perfect examples of how to bind api-components to UI equivalents.

We need to make sure that the code for all ui-components is as simple as possible.

Add example code and instructions for an overlay style search interface

Should by default be designed for web collections. Core base features to include:

  • overlay base css
  • overlay animate in on trigger
  • logo left on desktop, on top on mobile style layout, click logo to exit
  • close button in top right
  • search box in top bar
  • results rendering in main section under top bar
  • esc to exit

And:

  • readme explaining how to build and release.
  • add animated gif showing what it does in action

Change summary to provide more information

When a search is being autocompleted, the user can hit enter to override the autocomplete and run the exact text in the input box. This is ok, but can confuse the user if they aren't aware they can hit enter.

So:

  • Wrap the timing component in a span so it can be hidden if desired
  • We don't need 6 decimal places in the timing. So 0.000444 should be 0.0004. And 0.044 should be 0.04 etc.
  • Change summary when the query run does not equal the query in the box to also include "Hit enter to search for X", where X is the original search. X should also be a link, that performs the same functionality.

Update all API components to use the exact names given in the actual API.

We need to make sure that everything is defined using the same terminology (i.e. so that a central set of documentation which describes meta boosts, index boosts, sorts etc applies to everything).

In particular, the use of constants is preferred to many helper functions which won't necessarily be defined in other variants of the SDKs. The constants will always be defined due to the protobuf.

Proposal: state event hooks

state.js currently performs actions without exposing ways for other code to hook in to all of it's actions nicely.

There is currently beforeMergingValues which performs some actions related to tracking. Since this point in time (received new values, not merged yet) is useful to query tracking, it might also be useful to code outside of state.js, for example analytics.

Currently adding analytics would require baking it into the NamespaceState class or keeping state in the analytics implementation to gauge how the values are changing in order to fire analytics events.

Having a beforeMergingValues action to listen on could look like this:

callback(oldValues, newValues)

It wouldn't be able to modify the values, only read them. This would remove the need to keep track of things like the q param externally to trigger analytics events when the qid has changed.

Alternatively, we could expose the query id reseting as an action and also pass along the old and new q values.

The issue with listening for qid reset on q change is that it is pipeline specific. Once pipelines other than website and raw are used it might not function properly.

basic-site-integration: bug with query deletion via typing

  • If a query is fully selected, then the searcher types (which replaces the entire query), the autocompleted text remains as per previous and javascript errors prevent the search from working.

  • if a query is deleted via backspace, the autocomplete text remains, even though the query is ""

screen shot 2017-05-28 at 9 35 13 pm
screen shot 2017-05-28 at 9 29 05 pm

Rework Pagination ui-component

Pagination component was changed to work in boostrap, and now doesn't work without it.

Refactor so that it works standalone and is simple.

Upgrade to new version of sajari-sdk-js

Sajari has had API changes which are reflected in the new sajari-sdk-js. This library needs to upgrade to use the newest sajari-sdk-js to stay api compatible.

Immutables all the way

I'm currently trying to use this in a simple React app, and I absolutely love Immutables. However, because the <ResultInjector> component unwraps immutables via the expensive .toJS() operation, I end up rewrapping it again with the even more expensive .fromJS().

Could we have an alternative <ImmutableResultInjector> that injects Immutable props to its children?

setState(x) merges x with this.state

You don't need to set things that you want to keep, this will happen automatically because it is merging the dictionaries, not overwriting this.state.

i.e. you don't need things like

this.setState({
    namespace: this.state.namespace,
    // ...
})

Come up with standardised naming for UI components

Where single HTML elements are bound to single API components, can we construct a sensible naming scheme?

<Body ... /> + <input type="text" ... /> => <BodyInputText /> or <BodyTextInput />?

This comes into play more when you have things like:

<FieldFilter ... /> + <input type="check" ... /> => <FieldFilterInputCheck ... /> or <FieldFilterCheckInput ... />

Dispatch in middle of Dispatch

Getting

invariant.js:39 Uncaught Error: Invariant Violation: Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.

When a request is aborted.

Review class names and styles for html elements

Currently some components have class names and ids that don't make a lot of sense, eg sj-search-modal-input-holder-outer.

Go through and make sure all of them make sense, are consistent, and won't clash with commonly used names on users sites, eg disabled.

Also check that all overlay specific styles are only applied to overlay interfaces.

Standardise the form of all UI components.

Make sure that they are all rendered in the same context, i.e. within a single <div>. Decide whether you do this if there is only one child.

Remove any non-specific items that can be added around the component when rendered by the caller (i.e. unnecessary labels etc).

Split entry points into 2 main files.

Would be nice for people to be able to import api from etc, but not to have to import the UI components if they don't want them, and base api similarly.

Need "main" files for

  • base api components.
  • basic ui components.

Update documentation.

The current docs refer to some components that have been removed/replaced: i.e. ResultsPerPage and ResultsInjector.

Do the request building better

The way requests are built now is a mix of helpers in the utils folder and builder function in SearchActions.

Fix it so that they are in one place, and obvious to use.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.