Skip to content

Commit b7c4c6b

Browse files
committed
show all pins
1 parent 8c2f97c commit b7c4c6b

File tree

3 files changed

+181
-176
lines changed

3 files changed

+181
-176
lines changed

src/components/layout/SinglePlayerComponents/SinglePlayerAudioReview.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const SinglePlayerAudioReview = ({
2626
setCurPinIndex,
2727
prevPinIndex,
2828
setPrevPinIndex,
29+
allPins = [],
2930
disableAddPin = true,
3031
}) => {
3132
const player = useRef(null);
@@ -339,6 +340,10 @@ const SinglePlayerAudioReview = ({
339340
return -1;
340341
};
341342

343+
if (allPins.length === 0) {
344+
allPins = singlePlayerPins;
345+
}
346+
342347
return (
343348
<Grid item xs={12}>
344349
{curActiveStep === 2 ? (
@@ -357,7 +362,7 @@ const SinglePlayerAudioReview = ({
357362
currentTime={audioProgress}
358363
setCurrentTime={handleAudioProgress}
359364
duration={audioLen}
360-
marks={singlePlayerPins.map((pin) => {
365+
marks={allPins.map((pin) => {
361366
return { pinTime: pin.pinTime, creatorMode: pin.creatorMode };
362367
})}
363368
addPin={addPin}

src/components/layout/SinglePlayerComponents/SinglePlayerNotesComparison.jsx

Lines changed: 150 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const SinglePlayerNotesComparison = ({
8282
prevPinIndex,
8383
setPrevPinIndex,
8484
peerPins,
85+
singlePlayerPins,
8586
}) => {
8687
// user mode switcher
8788
const user = useSelector((state) => state.user);
@@ -97,7 +98,7 @@ const SinglePlayerNotesComparison = ({
9798
//get sessionID
9899
const { sessionID } = useSessionValue();
99100

100-
const { singlePlayerPins } = useSinglePlayerPinsValue();
101+
// const { singlePlayerPins } = useSinglePlayerPinsValue();
101102
const [peerPin, setPeerPin] = useState();
102103

103104
// // fetch raw pin data here
@@ -165,23 +166,30 @@ const SinglePlayerNotesComparison = ({
165166
const fetchPeerPins = async () => {
166167
let curPin = singlePlayerPins[curPinIndex];
167168
console.log(curPin);
168-
let TSIndex = curPin.transcriptindex;
169169

170-
let peerPin = peerPins.find((e) => e.transcriptindex == TSIndex);
171-
setPeerPin(peerPin);
172-
console.log('CUR PINS TS: ', TSIndex);
170+
let _peerPin = null;
171+
if (curPin.peer === false) {
172+
let TSIndex = curPin.transcriptindex;
173173

174-
if (!peerPin) {
174+
_peerPin = peerPins.find((e) => e.transcriptindex == TSIndex);
175+
setPeerPin(_peerPin);
176+
console.log('CUR PINS TS: ', TSIndex);
177+
} else {
178+
_peerPin = curPin;
179+
setPeerPin(_peerPin);
180+
}
181+
182+
if (!_peerPin) {
175183
console.log('No peer pin matched');
176184
} else {
177-
setCurPerspectiveInfo2(peerPin['calleePinPerspective']);
178-
setPinType2(peerPin['calleePinCategory']);
179-
setCurSkillInfo2(peerPin['calleePinSkill']);
180-
setPeerNoteInfo(peerPin['calleePinNote']);
181-
setPeerGoalInfo(peerPin['pinGoal']);
182-
setPeerStrengthInfo(peerPin['pinStrength']);
183-
setPeerOpportunityInfo(peerPin['pinOpportunity']);
184-
console.log('Peer PINS TS: ', peerPin.transcriptindex);
185+
setCurPerspectiveInfo2(_peerPin['calleePinPerspective']);
186+
setPinType2(_peerPin['calleePinCategory']);
187+
setCurSkillInfo2(_peerPin['calleePinSkill']);
188+
setPeerNoteInfo(_peerPin['calleePinNote']);
189+
setPeerGoalInfo(_peerPin['pinGoal']);
190+
setPeerStrengthInfo(_peerPin['pinStrength']);
191+
setPeerOpportunityInfo(_peerPin['pinOpportunity']);
192+
console.log('Peer PINS TS: ', _peerPin.transcriptindex);
185193
}
186194
};
187195

@@ -197,173 +205,144 @@ const SinglePlayerNotesComparison = ({
197205
setCurSkillInfo1(curPin.calleePinSkill);
198206
};
199207

200-
const handlePrevPin = () => {
201-
setPrevPinIndex(curPinIndex);
202-
setCurPinIndex(curPinIndex - 1);
203-
};
204-
205-
const handleNextPin = () => {
206-
setPrevPinIndex(curPinIndex);
207-
setCurPinIndex(curPinIndex + 1);
208-
};
209-
210-
const PinNavButtons = () => {
211-
if (curPinIndex === -1) return null;
212-
const prev = (
213-
<ColorLibBackButton
214-
style={{ margin: '0px 8px' }}
215-
variant='contained'
216-
size='small'
217-
onClick={handlePrevPin}
218-
>
219-
Prev Pin
220-
</ColorLibBackButton>
221-
);
222-
const next = (
223-
<ColorLibNextButton
224-
style={{ margin: '0px 8px' }}
225-
variant='contained'
226-
size='small'
227-
onClick={handleNextPin}
228-
>
229-
Next Pin
230-
</ColorLibNextButton>
231-
);
232-
233-
if (curPinIndex === 0) {
234-
return next;
235-
}
236-
if (curPinIndex === singlePlayerPins.length - 1) {
237-
return prev;
238-
}
239-
return (
240-
<Fragment>
241-
{' '}
242-
{prev} {next}{' '}
243-
</Fragment>
244-
);
245-
};
246-
247208
return (
248209
<>
249210
<Grid item xs className={classes.grid}>
250211
<ColorLibPaper elevation={2}>
251212
<Typography variant='h4' style={{ textTransform: 'capitalize' }}>
252213
Your Pin Notes
253214
</Typography>
254-
{curPinIndex !== -1 ? (
215+
216+
{singlePlayerPins[curPinIndex].peer !== true ? (
217+
<>
218+
{curPinIndex !== -1 ? (
219+
<Box fontStyle='italic'>
220+
<Typography>
221+
The session was pinned at{' '}
222+
{formatTime(
223+
singlePlayerPins.map((pin) => pin.pinTime)[curPinIndex]
224+
)}
225+
</Typography>
226+
</Box>
227+
) : null}
228+
<ColorLibTextField
229+
disabled
230+
id='outlined-secondary'
231+
label='Personal Notes...'
232+
fullWidth
233+
variant='outlined'
234+
multiline
235+
rows={3}
236+
margin='normal'
237+
value={curNoteInfo}
238+
/>
239+
<Box textAlign='left'>
240+
<Typography>
241+
What is your perspective of what happened at this pin?
242+
</Typography>
243+
</Box>
244+
<ColorLibTextField
245+
disabled
246+
label=''
247+
id='outlined-secondary'
248+
fullWidth
249+
variant='outlined'
250+
multiline
251+
rows={2}
252+
margin='normal'
253+
value={curPerspectiveInfo1}
254+
/>
255+
<Box textAlign='left'>
256+
<Typography>What would you categorize this pin as?</Typography>
257+
</Box>
258+
259+
<Box align='left'>
260+
<ToggleButtonGroup
261+
disabled
262+
className={classes.toggleGroup}
263+
value={pinType1}
264+
exclusive
265+
size='large'
266+
>
267+
<ToggleButton
268+
value='strength'
269+
selected={pinType1 === 'strength'}
270+
>
271+
Strength
272+
</ToggleButton>
273+
<ToggleButton
274+
value='opportunity'
275+
selected={pinType1 === 'opportunity'}
276+
>
277+
Opportunity
278+
</ToggleButton>
279+
</ToggleButtonGroup>
280+
</Box>
281+
<Box textAlign='left'>
282+
<Typography>
283+
What was the goal during the pinned situation?
284+
</Typography>
285+
</Box>
286+
<ColorLibTextField
287+
disabled
288+
label=''
289+
id='outlined-secondary'
290+
fullWidth
291+
variant='outlined'
292+
multiline
293+
rows={3}
294+
margin='normal'
295+
value={curGoalInfo}
296+
inputRef={goalValueRef}
297+
onChange={() => setCurGoalInfo(goalValueRef.current.value)}
298+
/>
299+
300+
<Box textAlign='left'>
301+
<Typography>What worked well to achieve the goal?</Typography>
302+
</Box>
303+
<ColorLibTextField
304+
disabled
305+
label=''
306+
id='outlined-secondary'
307+
fullWidth
308+
variant='outlined'
309+
multiline
310+
rows={3}
311+
margin='normal'
312+
value={curStrengthInfo}
313+
inputRef={strengthValueRef}
314+
onChange={() =>
315+
setCurStrengthInfo(strengthValueRef.current.value)
316+
}
317+
/>
318+
<Box textAlign='left'>
319+
<Typography>
320+
What could be improved to achieve the goal?
321+
</Typography>
322+
</Box>
323+
<ColorLibTextField
324+
disabled
325+
label=''
326+
id='outlined-secondary'
327+
fullWidth
328+
variant='outlined'
329+
multiline
330+
rows={3}
331+
margin='normal'
332+
value={curOpporunityInfo}
333+
inputRef={opportunityValueRef}
334+
onChange={() =>
335+
setCurOpportunityInfo(opportunityValueRef.current.value)
336+
}
337+
/>
338+
</>
339+
) : (
255340
<Box fontStyle='italic'>
256-
<Typography>
257-
The session was pinned at{' '}
258-
{formatTime(
259-
singlePlayerPins.map((pin) => pin.pinTime)[curPinIndex]
260-
)}
341+
<Typography style={{ color: '#FC6D78' }}>
342+
You did not pin here.
261343
</Typography>
262344
</Box>
263-
) : null}
264-
<ColorLibTextField
265-
disabled
266-
id='outlined-secondary'
267-
label='Personal Notes...'
268-
fullWidth
269-
variant='outlined'
270-
multiline
271-
rows={3}
272-
margin='normal'
273-
value={curNoteInfo}
274-
/>
275-
<Box textAlign='left'>
276-
<Typography>
277-
What is your perspective of what happened at this pin?
278-
</Typography>
279-
</Box>
280-
<ColorLibTextField
281-
disabled
282-
label=''
283-
id='outlined-secondary'
284-
fullWidth
285-
variant='outlined'
286-
multiline
287-
rows={2}
288-
margin='normal'
289-
value={curPerspectiveInfo1}
290-
/>
291-
<Box textAlign='left'>
292-
<Typography>What would you categorize this pin as?</Typography>
293-
</Box>
294-
295-
<Box align='left'>
296-
<ToggleButtonGroup
297-
disabled
298-
className={classes.toggleGroup}
299-
value={pinType1}
300-
exclusive
301-
size='large'
302-
>
303-
<ToggleButton value='strength' selected={pinType1 === 'strength'}>
304-
Strength
305-
</ToggleButton>
306-
<ToggleButton
307-
value='opportunity'
308-
selected={pinType1 === 'opportunity'}
309-
>
310-
Opportunity
311-
</ToggleButton>
312-
</ToggleButtonGroup>
313-
</Box>
314-
<Box textAlign='left'>
315-
<Typography>
316-
What was the goal during the pinned situation?
317-
</Typography>
318-
</Box>
319-
<ColorLibTextField
320-
disabled
321-
label=''
322-
id='outlined-secondary'
323-
fullWidth
324-
variant='outlined'
325-
multiline
326-
rows={3}
327-
margin='normal'
328-
value={curGoalInfo}
329-
inputRef={goalValueRef}
330-
onChange={() => setCurGoalInfo(goalValueRef.current.value)}
331-
/>
332-
333-
<Box textAlign='left'>
334-
<Typography>What worked well to achieve the goal?</Typography>
335-
</Box>
336-
<ColorLibTextField
337-
disabled
338-
label=''
339-
id='outlined-secondary'
340-
fullWidth
341-
variant='outlined'
342-
multiline
343-
rows={3}
344-
margin='normal'
345-
value={curStrengthInfo}
346-
inputRef={strengthValueRef}
347-
onChange={() => setCurStrengthInfo(strengthValueRef.current.value)}
348-
/>
349-
<Box textAlign='left'>
350-
<Typography>What could be improved to achieve the goal?</Typography>
351-
</Box>
352-
<ColorLibTextField
353-
disabled
354-
label=''
355-
id='outlined-secondary'
356-
fullWidth
357-
variant='outlined'
358-
multiline
359-
rows={3}
360-
margin='normal'
361-
value={curOpporunityInfo}
362-
inputRef={opportunityValueRef}
363-
onChange={() =>
364-
setCurOpportunityInfo(opportunityValueRef.current.value)
365-
}
366-
/>
345+
)}
367346
</ColorLibPaper>
368347
</Grid>
369348
<Grid item xs>

0 commit comments

Comments
 (0)