Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions datahub-web-react/src/CustomThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from 'react';
import { ThemeProvider } from 'styled-components';

import { useIsThemeV2 } from '@app/useIsThemeV2';
import { useCustomThemeId } from '@app/useSetAppTheme';
import themes from '@conf/theme/themes';
import { Theme } from '@conf/theme/types';
Expand All @@ -12,12 +11,9 @@ interface Props {
}

const CustomThemeProvider = ({ children }: Props) => {
// Note: AppConfigContext not provided yet, so both of these calls rely on the DEFAULT_APP_CONFIG
const isThemeV2 = useIsThemeV2();
const customThemeId = useCustomThemeId();

// Note: If custom theme id is a json file, it will only be loaded later in useSetAppTheme
const defaultTheme = isThemeV2 ? themes.themeV2 : themes.themeV1;
const defaultTheme = themes.themeV2;
const customTheme = customThemeId ? themes[customThemeId] : null;
const [theme, setTheme] = useState<Theme>(customTheme ?? defaultTheme);

Expand Down
14 changes: 3 additions & 11 deletions datahub-web-react/src/app/ProtectedRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import styled from 'styled-components';
import DataHubTitle from '@app/DataHubTitle';
import EmbedRoutes from '@app/EmbedRoutes';
import { SearchRoutes } from '@app/SearchRoutes';
import { HomePage } from '@app/home/HomePage';
import { HomePage as HomePageV2 } from '@app/homeV2/HomePage';
import { IntroduceYourself } from '@app/homeV2/introduce/IntroduceYourself';
import { useSetUserPersona } from '@app/homeV2/persona/useUserPersona';
import { HomePage as HomePageV3 } from '@app/homeV3/HomePage';
import { useShowHomePageRedesign } from '@app/homeV3/context/hooks/useShowHomePageRedesign';
import { useSetUserTitle } from '@app/identity/user/useUserTitle';
import { OnboardingContextProvider } from '@app/onboarding/OnboardingContextProvider';
import { useIsThemeV2, useSetThemeIsV2 } from '@app/useIsThemeV2';
import { useSetThemeIsV2 } from '@app/useIsThemeV2';
import { useSetAppTheme } from '@app/useSetAppTheme';
import { useSetNavBarRedesignEnabled } from '@app/useShowNavBarRedesign';
import { NEW_ROUTE_MAP, PageRoutes } from '@conf/Global';
Expand All @@ -34,16 +33,9 @@ export const ProtectedRoutes = (): JSX.Element => {
useSetUserTitle();
useSetNavBarRedesignEnabled();

const isThemeV2 = useIsThemeV2();
const showHomepageRedesign = useShowHomePageRedesign();
const FinalHomePage = showHomepageRedesign ? HomePageV3 : HomePageV2;

let FinalHomePage;

if (isThemeV2) {
FinalHomePage = showHomepageRedesign ? HomePageV3 : HomePageV2;
} else {
FinalHomePage = HomePage;
}
const location = useLocation();
const history = useHistory();

Expand All @@ -57,7 +49,7 @@ export const ProtectedRoutes = (): JSX.Element => {
return (
<OnboardingContextProvider>
<DataHubTitle />
<StyledLayout className={isThemeV2 ? 'themeV2' : undefined}>
<StyledLayout className="themeV2">
<Switch>
<Route exact path="/" render={() => <FinalHomePage />} />
<Route path={PageRoutes.EMBED} render={() => <EmbedRoutes />} />
Expand Down
50 changes: 8 additions & 42 deletions datahub-web-react/src/app/SearchRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,14 @@ import { ManageApplications } from '@app/applications/ManageApplications';
import { BrowseResultsPage } from '@app/browse/BrowseResultsPage';
import { BusinessAttributes } from '@app/businessAttribute/BusinessAttributes';
import { useUserContext } from '@app/context/useUserContext';
import DomainRoutes from '@app/domain/DomainRoutes';
import { ManageDomainsPage } from '@app/domain/ManageDomainsPage';
import DomainRoutesV2 from '@app/domainV2/DomainRoutes';
import { ManageDomainsPage as ManageDomainsPageV2 } from '@app/domainV2/ManageDomainsPage';
import { EntityPage } from '@app/entity/EntityPage';
import { EntityPage as EntityPageV2 } from '@app/entityV2/EntityPage';
import GlossaryRoutes from '@app/glossary/GlossaryRoutes';
import GlossaryRoutesV2 from '@app/glossaryV2/GlossaryRoutes';
import StructuredProperties from '@app/govern/structuredProperties/StructuredProperties';
import { ManageIngestionPage } from '@app/ingest/ManageIngestionPage';
import { ManageIngestionPage as ManageIngestionPageV2 } from '@app/ingestV2/ManageIngestionPage';
import { SearchPage } from '@app/search/SearchPage';
import { SearchablePage } from '@app/search/SearchablePage';
import { SearchPage as SearchPageV2 } from '@app/searchV2/SearchPage';
import { SearchablePage as SearchablePageV2 } from '@app/searchV2/SearchablePage';
import { SettingsPage } from '@app/settings/SettingsPage';
import { SettingsPage as SettingsPageV2 } from '@app/settingsV2/SettingsPage';
import { NoPageFound } from '@app/shared/NoPageFound';
import { ManageTags } from '@app/tags/ManageTags';
Expand All @@ -32,7 +24,6 @@ import {
useIsNestedDomainsEnabled,
} from '@app/useAppConfig';
import { useEntityRegistry } from '@app/useEntityRegistry';
import { useIsThemeV2 } from '@app/useIsThemeV2';
import { PageRoutes } from '@conf/Global';

/**
Expand All @@ -46,8 +37,6 @@ export const SearchRoutes = (): JSX.Element => {
? entityRegistry.getEntitiesForSearchRoutes()
: entityRegistry.getNonGlossaryEntities();
const { config, loaded } = useAppConfig();
const isThemeV2 = useIsThemeV2();
const FinalSearchablePage = isThemeV2 ? SearchablePageV2 : SearchablePage;

const businessAttributesFlag = useBusinessAttributesFlag();
const appConfigContextLoaded = useIsAppConfigContextLoaded();
Expand All @@ -64,25 +53,16 @@ export const SearchRoutes = (): JSX.Element => {
const showAnalytics = (config?.analyticsConfig?.enabled && me && me?.platformPrivileges?.viewAnalytics) || false;

return (
<FinalSearchablePage>
<SearchablePageV2>
<Switch>
{entities.map((entity) => (
<Route
key={entity.getPathName()}
path={`/${entity.getPathName()}/:urn`}
render={() =>
isThemeV2 ? (
<EntityPageV2 entityType={entity.type} />
) : (
<EntityPage entityType={entity.type} />
)
}
render={() => <EntityPageV2 entityType={entity.type} />}
/>
))}
<Route
path={PageRoutes.SEARCH_RESULTS}
render={() => (isThemeV2 ? <SearchPageV2 /> : <SearchPage />)}
/>
<Route path={PageRoutes.SEARCH_RESULTS} render={() => <SearchPageV2 />} />
<Route path={PageRoutes.BROWSE_RESULTS} render={() => <BrowseResultsPage />} />
{showTags ? <Route path={PageRoutes.MANAGE_TAGS} render={() => <ManageTags />} /> : null}
<Route path={PageRoutes.MANAGE_APPLICATIONS} render={() => <ManageApplications />} />
Expand All @@ -97,27 +77,13 @@ export const SearchRoutes = (): JSX.Element => {
/>
<Route path={PageRoutes.PERMISSIONS} render={() => <Redirect to="/settings/permissions" />} />
<Route path={PageRoutes.IDENTITIES} render={() => <Redirect to="/settings/identities" />} />
{isNestedDomainsEnabled && (
<Route
path={`${PageRoutes.DOMAIN}*`}
render={() => (isThemeV2 ? <DomainRoutesV2 /> : <DomainRoutes />)}
/>
)}
{!isNestedDomainsEnabled && (
<Route
path={PageRoutes.DOMAINS}
render={() => (isThemeV2 ? <ManageDomainsPageV2 /> : <ManageDomainsPage />)}
/>
)}
{isNestedDomainsEnabled && <Route path={`${PageRoutes.DOMAIN}*`} render={() => <DomainRoutesV2 />} />}
{!isNestedDomainsEnabled && <Route path={PageRoutes.DOMAINS} render={() => <ManageDomainsPageV2 />} />}

{!showIngestV2 && <Route path={PageRoutes.INGESTION} render={() => <ManageIngestionPage />} />}
{showIngestV2 && <Route path={PageRoutes.INGESTION} render={() => <ManageIngestionPageV2 />} />}

<Route path={PageRoutes.SETTINGS} render={() => (isThemeV2 ? <SettingsPageV2 /> : <SettingsPage />)} />
<Route
path={`${PageRoutes.GLOSSARY}*`}
render={() => (isThemeV2 ? <GlossaryRoutesV2 /> : <GlossaryRoutes />)}
/>
<Route path={PageRoutes.SETTINGS} render={() => <SettingsPageV2 />} />
<Route path={`${PageRoutes.GLOSSARY}*`} render={() => <GlossaryRoutesV2 />} />
{showStructuredProperties && (
<Route path={PageRoutes.STRUCTURED_PROPERTIES} render={() => <StructuredProperties />} />
)}
Expand All @@ -135,6 +101,6 @@ export const SearchRoutes = (): JSX.Element => {
/>
{me.loaded && loaded && <Route component={NoPageFound} />}
</Switch>
</FinalSearchablePage>
</SearchablePageV2>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ import { useUserContext } from '@app/context/useUserContext';
import { ANTD_GRAY } from '@app/entity/shared/constants';
import filterSearchQuery from '@app/search/utils/filterSearchQuery';
import { Message } from '@app/shared/Message';
import { useIsThemeV2 } from '@app/useIsThemeV2';
import { useShowNavBarRedesign } from '@src/app/useShowNavBarRedesign';

import { useGetAnalyticsChartsQuery, useGetMetadataAnalyticsChartsQuery } from '@graphql/analytics.generated';
import { useListDomainsQuery } from '@graphql/domain.generated';
import { useGetHighlightsQuery } from '@graphql/highlights.generated';

const PageContainer = styled.div<{ isV2: boolean; $isShowNavBarRedesign?: boolean }>`
background-color: ${(props) => (props.isV2 ? '#fff' : 'inherit')};
const PageContainer = styled.div<{ $isShowNavBarRedesign?: boolean }>`
background-color: #fff;
${(props) =>
props.$isShowNavBarRedesign &&
`
Expand All @@ -29,12 +28,12 @@ const PageContainer = styled.div<{ isV2: boolean; $isShowNavBarRedesign?: boolea
${(props) =>
!props.$isShowNavBarRedesign &&
`
margin-right: ${props.isV2 ? '24px' : '0'};
margin-bottom: ${props.isV2 ? '24px' : '0'};
margin-right: 24px;
margin-bottom: 24px;
`}
border-radius: ${(props) => {
if (props.isV2 && props.$isShowNavBarRedesign) return props.theme.styles['border-radius-navbar-redesign'];
return props.isV2 ? '8px' : '0';
if (props.$isShowNavBarRedesign) return props.theme.styles['border-radius-navbar-redesign'];
return '8px';
}};
`;

Expand Down Expand Up @@ -75,7 +74,6 @@ const StyledSearchBar = styled(Input)`
`;

export const AnalyticsPage = () => {
const isV2 = useIsThemeV2();
const isShowNavBarRedesign = useShowNavBarRedesign();
const me = useUserContext();
const canManageDomains = me?.platformPrivileges?.createDomains;
Expand Down Expand Up @@ -118,7 +116,7 @@ export const AnalyticsPage = () => {

const isLoading = highlightLoading || chartLoading || domainLoading || metadataAnalyticsLoading;
return (
<PageContainer isV2={isV2} $isShowNavBarRedesign={isShowNavBarRedesign}>
<PageContainer $isShowNavBarRedesign={isShowNavBarRedesign}>
{isLoading && <Message type="loading" content="Loading…" style={{ marginTop: '10%' }} />}
<HighlightGroup>
{highlightError && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useEntityFormContext } from '@app/entity/shared/entityForm/EntityFormCo
import Form from '@app/entity/shared/entityForm/Form';
import ProgressBar from '@app/entity/shared/entityForm/ProgressBar';
import { useEntityRegistry } from '@app/useEntityRegistry';
import { useIsThemeV2 } from '@app/useIsThemeV2';

const ContentWrapper = styled.div`
background-color: ${ANTD_GRAY_V2[1]};
Expand All @@ -36,15 +35,9 @@ export default function FormByEntity({ formUrn }: Props) {
const { entityType } = useEntityContext();
const entityRegistry = useEntityRegistry();
const sidebarSections = entityRegistry.getSidebarSections(selectedEntity?.type || entityType);
const isV2 = useIsThemeV2();

// Used for v2 - removes repeated entity header (we use EntityInfo in this component)
// SidebarEntityHeader is always the first index in sidebarSections, so remove it here
// TODO (OBS-677): remove this logic once we get form info into V2 sidebar
const cleanedSidebarSections = sidebarSections.slice(1);

// Conditional sections based on theme version
const sections = isV2 ? cleanedSidebarSections : sidebarSections;
const sections = cleanedSidebarSections;

return (
<EntityContext.Provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ import { useEntityData } from '@app/entity/shared/EntityContext';
import EditStructuredPropertyModal from '@app/entity/shared/tabs/Properties/Edit/EditStructuredPropertyModal';
import { Icon, Input as InputComponent, Text, colors } from '@src/alchemy-components';
import { useUserContext } from '@src/app/context/useUserContext';
import { REDESIGN_COLORS } from '@src/app/entityV2/shared/constants';
import { getStructuredPropertiesSearchInputs } from '@src/app/govern/structuredProperties/utils';
import { useEntityRegistry } from '@src/app/useEntityRegistry';
import { useIsThemeV2 } from '@src/app/useIsThemeV2';
import { PageRoutes } from '@src/conf/Global';
import { useGetSearchResultsForMultipleQuery } from '@src/graphql/search.generated';
import { Maybe, StructuredProperties, StructuredPropertyEntity } from '@src/types.generated';

const AddButton = styled.div<{ isThemeV2: boolean; isV1Drawer?: boolean }>`
const AddButton = styled.div<{ isV1Drawer?: boolean }>`
border-radius: 200px;
background-color: ${(props) =>
props.isThemeV2 ? props.theme.styles['primary-color'] : REDESIGN_COLORS.LINK_HOVER_BLUE};
background-color: ${(props) => props.theme.styles['primary-color']};
width: ${(props) => (props.isV1Drawer ? '24px' : '32px')};
height: ${(props) => (props.isV1Drawer ? '24px' : '32px')};
display: flex;
Expand Down Expand Up @@ -82,7 +79,6 @@ interface Props {
const AddPropertyButton = ({ fieldUrn, refetch, fieldProperties, isV1Drawer }: Props) => {
const [searchQuery, setSearchQuery] = useState('');
const { entityData, entityType } = useEntityData();
const isThemeV2 = useIsThemeV2();
const me = useUserContext();
const entityRegistry = useEntityRegistry();
const [isEditModalVisible, setIsEditModalVisible] = useState(false);
Expand Down Expand Up @@ -194,7 +190,7 @@ const AddPropertyButton = ({ fieldUrn, refetch, fieldProperties, isV1Drawer }: P
)}
>
<Tooltip title="Add property" placement="left" showArrow={false}>
<AddButton isThemeV2={isThemeV2} isV1Drawer={isV1Drawer} data-testid="add-structured-prop-button">
<AddButton isV1Drawer={isV1Drawer} data-testid="add-structured-prop-button">
<Icon icon="Add" size={isV1Drawer ? 'lg' : '2xl'} color="white" />
</AddButton>
</Tooltip>
Expand Down
4 changes: 1 addition & 3 deletions datahub-web-react/src/app/onboarding/OnboardingTour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { REDESIGN_COLORS } from '@app/entityV2/shared/constants';
import OnboardingContext from '@app/onboarding/OnboardingContext';
import useShouldSkipOnboardingTour from '@app/onboarding/useShouldSkipOnboardingTour';
import { convertStepId, getConditionalStepIdsToAdd, getStepsToRender } from '@app/onboarding/utils';
import { useIsThemeV2 } from '@app/useIsThemeV2';
import { EducationStepsContext } from '@providers/EducationStepsContext';

import { useBatchUpdateStepStatesMutation } from '@graphql/step.generated';
Expand All @@ -21,10 +20,9 @@ type Props = {
export const OnboardingTour = ({ stepIds }: Props) => {
const { educationSteps, setEducationSteps, educationStepIdsAllowlist } = useContext(EducationStepsContext);
const userUrn = useUserContext()?.user?.urn;
const isThemeV2 = useIsThemeV2();
const { isTourOpen, tourReshow, setTourReshow, setIsTourOpen } = useContext(OnboardingContext);
const location = useLocation();
const accentColor = isThemeV2 ? REDESIGN_COLORS.BACKGROUND_PURPLE : '#5cb7b7';
const accentColor = REDESIGN_COLORS.BACKGROUND_PURPLE;

useEffect(() => {
function handleKeyDown(e) {
Expand Down
Loading
Loading