Skip to content

Commit

Permalink
Merge pull request #28 from WDAqua/fix/itzbund-theme-corrections
Browse files Browse the repository at this point in the history
Fix/itzbund theme corrections
  • Loading branch information
Wutras authored Oct 24, 2023
2 parents 0d1322e + 58cb8ca commit 20e9275
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ ARG DEFAULT_CHATBOT_COMPONENTS
ARG INITIAL_QUESTION_PARAMETER_NAME
ARG DEFAULT_BACKEND_TYPE
ARG DEFAULT_THEME
ARG INITIAL_MESSAGE_TEXT_DE
ARG INITIAL_MESSAGE_TEXT_EN
ARG PAGE_TITLE_DE
ARG PAGE_TITLE_EN

WORKDIR /app
COPY ./package*.json ./
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qanary-ui",
"version": "0.5.0",
"version": "0.6.0",
"private": true,
"dependencies": {
"@qanary/spring-boot-health-check": "1.2.1",
Expand Down
21 changes: 17 additions & 4 deletions src/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import {
defaultChatbotComponents,
initialQuestionParameter,
defaultTheme,
initialMessageTextEn,
initialMessageTextDe,
} from "../../helpers/constants";
import {
supportedServiceNames,
supportedServices,
supportedThemes,
} from "../../services";
import { getCurrentLanguage } from "../../helpers/getTexts";

class App extends Component {
constructor(props) {
Expand All @@ -35,11 +38,21 @@ class App extends Component {
backendType === "rasa"
? !!backendUrl
: !!backendUrl && !!components?.length > 0;
const initialMessage = isConfigured
? this.texts["default-responses"]["initial-message"][
const getInitialMessage = () => {
const currentLanguage = getCurrentLanguage()
if (initialMessageTextEn && currentLanguage === "en") {
return initialMessageTextEn.replace("{{url}}", backendUrl);
} else if (initialMessageTextDe && currentLanguage === "de") {
return initialMessageTextDe.replace("{{url}}", backendUrl);
} else if (isConfigured) {
return this.texts["default-responses"]["initial-message"][
"is-configured"
].replace("{{url}}", backendUrl)
: this.texts["default-responses"]["initial-message"]["is-not-configured"];
].replace("{{url}}", backendUrl);
} else {
return this.texts["default-responses"]["initial-message"]["is-not-configured"];
}
}
const initialMessage = getInitialMessage();

this.state = {
messages: [
Expand Down
4 changes: 2 additions & 2 deletions src/components/PageHeader/PageHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import settings_icon_white from "../share/imgs/settings_icon_white.svg";
import info_icon_black from "../share/imgs/info_icon_black.svg";
import info_icon_white from "../share/imgs/info_icon_white.svg";
import "./PageHeader.css";
import { chatbotFrontendUrl } from "../../helpers/constants";
import { chatbotFrontendUrl, pageTitleDe, pageTitleEn } from "../../helpers/constants";

function toggleContainer(containerId) {
const container = document.getElementById(containerId);
Expand Down Expand Up @@ -86,7 +86,7 @@ export default class PageHeader extends Component {
target="_self"
className="center white-text"
>
{this.texts["page-header"].title}
{(textsHelper.getCurrentLanguage() === "en" ? pageTitleEn : pageTitleDe) ?? this.texts["page-header"].title}
</a>
</div>
<div
Expand Down
12 changes: 12 additions & 0 deletions src/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,15 @@ export const defaultBackendType =

export const defaultTheme =
window._env_?.DEFAULT_THEME ?? "default";

export const initialMessageTextEn =
window._env_?.INITIAL_MESSAGE_TEXT_EN;

export const initialMessageTextDe =
window._env_?.INITIAL_MESSAGE_TEXT_DE;

export const pageTitleEn =
window._env_?.PAGE_TITLE_EN

export const pageTitleDe =
window._env_?.PAGE_TITLE_DE

0 comments on commit 20e9275

Please sign in to comment.