Added a button that the user can click to toggle between placing emoj…#9
Open
htsukamoto5 wants to merge 1 commit into
Open
Added a button that the user can click to toggle between placing emoj…#9htsukamoto5 wants to merge 1 commit into
htsukamoto5 wants to merge 1 commit into
Conversation
…is and vowels on the screen
🦋 Changeset detectedLatest commit: 336d52e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Pull request overview
Adds a mode toggle button to the @jspsych/plugin-emoji-screen plugin so participants can switch between placing emojis and vowels on the click canvas. The trial data format is generalized from emoji-specific to a more general "symbol" shape, and the simulation logic is updated to match.
Changes:
- Introduces new
vowelsandmodeplugin parameters and a click-driven toggle button that updates the prompt and mode. - Renames the output data from
emoji_locations: [{x, y, emoji}]tosymbol_locations: [{x, y, symbol, mode}]and the DOM attributedata-emojitodata-symbol. - Updates simulation (
create_simulation_data/ visual simulation) to produce and replay mixed emoji/vowel sequences.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| packages/plugin-emoji-screen/src/index.ts | Adds vowel/mode parameters, mode toggle button, renames data/attribute fields, updates simulation. |
| packages/plugin-emoji-screen/examples/index.html | Updates example prompt text to mention the mode-switch button and drops explicit emojis override. |
| .changeset/thirty-onions-eat.md | New minor changeset describing the toggle feature. |
| .changeset/brave-lions-arrive.md | Duplicate minor changeset for the same feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let currentMode: "emoji" | "vowel" = trial.mode as "emoji" | "vowel"; | ||
| modeButton.textContent = currentMode === "emoji" ? "Switch from Emojis to Vowels" : "Switch from Vowels to Emojis"; | ||
| modeButton.addEventListener("click", () => { | ||
| event.stopPropagation(); // Prevent the click from placing an emoji when toggling modes |
| }, | ||
| /** The mode of the trial. Valid values are "emoji" or "vowel". */ | ||
| mode: { | ||
| type: ParameterType.STRING, |
Comment on lines
+46
to
50
| /** Array of objects describing each placed symbol: {x, y, symbol, mode}. x and y are pixel coordinates relative to the canvas. */ | ||
| symbol_locations: { | ||
| type: ParameterType.COMPLEX, | ||
| array: true, | ||
| }, |
Comment on lines
+1
to
+5
| --- | ||
| "@jspsych/plugin-emoji-screen": minor | ||
| --- | ||
|
|
||
| Added a button that the user can click to toggle between placing emojis or vowels on the screen |
Comment on lines
+23
to
+33
| /** The pool of vowels to randomly select from when the participant clicks. */ | ||
| vowels: { | ||
| type: ParameterType.STRING, | ||
| array: true, | ||
| default: ["a", "e", "i", "o", "u"], | ||
| }, | ||
| /** The mode of the trial. Valid values are "emoji" or "vowel". */ | ||
| mode: { | ||
| type: ParameterType.STRING, | ||
| default: "emoji", | ||
| }, |
Comment on lines
+108
to
+114
| modeButton.addEventListener("click", () => { | ||
| event.stopPropagation(); // Prevent the click from placing an emoji when toggling modes | ||
| currentMode = currentMode === "emoji" ? "vowel" : "emoji"; | ||
| modeButton.textContent = currentMode === "emoji" ? "Switch from Emojis to Vowels" : "Switch from Vowels to Emojis"; | ||
| promptDiv.innerHTML = currentMode === "emoji" | ||
| ? "<p>Click anywhere to place emojis. Use the button to switch to vowels. Press <strong>Enter</strong> when done.</p>" | ||
| : "<p>Click anywhere to place vowels. Use the button to switch to emojis. Press <strong>Enter</strong> when done.</p>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…is and vowels on the screen