epeterson320/triangle-calculator

Add Router

Closed this issue · 1 comments

E.g. www.ericp.co/triangle-calculator/?labels=a,b,q&a=60&b=90&aq=17&u=deg
Note: Per RFC3986 it is ok to skip the slash after the host.

On Mobile & portrait tablet
Bottom navigation w/ 2 options: Edit, Results

On landscape Tablet:
Edit view on left, results on right

On Web or widest screens:
Input form on left, edit view in middle, results on right

Views:
Edit (Drag point, input boxes for measurements)
Results (Scrolling text view showing work)

ROUTING
Paths:
/ (edit point, also results for lg. devices)
/results (results view for small devices) <-- serve from here too! symlink?
Query Params:
Param Value Default
a, b, c degrees undefined
A, B, C pos. number undefined
&rotate =2.2 // 0
&pan =30.1,20.2 // 0,0
&showWork =false // true

Probably use the History API and Location API, put side effects in action creators.
Add a new action creator, loadFromUrl() or such, and dispatch during init.
https://developer.mozilla.org/en-US/docs/Web/API/History
https://developer.mozilla.org/en-US/docs/Web/API/Location

The other option is
https://github.com/reactjs/react-router-redux which doesn't seem as well supported.