diff --git a/js/store.js b/js/store.js index 1d4fa3b..0f3269a 100644 --- a/js/store.js +++ b/js/store.js @@ -82,7 +82,7 @@ export const Grade =(inTest)=> const Reselect =(inState, inTest)=> { /** @type {Store.Context} */ - const output = { Test:inTest??inState.Live.Test }; + const output = { Test:inTest??inState.Live.Test, Mark:{User:undefined} }; const column = ColumnMapping[inState.Freq.Value]; if(column && output.Test) { @@ -93,7 +93,8 @@ const Reselect =(inState, inTest)=> if(plot.Hz == hz) { output.Freq = plot; - output.Mark = inState.Chan.Value ? plot.UserR : plot.UserL; + output.Mark.User = inState.Chan.Value ? plot.UserR : plot.UserL; + output.Mark.Test = inState.Chan.Value ? plot.TestR : plot.TestL; break; } } @@ -179,8 +180,8 @@ export function Reducer(inState, inAction) if(clone.Live.Test && clone.Live.Freq) { const key = clone.Chan.Value == 0 ? "UserL" : "UserR"; - clone.Live.Mark = Data !== null ? {Stim:clone.Stim.Value, Resp:Data} : undefined; - clone.Live.Freq[key] = clone.Live.Mark; + clone.Live.Mark.User = Data !== null ? {Stim:clone.Stim.Value, Resp:Data} : undefined; + clone.Live.Freq[key] = clone.Live.Mark.User; clone.Draw[key] = Redraw(clone.Live.Test, clone.Chan.Value, clone.Stim, true); clone.Live.Test.Done = Grade(clone.Live.Test); SaveTests(clone); @@ -328,7 +329,7 @@ export const Initial = Reducer( { Test: undefined, Freq: undefined, - Mark: undefined + Mark: {User: undefined} }, Draw: { diff --git a/js/ui.js b/js/ui.js index 1cb43ea..8ed01a0 100644 --- a/js/ui.js +++ b/js/ui.js @@ -267,7 +267,7 @@ export const Controls =()=> `} onClick=${()=>Dispatch({Name:"Mark", Data:null })} classes="text-sm w-full" - disabled=${State.Live.Mark == undefined} + disabled=${State.Live.Mark.User == undefined} > Clear @@ -284,9 +284,9 @@ export const Audiogram =()=> const [State] = Store.Consumer(); const testMarksL = State.Draw.TestL.Points.map(p=>html`<${Mark} x=${p.X} y=${p.Y} response=${p.Mark?.Resp} right=${false}/>`); - const userMarksL = State.Draw.UserL.Points.map(p=>html`<${Mark} x=${p.X} y=${p.Y} response=${p.Mark?.Resp} right=${false} classes=${State.Live.Mark == p.Mark ? "stroke-bold":""}/>`); + const userMarksL = State.Draw.UserL.Points.map(p=>html`<${Mark} x=${p.X} y=${p.Y} response=${p.Mark?.Resp} right=${false} classes=${State.Live.Mark.User == p.Mark ? "stroke-bold":""}/>`); const testMarksR = State.Draw.TestR.Points.map(p=>html`<${Mark} x=${p.X} y=${p.Y} response=${p.Mark?.Resp} right=${true} />`); - const userMarksR = State.Draw.UserR.Points.map(p=>html`<${Mark} x=${p.X} y=${p.Y} response=${p.Mark?.Resp} right=${true} classes=${State.Live.Mark == p.Mark ? "stroke-bold":""}/>`); + const userMarksR = State.Draw.UserR.Points.map(p=>html`<${Mark} x=${p.X} y=${p.Y} response=${p.Mark?.Resp} right=${true} classes=${State.Live.Mark.User == p.Mark ? "stroke-bold":""}/>`); const testLinesL = State.Draw.TestL.Paths.map( p=>html``); const userLinesL = State.Draw.UserL.Paths.map( p=>html``); diff --git a/ts/store.d.ts b/ts/store.d.ts index cdde39f..dda77a1 100644 --- a/ts/store.d.ts +++ b/ts/store.d.ts @@ -21,7 +21,11 @@ declare namespace Store { type Context = { Test?: Test; Freq?: TestFrequency; - Mark?: TestFrequencySample; + Mark: + { + User?: TestFrequencySample, + Test?: TestFrequencySample, + } }; type StatePartSimple =