Skip to content

Commit afb5a01

Browse files
committed
large overhaul to the design, style for better ux
Co-Authored-By: Yury-Shevchenko <[email protected]> this adds an option to enable/disable eeg, adds tiles for the four main experiment types
1 parent 508b919 commit afb5a01

File tree

18 files changed

+355
-179
lines changed

18 files changed

+355
-179
lines changed

app/actions/experimentActions.js

+4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ export const START = 'START';
55
export const PAUSE = 'PAUSE';
66
export const STOP = 'STOP';
77
export const SET_TYPE = 'SET_TYPE';
8+
export const SET_PARADIGM = 'SET_PARADIGM';
89
export const SET_SUBJECT = 'SET_SUBJECT';
10+
export const SET_GROUP = 'SET_GROUP';
911
export const CREATE_NEW_WORKSPACE = 'CREATE_NEW_WORKSPACE';
1012
export const SET_SESSION = 'SET_SESSION';
1113
export const SET_PARAMS = 'SET_PARAMS';
@@ -24,7 +26,9 @@ export const pause = () => ({ type: PAUSE });
2426
// export const stop = () => ({ type: STOP });
2527
export const stop = payload => ({ payload, type: STOP });
2628
export const setType = payload => ({ payload, type: SET_TYPE });
29+
export const setParadigm = payload => ({ payload, type: SET_PARADIGM });
2730
export const setSubject = payload => ({ payload, type: SET_SUBJECT });
31+
export const setGroup = payload => ({ payload, type: SET_GROUP });
2832
export const setSession = payload => ({ payload, type: SET_SESSION });
2933
export const setParams = payload => ({ payload, type: SET_PARAMS });
3034
export const setDescription = payload => ({ payload, type: SET_DESCRIPTION });

app/components/CollectComponent/PreTestComponent.js

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ interface Props {
3636
trials: { [string]: Trial };
3737
timelines: {};
3838
subject: string;
39+
group: string;
3940
session: number;
4041
openRunComponent: () => void;
4142
}

app/components/CollectComponent/RunComponent.js

+32-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ interface Props {
3434
trials: { [string]: Trial };
3535
timelines: {};
3636
subject: string;
37+
group: string;
3738
session: number;
3839
deviceType: DEVICES;
3940
isEEGEnabled: boolean;
@@ -42,6 +43,7 @@ interface Props {
4243

4344
interface State {
4445
isInputModalOpen: boolean;
46+
isGroupInputModalOpen: boolean;
4547
}
4648

4749
export default class Run extends Component<Props, State> {
@@ -52,18 +54,21 @@ export default class Run extends Component<Props, State> {
5254
handleStartExperiment: () => void;
5355
handleTimeline: () => void;
5456
handleCloseInputModal: () => void;
57+
handleCloseGroupInputModal: () => void;
5558
handleClean: () => void;
5659

5760
constructor(props: Props) {
5861
super(props);
5962
this.state = {
60-
isInputModalOpen: props.subject.length === 0
63+
isInputModalOpen: props.subject.length === 0,
64+
isGroupInputModalOpen: false
6165
};
6266
this.handleSubjectEntry = debounce(this.handleSubjectEntry, 500).bind(this);
6367
this.handleSessionEntry = debounce(this.handleSessionEntry, 500).bind(this);
6468
this.handleStartExperiment = this.handleStartExperiment.bind(this);
6569
this.handleTimeline = this.handleTimeline.bind(this);
6670
this.handleCloseInputModal = this.handleCloseInputModal.bind(this);
71+
this.handleCloseGroupInputModal = this.handleCloseGroupInputModal.bind(this);
6772
}
6873

6974
componentDidMount() {
@@ -94,6 +99,11 @@ export default class Run extends Component<Props, State> {
9499
this.setState({ isInputModalOpen: false });
95100
}
96101

102+
handleCloseGroupInputModal(name: string) {
103+
this.props.experimentActions.setGroup(name);
104+
this.setState({ isGroupInputModalOpen: false });
105+
}
106+
97107
handleTimeline() {
98108
let injectionFunction = () => null;
99109
if (this.props.isEEGEnabled) {
@@ -144,6 +154,7 @@ export default class Run extends Component<Props, State> {
144154
basic
145155
textAlign="left"
146156
className={styles.descriptionContainer}
157+
vertical
147158
>
148159
<Header as="h1">{this.props.type}</Header>
149160
<Segment basic className={styles.infoSegment}>
@@ -157,6 +168,19 @@ export default class Run extends Component<Props, State> {
157168
onClick={() => this.setState({ isInputModalOpen: true })}
158169
/>
159170
</Segment>
171+
172+
<Segment basic className={styles.infoSegment}>
173+
Group Name: <b>{this.props.group}</b>
174+
<Button
175+
basic
176+
circular
177+
size="huge"
178+
icon="edit"
179+
className={styles.closeButton}
180+
onClick={() => this.setState({ isGroupInputModalOpen: true })}
181+
/>
182+
</Segment>
183+
160184
<Segment basic className={styles.infoSegment}>
161185
Session Number: <b>{this.props.session}</b>
162186
</Segment>
@@ -175,7 +199,7 @@ export default class Run extends Component<Props, State> {
175199
}
176200
return (
177201
<ExperimentWindow settings={{
178-
script: this.props.type,
202+
script: this.props.paradigm,
179203
on_finish: (csv) => {
180204
this.props.experimentActions.stop({data: csv});
181205
}
@@ -201,6 +225,12 @@ export default class Run extends Component<Props, State> {
201225
onExit={() => this.setState({ isInputModalOpen: false })}
202226
header="Enter Subject Name"
203227
/>
228+
<InputModal
229+
open={this.state.isGroupInputModalOpen}
230+
onClose={this.handleCloseGroupInputModal}
231+
onExit={() => this.setState({ isGroupInputModalOpen: false })}
232+
header="Enter Group Name"
233+
/>
204234
</div>
205235
);
206236
}

app/components/CollectComponent/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface Props {
3333
trials: ?{ [string]: Trial };
3434
timelines: ?{};
3535
subject: string;
36+
group: string;
3637
session: number;
3738
isEEGEnabled: boolean;
3839
}
@@ -141,6 +142,7 @@ export default class Collect extends Component<Props, State> {
141142
trials={this.props.trials}
142143
timelines={this.props.timelines}
143144
subject={this.props.subject}
145+
group={this.props.group}
144146
session={this.props.session}
145147
openRunComponent={this.handleRunComponentOpen}
146148
/>

0 commit comments

Comments
 (0)