skuilder 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +155 -12
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +35 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/init.d.ts +3 -0
  7. package/dist/commands/init.d.ts.map +1 -0
  8. package/dist/commands/init.js +70 -0
  9. package/dist/commands/init.js.map +1 -0
  10. package/dist/types.d.ts +35 -0
  11. package/dist/types.d.ts.map +1 -0
  12. package/dist/types.js +35 -0
  13. package/dist/types.js.map +1 -0
  14. package/dist/utils/prompts.d.ts +5 -0
  15. package/dist/utils/prompts.d.ts.map +1 -0
  16. package/dist/utils/prompts.js +185 -0
  17. package/dist/utils/prompts.js.map +1 -0
  18. package/dist/utils/template.d.ts +26 -0
  19. package/dist/utils/template.d.ts.map +1 -0
  20. package/dist/utils/template.js +170 -0
  21. package/dist/utils/template.js.map +1 -0
  22. package/eslint.config.mjs +21 -0
  23. package/package.json +41 -36
  24. package/src/cli.ts +42 -0
  25. package/src/commands/init.ts +83 -0
  26. package/src/types.ts +72 -0
  27. package/src/utils/prompts.ts +204 -0
  28. package/src/utils/template.ts +215 -0
  29. package/tsconfig.json +12 -21
  30. package/.npmignore +0 -56
  31. package/android/app/BUCK +0 -65
  32. package/android/app/build.gradle +0 -139
  33. package/android/app/proguard-rules.pro +0 -66
  34. package/android/app/src/main/AndroidManifest.xml +0 -32
  35. package/android/app/src/main/java/com/rxphelloworld/MainActivity.java +0 -15
  36. package/android/app/src/main/java/com/rxphelloworld/MainApplication.java +0 -40
  37. package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  38. package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  39. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  40. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  41. package/android/app/src/main/res/values/strings.xml +0 -3
  42. package/android/app/src/main/res/values/styles.xml +0 -8
  43. package/android/build.gradle +0 -24
  44. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  45. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  46. package/android/gradle.properties +0 -20
  47. package/android/gradlew +0 -164
  48. package/android/gradlew.bat +0 -90
  49. package/android/keystores/BUCK +0 -8
  50. package/android/keystores/debug.keystore.properties +0 -4
  51. package/android/settings.gradle +0 -3
  52. package/img/fingerCounter/1.PNG +0 -0
  53. package/img/fingerCounter/10.PNG +0 -0
  54. package/img/fingerCounter/2.PNG +0 -0
  55. package/img/fingerCounter/3.PNG +0 -0
  56. package/img/fingerCounter/4.PNG +0 -0
  57. package/img/fingerCounter/5.PNG +0 -0
  58. package/img/fingerCounter/6.PNG +0 -0
  59. package/img/fingerCounter/7.PNG +0 -0
  60. package/img/fingerCounter/8.PNG +0 -0
  61. package/img/fingerCounter/9.PNG +0 -0
  62. package/index.android.js +0 -1
  63. package/index.html +0 -30
  64. package/index.ios.js +0 -1
  65. package/ios/RXPHelloWorld/AppDelegate.h +0 -16
  66. package/ios/RXPHelloWorld/AppDelegate.m +0 -37
  67. package/ios/RXPHelloWorld/Base.lproj/LaunchScreen.xib +0 -42
  68. package/ios/RXPHelloWorld/Images.xcassets/AppIcon.appiconset/Contents.json +0 -38
  69. package/ios/RXPHelloWorld/Info.plist +0 -56
  70. package/ios/RXPHelloWorld/main.m +0 -18
  71. package/ios/RXPHelloWorld.xcodeproj/project.pbxproj +0 -1251
  72. package/ios/RXPHelloWorld.xcodeproj/xcshareddata/xcschemes/RXPHelloWorld-tvOS.xcscheme +0 -129
  73. package/ios/RXPHelloWorld.xcodeproj/xcshareddata/xcschemes/RXPHelloWorld.xcscheme +0 -129
  74. package/ios/RXPHelloWorldTests/Info.plist +0 -24
  75. package/ios/RXPHelloWorldTests/RXPHelloWorldTests.m +0 -70
  76. package/src/App.tsx +0 -206
  77. package/src/appUtilities/Grader.ts +0 -72
  78. package/src/appUtilities/Keybinder.ts +0 -28
  79. package/src/appUtilities/Recorder.ts +0 -73
  80. package/src/cloudantFiles/_users._design._auth.validate_doc_update.js +0 -136
  81. package/src/components/ProgressChart.tsx +0 -155
  82. package/src/components/fingerCounter/fingerCounter.tsx +0 -38
  83. package/src/components/fingerCounter/resources/hands.svg +0 -512
  84. package/src/components/numpad.tsx +0 -146
  85. package/src/components/sessionReport.tsx +0 -87
  86. package/src/index.tsx +0 -8
  87. package/src/questions/addition.tsx +0 -30
  88. package/src/questions/division.tsx +0 -62
  89. package/src/questions/multiplication.tsx +0 -71
  90. package/src/styles/answerStyles.css +0 -22
  91. package/src/typings/react.d.ts +0 -964
  92. package/webpack.config.ts +0 -26
  93. package/yarn.lock +0 -6208
@@ -1,129 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "0820"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "NO"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
18
- BuildableName = "libReact.a"
19
- BlueprintName = "React-tvOS"
20
- ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- <BuildActionEntry
24
- buildForTesting = "YES"
25
- buildForRunning = "YES"
26
- buildForProfiling = "YES"
27
- buildForArchiving = "YES"
28
- buildForAnalyzing = "YES">
29
- <BuildableReference
30
- BuildableIdentifier = "primary"
31
- BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
32
- BuildableName = "RXPHelloWorld-tvOS.app"
33
- BlueprintName = "RXPHelloWorld-tvOS"
34
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
35
- </BuildableReference>
36
- </BuildActionEntry>
37
- <BuildActionEntry
38
- buildForTesting = "YES"
39
- buildForRunning = "YES"
40
- buildForProfiling = "NO"
41
- buildForArchiving = "NO"
42
- buildForAnalyzing = "YES">
43
- <BuildableReference
44
- BuildableIdentifier = "primary"
45
- BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
46
- BuildableName = "RXPHelloWorld-tvOSTests.xctest"
47
- BlueprintName = "RXPHelloWorld-tvOSTests"
48
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
49
- </BuildableReference>
50
- </BuildActionEntry>
51
- </BuildActionEntries>
52
- </BuildAction>
53
- <TestAction
54
- buildConfiguration = "Debug"
55
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
- shouldUseLaunchSchemeArgsEnv = "YES">
58
- <Testables>
59
- <TestableReference
60
- skipped = "NO">
61
- <BuildableReference
62
- BuildableIdentifier = "primary"
63
- BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
64
- BuildableName = "RXPHelloWorld-tvOSTests.xctest"
65
- BlueprintName = "RXPHelloWorld-tvOSTests"
66
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
67
- </BuildableReference>
68
- </TestableReference>
69
- </Testables>
70
- <MacroExpansion>
71
- <BuildableReference
72
- BuildableIdentifier = "primary"
73
- BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
74
- BuildableName = "RXPHelloWorld-tvOS.app"
75
- BlueprintName = "RXPHelloWorld-tvOS"
76
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
77
- </BuildableReference>
78
- </MacroExpansion>
79
- <AdditionalOptions>
80
- </AdditionalOptions>
81
- </TestAction>
82
- <LaunchAction
83
- buildConfiguration = "Debug"
84
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
- launchStyle = "0"
87
- useCustomWorkingDirectory = "NO"
88
- ignoresPersistentStateOnLaunch = "NO"
89
- debugDocumentVersioning = "YES"
90
- debugServiceExtension = "internal"
91
- allowLocationSimulation = "YES">
92
- <BuildableProductRunnable
93
- runnableDebuggingMode = "0">
94
- <BuildableReference
95
- BuildableIdentifier = "primary"
96
- BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
97
- BuildableName = "RXPHelloWorld-tvOS.app"
98
- BlueprintName = "RXPHelloWorld-tvOS"
99
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
100
- </BuildableReference>
101
- </BuildableProductRunnable>
102
- <AdditionalOptions>
103
- </AdditionalOptions>
104
- </LaunchAction>
105
- <ProfileAction
106
- buildConfiguration = "Release"
107
- shouldUseLaunchSchemeArgsEnv = "YES"
108
- savedToolIdentifier = ""
109
- useCustomWorkingDirectory = "NO"
110
- debugDocumentVersioning = "YES">
111
- <BuildableProductRunnable
112
- runnableDebuggingMode = "0">
113
- <BuildableReference
114
- BuildableIdentifier = "primary"
115
- BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
116
- BuildableName = "RXPHelloWorld-tvOS.app"
117
- BlueprintName = "RXPHelloWorld-tvOS"
118
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
119
- </BuildableReference>
120
- </BuildableProductRunnable>
121
- </ProfileAction>
122
- <AnalyzeAction
123
- buildConfiguration = "Debug">
124
- </AnalyzeAction>
125
- <ArchiveAction
126
- buildConfiguration = "Release"
127
- revealArchiveInOrganizer = "YES">
128
- </ArchiveAction>
129
- </Scheme>
@@ -1,129 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "0620"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "NO"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
18
- BuildableName = "libReact.a"
19
- BlueprintName = "React"
20
- ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- <BuildActionEntry
24
- buildForTesting = "YES"
25
- buildForRunning = "YES"
26
- buildForProfiling = "YES"
27
- buildForArchiving = "YES"
28
- buildForAnalyzing = "YES">
29
- <BuildableReference
30
- BuildableIdentifier = "primary"
31
- BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
32
- BuildableName = "RXPHelloWorld.app"
33
- BlueprintName = "RXPHelloWorld"
34
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
35
- </BuildableReference>
36
- </BuildActionEntry>
37
- <BuildActionEntry
38
- buildForTesting = "YES"
39
- buildForRunning = "YES"
40
- buildForProfiling = "NO"
41
- buildForArchiving = "NO"
42
- buildForAnalyzing = "YES">
43
- <BuildableReference
44
- BuildableIdentifier = "primary"
45
- BlueprintIdentifier = "00E356ED1AD99517003FC87E"
46
- BuildableName = "RXPHelloWorldTests.xctest"
47
- BlueprintName = "RXPHelloWorldTests"
48
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
49
- </BuildableReference>
50
- </BuildActionEntry>
51
- </BuildActionEntries>
52
- </BuildAction>
53
- <TestAction
54
- buildConfiguration = "Debug"
55
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
- shouldUseLaunchSchemeArgsEnv = "YES">
58
- <Testables>
59
- <TestableReference
60
- skipped = "NO">
61
- <BuildableReference
62
- BuildableIdentifier = "primary"
63
- BlueprintIdentifier = "00E356ED1AD99517003FC87E"
64
- BuildableName = "RXPHelloWorldTests.xctest"
65
- BlueprintName = "RXPHelloWorldTests"
66
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
67
- </BuildableReference>
68
- </TestableReference>
69
- </Testables>
70
- <MacroExpansion>
71
- <BuildableReference
72
- BuildableIdentifier = "primary"
73
- BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
74
- BuildableName = "RXPHelloWorld.app"
75
- BlueprintName = "RXPHelloWorld"
76
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
77
- </BuildableReference>
78
- </MacroExpansion>
79
- <AdditionalOptions>
80
- </AdditionalOptions>
81
- </TestAction>
82
- <LaunchAction
83
- buildConfiguration = "Debug"
84
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
- launchStyle = "0"
87
- useCustomWorkingDirectory = "NO"
88
- ignoresPersistentStateOnLaunch = "NO"
89
- debugDocumentVersioning = "YES"
90
- debugServiceExtension = "internal"
91
- allowLocationSimulation = "YES">
92
- <BuildableProductRunnable
93
- runnableDebuggingMode = "0">
94
- <BuildableReference
95
- BuildableIdentifier = "primary"
96
- BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
97
- BuildableName = "RXPHelloWorld.app"
98
- BlueprintName = "RXPHelloWorld"
99
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
100
- </BuildableReference>
101
- </BuildableProductRunnable>
102
- <AdditionalOptions>
103
- </AdditionalOptions>
104
- </LaunchAction>
105
- <ProfileAction
106
- buildConfiguration = "Release"
107
- shouldUseLaunchSchemeArgsEnv = "YES"
108
- savedToolIdentifier = ""
109
- useCustomWorkingDirectory = "NO"
110
- debugDocumentVersioning = "YES">
111
- <BuildableProductRunnable
112
- runnableDebuggingMode = "0">
113
- <BuildableReference
114
- BuildableIdentifier = "primary"
115
- BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
116
- BuildableName = "RXPHelloWorld.app"
117
- BlueprintName = "RXPHelloWorld"
118
- ReferencedContainer = "container:RXPHelloWorld.xcodeproj">
119
- </BuildableReference>
120
- </BuildableProductRunnable>
121
- </ProfileAction>
122
- <AnalyzeAction
123
- buildConfiguration = "Debug">
124
- </AnalyzeAction>
125
- <ArchiveAction
126
- buildConfiguration = "Release"
127
- revealArchiveInOrganizer = "YES">
128
- </ArchiveAction>
129
- </Scheme>
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>en</string>
7
- <key>CFBundleExecutable</key>
8
- <string>$(EXECUTABLE_NAME)</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundleName</key>
14
- <string>$(PRODUCT_NAME)</string>
15
- <key>CFBundlePackageType</key>
16
- <string>BNDL</string>
17
- <key>CFBundleShortVersionString</key>
18
- <string>1.0</string>
19
- <key>CFBundleSignature</key>
20
- <string>????</string>
21
- <key>CFBundleVersion</key>
22
- <string>1</string>
23
- </dict>
24
- </plist>
@@ -1,70 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- */
9
-
10
- #import <UIKit/UIKit.h>
11
- #import <XCTest/XCTest.h>
12
-
13
- #import <React/RCTLog.h>
14
- #import <React/RCTRootView.h>
15
-
16
- #define TIMEOUT_SECONDS 600
17
- #define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
18
-
19
- @interface RXPHelloWorldTests : XCTestCase
20
-
21
- @end
22
-
23
- @implementation RXPHelloWorldTests
24
-
25
- - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
26
- {
27
- if (test(view)) {
28
- return YES;
29
- }
30
- for (UIView *subview in [view subviews]) {
31
- if ([self findSubviewInView:subview matching:test]) {
32
- return YES;
33
- }
34
- }
35
- return NO;
36
- }
37
-
38
- - (void)testRendersWelcomeScreen
39
- {
40
- UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
41
- NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
42
- BOOL foundElement = NO;
43
-
44
- __block NSString *redboxError = nil;
45
- RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
46
- if (level >= RCTLogLevelError) {
47
- redboxError = message;
48
- }
49
- });
50
-
51
- while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
52
- [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
53
- [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
54
-
55
- foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
56
- if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
57
- return YES;
58
- }
59
- return NO;
60
- }];
61
- }
62
-
63
- RCTSetLogFunction(RCTDefaultLogFunction);
64
-
65
- XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
66
- XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
67
- }
68
-
69
-
70
- @end
package/src/App.tsx DELETED
@@ -1,206 +0,0 @@
1
- /*
2
- * This file demonstrates a basic ReactXP app.
3
- */
4
-
5
- import * as RX from 'reactxp'
6
- import Keybinder from './appUtilities/Keybinder'
7
- import Recorder from './appUtilities/Recorder'
8
-
9
- import SessionReport from './components/sessionReport';
10
- import ProgressChart from './components/ProgressChart';
11
-
12
- import MathCrs from 'skldr-crs-math';
13
-
14
- const styles = {
15
- container: RX.Styles.createViewStyle({
16
- flex: 1,
17
- justifyContent: 'center',
18
- alignItems: 'center',
19
- backgroundColor: '#f5fcff'
20
- }),
21
- helloWorld: RX.Styles.createTextStyle({
22
- fontSize: 48,
23
- fontWeight: 'bold',
24
- marginBottom: 28
25
- }),
26
- welcome: RX.Styles.createTextStyle({
27
- fontSize: 32,
28
- marginBottom: 12
29
- }),
30
- instructions: RX.Styles.createTextStyle({
31
- fontSize: 16,
32
- color: '#aaa',
33
- marginBottom: 40
34
- }),
35
- docLink: RX.Styles.createLinkStyle({
36
- fontSize: 16,
37
- color: 'blue',
38
- marginBottom: 40
39
- }),
40
- toggleTitle: RX.Styles.createTextStyle({
41
- fontSize: 16,
42
- color: 'black'
43
- })
44
- };
45
-
46
- enum ViewState {
47
- QUESTIONS,
48
- REPORT,
49
- PROGRESS
50
- }
51
-
52
- interface AppState {
53
- record?: Array<Object>
54
- sessionQcount?: number
55
- viewState?: ViewState
56
- }
57
-
58
- function randDigit() {
59
- return getRandomInt(0, 10);
60
- };
61
-
62
- function getRandomInt(min: number, max: number) {
63
- return Math.floor(Math.random() * (max - min + 1)) + min;
64
- };
65
-
66
- class App extends RX.Component<null, AppState> {
67
- private _translationValue: RX.Animated.Value;
68
- private _animatedStyle: RX.Types.AnimatedTextStyleRuleSet;
69
- private UIBindings: Keybinder;
70
-
71
- newQuestion() {
72
-
73
- this.setState({
74
- record: this.state ? this.state.record : Recorder.getRecord(),
75
- sessionQcount: this.state ? (this.state.sessionQcount + 1) : 0
76
- });
77
-
78
- if (this.state.sessionQcount >= 25) {
79
- //window.alert("You've done " + this.state.sessionQcount + " questions! Great! Have some free time!");
80
- this.setState({
81
- viewState: ViewState.REPORT
82
- })
83
- }
84
- }
85
-
86
- constructor() {
87
- super();
88
-
89
- this._translationValue = new RX.Animated.Value(-10);
90
- this._animatedStyle = RX.Styles.createAnimatedTextStyle({
91
- transform: [
92
- {
93
- translateY: this._translationValue
94
- }
95
- ]
96
- });
97
- this.UIBindings = new Keybinder([
98
- {
99
- binding: "/",
100
- callback: (e: ExtendedKeyboardEvent) => {
101
- console.log("Toggling report state");
102
-
103
- if (this.state.viewState === ViewState.QUESTIONS) {
104
- this.setState({
105
- viewState: ViewState.REPORT
106
- })
107
- } else {
108
- this.setState({
109
- viewState: ViewState.QUESTIONS
110
- })
111
- }
112
- }
113
- },
114
- {
115
- binding: "?",
116
- callback: (e: ExtendedKeyboardEvent) => {
117
- console.log("Toggling progress state");
118
-
119
- this.setState({
120
- viewState: ViewState.PROGRESS
121
- })
122
- }
123
- }
124
- ])
125
-
126
-
127
- this.state = {
128
- record: Recorder.getRecord(),
129
- sessionQcount: 0,
130
- viewState: ViewState.QUESTIONS
131
- };
132
-
133
- }
134
-
135
- componentDidMount() {
136
- this.UIBindings.bind();
137
-
138
- let animation = RX.Animated.timing(this._translationValue, {
139
- toValue: 0,
140
- easing: RX.Animated.Easing.OutBack(),
141
- duration: 500
142
- }
143
- );
144
-
145
- animation.start();
146
- }
147
-
148
- render(): JSX.Element | null {
149
- return (
150
-
151
- <RX.View style={styles.container}>
152
- <RX.Animated.Text style={[styles.helloWorld, this._animatedStyle]}>
153
- AHHHHHH!
154
- </RX.Animated.Text>
155
- <RX.Text style={styles.welcome}>
156
- Let's get a little practice with our multiplication and division facts.
157
- </RX.Text>
158
-
159
- {(this.state.viewState === ViewState.REPORT) ?
160
- <SessionReport records={this.state.record} /> :
161
- null}
162
-
163
- {(this.state.viewState === ViewState.QUESTIONS) ?
164
- (<RX.Text style={styles.toggleTitle}>
165
- Use the RIGHT and LEFT Arrow Keys to move on the numberpad and help with counting-by!
166
- </RX.Text>) : null
167
- }
168
-
169
- {(this.state.viewState === ViewState.QUESTIONS) ?
170
- this.renderCurrentQ() : null
171
- }
172
-
173
- {(this.state.viewState === ViewState.PROGRESS) ?
174
- (<ProgressChart questionType="multiplication" />) :
175
- null
176
- }
177
-
178
-
179
- </RX.View>
180
- );
181
- }
182
-
183
- renderCurrentQ(): JSX.Element | null {
184
- console.log("Trying to render the current question:");
185
-
186
- // const Question = qTypes[getRandomInt(0, 1)];
187
- const Question = MathCrs.types[
188
- getRandomInt(0, MathCrs.types.length - 1)
189
- ];
190
-
191
- const questionProps = Question.getProps();
192
-
193
- return <Question {...questionProps} onanswer={this.newQuestion.bind(this)} />
194
- }
195
-
196
- // Note that we define this as a variable rather than a normal method. Using this
197
- // method, we prebind the method to this component instance. This prebinding ensures
198
- // that each time we pass the variable as a prop in the render function, it will
199
- // not change. We want to avoid unnecessary prop changes because this will trigger
200
- // extra work within React's virtual DOM diffing mechanism.
201
- // private _onChangeToggle = (newValue: boolean) => {
202
- // this.setState({ toggleValue: newValue });
203
- // }
204
- }
205
-
206
- export = App;
@@ -1,72 +0,0 @@
1
- import Recorder from './Recorder'
2
-
3
- export default class Grader {
4
- static Grade(qType: string, a: number, b: number) {
5
- const records = Recorder.getRecord();
6
-
7
- let qCount: number = 0;
8
- let index: number = records.length - 1;
9
-
10
- let scorables = new Array<any>();
11
-
12
- while (qCount < 6 && index >= 0) {
13
- if (records[index].q === qType &&
14
- records[index].a === a &&
15
- records[index].b === b &&
16
- records[index].correct) {
17
- scorables.push(records[index]);
18
- }
19
- index--;
20
- }
21
-
22
- let totalAttempts = 0;
23
- let totalTime = 0;
24
-
25
- scorables.forEach((answer) => {
26
- totalAttempts += answer.attempts;
27
- totalTime += answer.time;
28
- })
29
-
30
-
31
- return new Grade(
32
- (scorables.length / totalAttempts),
33
- (totalTime / scorables.length)
34
- );
35
- }
36
- }
37
-
38
- export class Grade {
39
- isValid: boolean;
40
- score: number;
41
- averageTime: number;
42
-
43
- constructor(score: number, time: number) {
44
- this.score = score;
45
- this.averageTime = time;
46
-
47
- if (isNaN(score) || isNaN(time)) {
48
- this.isValid = false;
49
- } else {
50
- this.isValid = true;
51
- }
52
- }
53
- toString(): string {
54
- if (this.isValid) {
55
- return this.score.toFixed(2).toString();
56
- } else {
57
- return "";
58
- }
59
- }
60
- getRGB(): string {
61
- const score = this.score * this.score;
62
-
63
- if (this.isValid) {
64
- return "rgb(" +
65
- Math.floor(255 * Math.min(1, 2 - 2 * score)) + "," + // red
66
- Math.floor(255 * Math.min(1, 2 * score)) + // green
67
- ", 0)"; // blue
68
- } else {
69
- return "white";
70
- }
71
- }
72
- }
@@ -1,28 +0,0 @@
1
- import * as mt from 'mousetrap'
2
-
3
- export default class Keybinder {
4
- bindings: Array<Binding>;
5
-
6
- bind(): void {
7
- this.bindings.forEach(
8
- (binding) => {
9
- mt.bind(binding.binding, binding.callback, binding.action);
10
- })
11
- }
12
- unbind(): void {
13
- this.bindings.forEach(
14
- (binding) => {
15
- mt.unbind(binding.binding, binding.action);
16
- })
17
- }
18
-
19
- constructor(bindings: Array<Binding>) {
20
- this.bindings = bindings;
21
- }
22
- }
23
-
24
- interface Binding {
25
- binding: string | Array<string>;
26
- callback: (e: ExtendedKeyboardEvent, combo: string) => any;
27
- action?: string;
28
- }