Skip to content

Commit

Permalink
Merge pull request #1053 from joshunrau/cpp-mvp
Browse files Browse the repository at this point in the history
  • Loading branch information
joshunrau authored Dec 5, 2024
2 parents 294e1bf + a84fe84 commit f9746a0
Show file tree
Hide file tree
Showing 42 changed files with 442 additions and 257 deletions.
3 changes: 2 additions & 1 deletion apps/api/src/instruments/instruments.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ export class InstrumentsService {
options: EntityOperationOptions = {}
): Promise<InstrumentInfo[]> {
const instances = await this.find(query, options);
return instances.map(({ __runtimeVersion, details, id, kind, language, tags }) => ({
return instances.map(({ __runtimeVersion, clientDetails, details, id, kind, language, tags }) => ({
__runtimeVersion,
clientDetails,
details,
id,
kind,
Expand Down
2 changes: 1 addition & 1 deletion apps/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "Apache-2.0",
"scripts": {
"build": "tsc && env-cmd -f ../../.env pnpm exec vite build",
"deploy": "rsync -r dist/* douglasneuroinformatics.ca:/home/unrjos/www/playground.opendatacapture.org",
"deploy": "rsync -r dist/* unrjos@cloud1.douglasneuroinformatics.ca:/home/unrjos/www/playground.opendatacapture.org",
"dev": "NODE_ENV=development env-cmd -f ../../.env pnpm exec vite",
"format": "prettier --write src",
"lint": "tsc && eslint --fix src",
Expand Down
5 changes: 5 additions & 0 deletions apps/playground/src/components/Editor/EditorPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export const EditorPane = React.forwardRef<EditorPaneRef, EditorPaneProps>(funct
options={{
automaticLayout: true,
codeLens: false,
colorDecorators: true,
contextmenu: false,
fixedOverflowWidgets: true,
minimap: {
Expand All @@ -150,9 +151,13 @@ export const EditorPane = React.forwardRef<EditorPaneRef, EditorPaneProps>(funct
quickSuggestions: true,
quickSuggestionsDelay: 10,
scrollBeyondLastLine: false,
showDeprecated: true,
stickyScroll: {
enabled: false
},
suggest: {
showDeprecated: false
},
suggestOnTriggerCharacters: true,
tabCompletion: 'on',
tabSize: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,13 @@ export default defineInstrument({
}
}
],
clientDetails: {
estimatedDuration: 5,
instructions: ['Please complete all questions']
},
details: {
description: 'This example includes all possible static field variants',
title: 'Reference Instrument',
estimatedDuration: 5,
instructions: ['Please complete all questions'],
license: 'Apache-2.0'
},
measures: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ export default defineInstrument({
variant: 'slider'
}
},
clientDetails: {
estimatedDuration: 1,
instructions: ['Please respond to all questions']
},
details: {
description: 'This is an example of a form with computed measures',
estimatedDuration: 1,
instructions: ['Please respond to all questions'],
license: 'Apache-2.0',
title: 'Happiness Questionnaire'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,17 @@ export default defineInstrument({
}
}
],
details: {
description: {
en: 'This is an example of a multilingual grouped form',
fr: 'Voici un exemple de formulaire groupé multilingue'
},
clientDetails: {
estimatedDuration: 1,
instructions: {
en: ['Please respond to all questions'],
fr: ['Veuillez répondre à toutes les questions']
}
},
details: {
description: {
en: 'This is an example of a multilingual grouped form',
fr: 'Voici un exemple de formulaire groupé multilingue'
},
license: 'Apache-2.0',
title: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ export default defineInstrument({
}
}
},
details: {
description: {
en: 'This is an example of a simple form with conditional rendering and validation logic',
fr: 'Voici un exemple de formulaire simple avec un rendu conditionnel et une logique de validation'
},
clientDetails: {
estimatedDuration: 1,
instructions: {
en: ['Please respond to all questions'],
fr: ['Veuillez répondre à toutes les questions']
}
},
details: {
description: {
en: 'This is an example of a simple form with conditional rendering and validation logic',
fr: 'Voici un exemple de formulaire simple avec un rendu conditionnel et une logique de validation'
},
license: 'Apache-2.0',
title: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ export default defineInstrument({
});
}
},
clientDetails: {
estimatedDuration: 1,
instructions: ['<PLACEHOLDER>']
},
details: {
description: '<PLACEHOLDER>',
estimatedDuration: 1,
instructions: ['<PLACEHOLDER>'],
license: 'UNLICENSED',
title: '<PLACEHOLDER>'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import orange from './orange.png';
import '/runtime/v1/[email protected]/css/jspsych.css';

export default defineInstrument({
clientDetails: {
estimatedDuration: 1,
instructions: ['The user will be displayed instructions on the screen']
},
content: {
async render(done) {
const jsPsych = initJsPsych({
Expand Down Expand Up @@ -116,8 +120,6 @@ export default defineInstrument({
},
details: {
description: 'This reaction time task is a non-trivial proof of concept with jspsych.',
estimatedDuration: 1,
instructions: ['The user will be displayed instructions on the screen'],
license: 'MIT',
title: 'Reaction Time Task'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ export default defineInstrument({
});
}
},
clientDetails: {
estimatedDuration: 1,
instructions: ['Please complete the task.']
},
details: {
description: 'This is an example of how ancient scripts, that fail in strict mode, can be used in an instrument.',
estimatedDuration: 1,
instructions: ['Please complete the task.'],
license: 'Apache-2.0',
title: 'Interactive Instrument With Legacy Script'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { App } from './App.tsx';
import './index.css';

export default defineInstrument({
clientDetails: {
estimatedDuration: 1,
instructions: ['Please submit whatever count you want!']
},
content: {
render(done) {
const rootElement = document.createElement('div');
Expand All @@ -17,8 +21,6 @@ export default defineInstrument({
},
details: {
description: 'This task is completely useless. It is a proof of concept for an interactive instrument.',
estimatedDuration: 1,
instructions: ['Please submit whatever count you want!'],
license: 'Apache-2.0',
title: 'React Click Task'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { z } from '/runtime/v1/[email protected]';
import './styles.css';

export default defineInstrument({
clientDetails: {
estimatedDuration: 1,
instructions: ['Please attempt to win the game as quickly as possible.']
},
content: {
render(done) {
const startTime = Date.now();
Expand Down Expand Up @@ -185,8 +189,6 @@ export default defineInstrument({
authors: ['Andrzej Mazur', 'Mozilla Contributors', 'Joshua Unrau'],
description:
'This is a very simple interactive instrument, adapted from a 2D breakout game in the Mozilla documentation.',
estimatedDuration: 1,
instructions: ['Please attempt to win the game as quickly as possible.'],
license: 'CC0-1.0',
referenceUrl: 'https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript',
sourceUrl: 'https://github.com/end3r/Gamedev-Canvas-workshop/tree/gh-pages',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ export default defineInstrument({
});
}
},
details: {
description: {
en: '<PLACEHOLDER>',
fr: '<PLACEHOLDER>'
},
clientDetails: {
estimatedDuration: 1,
instructions: {
en: ['<PLACEHOLDER>'],
fr: ['<PLACEHOLDER>']
}
},
details: {
description: {
en: '<PLACEHOLDER>',
fr: '<PLACEHOLDER>'
},
license: 'UNLICENSED',
title: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ export default defineInstrument({
edition: 1,
name: '<PLACEHOLDER>'
},
clientDetails: {
estimatedDuration: 1,
instructions: {
en: ['<PLACEHOLDER>'],
fr: ['<PLACEHOLDER>']
}
},
content: {},
details: {
description: {
en: '<PLACEHOLDER>',
fr: '<PLACEHOLDER>'
},
estimatedDuration: 1,
instructions: {
en: ['<PLACEHOLDER>'],
fr: ['<PLACEHOLDER>']
},
license: 'UNLICENSED',
title: {
en: '<PLACEHOLDER>',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ export default defineInstrument({
edition: 1,
name: '<PLACEHOLDER>'
},
clientDetails: {
estimatedDuration: 1,
instructions: ['<PLACEHOLDER>']
},
content: {},
details: {
description: '<PLACEHOLDER>',
estimatedDuration: 1,
instructions: ['<PLACEHOLDER>'],
license: 'UNLICENSED',
title: '<PLACEHOLDER>'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { z } from '/runtime/v1/[email protected]';
export default defineInstrument({
kind: 'INTERACTIVE',
language: 'en',

tags: ['<PLACEHOLDER>'],
internal: {
edition: 1,
Expand All @@ -22,10 +21,12 @@ export default defineInstrument({
});
}
},
clientDetails: {
estimatedDuration: 1,
instructions: ['<PLACEHOLDER>']
},
details: {
description: '<PLACEHOLDER>',
estimatedDuration: 1,
instructions: ['<PLACEHOLDER>'],
license: 'UNLICENSED',
title: '<PLACEHOLDER>'
},
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"format:translations": "find src/translations -name '*.json' -exec pnpm exec sort-json {} \\;",
"inject": "pnpm exec import-meta-env -x .env.public -p dist/index.html",
"lint": "tsc && eslint --fix src",
"storybook": "env-cmd -f ../../.env storybook dev -p 6006",
"storybook": "NODE_OPTIONS='--import=tsx' env-cmd -f ../../.env storybook dev -p 6006",
"test": "env-cmd -f ../../.env vitest"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default { component: InstrumentCard } as Meta<typeof InstrumentCard>;

export const Default: Story = {
args: {
instrument: { ...unilingualFormInstrument.instance, supportedLanguages: [] },
instrument: { ...unilingualFormInstrument.instance, supportedLanguages: ['en', 'fr'] },
onClick: () => alert('Click!')
}
};
Loading

0 comments on commit f9746a0

Please sign in to comment.