2022-12-04 16:19:22 -05:00
|
|
|
declare namespace Store {
|
|
|
|
type ColumnMapping = [frequency: number, position: number, normal: boolean];
|
|
|
|
|
|
|
|
type Range = { Min: number; Max: number; Value: number; Step: number };
|
|
|
|
type TestFrequencySample = { Stim: number; Resp: boolean };
|
|
|
|
|
|
|
|
type TestFrequency = {
|
|
|
|
Hz: number;
|
|
|
|
TestL: TestFrequencySample;
|
|
|
|
TestR: TestFrequencySample;
|
|
|
|
UserL?: TestFrequencySample;
|
|
|
|
UserR?: TestFrequencySample;
|
|
|
|
};
|
|
|
|
|
2023-06-07 19:31:10 -04:00
|
|
|
type Test = {
|
2023-06-07 21:09:10 -04:00
|
|
|
Name : string;
|
2023-06-07 19:31:10 -04:00
|
|
|
Done?: Grade;
|
2023-06-07 21:09:10 -04:00
|
|
|
Plot : Array<TestFrequency>
|
2023-06-07 19:31:10 -04:00
|
|
|
};
|
2022-12-04 16:19:22 -05:00
|
|
|
|
|
|
|
type Context = {
|
|
|
|
Test?: Test;
|
|
|
|
Freq?: TestFrequency;
|
2023-06-14 22:32:21 -04:00
|
|
|
Mark:
|
|
|
|
{
|
|
|
|
User?: TestFrequencySample,
|
|
|
|
Test?: TestFrequencySample,
|
|
|
|
}
|
2022-12-04 16:19:22 -05:00
|
|
|
};
|
|
|
|
|
2023-06-07 21:09:10 -04:00
|
|
|
type StatePartSimple =
|
|
|
|
{
|
2022-12-04 16:19:22 -05:00
|
|
|
Chan: Range;
|
|
|
|
Freq: Range;
|
|
|
|
Stim: Range;
|
2023-06-07 19:30:56 -04:00
|
|
|
Errs: number;
|
2023-06-07 21:09:10 -04:00
|
|
|
Pick: number;
|
|
|
|
Show:
|
|
|
|
{
|
|
|
|
Cursor:boolean,
|
|
|
|
Answer:boolean
|
|
|
|
}
|
|
|
|
};
|
|
|
|
type StatePartComplex =
|
|
|
|
{
|
2022-12-04 16:19:22 -05:00
|
|
|
Live: Context;
|
2022-12-10 13:24:31 -05:00
|
|
|
Draw: DrawChart;
|
2022-12-10 14:45:15 -05:00
|
|
|
Test: Array<Test>;
|
2022-12-04 16:19:22 -05:00
|
|
|
};
|
|
|
|
|
2023-06-07 21:09:10 -04:00
|
|
|
type State = StatePartSimple & StatePartComplex;
|
|
|
|
|
2022-12-04 16:19:22 -05:00
|
|
|
type ActionMark = { Name: "Mark"; Data: boolean | null };
|
|
|
|
type ActionTest = { Name: "Test"; Data: number };
|
|
|
|
type ActionChan = { Name: "Chan"; Data: number };
|
|
|
|
type ActionFreq = { Name: "Freq"; Data: number };
|
|
|
|
type ActionStim = { Name: "Stim"; Data: number };
|
2023-06-07 19:30:56 -04:00
|
|
|
type ActionErrs = { Name: "Errs"; Data: number };
|
|
|
|
type ActionKill = { Name: "Kill"; Data: number };
|
2022-12-12 15:57:49 -05:00
|
|
|
type ActionShowCursor = {Name: "ShowCursor", Data:boolean};
|
|
|
|
type ActionShowAnswer = {Name: "ShowAnswer", Data:boolean};
|
2023-06-07 19:30:56 -04:00
|
|
|
type Action = ActionMark | ActionTest | ActionChan | ActionFreq | ActionStim | ActionErrs | ActionKill | ActionShowCursor | ActionShowAnswer;
|
2022-12-04 16:19:22 -05:00
|
|
|
type Reducer = (inState: State, inAction: Action) => State;
|
|
|
|
type ContextUpdater = (inState: State) => boolean;
|
|
|
|
|
|
|
|
type PlotKeyUser = "UserL" | "UserR";
|
|
|
|
type PlotKeyTest = "TestL" | "TestR";
|
|
|
|
type PlotKey = PlotKeyUser | PlotKeyTest;
|
|
|
|
|
2022-12-10 13:24:31 -05:00
|
|
|
type DrawPoint = { X: string; Y: string; Mark?: TestFrequencySample };
|
2022-12-05 23:22:37 -05:00
|
|
|
type DrawLine = { Head:DrawPoint, Tail:DrawPoint};
|
|
|
|
type DrawGroup = { Points: Array<DrawPoint>; Paths: Array<DrawLine> };
|
2022-12-10 13:24:31 -05:00
|
|
|
type DrawChart = { Cross?:DrawPoint, UserL: DrawGroup, UserR: DrawGroup, TestL: DrawGroup, TestR: DrawGroup };
|
2022-12-05 23:22:37 -05:00
|
|
|
|
|
|
|
type Binding = [state:State, dispatch:(inAction:Action)=>void]
|
2022-12-11 14:56:43 -05:00
|
|
|
|
|
|
|
type Grade = {
|
|
|
|
Total:number,
|
2023-06-07 19:31:10 -04:00
|
|
|
Marks:number,
|
2022-12-11 14:56:43 -05:00
|
|
|
Score:number
|
|
|
|
};
|
2022-12-10 23:36:48 -05:00
|
|
|
}
|