Whitelabel: ban empty logoTextWhiteLabel

This commit is contained in:
Alexey Safronov 2024-07-19 18:17:04 +04:00
parent b091424f5d
commit fcb6d9dba2

View File

@ -82,6 +82,7 @@ const WhiteLabel = (props) => {
const [logoTextWhiteLabel, setLogoTextWhiteLabel] = useState("");
const [isSaving, setIsSaving] = useState(false);
const [isEmpty, setIsEmpty] = useState(!logoText);
const isMobileView = deviceType === DeviceType.mobile;
@ -122,6 +123,12 @@ const WhiteLabel = (props) => {
navigate(url);
};
useEffect(() => {
if (!isWhitelableLoaded) return;
setIsEmpty(!logoText);
}, [logoText]);
useEffect(() => {
const companyNameFromSessionStorage = getFromSessionStorage("companyName");
@ -144,12 +151,18 @@ const WhiteLabel = (props) => {
const onChangeCompanyName = (e) => {
const value = e.target.value;
setIsEmpty(!value || value?.trim() === "");
setLogoTextWhiteLabel(value);
saveToSessionStorage("companyName", value);
};
const onUseTextAsLogo = () => {
if (!logoTextWhiteLabel) {
return;
}
let newLogos = logoUrlsWhiteLabel;
for (let i = 0; i < logoUrlsWhiteLabel.length; i++) {
const options = getLogoOptions(
i,
@ -303,6 +316,7 @@ const WhiteLabel = (props) => {
labelText={t("Common:CompanyName")}
isVertical={true}
className="settings_unavailable"
hasError={isEmpty}
>
<TextInput
className="company-name input"
@ -314,6 +328,7 @@ const WhiteLabel = (props) => {
isAutoFocussed={!isMobile}
tabIndex={1}
maxLength={30}
hasError={isEmpty}
/>
<Button
id="btnUseAsLogo"