diff --git a/.env b/.env index eefb96d..b66a84c 100644 --- a/.env +++ b/.env @@ -28,3 +28,4 @@ VITE_LOGOUT_URL=/oauth/logout VITE_LOGIN_USERNAME_FIELD=name VITE_REMOVE_BACKLINK=true +VITE_REMOVE_BACKLINK_TEXT=true diff --git a/.env.options.dist b/.env.options.dist index 42fd77f..f804b89 100644 --- a/.env.options.dist +++ b/.env.options.dist @@ -30,3 +30,4 @@ LOGOUT_URL= LOGIN_USERNAME_FIELD= REMOVE_BACKLINK= +REMOVE_BACKLINK_TEXT= diff --git a/server/index.ts b/server/index.ts index 7a45852..f1d7104 100644 --- a/server/index.ts +++ b/server/index.ts @@ -63,6 +63,8 @@ const LOGIN_USERNAME_FIELD = process.env.LOCAL === 'true' ? options?.LOGIN_USERNAME_FIELD : process.env.LOGIN_USERNAME_FIELD const REMOVE_BACKLINK = process.env.LOCAL === 'true' ? options?.REMOVE_BACKLINK : process.env.REMOVE_BACKLINK +const REMOVE_BACKLINK_TEXT = + process.env.LOCAL === 'true' ? options?.REMOVE_BACKLINK_TEXT : process.env.REMOVE_BACKLINK_TEXT const healthcheck = require('express-healthcheck') const promBundle = require('express-prom-bundle') @@ -187,7 +189,8 @@ app.get(`${basePrefix ? basePrefix : ''}/env.js`, (_, res) => { LOGIN_URL: ${JSON.stringify(LOGIN_URL) || '"check envs"'}, LOGOUT_URL: ${JSON.stringify(LOGOUT_URL) || '"check envs"'}, LOGIN_USERNAME_FIELD: ${JSON.stringify(LOGIN_USERNAME_FIELD) || '"check envs"'}, - REMOVE_BACKLINK: ${!!REMOVE_BACKLINK ? REMOVE_BACKLINK.toString().toLowerCase() : '"false"'} + REMOVE_BACKLINK: ${!!REMOVE_BACKLINK ? REMOVE_BACKLINK.toString().toLowerCase() : '"false"'}, + REMOVE_BACKLINK_TEXT: ${!!REMOVE_BACKLINK_TEXT ? REMOVE_BACKLINK_TEXT.toString().toLowerCase() : '"false"'} } `, ) diff --git a/src/components/atoms/BackLink/BackLink.tsx b/src/components/atoms/BackLink/BackLink.tsx index 8d1df92..dd7cbf1 100644 --- a/src/components/atoms/BackLink/BackLink.tsx +++ b/src/components/atoms/BackLink/BackLink.tsx @@ -1,7 +1,7 @@ import React, { FC } from 'react' import { To } from 'react-router-dom' import { ArrowLeftOutlined } from '@ant-design/icons' -import { BASE_REMOVE_BACKLINK } from 'constants/customizationApiGroupAndVersion' +import { BASE_REMOVE_BACKLINK, BASE_REMOVE_BACKLINK_TEXT } from 'constants/customizationApiGroupAndVersion' import { TitleWithNoMargin } from '../TitleWithNoMargin' import { Styled } from './styled' @@ -12,6 +12,10 @@ type TBackLinkProps = { } export const BackLink: FC = ({ to, title }) => { + if (BASE_REMOVE_BACKLINK && BASE_REMOVE_BACKLINK_TEXT) { + return null + } + return ( {to && !BASE_REMOVE_BACKLINK && ( @@ -21,7 +25,7 @@ export const BackLink: FC = ({ to, title }) => { )} - {title} + {!BASE_REMOVE_BACKLINK_TEXT && {title}} ) } diff --git a/src/constants/customizationApiGroupAndVersion.ts b/src/constants/customizationApiGroupAndVersion.ts index b2036c9..2090dd5 100644 --- a/src/constants/customizationApiGroupAndVersion.ts +++ b/src/constants/customizationApiGroupAndVersion.ts @@ -34,4 +34,7 @@ export const LOGOUT_URL = window._env_.LOGOUT_URL || import.meta.env.VITE_LOGOUT export const LOGIN_USERNAME_FIELD = window._env_.LOGIN_USERNAME_FIELD || import.meta.env.VITE_LOGIN_USERNAME_FIELD export const BASE_REMOVE_BACKLINK = - window._env_.REMOVE_BACKLINK === 'true' || import.meta.env.VITE_REMOVE_BACKLINK.toString().toLowerCase() === 'true' + window._env_.REMOVE_BACKLINK === 'true' || import.meta.env.VITE_REMOVE_BACKLINK?.toString().toLowerCase() === 'true' +export const BASE_REMOVE_BACKLINK_TEXT = + window._env_.REMOVE_BACKLINK_TEXT === 'true' || + import.meta.env.VITE_REMOVE_BACKLINK_TEXT?.toString().toLowerCase() === 'true'