Code Monkey home page Code Monkey logo

react-tv-redux-navigation's Introduction

react-tv-redux-navigation

Diagram

The main goal of the project

Predictable and inspectable focus management for LRUD user input.

Instead of traversing through the tree of React components, the completely different approach was applied in this project.

The core idea is that each focusable component knows about its neighbours, hence has a reference to them. To support the navigation process the system only needs to have a reference to the current focused element, then when the user input is handled get the neighbour reference for the corresponding direction and make this neighbour the next focused element.

Diagram

Core layout components

Focusable component

This component is the foundation of the whole application, as it handles the focus updates and passes them down to target UI components. Focusable component also has references to all neighbour components, e.g. navigationRight, navigationLeft, navigationUp, navigationDown. This component also has a container, which get updates from the Redux store. Navigation reducer is using references from this component in order to maintain the navigation process, e.g. navigating up/down/left/right. If Any of the navigation properties of this component is not defined, it means that there is nothing to be navigated to in the corresponding direction.

Columns

Columns layout component represents the container with columns, where each columns is a Focusable component. To support navigation process, the component should assign left/right navigation references to all columns (Focusable elements), so that each of the will know what component is on the left/right side. This component also support scrolling of the content, hence the selected frame stays as the most left one and the lane has a moving effect.

Diagram

Rows

Rows layout component is a container with focusable rows inside, where each row is a Focusable component. The main principle is very the same, as for Columns component with only difference, that Rows component is assigning up/down neighbours to each Focusable row.

Diagram

Scroll

Scroll layout component is a container to support vertical scrolling of Rows component. It always keeps the focused element in the middle of the viewport if possible.

Diagram

react-tv-redux-navigation's People

Contributors

oleks-fedotov avatar

Watchers

 avatar  avatar

react-tv-redux-navigation's Issues

Lazy collection rendering

The main goal of this ticket will be, to first render only visible part of the lane and afterward to fetch next elements and also render them.

Main tasks:

  • Implement 2 steps rendering for the lane
  • Optimize the update for the second step, not to update already existing elements
  • Only the last element's navigationRight property should be updated during the 2 rendering step
  • Implement configurable lazy lane rendering, so when the user is getting closer to the visible border, the lane is fetching the next set of data to be rendered.

Configurable lazy lane rendering

During the first render, the lane is only rendering 10 elements. The lane also should have a right range parameter, which describes how many elements should always be kept on the right side of the focused element. The same parameter should exist also for the left side.

Example:
let's say the right range will be 15 and the left one is 5. This way after the first rendering step we have 9 elements on the left side from the focused one and 0 elements on the left side. Therefore, the second rendering step should additionally fetch 6 right elements and 5 left elements, also render them. When the user starts moving right and gets the number of elements smaller than 15, the lane should fetch additional 15 elements and render them. The same principle is applied on the left side.

Configurable parameters:

  • initial elements number
  • min right elements number
  • min left elements number

Add left menu navigation

  • Implement PageWithMenu component, which will have 2 columns, which are the menu and main content
  • Add left menu navigation
  • Menu should open when navigating left from the most left element
  • Moving right from the menu moves to the previous focused place
  • Opening animation

Update README

  • Include the main goal of the project
  • Describe the high-level overview of the used approach
  • Diagram to visualize the core principle of the approach
  • Describe the core building blocks
  • Show what components do internally (e.g. assigning left-right, up-down neighbours)
  • Describe state management
  • Describe component interfaces

Reusability of components

  • Think and try to reuse existing components
  • Collect issues when trying the reuse
  • Adjust the library to be quickly pluggable into the existing project

Think over storing history between page switches

When moving between different screen, focusing when moving back should be maintained and be in the correct place. With this issue think about possible ways, for example it can be storing id of the focused element when move to the new page.

Add pointer support

  • Pointer support should be activated, when the mouse is entering any of the clickable areas of the application
  • Once any button is pressed, pointer support should be deactivated, returned to the previous place
  • When the pointer is leaving the hoverable area, the focus should be returned to the previous place

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.