remove backlink text

This commit is contained in:
typescreep
2025-08-25 21:48:02 +03:00
parent 34727f4a1d
commit 3ea1723a17
5 changed files with 16 additions and 4 deletions

1
.env
View File

@@ -28,3 +28,4 @@ VITE_LOGOUT_URL=/oauth/logout
VITE_LOGIN_USERNAME_FIELD=name
VITE_REMOVE_BACKLINK=true
VITE_REMOVE_BACKLINK_TEXT=true

View File

@@ -30,3 +30,4 @@ LOGOUT_URL=
LOGIN_USERNAME_FIELD=
REMOVE_BACKLINK=
REMOVE_BACKLINK_TEXT=

View File

@@ -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"'}
}
`,
)

View File

@@ -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<TBackLinkProps> = ({ to, title }) => {
if (BASE_REMOVE_BACKLINK && BASE_REMOVE_BACKLINK_TEXT) {
return null
}
return (
<Styled.Container>
{to && !BASE_REMOVE_BACKLINK && (
@@ -21,7 +25,7 @@ export const BackLink: FC<TBackLinkProps> = ({ to, title }) => {
</TitleWithNoMargin>
</Styled.CustomLink>
)}
<TitleWithNoMargin level={5}>{title}</TitleWithNoMargin>
{!BASE_REMOVE_BACKLINK_TEXT && <TitleWithNoMargin level={5}>{title}</TitleWithNoMargin>}
</Styled.Container>
)
}

View File

@@ -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'