Skip to content

Commit a1e080d

Browse files
committed
feat: implement client details
1 parent ef3850e commit a1e080d

32 files changed

Lines changed: 370 additions & 223 deletions

File tree

apps/api/src/instruments/instruments.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ export class InstrumentsService {
164164
options: EntityOperationOptions = {}
165165
): Promise<InstrumentInfo[]> {
166166
const instances = await this.find(query, options);
167-
return instances.map(({ __runtimeVersion, details, id, kind, language, tags }) => ({
167+
return instances.map(({ __runtimeVersion, clientDetails, details, id, kind, language, tags }) => ({
168168
__runtimeVersion,
169+
clientDetails,
169170
details,
170171
id,
171172
kind,

apps/playground/src/instruments/examples/form/Form-Reference/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,13 @@ export default defineInstrument({
188188
}
189189
}
190190
],
191+
clientDetails: {
192+
estimatedDuration: 5,
193+
instructions: ['Please complete all questions']
194+
},
191195
details: {
192196
description: 'This example includes all possible static field variants',
193197
title: 'Reference Instrument',
194-
estimatedDuration: 5,
195-
instructions: ['Please complete all questions'],
196198
license: 'Apache-2.0'
197199
},
198200
measures: {},

apps/playground/src/instruments/examples/form/Form-With-Computed-Measures/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ export default defineInstrument({
3333
variant: 'slider'
3434
}
3535
},
36+
clientDetails: {
37+
estimatedDuration: 1,
38+
instructions: ['Please respond to all questions']
39+
},
3640
details: {
3741
description: 'This is an example of a form with computed measures',
38-
estimatedDuration: 1,
39-
instructions: ['Please respond to all questions'],
4042
license: 'Apache-2.0',
4143
title: 'Happiness Questionnaire'
4244
},

apps/playground/src/instruments/examples/form/Form-With-Groups/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,17 @@ export default defineInstrument({
9191
}
9292
}
9393
],
94-
details: {
95-
description: {
96-
en: 'This is an example of a multilingual grouped form',
97-
fr: 'Voici un exemple de formulaire groupé multilingue'
98-
},
94+
clientDetails: {
9995
estimatedDuration: 1,
10096
instructions: {
10197
en: ['Please respond to all questions'],
10298
fr: ['Veuillez répondre à toutes les questions']
99+
}
100+
},
101+
details: {
102+
description: {
103+
en: 'This is an example of a multilingual grouped form',
104+
fr: 'Voici un exemple de formulaire groupé multilingue'
103105
},
104106
license: 'Apache-2.0',
105107
title: {

apps/playground/src/instruments/examples/form/Multilingual-Form-With-Dynamic-Field/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,17 @@ export default defineInstrument({
5353
}
5454
}
5555
},
56-
details: {
57-
description: {
58-
en: 'This is an example of a simple form with conditional rendering and validation logic',
59-
fr: 'Voici un exemple de formulaire simple avec un rendu conditionnel et une logique de validation'
60-
},
56+
clientDetails: {
6157
estimatedDuration: 1,
6258
instructions: {
6359
en: ['Please respond to all questions'],
6460
fr: ['Veuillez répondre à toutes les questions']
61+
}
62+
},
63+
details: {
64+
description: {
65+
en: 'This is an example of a simple form with conditional rendering and validation logic',
66+
fr: 'Voici un exemple de formulaire simple avec un rendu conditionnel et une logique de validation'
6567
},
6668
license: 'Apache-2.0',
6769
title: {

apps/playground/src/instruments/examples/interactive/Interactive-With-CSS/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ export default defineInstrument({
3131
});
3232
}
3333
},
34+
clientDetails: {
35+
estimatedDuration: 1,
36+
instructions: ['<PLACEHOLDER>']
37+
},
3438
details: {
3539
description: '<PLACEHOLDER>',
36-
estimatedDuration: 1,
37-
instructions: ['<PLACEHOLDER>'],
3840
license: 'UNLICENSED',
3941
title: '<PLACEHOLDER>'
4042
},

apps/playground/src/instruments/examples/interactive/Interactive-With-JSPsych/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import orange from './orange.png';
1212
import '/runtime/v1/jspsych@8.x/css/jspsych.css';
1313

1414
export default defineInstrument({
15+
clientDetails: {
16+
estimatedDuration: 1,
17+
instructions: ['The user will be displayed instructions on the screen']
18+
},
1519
content: {
1620
async render(done) {
1721
const jsPsych = initJsPsych({
@@ -116,8 +120,6 @@ export default defineInstrument({
116120
},
117121
details: {
118122
description: 'This reaction time task is a non-trivial proof of concept with jspsych.',
119-
estimatedDuration: 1,
120-
instructions: ['The user will be displayed instructions on the screen'],
121123
license: 'MIT',
122124
title: 'Reaction Time Task'
123125
},

apps/playground/src/instruments/examples/interactive/Interactive-With-Legacy-Script/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ export default defineInstrument({
2323
});
2424
}
2525
},
26+
clientDetails: {
27+
estimatedDuration: 1,
28+
instructions: ['Please complete the task.']
29+
},
2630
details: {
2731
description: 'This is an example of how ancient scripts, that fail in strict mode, can be used in an instrument.',
28-
estimatedDuration: 1,
29-
instructions: ['Please complete the task.'],
3032
license: 'Apache-2.0',
3133
title: 'Interactive Instrument With Legacy Script'
3234
},

apps/playground/src/instruments/examples/interactive/Interactive-With-React/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { App } from './App.tsx';
77
import './index.css';
88

99
export default defineInstrument({
10+
clientDetails: {
11+
estimatedDuration: 1,
12+
instructions: ['Please submit whatever count you want!']
13+
},
1014
content: {
1115
render(done) {
1216
const rootElement = document.createElement('div');
@@ -17,8 +21,6 @@ export default defineInstrument({
1721
},
1822
details: {
1923
description: 'This task is completely useless. It is a proof of concept for an interactive instrument.',
20-
estimatedDuration: 1,
21-
instructions: ['Please submit whatever count you want!'],
2224
license: 'Apache-2.0',
2325
title: 'React Click Task'
2426
},

apps/playground/src/instruments/examples/interactive/Interactive-With-Vanilla/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { z } from '/runtime/v1/zod@3.23.x';
44
import './styles.css';
55

66
export default defineInstrument({
7+
clientDetails: {
8+
estimatedDuration: 1,
9+
instructions: ['Please attempt to win the game as quickly as possible.']
10+
},
711
content: {
812
render(done) {
913
const startTime = Date.now();
@@ -185,8 +189,6 @@ export default defineInstrument({
185189
authors: ['Andrzej Mazur', 'Mozilla Contributors', 'Joshua Unrau'],
186190
description:
187191
'This is a very simple interactive instrument, adapted from a 2D breakout game in the Mozilla documentation.',
188-
estimatedDuration: 1,
189-
instructions: ['Please attempt to win the game as quickly as possible.'],
190192
license: 'CC0-1.0',
191193
referenceUrl: 'https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript',
192194
sourceUrl: 'https://github.com/end3r/Gamedev-Canvas-workshop/tree/gh-pages',

0 commit comments

Comments
 (0)