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

Game route path changes + vocab translations #622

Merged
merged 3 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
30 changes: 29 additions & 1 deletion src/components/GameTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<span v-else>{{ taskCompletedMessage }}</span>
<router-link
v-if="!allGamesComplete && !game.completedOn && !game.taskData?.taskURL && !game.taskData?.variantURL"
:to="{ path: `${game.taskId === 'survey' ? '/survey' : 'game/' + game.taskId}` }"
:to="{ path: getRoutePath(game.taskId) }"
></router-link>
</div>
</div>
Expand Down Expand Up @@ -93,6 +93,7 @@ const props = defineProps({
sequential: { type: Boolean, required: false, default: true },
userData: { type: Object, required: true },
});
const isLevante = import.meta.env.MODE === 'LEVANTE';

const { t, locale } = useI18n();

Expand All @@ -108,6 +109,18 @@ const levanteTasks = [
'survey',
'mefs',
];

const levantifiedRoarTasks = [
'vocab',
// Not yet implemented
// 'swr',
// 'swr-es',
// 'sre',
// 'sre-es',
// 'pa',
// 'pa-es',
];

const getTaskName = (taskId, taskName) => {
// Translate Levante task names. The task name is not the same as the taskId.
const taskIdLowercased = taskId.toLowerCase();
Expand All @@ -127,6 +140,21 @@ const getTaskDescription = (taskId, taskDescription) => {
return taskDescription;
};

const getRoutePath = (taskId) => {
const lowerCasedAndCamelizedTaskId = camelize(taskId.toLowerCase());

if (lowerCasedAndCamelizedTaskId === 'survey') {
return '/survey';
} else if (
levanteTasks.includes(lowerCasedAndCamelizedTaskId) ||
(isLevante && levantifiedRoarTasks.includes(lowerCasedAndCamelizedTaskId))
) {
return '/game/core-tasks/' + taskId;
} else {
return '/game/' + taskId;
}
};

const taskCompletedMessage = computed(() => {
return t('gameTabs.taskCompleted');
});
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const routes = [
meta: { pageTitle: 'Fluency-Alpaca ES' },
},
{
path: '/game/:taskId',
path: '/game/core-tasks/:taskId',
name: 'Core Tasks',
component: () => import('../components/tasks/TaskLevante.vue'),
props: true,
Expand Down
6 changes: 4 additions & 2 deletions src/translations/en/en-componentTranslations.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"heartsAndFlowersName": "Hearts and Flowers",
"egmaMathDescription": "Solve the math problems.",
"egmaMathName": "Math Game",
"matrixReasoningDescription": "¡Find the missing piece to complete the puzzle.",
"matrixReasoningDescription": "Find the missing piece to complete the puzzle.",
"matrixReasoningName": "Puzzle Game",
"memoryGameDescription": "Watch the squares light up. Remember the order and make the same pattern.",
"memoryGameName": "Memory Game",
Expand All @@ -64,7 +64,9 @@
"surveyName": "Thoughts and Feelings",
"surveyDescription": "Answer questions about your time at school.",
"mefsName": "Lion and Monkey Game",
"mefsDescription": "Match the shapes and colors."
"mefsDescription": "Match the shapes and colors.",
"vocabName": "Vocabulary Game",
"vocabDescription": "Listen to the word and choose the matching image."
},
"navBar": {
"signOut": "Sign Out"
Expand Down
6 changes: 4 additions & 2 deletions src/translations/en/us/en-us-componentTranslations.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"heartsAndFlowersName": "Hearts and Flowers",
"egmaMathDescription": "Solve the math problems.",
"egmaMathName": "Math Game",
"matrixReasoningDescription": "¡Find the missing piece to complete the puzzle.",
"matrixReasoningDescription": "Find the missing piece to complete the puzzle.",
"matrixReasoningName": "Puzzle Game",
"memoryGameDescription": "Watch the squares light up. Remember the order and make the same pattern.",
"memoryGameName": "Memory Game",
Expand All @@ -64,7 +64,9 @@
"surveyName": "Thoughts and Feelings",
"surveyDescription": "Answer questions about your time at school.",
"mefsName": "Lion and Monkey Game",
"mefsDescription": "Match the shapes and colors."
"mefsDescription": "Match the shapes and colors.",
"vocabName": "Vocabulary Game",
"vocabDescription": "Listen to the word and choose the matching image."
},
"navBar": {
"signOut": "Sign Out"
Expand Down
4 changes: 3 additions & 1 deletion src/translations/es/es-componentTranslations.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
"surveyName": "Pensamientos y Sentimientos",
"surveyDescription": "Responde a las preguntas sobre tu estancia en el colegio.",
"mefsName": "Juego del León y el Mono",
"mefsDescription": "Empareja las formas y los colores."
"mefsDescription": "Empareja las formas y los colores.",
"vocabName": "Juego de Vocabulario",
"vocabDescription": "Escucha la palabra y elige la imagen correspondiente."
},
"navBar": {
"signOut": "Salir"
Expand Down
Loading