Whitelabel: Fix hide skeletons on logoTextWhiteLabel equals empty string

This commit is contained in:
Alexey Safronov 2024-07-19 17:50:33 +04:00
parent 912e16c3f4
commit b091424f5d
2 changed files with 13 additions and 8 deletions

View File

@ -74,11 +74,12 @@ const WhiteLabel = (props) => {
resetIsInit,
standalone,
theme,
isWhitelableLoaded,
} = props;
const navigate = useNavigate();
const location = useLocation();
const [isLoadedData, setIsLoadedData] = useState(false);
const [logoTextWhiteLabel, setLogoTextWhiteLabel] = useState("");
const [isSaving, setIsSaving] = useState(false);
@ -135,12 +136,6 @@ const WhiteLabel = (props) => {
}
}, [logoText]);
useEffect(() => {
if (logoTextWhiteLabel && logoUrlsWhiteLabel.length && !isLoadedData) {
setIsLoadedData(true);
}
}, [isLoadedData, logoTextWhiteLabel, logoUrlsWhiteLabel]);
const onResetCompanyName = async () => {
const whlText = await getWhiteLabelLogoText();
saveToSessionStorage("companyName", whlText);
@ -265,7 +260,7 @@ const WhiteLabel = (props) => {
const isEqualText = defaultLogoTextWhiteLabel === logoTextWhiteLabel;
const saveButtonDisabled = isEqualLogo && isEqualText;
return !isLoadedData ? (
return !isWhitelableLoaded ? (
<LoaderWhiteLabel />
) : (
<WhiteLabelWrapper showReminder={!saveButtonDisabled}>
@ -563,6 +558,7 @@ export default inject(({ settingsStore, common, currentQuotaStore }) => {
defaultLogoTextWhiteLabel,
enableRestoreButton,
resetIsInit,
isWhitelableLoaded,
} = common;
const {
@ -590,5 +586,7 @@ export default inject(({ settingsStore, common, currentQuotaStore }) => {
deviceType,
resetIsInit,
standalone,
isWhitelableLoaded,
};
})(withTranslation(["Settings", "Profile", "Common"])(observer(WhiteLabel)));

View File

@ -211,6 +211,13 @@ class CommonStore {
this.applyNewLogos(logos);
};
get isWhitelableLoaded() {
return (
this.logoUrlsWhiteLabel.length > 0 &&
this.whiteLabelLogoText !== undefined
);
}
getGreetingSettingsIsDefault = async () => {
const isDefault = await api.settings.getGreetingSettingsIsDefault();
runInAction(() => {