forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'datahub-project:master' into master
- Loading branch information
Showing
133 changed files
with
4,152 additions
and
841 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { ThemeProvider } from 'styled-components'; | ||
import { Theme } from './conf/theme/types'; | ||
import defaultThemeConfig from './conf/theme/theme_light.config.json'; | ||
import { CustomThemeContext } from './customThemeContext'; | ||
|
||
const CustomThemeProvider = ({ children }: { children: React.ReactNode }) => { | ||
const [currentTheme, setTheme] = useState<Theme>(defaultThemeConfig); | ||
|
||
useEffect(() => { | ||
if (import.meta.env.DEV) { | ||
import(/* @vite-ignore */ `./conf/theme/${import.meta.env.REACT_APP_THEME_CONFIG}`).then((theme) => { | ||
setTheme(theme); | ||
}); | ||
} else { | ||
// Send a request to the server to get the theme config. | ||
fetch(`/assets/conf/theme/${import.meta.env.REACT_APP_THEME_CONFIG}`) | ||
.then((response) => response.json()) | ||
.then((theme) => { | ||
setTheme(theme); | ||
}); | ||
} | ||
}, []); | ||
|
||
return ( | ||
<CustomThemeContext.Provider value={{ theme: currentTheme, updateTheme: setTheme }}> | ||
<ThemeProvider theme={currentTheme}>{children}</ThemeProvider> | ||
</CustomThemeContext.Provider> | ||
); | ||
}; | ||
|
||
export default CustomThemeProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
datahub-web-react/src/app/entity/shared/components/styled/EntityIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import { useEntityRegistry } from '../../../../useEntityRegistry'; | ||
import { PlatformIcon } from '../../../../search/filters/utils'; | ||
import { Entity } from '../../../../../types.generated'; | ||
import { IconStyleType } from '../../../Entity'; | ||
import { ANTD_GRAY } from '../../constants'; | ||
|
||
interface Props { | ||
entity: Entity; | ||
size?: number; | ||
} | ||
|
||
export default function EntityIcon({ entity, size = 14 }: Props) { | ||
const entityRegistry = useEntityRegistry(); | ||
const genericEntityProps = entityRegistry.getGenericEntityProperties(entity.type, entity); | ||
const logoUrl = genericEntityProps?.platform?.properties?.logoUrl; | ||
const icon = logoUrl ? ( | ||
<PlatformIcon src={logoUrl} size={size} /> | ||
) : ( | ||
entityRegistry.getIcon(entity.type, size, IconStyleType.ACCENT, ANTD_GRAY[9]) | ||
); | ||
|
||
return <>{icon}</>; | ||
} |
Oops, something went wrong.