Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intro task updates #202

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion task-launcher/src/tasks/intro/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function buildIntroTimeline(config: Record<string, any>, mediaAss

const timeline = [preloadTrials, initialTimeline, ...instructions];

timeline.push(taskFinished);
timeline.push(taskFinished(true));
timeline.push(exitFullscreen);

return { jsPsych, timeline };
Expand Down
5 changes: 3 additions & 2 deletions task-launcher/src/tasks/intro/trials/instructions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ export const instructions = instructionData.map(data => {
<button id="replay-btn-revisited" class="replay">
${replayButtonSvg}
</button>
<div class="lev-row-container instruction">
<p>${t[data.prompt]}</p>
<div class="lev-row-container instruction" style="width: 90vw;">
<p style="font-size: 1.5em;">${t[data.prompt]}</p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if these went into the class definitions. You can add a new definition of font size called:
font-size-xs-em: 1.5em and then update the:

&.instruction {
    display: flex;
    padding: $lev-spacing-s;
    justify-content: center;
    align-items: center;
    text-align: center;
    border: 3px solid $bg-accent_secondary;
    border-radius: 32px;
    background-color: $bg-bubble-base;
   width: 90vw;

    p {
      font-size: $font-size-xs-em;
      font-weight: $font-weight-light;
      line-height: 1.0;
      margin: 0;
    }

Does the width need to be 90vw? or should the max-width be 90vw? We want consistent experience so we will need to just make sure it looks good across different tasks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, I'll work on adding it to the class definition. I think setting max-width to 90vw would probably be better, so I'll try that - thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up making an instructions-small class with the font size and max-width changes and using that for intro - I thought making the font smaller for all tasks didn't look as good. Let me know if you would prefer a different design though!

</div>
<div class="lev-stim-content-x-3">
<img
src=${mediaAssets.images[data.image]}
alt='Instruction graphic'
style="height:330px;width:330px"
/>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion task-launcher/src/tasks/math/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default function buildMathTimeline(config: Record<string, any>, mediaAsse

initializeCat();

timeline.push(taskFinished);
timeline.push(taskFinished(false));
timeline.push(exitFullscreen);

return { jsPsych, timeline };
Expand Down
2 changes: 1 addition & 1 deletion task-launcher/src/tasks/matrix-reasoning/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function buildMatrixTimeline(config: Record<string, any>, mediaAs

initializeCat();

timeline.push(taskFinished);
timeline.push(taskFinished(false));
timeline.push(exitFullscreen);

return { jsPsych, timeline };
Expand Down
2 changes: 1 addition & 1 deletion task-launcher/src/tasks/mental-rotation/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default function buildMentalRotationTimeline(config: Record<string, any>,

initializeCat();

timeline.push(taskFinished);
timeline.push(taskFinished(false));
timeline.push(exitFullscreen);

return { jsPsych, timeline };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default function buildSameDifferentTimeline(config: Record<string, any>,

initializeCat();

timeline.push(taskFinished);
timeline.push(taskFinished(false));
timeline.push(exitFullscreen);

return { jsPsych, timeline };
Expand Down
56 changes: 31 additions & 25 deletions task-launcher/src/tasks/shared/trials/taskFinished.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,39 @@ import jsPsychHTMLMultiResponse from '@jspsych-contrib/plugin-html-multi-respons
import { taskStore, PageAudioHandler } from '../helpers';
import { mediaAssets } from '../../..';

export const taskFinished = {
type: jsPsychHTMLMultiResponse,
data: () => {
return {
// save_trial: true,
assessment_stage: 'instructions',
};
},
stimulus: () => {
const t = taskStore().translations;
return `
<div class='lev-stimulus-container'>
<div class='lev-row-container instruction'>
<h1>${t.taskFinished}</h1>
</div>
<footer>${t.generalFooter}</footer>
</div>`;
},
button_choices: [`Continue`],
keyboard_choices: 'ALL_KEYS',
button_html: '<button class="primary" style=margin-top:10%>Exit</button>',
on_load: () => {
if (mediaAssets.audio.taskFinished) {
PageAudioHandler.playAudio(mediaAssets.audio.taskFinished)
export const taskFinished = (intro = false) => {
return {
type: jsPsychHTMLMultiResponse,
data: () => {
return {
// save_trial: true,
assessment_stage: 'instructions',
};
},
stimulus: () => {
const t = taskStore().translations;
const endMessage = intro ? 'introFinished' : 'taskFinished';

return `
<div class='lev-stimulus-container'>
<div class='lev-row-container instruction'>
<h1>${t[endMessage]}</h1>
</div>
<footer>${t.generalFooter}</footer>
</div>`;
},
button_choices: [`Continue`],
keyboard_choices: 'ALL_KEYS',
button_html: '<button class="primary" style=margin-top:10%>Exit</button>',
on_load: () => {
const endMessage = intro ? 'introFinished' : 'taskFinished';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename the mediaAsset to taskFinished instead of introFinished?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taskFinished is the asset that all the other tasks use - the text is "You've completed the game. Thank you!" and introFinished is a separate asset for intro only that I just created (it says "You've finished the instructions. Thank you!"). I could definitely rename introFinished, but I think it has to be different from taskFinished. Sorry if I'm misunderstanding your comment though!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I guess when we pull them both in the common folder that we have been talking about, both can exist. So a config param makes sense. I am wondering though for future proofing should we pass the asset name as the parameter to taskFinished as opposed to supporting just two use cases. If we pass the asset name then in the future we can support as many ending screens as we want. But that is optional, I'll leave it up to you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, I switched it so that we now pass in the asset name.


if (mediaAssets.audio[endMessage]) {
PageAudioHandler.playAudio(mediaAssets.audio[endMessage])
}
}
// trial_duration: 1000,
}
// trial_duration: 1000,
};


2 changes: 1 addition & 1 deletion task-launcher/src/tasks/theory-of-mind/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function buildTOMTimeline(config: Record<string, any>, mediaAsset

initializeCat();

timeline.push(taskFinished);
timeline.push(taskFinished(false));
timeline.push(exitFullscreen);

return { jsPsych, timeline };
Expand Down
2 changes: 1 addition & 1 deletion task-launcher/src/tasks/trog/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function buildTROGTimeline(config: Record<string, any>, mediaAsse
initializeCat();

// final screens
timeline.push(taskFinished);
timeline.push(taskFinished(false));
timeline.push(exitFullscreen);

return { jsPsych, timeline };
Expand Down
2 changes: 1 addition & 1 deletion task-launcher/src/tasks/vocab/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function buildVocabTimeline(config: Record<string, any>, mediaAss
initializeCat();

// final screens
timeline.push(taskFinished);
timeline.push(taskFinished(false));
timeline.push(exitFullscreen);

return { jsPsych, timeline };
Expand Down
Loading