Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0f51037
add: new messages file with French translations
chosww Jul 26, 2024
47ede16
fix: sort the messages file in alphabetical order
chosww Jul 26, 2024
b784239
fix: errors in messages
chosww Jul 26, 2024
810f99e
merge develop-1.13
chosww Jul 29, 2024
d2f993d
fix: update messages
chosww Aug 22, 2024
48b8c97
fix: remove unused messages
chosww Aug 23, 2024
2eb4e2b
fix: replace redundant messages with common message
chosww Aug 23, 2024
59d15b3
fix: update privacy policy messages to be stored in localization file
chosww Sep 4, 2024
feb9f13
fix: simplify key for list items and fix lint issues
chosww Sep 4, 2024
b93ef72
fix: format the messages
chosww Sep 23, 2024
5045736
fix: combine messages for the command replacement and move to next/pr…
chosww Sep 23, 2024
6ef7e44
fix: lint issues
chosww Sep 23, 2024
c2e70da
fix: separate step numbers and step names from add node aria label
chosww Sep 23, 2024
31cdea6
fix: return aria labels for ActionPanel in a method
chosww Sep 23, 2024
27f63b2
fix: merge develop-1.13
chosww Sep 27, 2024
ead12c8
fix: update messages placeholders
chosww Sep 30, 2024
11b1a92
fix: update based on PR feedback
chosww Oct 23, 2024
8bb37d6
Add messages2tsv.js and tsv2messages.js
sbates-idrc Oct 24, 2024
db78632
Sort messages.json keys in ASCII order
sbates-idrc Oct 24, 2024
f7f9011
Add check_messages.js
sbates-idrc Oct 25, 2024
3f65859
Use Unix line endings
sbates-idrc Oct 25, 2024
dd5ab8e
Add "UI." prefix to messages that are visible in the UI
sbates-idrc Oct 28, 2024
d346ff0
Sort messages
sbates-idrc Oct 28, 2024
e517ddd
Merge branch 'develop-1.13' into message-french-translation
sbates-idrc Nov 12, 2024
16cf4a5
Update messages and French translations
sbates-idrc Mar 24, 2025
72b37a5
Sort messages
sbates-idrc Mar 24, 2025
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
143 changes: 85 additions & 58 deletions src/ActionPanel.js

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/ActionPanel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function createMountActionPanel(props) {
{},
{
focusedOptionName: null,
selectedCommandName: 'right45',
selectedActionName: 'right45',
programSequence: new ProgramSequence(
[
{block: 'forward1'},
Expand Down Expand Up @@ -101,10 +101,10 @@ describe('ActionPanel options', () => {
test('Given that there is no selected action, then the Replace button should be disabled', () => {
const { wrapper } = createMountActionPanel({
pressedStepIndex: 1,
selectedCommandName: null
selectedActionName: null
});
const replaceButton = getActionPanelOptionButtons(wrapper, 'replaceCurrentStep');
const expectedAriaLabel = 'Replace Step 2 turn left 45 degrees ';
const expectedAriaLabel = 'Replace Step 2 turn left 45 degrees';
expect(replaceButton.get(0).props['aria-label']).toBe(expectedAriaLabel);
expect(replaceButton.get(0).props['disabled']).toBe(true);
});
Expand All @@ -127,7 +127,7 @@ describe('ActionPanel options', () => {
pressedStepIndex: 0
});
const moveToPreviousStepButton = getActionPanelOptionButtons(wrapper, 'moveToPreviousStep');
const expectedAriaLabel = 'Move Step 1 forward 1 square ';
const expectedAriaLabel = 'Move Step 1 forward 1 square';
expect(moveToPreviousStepButton.get(0).props['aria-label']).toBe(expectedAriaLabel);
expect(moveToPreviousStepButton.get(0).props['disabled']).toBe(true);
moveToPreviousStepButton.simulate('click');
Expand All @@ -150,7 +150,7 @@ describe('ActionPanel options', () => {
pressedStepIndex: 0
});
const moveToPreviousStepButton = getActionPanelOptionButtons(wrapper, 'moveToPreviousStep');
const expectedAriaLabel = "Move Step 1 loop A ";
const expectedAriaLabel = "Move Step 1 loop A";
expect(moveToPreviousStepButton.get(0).props['disabled']).toBe(true);
moveToPreviousStepButton.simulate('click');
expect(moveToPreviousStepButton.get(0).props['aria-label']).toBe(expectedAriaLabel);
Expand All @@ -173,7 +173,7 @@ describe('ActionPanel options', () => {
pressedStepIndex: 2
});
const moveToPreviousStepButton = getActionPanelOptionButtons(wrapper, 'moveToPreviousStep');
const expectedAriaLabel = "Move Step 3 loop A ";
const expectedAriaLabel = "Move Step 3 loop A";
expect(moveToPreviousStepButton.get(0).props['disabled']).toBe(true);
moveToPreviousStepButton.simulate('click');
expect(moveToPreviousStepButton.get(0).props['aria-label']).toBe(expectedAriaLabel);
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('ActionPanel options', () => {
pressedStepIndex: 2
});
const moveToNextStepButton = getActionPanelOptionButtons(wrapper, 'moveToNextStep');
const expectedAriaLabel = 'Move Step 3 turn right 45 degrees ';
const expectedAriaLabel = 'Move Step 3 turn right 45 degrees';
expect(moveToNextStepButton.get(0).props['aria-label']).toBe(expectedAriaLabel);
expect(moveToNextStepButton.get(0).props['disabled']).toBe(true);
moveToNextStepButton.simulate('click');
Expand All @@ -351,7 +351,7 @@ describe('ActionPanel options', () => {
pressedStepIndex: 0
});
const moveToNextStepButton = getActionPanelOptionButtons(wrapper, 'moveToNextStep');
const expectedAriaLabel = "Move Step 1 loop A ";
const expectedAriaLabel = "Move Step 1 loop A";
expect(moveToNextStepButton.get(0).props['disabled']).toBe(true);
moveToNextStepButton.simulate('click');
expect(moveToNextStepButton.get(0).props['aria-label']).toBe(expectedAriaLabel);
Expand All @@ -374,7 +374,7 @@ describe('ActionPanel options', () => {
pressedStepIndex: 2
});
const moveToNextStepButton = getActionPanelOptionButtons(wrapper, 'moveToNextStep');
const expectedAriaLabel = "Move Step 3 loop A ";
const expectedAriaLabel = "Move Step 3 loop A";
expect(moveToNextStepButton.get(0).props['disabled']).toBe(true);
moveToNextStepButton.simulate('click');
expect(moveToNextStepButton.get(0).props['aria-label']).toBe(expectedAriaLabel);
Expand Down
4 changes: 2 additions & 2 deletions src/ActionsSimplificationModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ class ActionsSimplificationModal extends React.Component<ActionsSimplificationMo

render() {
const cancelButtonProperties = {
label: this.props.intl.formatMessage({ id: 'ActionsSimplificationModal.cancel'} ),
label: this.props.intl.formatMessage({ id: 'Cancel'} ),
isPrimary: false,
onClick: this.handleOnCancel
};
const saveButtonProperties = {
id: 'ActionSimplificationModal-done',
isPrimary: true,
label: this.props.intl.formatMessage({ id: 'ActionsSimplificationModal.save'} ),
label: this.props.intl.formatMessage({ id: 'Save'} ),
onClick: this.saveChanges
};
return (
Expand Down
32 changes: 16 additions & 16 deletions src/AnnouncementBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,43 @@ export default class AnnouncementBuilder {
}

buildSelectActionAnnouncement(action: string): AnnouncementData {
let commandType = null;
let actionType = null;
if (action === 'loop') {
commandType = this.intl.formatMessage({
actionType = this.intl.formatMessage({
id: 'Announcement.control'
});
} else {
commandType = this.intl.formatMessage({
actionType = this.intl.formatMessage({
id: 'Announcement.movement'
});
}
return {
messageIdSuffix: 'actionSelected',
values: {
commandType: commandType,
command: this.intl.formatMessage({
actionType,
actionName: this.intl.formatMessage({
id: `Announcement.${action}`
}),
}
};
}

buildAddStepAnnouncement(action: string): AnnouncementData {
let commandType = null;
let actionType = null;
if (action === 'loop') {
commandType = this.intl.formatMessage({
actionType = this.intl.formatMessage({
id: 'Announcement.control'
});
} else {
commandType = this.intl.formatMessage({
actionType = this.intl.formatMessage({
id: 'Announcement.movement'
});
}
return {
messageIdSuffix: 'add',
values: {
commandType: commandType,
command: this.intl.formatMessage({
actionType,
actionName: this.intl.formatMessage({
id: `Announcement.${action}`
}),
}
Expand All @@ -64,10 +64,10 @@ export default class AnnouncementBuilder {
return {
messageIdSuffix: 'delete',
values: {
commandType: this.intl.formatMessage({
actionType: this.intl.formatMessage({
id: "Announcement.control"
}),
command: this.intl.formatMessage(
actionName: this.intl.formatMessage(
{
id: `Announcement.${programBlock.block}`
},
Expand All @@ -81,10 +81,10 @@ export default class AnnouncementBuilder {
return {
messageIdSuffix: 'delete',
values: {
commandType: this.intl.formatMessage({
actionType: this.intl.formatMessage({
id: "Announcement.movement"
}),
command: this.intl.formatMessage(
actionName: this.intl.formatMessage(
{
id: `Announcement.${programBlock.block}`
}
Expand All @@ -100,10 +100,10 @@ export default class AnnouncementBuilder {
return {
messageIdSuffix: 'replace',
values: {
oldCommand: this.intl.formatMessage({
oldActionName: this.intl.formatMessage({
id: `Announcement.${programBlock.block}`
}),
newCommand: this.intl.formatMessage({
newActionName: this.intl.formatMessage({
id: `Announcement.${selectedAction}`
})
}
Expand Down
32 changes: 16 additions & 16 deletions src/AnnouncementBuilder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ test('Test buildSelectActionAnnouncement()', () => {
expect(announcementBuilder.buildSelectActionAnnouncement('loop')).toStrictEqual({
messageIdSuffix: 'actionSelected',
values: {
commandType: 'control',
command: 'loop'
actionType: 'control',
actionName: 'loop'
}
});

expect(announcementBuilder.buildSelectActionAnnouncement('forward1')).toStrictEqual({
messageIdSuffix: 'actionSelected',
values: {
commandType: 'movement',
command: 'forward 1 square'
actionType: 'movement',
actionName: 'forward 1 square'
}
});
});
Expand All @@ -44,16 +44,16 @@ test('Test buildAddStepAnnouncement()', () => {
expect(announcementBuilder.buildAddStepAnnouncement('loop')).toStrictEqual({
messageIdSuffix: 'add',
values: {
commandType: 'control',
command: 'loop'
actionType: 'control',
actionName: 'loop'
}
});

expect(announcementBuilder.buildAddStepAnnouncement('forward1')).toStrictEqual({
messageIdSuffix: 'add',
values: {
commandType: 'movement',
command: 'forward 1 square'
actionType: 'movement',
actionName: 'forward 1 square'
}
});
});
Expand All @@ -71,8 +71,8 @@ describe('Test buildDeleteStepAnnouncement()', () => {
expect(announcementBuilder.buildDeleteStepAnnouncement(startLoopBlock)).toStrictEqual({
messageIdSuffix: 'delete',
values: {
commandType: 'control',
command: 'loop A'
actionType: 'control',
actionName: 'loop A'
}
});
});
Expand All @@ -88,8 +88,8 @@ describe('Test buildDeleteStepAnnouncement()', () => {
expect(announcementBuilder.buildDeleteStepAnnouncement(endLoopBlock)).toStrictEqual({
messageIdSuffix: 'delete',
values: {
commandType: 'control',
command: 'loop A'
actionType: 'control',
actionName: 'loop A'
}
});
});
Expand All @@ -104,8 +104,8 @@ describe('Test buildDeleteStepAnnouncement()', () => {
expect(announcementBuilder.buildDeleteStepAnnouncement(forwardBlock)).toStrictEqual({
messageIdSuffix: 'delete',
values: {
commandType: 'movement',
command: 'forward 1 square'
actionType: 'movement',
actionName: 'forward 1 square'
}
});
});
Expand All @@ -123,8 +123,8 @@ test('Test buildReplaceStepAnnouncement()', () => {
expect(announcementBuilder.buildReplaceStepAnnouncement(forwardBlock, 'right45')).toStrictEqual({
messageIdSuffix: 'replace',
values: {
oldCommand: 'forward 1 square',
newCommand: 'turn right 45 degrees'
oldActionName: 'forward 1 square',
newActionName: 'turn right 45 degrees'
}
});
});
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export class App extends React.Component<AppProps, AppState> {
});
}

getSelectedCommandName() {
getSelectedActionName() {
if (this.state.selectedAction !== null) {
return this.state.selectedAction;
} else {
Expand Down Expand Up @@ -1013,7 +1013,7 @@ export class App extends React.Component<AppProps, AppState> {
<CommandPaletteCommand
key={`CommandBlock-${index}`}
commandName={value}
selectedCommandName={this.getSelectedCommandName()}
selectedActionName={this.getSelectedActionName()}
audioManager={this.audioManager}
isDraggingCommand={this.state.isDraggingCommand}
onSelect={this.handleCommandFromCommandPalette}
Expand Down
6 changes: 3 additions & 3 deletions src/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ it('renders without crashing', () => {
ReactDOM.unmountComponentAtNode(div);
});

it('Should play a sound when selectedCommandName changes', () => {
it('Should play a sound when selectedActionName changes', () => {
const { app, audioManagerMock } = mountApp({});

// Update the selectedAction
app.setState({ selectedAction: "forward1"}, function () {
expect(audioManagerMock.playAnnouncement.mock.calls.length).toBe(1);
expect(audioManagerMock.playAnnouncement.mock.calls[0][0]).toBe('actionSelected');
expect(audioManagerMock.playAnnouncement.mock.calls[0][2]).toStrictEqual({
"commandType": "movement",
"command": "forward 1 square"
"actionType": "movement",
"actionName": "forward 1 square"
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/CharacterAriaLive.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CharacterAriaLive extends React.Component<CharacterAriaLiveProps, {}> {
});
const text = this.props.intl.formatMessage(
{ id:'CharacterAriaLive.movementAriaLabel' },
{ character: characterLabel }
{ sceneCharacter: characterLabel }
);
this.setLiveRegion(text);
}
Expand Down
2 changes: 1 addition & 1 deletion src/CharacterDescriptionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class CharacterDescriptionBuilder {
{
columnLabel: columnLabel,
rowLabel: rowLabel,
item: itemLabel,
backgroundItem: itemLabel,
direction: directionLabel
}
);
Expand Down
4 changes: 2 additions & 2 deletions src/CommandPaletteCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type CommandPaletteCommandProps = {
commandName: CommandName,
intl: IntlShape,
isDraggingCommand: boolean,
selectedCommandName: ?CommandName,
selectedActionName: ?CommandName,
onSelect: (commandName: CommandName) => void,
onDragStart: (commandName: CommandName) => void,
onDragEnd: () => void
Expand All @@ -34,7 +34,7 @@ class CommandPaletteCommand extends React.Component<CommandPaletteCommandProps,
};

render() {
const pressed = this.props.commandName === this.props.selectedCommandName && !this.props.isDraggingCommand;
const pressed = this.props.commandName === this.props.selectedActionName && !this.props.isDraggingCommand;

const classes = classNames(
{'command-block--pressed' : pressed},
Expand Down
12 changes: 6 additions & 6 deletions src/CommandPaletteCommand.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('Pressed state is false when selecedCommandName is null', () => {
<CommandPaletteCommand.WrappedComponent
intl={intl}
commandName='forward1'
selectedCommandName={null}
selectedActionName={null}
onSelect={() => {}}/>
);
expect(hasPressedClass(wrapper)).toBe(false);
Expand All @@ -43,7 +43,7 @@ test('Pressed state is false when selecedCommandName is another command', () =>
<CommandPaletteCommand.WrappedComponent
intl={intl}
commandName='forward1'
selectedCommandName='left45'
selectedActionName='left45'
onSelect={() => {}}/>
);
expect(hasPressedClass(wrapper)).toBe(false);
Expand All @@ -55,7 +55,7 @@ test('Pressed state is true when selecedCommandName is this command', () => {
<CommandPaletteCommand.WrappedComponent
intl={intl}
commandName='forward1'
selectedCommandName='forward1'
selectedActionName='forward1'
onSelect={() => {}}/>
);
expect(hasPressedClass(wrapper)).toBe(true);
Expand All @@ -69,7 +69,7 @@ test('Clicking the button calls the callback onSelect with commandName', () => {
<CommandPaletteCommand.WrappedComponent
intl={intl}
commandName='forward1'
selectedCommandName={null}
selectedActionName={null}
onSelect={mockSelectHandler}/>
);

Expand All @@ -80,8 +80,8 @@ test('Clicking the button calls the callback onSelect with commandName', () => {
// Verify that onSelect is called with the commandName
expect(mockSelectHandler.mock.calls.length).toBe(1);
expect(mockSelectHandler.mock.calls[0][0]).toBe('forward1');
// Update the selectedCommandName
wrapper.setProps({selectedCommandName: 'forward1'});
// Update the selectedActionName
wrapper.setProps({selectedActionName: 'forward1'});
wrapper.update();
// Click again
button.simulate('click');
Expand Down
Loading