This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
feb02ab
commit 5193fab
Showing
10 changed files
with
163 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
part of gridhub.actions; | ||
|
||
|
||
class GlobalStateActions { | ||
|
||
/// Payload is whether or not the global open state is open or closed | ||
final Action<bool> globalOpenState = new Action<bool>(); | ||
|
||
/// Payload is active pane key | ||
final Action<String> switchActivePaneKey = new Action<String>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
part of gridhub.stores; | ||
|
||
class GlobalStateStore extends Store { | ||
|
||
GridHubActions _actions; | ||
String _activePaneKey = '1'; | ||
bool _openState = true; | ||
|
||
String get activePaneKey => _activePaneKey; | ||
bool get openState => _openState; | ||
|
||
GlobalStateStore(GridHubActions this._actions) { | ||
_actions.globalStateActions.globalOpenState.listen(onGlobalOpenState); | ||
_actions.globalStateActions.switchActivePaneKey.listen(onSwitchActivePaneKey); | ||
} | ||
|
||
|
||
onGlobalOpenState(bool open) { | ||
_openState = open; | ||
trigger(); | ||
} | ||
|
||
onSwitchActivePaneKey(String key) { | ||
_activePaneKey = key; | ||
trigger(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
library gridhub.utils.keyboard_shortcuts; | ||
|
||
import 'dart:html'; | ||
|
||
import '../actions/actions.dart'; | ||
|
||
void handleKeyDown(KeyboardEvent event, GridHubActions gridhubActions) { | ||
RepoActions actions = gridhubActions.repoActions; | ||
switch (event.keyCode) { | ||
// Pages | ||
case KeyCode.ONE: | ||
actions.switchPageByIndex.dispatch(0); | ||
break; | ||
case KeyCode.TWO: | ||
actions.switchPageByIndex.dispatch(1); | ||
break; | ||
case KeyCode.THREE: | ||
actions.switchPageByIndex.dispatch(2); | ||
break; | ||
case KeyCode.FOUR: | ||
actions.switchPageByIndex.dispatch(3); | ||
break; | ||
case KeyCode.FIVE: | ||
actions.switchPageByIndex.dispatch(4); | ||
break; | ||
case KeyCode.SIX: | ||
actions.switchPageByIndex.dispatch(5); | ||
break; | ||
case KeyCode.SEVEN: | ||
actions.switchPageByIndex.dispatch(6); | ||
break; | ||
case KeyCode.EIGHT: | ||
actions.switchPageByIndex.dispatch(7); | ||
break; | ||
case KeyCode.NINE: | ||
actions.switchPageByIndex.dispatch(8); | ||
break; | ||
case KeyCode.ZERO: | ||
actions.switchPageByIndex.dispatch(9); | ||
break; | ||
|
||
// Panels | ||
case KeyCode.A: | ||
gridhubActions.globalStateActions.switchActivePaneKey.dispatch('1'); | ||
break; | ||
case KeyCode.S: | ||
gridhubActions.globalStateActions.switchActivePaneKey.dispatch('2'); | ||
break; | ||
case KeyCode.D: | ||
gridhubActions.globalStateActions.switchActivePaneKey.dispatch('3'); | ||
break; | ||
case KeyCode.F: | ||
gridhubActions.globalStateActions.switchActivePaneKey.dispatch('4'); | ||
break; | ||
case KeyCode.G: | ||
gridhubActions.globalStateActions.switchActivePaneKey.dispatch('5'); | ||
break; | ||
case KeyCode.H: | ||
gridhubActions.globalStateActions.switchActivePaneKey.dispatch('6'); | ||
break; | ||
|
||
// Open/Close | ||
case KeyCode.O: | ||
gridhubActions.globalStateActions.globalOpenState.dispatch(true); | ||
break; | ||
case KeyCode.P: | ||
gridhubActions.globalStateActions.globalOpenState.dispatch(false); | ||
break; | ||
|
||
// Refresh | ||
case KeyCode.R: | ||
actions.refreshPage.dispatch(); | ||
break; | ||
} | ||
} |