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

feat(tabs): shortcuts #193

Merged
merged 2 commits into from May 31, 2018
Merged

Conversation

robmoorman
Copy link
Contributor

@robmoorman robmoorman commented May 31, 2018

Solving feature request #191 to add tab control.

Description

This pull requests adds expected tab control to the nOS client.

Motivation and Context

Quick opening up tabs and closing current actives ones wasn't supported yet.

How Has This Been Tested?

Tested on multiple OSX platforms and node environments.

Screenshots (if appropriate):

N/A

Types of changes

  • Chore (tests, refactors, and fixes)
  • New feature (adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • I have read the CONTRIBUTING document.
  • Compliant with Electron best practices https://electronjs.org/docs/tutorial/keyboard-shortcuts

Closing issues

Closes #191

@robmoorman robmoorman changed the title Add tab control shortcuts to tabs container feat(tabs): shortcuts May 31, 2018
Copy link
Contributor

@mhuggins mhuggins left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! I added a comment below that I think we should consider.


handleShortcuts = (event) => {
// Command + w (close current tab or client)
if (event.metaKey && event.key === 'w') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I could be mistaken, but I believe metaKey is only valid on macOS. We may need to conditionally use metaKey for macOS and check for ctrlKey on Windows/Linux.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's correct. Good point, I'll add it.

@robmoorman
Copy link
Contributor Author

robmoorman commented May 31, 2018

Fixed @mhuggins thanks for the quick review. There are also additional tab controls (switch tab etc.), maybe than it's wise to decouple this logic (to keep the Tabs component small and make these conditions testable separately) and place it somewhere in lib or utils. For now it's fixed in the handler method.

Copy link
Contributor

@mhuggins mhuggins left a comment

Choose a reason for hiding this comment

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

This is a good starting point, thanks! We can extract and clean up more as we find more is needed around tabs.

@mhuggins mhuggins merged commit 2449895 into nos:develop May 31, 2018
@robmoorman robmoorman deleted the feature/tab-shortcuts branch May 31, 2018 15:56
mhuggins added a commit that referenced this pull request Jun 2, 2018
mhuggins added a commit that referenced this pull request Jun 10, 2018
* Added the possibility to login using keystore json file

* Added the possibility for the user to choose among several accounts in the wallet + handle errors + fix

* Added the possibility to login using keystore json file

* Added the possibility for the user to choose among several accounts in the wallet + handle errors + fix

* feat(ui): select component

* Fix from the review + modified the way option keys are generated, preventing options from having potentially the same key

* Fixed: onLogin is again a noop function + removed the error message when selecting the 'Select an account' option

* Removed stale yarn.lock entries

* Updated Select component to allow more dynamic usage

* Fixed wallet file linting issues & general cleanup

* chore(.github): added issue template, PR template, contribution guidelines + updated readme

* chore(readme): fixed typos

* Create CODE_OF_CONDUCT.md

* Create LICENSE

* chore(docs): fix contributing typo

* chore(docs): add license to package.json

* Blank target to nOS client and neoblog dApp Links (#112)

Added blank target to nOS client and neoblog dApp Links

This prevents users from seeing these pages from within the client. They should pop out to the user's default system browser.

* feat(register): save the new account to an already existing Wallet file (#111)

* feat(register): save the new account to an already existing Wallet file

* refactor(SaveAccount): code refactoring

* refactor(SaveAccount): save as new wallet now also sets the account exported to isDefault: true & removed accountToNEP6.js

* chore(docs): update contributing guide and PR template (#115)

* chore(register): cleanup registration PR #111 (#114)

* Cleaned up user messaging for consistency
* Removed extra whitespace
* Updated logic

* chore(docs): prerequisites for dapps (#123)

* improved readme

* more clear message

* added clone instructions and requirement of nos-client

* added npm packages as well

* clarified usage of nos-api in the readme.

* chore(forms): disabled register button & show register error alert (#125)

* chore(forms): disabled register button if no text is entered and passphrases don't match  & disabled login buttons if no text is entered

* chores(register): unmatching passphrases no longer disable the register button

* fix(register): error messages now appear

* feat(public):add support for splash screen on app load (#119)

* add support for splash screen on app load

* adding conditional statement to load splash screen

* fix yarn test issues

* feat(settings): Add additional custom url network configurations (#109)

* Added a network reducer to store list of networks and currently selected network

* Update default state in network reducer

* Show a modal to input new network and persist that

* Added button to clear all custom network as well as a button to add new network

* Clean up code

* Handle some style issues with padding

* Added an alert when clearing custom network configurations

* Remove console log

* Clean up code and remove reducer

* Shorten code

* Remove unneeded extra variable

* Fix warning

* Fix yarn lint

* Define propTypes

* Fix lint errors

* Fix lint errors

* Fix lint error

* Fix linting

* Remove name

* Do better check of initial retrieval of data from storage

* Fix lint erros and add back name

* Remove name

* Check for null in store currentNetwork and all networks

* Save currentNetwork as just the url instead of an object with name and url

* Remove unused file

* Fix minor code refactor

* Fix user facing message consistency issue

* Create a new hoc and action file to store and handle functions related to allNetworks

* Add fullstop

* Only switch user to TestNet during the clearing of custom network only when they are currently not on any of the default networks

* Check for duplicate network name instead of duplicate network url

* Refactor to only store network name in redux store

* Fix a bug so that now when user is on a custom network when clearing networks, they switch to Testnet

* Use the name of the network as the value instead of the url, now that we are adding the network config to neon

* Shift initialisation of nosLocal back to its own file and simplify the update network code

* Revert "Shift initialisation of nosLocal back to its own file and simplify the update network code"

This reverts commit 608bfa2.

* Save network name instead of neoscan url

* Simply setCurrentNetwork instead of using saveNetwork since we do not need the 'Saved' feedback since we already have an alert for clearing networks

* Show the current network url since the bottom area is not showing the name of the network instead of the url

* Fix lint error

* feat(Account): added ability to transfer funds on the account view (#113)

* feat(Account): added ability to transfer funds on the account view

* chore(account): modified css

* chore(account): modified layout and added functionality

* chore(account): fixed transfer not working - added bignumberjs

* chore(account): modifed css

* chore(account): updated css

* chore(account): fixed amount input cursos jumping to the end on keystroke

* chore(account): fixed build failing

* feat(transfer): added loading state, success/error messages, input validation, and cleaned up constants

* chore(cleanup): removed commented lines

* chore(style): removed unneeded !important

* chore(register): fixed input focus not working (#129)

* Add focus-ring management (improve accessibility) (#122)

* feat(browser): added `nos` protocol & use it to resolve queries (#117)

* chore(project): moved files into pods (#126)

* Moved files into pods

* fixup! root pod & pod exports

* shared pod export

* Added babel-plugin-module-resolver to refer to pod paths absolutely

* chore(src): windows import resolver build fix (#134)

* chore(build): use getBabelLoader to find babel-loader

* chore(root): fixed building issue on windows

* chore(build): restore console.log

* chore(api): return full result object instead of script (#132)

* chore(api): return full result object instead of script

* chore(api): map correct prop name

* chore(api): add shapes

* chore(settings): refactorered settings design - structure (#135)

* chore(settings): refactorered settings design - structure

* chore(settings): small css fix

* chore(settings): PR comments

* chore(root): fixed build & dist scripts

* chore(deps): upgrade to electron 2.0.0 and associated packages

* chore(build): fixed build script

* feat(accounts): Login with saved encrypted account (#127)

* Save encrypted key instead of private key in the wallet file

* Ask for passphrase to login using the encrypted key loaded from the wallet file

* Rename WIF to encryptedWIF

* Fix lint errors

* Fix more lint errors

* Revert the naming of encryptedWIF back to WIF

* Remove the overwrite of key with encrypted key

* Remove passphrase input

* Fix errors

* Save all previous logged account's encrypted key for future use

* Set the encrypted WIF when you change your selection

* Yarn errors

* Revert "Yarn errors"

This reverts commit 5d4067f.

* Revert "Set the encrypted WIF when you change your selection"

This reverts commit 180b2f7.

* Revert "Save all previous logged account's encrypted key for future use"

This reverts commit d228821.

* Revert "Fix errors"

This reverts commit ae84b2f.

* Revert "Remove passphrase input"

This reverts commit b7c75e6.

* Revert "Remove the overwrite of key with encrypted key"

This reverts commit 2de5810.

* Revert "Revert the naming of encryptedWIF back to WIF"

This reverts commit bba33a5.

* Only show passphrase input if the key is an encrypted key

* Added description so users know why certain accounts needed a passphrase and others don't

* Fix lint issues

* Fix errors

* Refactor code

* Fix yarn errors

* Reset passphrase

* Chore(Settings): Fix select network bug (#147)

* Check if component exist before setting state

* Use clear timeout instead

* feat(public): added icon (#136)

* feat(public): added icon

* chore(public): fixed path

* chore(public): updated icons

* chore(public): updated logos

* chore(public): fixed pathing issues on prod build

* chore(root): PR comments fix

* Chore/nos icon fix windows (#152)

* chore(public): fixed windows icon size + rename

* chore(public): fixed build issue on mac

* feat(splash): Updated splash screen (#140)

* Updated splash screen with dimension, header removal and animation updates

* Changed bodymoving dependency to now being pulled from public folder instead of CDN. Changed naming convention on a html element.

* chore(public): re-created nos-homepage (#156)

* feat(public): re-created nos-homepage

* chore(public): pr comments fix

* chore(browser): refactored heirarchy and replaced actions/reducer (#153)

* chore(browser): refactored heirarchy and replaced actions/reducer

* chore(browser): removed unused matchShape

* chore(browser): removed react-router-breadcrumbs-hoc

* chore(app): quit app when all windows are closed (#165)

* feat(browser): Added browser tabs (#160)

* feat(browser): added browser tabs

* feat(browser): added tab loading loading state

* chore(lint): prefer react state before constructor

* chore(browser): differentiate link clicks from user address entry

* chore(browser): clean up tab styles

* chore(browser): strip trailing slash on TLD only when rendering

* feat(browser): tab close icon

* feat(browser): tab loading spinner

* chore(browser): clear tab loading state when loading fails

* chore(browser): allow current URI to be re-fetched by user input

* chore(browser): don't show loader for in-page anchors

* feat(app): nOS API refactor (#159)

* chore(app): use object instead of array for api arguments

* chore(app): refactor to a whitelisted config

* feat(app): use config object for invoke

* feat(app): use config object for getStorage

* feat(app): use config object for send

* feat(app): use config object for getBalance

* feat(app): use encodeInput and decodeOutput

* chore(app): add encodeArgs for (test)invokes

* chore(app): implement encodeArgs in testInvoke

* chore(app): bump switch-tree version

* chore(app): fix and lint

* chore(app): fix encoding of addresses

* chore(app): fix encodeArgs / createScript

* chore(app): refactor docs + getBalance scriptHash to asset

* chore(app): update docs to new API

* chore(docs): update documentation

* chore(app): update encodedArgs

* chore(app): delete unused property

* chore(app): update initialisation of flags

* chore(app): appease linter

* chore(tests): fixed react prop warnings (#174)

* Update dependencies to enable Greenkeeper 🌴 (#175)

* chore(package): update dependencies

* docs(readme): add Greenkeeper badge

* chore(app): update readme and pj

* chore(src): fixed css issue for menu bar (#172)

* chore(src): updated neonjs - fixed css issue

* chore(authenticatedLayout): removed redundant css

* chore(circle): added tagged builds to CircleCI (#176)

* chore(circle): separate build & test steps into workflow

* chore(circle): added build steps for tagged releases

* chore(circle): upgrade node version

* chore(docs): Added release documentation to readme

* chore(circle): upgrade yarn version

* chore(browser): clean up browser tabs when closed (#179)

* chore(browser): add closing tab functionality

* chore(browser): add ;

* chore(browser): remove ;

* add ;

* chore(browser): auto fix linting

* refine spacing

* feat(browser): empty request queue on logout (#177)

* feat(browser): remove request queue when logout

* fix from comments

* use compose with props

* refactor to mapDispatchToProps

* chore(dev): change default port from 3000 to 4000 (#181)

* chore(body): set background-color to content-bg (#182)

* Update getting started guide (#178)

* chore(app): update getting started guide

* chore(app): updated formatting

* chore(app): some more docs formatting

* chore(src): Cleaned up code from request queue changes (#185)

* chore(dev): clean up ordering of switch cases

* chore(dev): restore lost whitespace & adjust ordering

* chore(lint): preserve import groups

* chore(env): update yarn.lock to match dependencies (#183)

* Change default port from 4000 to 5000 (#184)

* chore(electron): syntax cleanup

* chore(electron): fix welcome page dev port

* chore(dev): change default port from 4000 to 5000

* chore(browser): fix responsive tab sizing behavior (#173)

* feat(tabs): shortcut keys (#193)

* Add tab control shortcuts to tabs container

* Fix platform specific combination key condition to control tab behavior

* chore(package): update redux-thunk to the latest version 🚀 (#189)

* fix(package): update redux-thunk to version 2.3.0

* chore(package): update lockfile

* Revert "chore(browser): fix responsive tab sizing behavior (#173)" (#198)

This reverts commit 1c70ad7.

* chore(package): update sass-loader to the latest version 🚀 (#196)

* chore(package): update sass-loader to version 7.0.2

* chore(package): update lockfile

* chore(package): update autoprefixer to the latest version 🚀 (#197)

* chore(package): update autoprefixer to version 8.6.0

* chore(package): update lockfile

* chore(package): update @cityofzion/neon-js to the latest version 🚀 (#190)

* fix(package): update @cityofzion/neon-js to version 3.8.1

* chore(package): update lockfile

* chore(browser): fix browser tab reload (#200)

* chore(browser): prevent webview reloading when changing tabs

* chore(browser): added tests

* chore(tests): moved tests to proper folder

* chore(root): updated docs and readme (#202)

* chore(login): refactored ledger login to show current state (#186)

* chore(login): refactored ledger login by using states

* chore(login): adjusted code to match the linting rules

* chore(login): added punctuation to the status codes to be consistent

* Replaced the state approach with withProgress of spunky

* chore(login): refactored after review, progress still shows LOADING steps

* chore(login): added a state to store the progress

* chore(ledger): fix option key

* chore(ledger): remove ledger component state & clean up messaging logic

* Update README.md

* Update README.md

* chore(tests): added tests for GetBalance & GetAddress requests (#207)

* chore(tests): added tests for GetBalance container component

* chore(component): fixed prop type for GetBalance component

* chore(tests): added tests for GetBalance component

* chore(lint): ignore coverage folder

* chore(tests): added tests for GetAddress component

* chore(tests): added tests for GetAddress container component

* chore(electron): disable service worker for unprivileged file: protocol (#211)

* chore(protocol): replace registerHttpProtocol with registerStreamProtocol (#210)

* chore(protocol): replace registerHttpProtocol with registerStreamProtocol to handle file streaming

* chore(public): fixed dist on windows

* feat(browser): add X-nOS-Version request header (#213)

* chore(browser): prevent many tabs from growing beyond window width (#199)

- sets width of authenticated main content for reliable use by its descendants.
- reduces spacing left, right of tabs and tab.
- fixes width of menu left with flex rather than min-width to prevent growing with content.

* feat(browser): My nOS (#215)

* feat(browser): set contributions app as start page

* feat(browser): link to contributions app from welcome screen

* feat(browser): new tabs lead to welcome screen

* Update README.md

* Update README.md

* Update README.md

* chore(package): update version to 0.2.0 (#216)
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.

Support shortcuts for tab behaviour
2 participants