Skip to content

Commit 162d27b

Browse files
authored
Merge pull request #197 from UTD-CRSS/develop
Merge Develop to Master
2 parents 6bac483 + 205c092 commit 162d27b

File tree

10 files changed

+848
-852
lines changed

10 files changed

+848
-852
lines changed

package-lock.json

+566-715
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"amex-jest-preset-react": "^6.1.0",
3434
"babel-eslint": "^10.1.0",
3535
"babel-loader": "^8.1.0",
36-
"browser-sync": "^2.26.12",
36+
"browser-sync": "^2.26.14",
3737
"chai": "^4.2.0",
3838
"enzyme": "^3.11.0",
3939
"enzyme-to-json": "^3.6.1",
@@ -71,7 +71,7 @@
7171
"history": "^5.0.0",
7272
"html-webpack-plugin": "^4.4.1",
7373
"imports-loader": "^1.1.0",
74-
"lodash": "^4.17.20",
74+
"lodash": "^4.17.19",
7575
"moment": "^2.28.0",
7676
"node-fetch": "^2.6.1",
7777
"node-sass": "^4.14.1",

src/components/AudioPlayer/index.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636

3737
.audio-title{
3838
height: 55px;
39-
font-size: 2.2rem;
39+
font-size: 2.4rem;
4040
}
4141
.audio-filename-text{
42-
font-size: 1.2rem;
42+
font-size: 1.3rem;
4343
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import React from "react";
2+
3+
import { Modal, Button } from "react-bootstrap";
4+
import "./index.scss";
5+
/**
6+
* A simple popup for first time users to help them use our navigation page
7+
*/
8+
9+
export function ChannelPlayerNavigatingInstruction(props) {
10+
var handleClosePopup = props.handleClosePopup;
11+
var showInstruction = props.showInstruction;
12+
return (
13+
<>
14+
<Modal
15+
size="lg"
16+
aria-labelledby="contained-modal-title-vcenter"
17+
centered
18+
show={showInstruction}
19+
onHide={handleClosePopup}
20+
dialogClassName=""
21+
>
22+
<Modal.Header closeButton>
23+
<Modal.Title
24+
className="message-title"
25+
id="contained-modal-title-vcenter"
26+
>
27+
How to navigate in playback page
28+
</Modal.Title>
29+
</Modal.Header>
30+
<Modal.Body className="message-body">
31+
<p>
32+
Thanks for visiting our page. Here are some tips for playing audios.
33+
</p>
34+
<ol>
35+
<li>To play all, click "Play All" button</li>
36+
<li>To play next parts of audio, click "Play Next" button</li>
37+
<li>
38+
To play previous parts of audio, click "Play Previous" button
39+
</li>
40+
<li>
41+
Note that when one of these two buttons is faded, it means there
42+
are no audios in next or previous part
43+
</li>
44+
<li>
45+
Toggle "Display Transcript" or "Hide Transcript" buttons to enable
46+
or disable transcripts for desired players
47+
</li>
48+
<p className="noted-message">
49+
Important: if you are experiencing performance issues, please hide
50+
some transripts, displaying up to 2 transcripts is ideal
51+
</p>
52+
</ol>
53+
</Modal.Body>
54+
<Modal.Footer>
55+
<div className="btn-close-container">
56+
<Button variant="bigCentered" size="lg" onClick={handleClosePopup}>
57+
Close
58+
</Button>
59+
</div>
60+
</Modal.Footer>
61+
</Modal>
62+
</>
63+
);
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
.noted-message{
3+
font-size: 1rem;
4+
color: orange
5+
}

src/components/ChannelsSelectingInstruction/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function ChannelsSelectingInstruction(props) {
2929
</Modal.Header>
3030
<Modal.Body className="message-body">
3131
<p>
32-
Thanks for visiting our page. Here are some tips for playing audios.
32+
Thanks for visiting our page. Here are some tips for selecting audios.
3333
</p>
3434
<ol>
3535
<li>First select a tape.</li>
@@ -38,7 +38,7 @@ export function ChannelsSelectingInstruction(props) {
3838
selected.
3939
</li>
4040
<li>
41-
Then select the audio block and nugget. There are 6 nuggets in a
41+
Next, select the audio block and nugget. There are 6 nuggets in a
4242
block of audio, a block is usally 30-minute long.
4343
</li>
4444
<li>And finally hit play!</li>

src/components/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ export { ChannelPlayer } from "./ChannelPlayer";
2222
export { AudioPlayer } from "./AudioPlayer";
2323
export { ChannelTimeline } from "./ChannelTimeline";
2424
export { ChannelsSelectingInstruction } from "./ChannelsSelectingInstruction";
25+
export { ChannelPlayerNavigatingInstruction} from "./ChannelPlayerNavigatingInstruction";

src/containers/ChannelViewer/index.js

+64-4
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,33 @@ import React, { Component } from "react";
22
import { AppFooter, AppHeader } from "../App";
33
import { ChannelPlayer } from "../../components/ChannelPlayer";
44
import { Link, Redirect } from "react-router-dom";
5+
import { ChannelPlayerNavigatingInstruction } from "../../components/ChannelPlayerNavigatingInstruction";
56
import "./index.scss";
67

78
export class ChannelViewer extends Component {
89
constructor(props) {
910
super(props);
1011
this.state = {
11-
data: this.props.location.state.audioData,
12+
data:
13+
this.props.location.state && this.props.location.state.audioData
14+
? this.props.location.state.audioData
15+
: null,
1216
playAll: false,
1317
pauseAll: false,
1418
playNext: false,
15-
tapeId: this.props.location.state.tapeId,
19+
tapeId:
20+
this.props.location.state && this.props.location.state.tapeId
21+
? this.props.location.state.tapeId
22+
: null,
23+
showInstruction: false,
24+
minBlock:
25+
this.props.location && this.props.location.state
26+
? this.props.location.state.minBlock
27+
: null,
28+
maxBlock:
29+
this.props.location && this.props.location.state
30+
? this.props.location.state.maxBlock
31+
: null,
1632
};
1733
}
1834

@@ -80,6 +96,13 @@ export class ChannelViewer extends Component {
8096
playNextOrPreviousActivate: true,
8197
});
8298
}
99+
handleCloseInstruction = () => {
100+
this.setState({ showInstruction: false });
101+
};
102+
103+
handleDisplayInstruction = () => {
104+
this.setState({ showInstruction: true });
105+
};
83106

84107
handlePlayNext() {
85108
const nextAudioBlockNuggetIndex = this.getNextBlockAndNuggetIndex();
@@ -101,8 +124,23 @@ export class ChannelViewer extends Component {
101124
this.setState({ playAll: false, pauseAll: false });
102125
}
103126

127+
isFirstVisit() {
128+
return localStorage.getItem("alreadyVisitedChannelPlayerPage") === "true";
129+
}
130+
104131
componentDidMount() {
105132
this.removeBrowserHistoryState();
133+
134+
let visited = this.isFirstVisit();
135+
136+
// Do not view popup if this isn't the first time
137+
if (visited) {
138+
this.setState({ showInstruction: false });
139+
} else {
140+
// This is the first time
141+
localStorage.setItem("alreadyVisitedChannelPlayerPage", true);
142+
this.setState({ showInstruction: true });
143+
}
106144
}
107145

108146
removeBrowserHistoryState() {
@@ -134,6 +172,8 @@ export class ChannelViewer extends Component {
134172
const currentBlockIndex = this.state.currentBlockIndex;
135173
const currentNuggetIndex = this.state.currentNuggetIndex;
136174
const tapeId = this.state.tapeId;
175+
const minBlock = this.state.minBlock;
176+
const maxBlock = this.state.maxBlock;
137177
return (
138178
<>
139179
<AppHeader />
@@ -149,6 +189,8 @@ export class ChannelViewer extends Component {
149189
blockIndex: nextBlockIndex,
150190
nuggetIndex: nextNuggetIndex,
151191
tapeId: tapeId,
192+
minBlock: minBlock,
193+
maxBlock: maxBlock
152194
},
153195
},
154196
}}
@@ -170,10 +212,16 @@ export class ChannelViewer extends Component {
170212

171213
{data && Object.keys(data).length > 0 ? (
172214
<>
215+
<ChannelPlayerNavigatingInstruction
216+
handleClosePopup={this.handleCloseInstruction}
217+
showInstruction={this.state.showInstruction}
218+
/>
173219
<div className="d-flex justify-content-center mb-4">
174220
<button
175221
type="button"
176-
disabled={currentBlockIndex == 1 && currentNuggetIndex == 1}
222+
disabled={
223+
currentBlockIndex == minBlock && currentNuggetIndex == 1
224+
}
177225
className="btn btn-warning mr-3 audio-controller-text"
178226
onClick={this.handlePlayPrevious.bind(this)}
179227
>
@@ -195,7 +243,9 @@ export class ChannelViewer extends Component {
195243
</button>
196244
<button
197245
type="button"
198-
disabled={currentBlockIndex == 6 && currentNuggetIndex == 6}
246+
disabled={
247+
currentBlockIndex == maxBlock && currentNuggetIndex == 6
248+
}
199249
className="btn btn-warning audio-controller-text"
200250
onClick={this.handlePlayNext.bind(this)}
201251
>
@@ -217,12 +267,22 @@ export class ChannelViewer extends Component {
217267
);
218268
})}
219269
</div>
270+
<div className="ml-2">
271+
<button
272+
type="button"
273+
className="btn btn-secondary mt-5"
274+
onClick={this.handleDisplayInstruction}
275+
>
276+
Instructions for navigating audio player page
277+
</button>
278+
</div>
220279
</>
221280
) : (
222281
<h4 className="container text-center">
223282
Error loading channels, please select different channels
224283
</h4>
225284
)}
285+
226286
<AppFooter />
227287
</>
228288
);

0 commit comments

Comments
 (0)