Update how terms
This commit is contained in:
parent
5c71c15c6d
commit
3e8981c7eb
14
README.md
14
README.md
@ -11,12 +11,12 @@ This starter is based on Vite. There is also [a Webpack based starter](https://g
|
|||||||
```bash
|
```bash
|
||||||
git clone https://github.com/keycloakify/keycloakify-starter
|
git clone https://github.com/keycloakify/keycloakify-starter
|
||||||
cd keycloakify-starter
|
cd keycloakify-starter
|
||||||
yarn install # Or use an other package manager, just be sure to delete the yarn.lock if you do.
|
yarn install # Or use an other package manager, just be sure to delete the yarn.lock if you do.
|
||||||
```
|
```
|
||||||
|
|
||||||
# Testing the theme locally
|
# Testing the theme locally
|
||||||
|
|
||||||
[Documentation](https://docs.keycloakify.dev/v/v10/testing-your-theme)
|
[Documentation](https://docs.keycloakify.dev/v/v10/testing-your-theme)
|
||||||
|
|
||||||
# How to customize the theme
|
# How to customize the theme
|
||||||
|
|
||||||
@ -25,16 +25,17 @@ yarn install # Or use an other package manager, just be sure to delete the yarn.
|
|||||||
# Building the theme
|
# Building the theme
|
||||||
|
|
||||||
You need to have Maven installed to build the theme (The `mvn` command must be in the PATH).
|
You need to have Maven installed to build the theme (The `mvn` command must be in the PATH).
|
||||||
- On macOS: `brew install maven`
|
|
||||||
- On Debian/Ubuntu: `sudo apt-get install maven`
|
- On macOS: `brew install maven`
|
||||||
- On Windows: `choco install openjdk` and `choco install maven` (Or download from [here](https://maven.apache.org/download.cgi))
|
- On Debian/Ubuntu: `sudo apt-get install maven`
|
||||||
|
- On Windows: `choco install openjdk` and `choco install maven` (Or download from [here](https://maven.apache.org/download.cgi))
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build-keycloak-theme
|
npm run build-keycloak-theme
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that by default Keycloakify generates multiple .jar files for different versions of Keycloak.
|
Note that by default Keycloakify generates multiple .jar files for different versions of Keycloak.
|
||||||
You can customize this behavior, see documentation [here](https://docs.keycloakify.dev/v/v10/targetting-specific-keycloak-versions).
|
You can customize this behavior, see documentation [here](https://docs.keycloakify.dev/v/v10/targetting-specific-keycloak-versions).
|
||||||
|
|
||||||
# GitHub Actions
|
# GitHub Actions
|
||||||
|
|
||||||
@ -44,4 +45,3 @@ To release a new version **just update the `package.json` version and push**.
|
|||||||
|
|
||||||
To enable the workflow go to your fork of this repository on GitHub then navigate to:
|
To enable the workflow go to your fork of this repository on GitHub then navigate to:
|
||||||
`Settings` > `Actions` > `Workflow permissions`, select `Read and write permissions`.
|
`Settings` > `Actions` > `Workflow permissions`, select `Read and write permissions`.
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"keycloakify": "10.0.0-rc.77",
|
"keycloakify": "10.0.0-rc.78",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
|
@ -17,27 +17,25 @@ export default function KcPage(props: { kcContext: KcContext }) {
|
|||||||
useDownloadTerms({
|
useDownloadTerms({
|
||||||
kcContext,
|
kcContext,
|
||||||
downloadTermsMarkdown: async ({ currentLanguageTag }) => {
|
downloadTermsMarkdown: async ({ currentLanguageTag }) => {
|
||||||
let termsLanguageTag = currentLanguageTag;
|
for (const languageTag of [currentLanguageTag, "en"]) {
|
||||||
let termsFileName: string;
|
const response = await fetch(
|
||||||
|
`${import.meta.env.BASE_URL}terms/${languageTag}.md`
|
||||||
|
);
|
||||||
|
|
||||||
switch (currentLanguageTag) {
|
if (!response.ok) {
|
||||||
case "fr":
|
continue;
|
||||||
termsFileName = "fr.md";
|
}
|
||||||
break;
|
|
||||||
case "es":
|
return {
|
||||||
termsFileName = "es.md";
|
termsMarkdown: await response.text(),
|
||||||
break;
|
termsLanguageTag: languageTag
|
||||||
default:
|
};
|
||||||
termsFileName = "en.md";
|
|
||||||
termsLanguageTag = "en";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const termsMarkdown = await fetch(
|
return {
|
||||||
`${import.meta.env.BASE_URL}terms/${termsFileName}`
|
termsMarkdown: "No terms found",
|
||||||
).then(r => r.text());
|
termsLanguageTag: "en"
|
||||||
|
};
|
||||||
return { termsMarkdown, termsLanguageTag };
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user