add reducer

This commit is contained in:
Tykayn 2025-09-10 13:01:13 +02:00 committed by tykayn
parent 72e35b5582
commit db2bef5a3c
3 changed files with 8 additions and 4 deletions

View file

@ -1,6 +1,7 @@
<div id="main_page">
<main>
<sae-feedback-button></sae-feedback-button>
<h2 class="title">
CSC Solution Matcher helps match client questions with similar previous cases using
<span class="magic-text">

View file

@ -165,9 +165,9 @@ function currentThemeReducer(state = initialState.currentTheme, action: AppActio
case ActionTypes.SWITCH_TO_NEXT_THEME:
// Get the themesList from the store
const themesList = initialState.themesList;
// Find the index of the current theme
// Find the main-button of the current theme
const currentThemeIndex = themesList.indexOf(state);
// Calculate the index of the next theme (or go back to the first theme if at the end)
// Calculate the main-button of the next theme (or go back to the first theme if at the end)
const nextThemeIndex = (currentThemeIndex + 1) % themesList.length;
// Get the next theme
return themesList[nextThemeIndex];
@ -188,9 +188,9 @@ function currentLangReducer(state = initialState.currentLang, action: AppActions
case ActionTypes.SWITCH_TO_NEXT_LANGUAGE:
// Get the langsList from the store
const langsList = initialState.langsList;
// Find the index of the current language
// Find the main-button of the current language
const currentLangIndex = langsList.indexOf(state);
// Calculate the index of the next language (or go back to the first language if at the end)
// Calculate the main-button of the next language (or go back to the first language if at the end)
const nextLangIndex = (currentLangIndex + 1) % langsList.length;
// Get the next language
return langsList[nextLangIndex];