diff --git a/README.md b/README.md index adfc9fe..baee526 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,15 @@ limitations under the License. - Open `.env` files and set `REACT_APP_API_URL` to point to services: - local: [http://localhost:{PORT}](http://localhost:{PORT}) +

💻 UI Customization

+ +The default description on each of the three main application pages can be customized by setting the following environment variables: + +- `DESCRIPTION_RETRIEVAL` +- `DESCRIPTION_READING` +- `DESCRIPTION_QA` + +

💻 Run Locally

- Run the app in the _*development mode*_: `yarn start` diff --git a/deployment.sh b/deployment.sh index 13282e7..4958a26 100755 --- a/deployment.sh +++ b/deployment.sh @@ -1,3 +1,6 @@ #!/bin/sh -sed -i 's#__API_URL__#'"$API_URL"'#g' /usr/share/nginx/html/env.js; \ No newline at end of file +sed -i 's#__API_URL__#'"$API_URL"'#g' /usr/share/nginx/html/env.js; +sed -i 's#__DESCRIPTION_RETRIEVAL__#'"$DESCRIPTION_RETRIEVAL"'#g' /usr/share/nginx/html/env.js; +sed -i 's#__DESCRIPTION_READING__#'"$DESCRIPTION_READING"'#g' /usr/share/nginx/html/env.js; +sed -i 's#__DESCRIPTION_QA__#'"$DESCRIPTION_QA"'#g' /usr/share/nginx/html/env.js; diff --git a/public/env.js b/public/env.js index 0014bcc..db68f91 100644 --- a/public/env.js +++ b/public/env.js @@ -1 +1,6 @@ -window.env = { API_URL: "__API_URL__" }; +window.env = { + API_URL: "__API_URL__", + DESCRIPTION_RETRIEVAL: "__DESCRIPTION_RETRIEVAL__", + DESCRIPTION_READING: "__DESCRIPTION_READING__", + DESCRIPTION_QA: "__DESCRIPTION_QA__" +}; diff --git a/src/api/config.js b/src/api/config.js index 7ca15fb..1b967f6 100644 --- a/src/api/config.js +++ b/src/api/config.js @@ -20,3 +20,20 @@ export const BASE_URL = process.env.NODE_ENV === "production" ? window.env.API_URL : process.env.REACT_APP_API_URL; + +export const DESCRIPTION_RETRIEVAL = + process.env.NODE_ENV === "production" + ? window.env.DESCRIPTION_RETRIEVAL + : process.env.REACT_APP_DESCRIPTION_RETRIEVAL; + +export const DESCRIPTION_READING = + process.env.NODE_ENV === "production" + ? window.env.DESCRIPTION_READING + : process.env.REACT_APP_DESCRIPTION_READING; + +export const DESCRIPTION_QA = + process.env.NODE_ENV === "production" + ? window.env.DESCRIPTION_QA + : process.env.REACT_APP_DESCRIPTION_QA; + + diff --git a/src/components/applications/index.js b/src/components/applications/index.js index 97f2799..f232d7c 100644 --- a/src/components/applications/index.js +++ b/src/components/applications/index.js @@ -22,6 +22,12 @@ import _ from "lodash"; import { Search, Book, SearchLocate, Application } from "@carbon/react/icons"; +import { + DESCRIPTION_RETRIEVAL, + DESCRIPTION_READING, + DESCRIPTION_QA, +} from "../../api/config"; + import HeaderContent from "../header/index"; import Notifications from "../notifications"; import Navigation from "../navigation"; @@ -52,7 +58,7 @@ export async function listApplicationsIfRequired(applications, dispatch) { applicationId: "retrieval", name: "Retrieval", description: - "Search a document collection using dense and sparse information retrieval techniques", + DESCRIPTION_RETRIEVAL || "Search a document collection using dense and sparse information retrieval techniques", githubLink: "https://github.com/primeqa/primeqa", feedbackLink: "https://github.com/primeqa/primeqa/issues/new", settings: settings, @@ -60,7 +66,8 @@ export async function listApplicationsIfRequired(applications, dispatch) { { applicationId: "reading", name: "Reading", - description: "Find answer to questions based on a given context", + description: + DESCRIPTION_READING || "Find answer to questions based on a given context", githubLink: "https://github.com/primeqa/primeqa", feedbackLink: "https://github.com/primeqa/primeqa/issues/new", settings: settings, @@ -69,7 +76,7 @@ export async function listApplicationsIfRequired(applications, dispatch) { applicationId: "qa", name: "Question Answering", description: - "Find answers to question from retrieved evidence blocks", + DESCRIPTION_QA || "Find answers to question from retrieved evidence blocks", githubLink: "https://github.com/primeqa/primeqa", feedbackLink: "https://github.com/primeqa/primeqa/issues/new", settings: settings,