mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-01 21:23:10 +00:00
MINOR: Add condition for welcome page (#19266)
* add condition for welcome page * create mock for useWelcomeStore --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
This commit is contained in:
parent
aceadb1cde
commit
29b48bec51
@ -30,6 +30,7 @@ import PermissionProvider from './context/PermissionProvider/PermissionProvider'
|
|||||||
import TourProvider from './context/TourProvider/TourProvider';
|
import TourProvider from './context/TourProvider/TourProvider';
|
||||||
import WebSocketProvider from './context/WebSocketProvider/WebSocketProvider';
|
import WebSocketProvider from './context/WebSocketProvider/WebSocketProvider';
|
||||||
import { useApplicationStore } from './hooks/useApplicationStore';
|
import { useApplicationStore } from './hooks/useApplicationStore';
|
||||||
|
import { useWelcomeStore } from './hooks/useWelcomeStore';
|
||||||
import { getCustomUiThemePreference } from './rest/settingConfigAPI';
|
import { getCustomUiThemePreference } from './rest/settingConfigAPI';
|
||||||
import { history } from './utils/HistoryUtils';
|
import { history } from './utils/HistoryUtils';
|
||||||
import i18n from './utils/i18next/LocalUtil';
|
import i18n from './utils/i18next/LocalUtil';
|
||||||
@ -37,6 +38,7 @@ import { getThemeConfig } from './utils/ThemeUtils';
|
|||||||
|
|
||||||
const App: FC = () => {
|
const App: FC = () => {
|
||||||
const { applicationConfig, setApplicationConfig } = useApplicationStore();
|
const { applicationConfig, setApplicationConfig } = useApplicationStore();
|
||||||
|
const { setIsWelcomeVisible } = useWelcomeStore();
|
||||||
|
|
||||||
const fetchApplicationConfig = async () => {
|
const fetchApplicationConfig = async () => {
|
||||||
try {
|
try {
|
||||||
@ -54,6 +56,7 @@ const App: FC = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchApplicationConfig();
|
fetchApplicationConfig();
|
||||||
|
setIsWelcomeVisible(true);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2025 Collate.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
import { create } from 'zustand';
|
||||||
|
|
||||||
|
interface WelcomeStore {
|
||||||
|
isWelcomeVisible: boolean;
|
||||||
|
setIsWelcomeVisible: (isVisible: boolean) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useWelcomeStore = create<WelcomeStore>()((set) => ({
|
||||||
|
isWelcomeVisible: false,
|
||||||
|
setIsWelcomeVisible: (isVisible: boolean) => {
|
||||||
|
set({ isWelcomeVisible: isVisible });
|
||||||
|
},
|
||||||
|
}));
|
@ -38,6 +38,7 @@ import { EntityReference } from '../../generated/type/entityReference';
|
|||||||
import LimitWrapper from '../../hoc/LimitWrapper';
|
import LimitWrapper from '../../hoc/LimitWrapper';
|
||||||
import { useApplicationStore } from '../../hooks/useApplicationStore';
|
import { useApplicationStore } from '../../hooks/useApplicationStore';
|
||||||
import { useGridLayoutDirection } from '../../hooks/useGridLayoutDirection';
|
import { useGridLayoutDirection } from '../../hooks/useGridLayoutDirection';
|
||||||
|
import { useWelcomeStore } from '../../hooks/useWelcomeStore';
|
||||||
import { getDocumentByFQN } from '../../rest/DocStoreAPI';
|
import { getDocumentByFQN } from '../../rest/DocStoreAPI';
|
||||||
import { getActiveAnnouncement } from '../../rest/feedsAPI';
|
import { getActiveAnnouncement } from '../../rest/feedsAPI';
|
||||||
import { searchQuery } from '../../rest/searchAPI';
|
import { searchQuery } from '../../rest/searchAPI';
|
||||||
@ -52,6 +53,7 @@ const ReactGridLayout = WidthProvider(RGL);
|
|||||||
const MyDataPage = () => {
|
const MyDataPage = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentUser, selectedPersona } = useApplicationStore();
|
const { currentUser, selectedPersona } = useApplicationStore();
|
||||||
|
const { isWelcomeVisible } = useWelcomeStore();
|
||||||
const [followedData, setFollowedData] = useState<Array<EntityReference>>([]);
|
const [followedData, setFollowedData] = useState<Array<EntityReference>>([]);
|
||||||
const [followedDataCount, setFollowedDataCount] = useState(0);
|
const [followedDataCount, setFollowedDataCount] = useState(0);
|
||||||
const [isLoadingOwnedData, setIsLoadingOwnedData] = useState<boolean>(false);
|
const [isLoadingOwnedData, setIsLoadingOwnedData] = useState<boolean>(false);
|
||||||
@ -117,7 +119,7 @@ const MyDataPage = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
isMounted.current = true;
|
isMounted.current = true;
|
||||||
updateWelcomeScreen(!usernameExistsInCookie);
|
updateWelcomeScreen(!usernameExistsInCookie && isWelcomeVisible);
|
||||||
|
|
||||||
return () => updateWelcomeScreen(false);
|
return () => updateWelcomeScreen(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -145,6 +145,12 @@ jest.mock('../DataInsightPage/DataInsightProvider', async () => {
|
|||||||
return jest.fn().mockImplementation(({ children }) => <>{children}</>);
|
return jest.fn().mockImplementation(({ children }) => <>{children}</>);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jest.mock('../../hooks/useWelcomeStore', () => ({
|
||||||
|
useWelcomeStore: jest.fn().mockReturnValue({
|
||||||
|
isWelcomeVisible: true,
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
|
||||||
jest.mock('../DataInsightPage/DataInsightProvider', () => {
|
jest.mock('../DataInsightPage/DataInsightProvider', () => {
|
||||||
return {
|
return {
|
||||||
__esModule: true,
|
__esModule: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user