diff --git a/src/extension.ts b/src/extension.ts index 51b51a1fd..b60093c24 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -30,7 +30,6 @@ import { ComponentsTreeDataProvider } from './componentsView'; import fsx = require('fs-extra'); - // eslint-disable-next-line @typescript-eslint/no-empty-function // this method is called when your extension is deactivated export function deactivate(): void { diff --git a/src/webview/devfile-registry/app/cardItem.tsx b/src/webview/devfile-registry/app/cardItem.tsx index f0447d24a..755a23e7c 100644 --- a/src/webview/devfile-registry/app/cardItem.tsx +++ b/src/webview/devfile-registry/app/cardItem.tsx @@ -12,8 +12,8 @@ import { StarterProject } from '../../../odo/componentTypeDescription'; import { StarterProjectDisplay } from './starterProjectDisplay'; import { Badge, Backdrop, Button, Card, CardActions, Modal } from '@material-ui/core'; import { FileCopy } from '@material-ui/icons'; -import { monokai } from 'react-syntax-highlighter/dist/esm/styles/hljs'; import { Tooltip, Typography } from '@mui/material'; +import { qtcreatorLight, monokai } from 'react-syntax-highlighter/dist/esm/styles/hljs'; export class CardItem extends React.Component { constructor(props: DevFileProps) { @@ -246,7 +246,7 @@ export class CardItem extends React.Component this.copyClicked(true)} > @@ -254,14 +254,14 @@ export class CardItem extends React.Component diff --git a/src/webview/devfile-registry/app/home.tsx b/src/webview/devfile-registry/app/home.tsx index cb917b113..70ac38700 100644 --- a/src/webview/devfile-registry/app/home.tsx +++ b/src/webview/devfile-registry/app/home.tsx @@ -27,6 +27,7 @@ interface CompTypeDesc extends ComponentTypeDescription { interface HomePageProps extends React.AnchorHTMLAttributes { compDescriptions: CompTypeDesc[]; + themeKind: number; } export interface DefaultProps { @@ -34,7 +35,8 @@ export interface DefaultProps { } const HomeItem: React.FC = ({ - compDescriptions + compDescriptions, + themeKind }: HomePageProps) => { const homeStyleClass = useHomeStyles(); const cardItemStyle = useCardItemStyles(); @@ -45,7 +47,8 @@ const HomeItem: React.FC = ({ compDescriptions.map((compDescription: CompTypeDesc, key: number) => ( + cardItemStyle={cardItemStyle} projectDisplayStyle={projectDisplayStyle} hasGitLink={hasGitLink(compDescription)} + themeKind={themeKind} /> )) } @@ -59,6 +62,7 @@ export const Home: React.FC = ({ }) => { const [registries, setRegistries] = React.useState([]); const [searchValue, setSearchValue] = React.useState(''); const [error, setError] = React.useState(''); + const [themeKind, setThemeKind] = React.useState(0); React.useEffect(() => { return VSCodeMessage.onMessage((message) => { @@ -81,6 +85,7 @@ export const Home: React.FC = ({ }) => { } }); } + setThemeKind(message.data.themeValue); setCompDescriptions(message.data.compDescriptions); setRegistries(message.data.registries); setFilteredcompDescriptions(getFilteredCompDesc(message.data.registries, message.data.compDescriptions, searchValue)); @@ -90,6 +95,8 @@ export const Home: React.FC = ({ }) => { setFilteredcompDescriptions([]); setCompDescriptions([]); setSearchValue(''); + } else if(message.data.action === 'setTheme') { + setThemeKind(message.data.themeValue); } }); }); @@ -130,7 +137,7 @@ export const Home: React.FC = ({ }) => { }} /> } - + {error?.length > 0 ? : null} : diff --git a/src/webview/devfile-registry/app/wrapperCardItem.tsx b/src/webview/devfile-registry/app/wrapperCardItem.tsx index fb932037a..34e94f679 100644 --- a/src/webview/devfile-registry/app/wrapperCardItem.tsx +++ b/src/webview/devfile-registry/app/wrapperCardItem.tsx @@ -11,6 +11,7 @@ export interface DevFileProps extends React.AnchorHTMLAttributes { + if (themeKind !== editor.kind) { + themeKind = editor.kind; + if (panel) { + panel.webview.postMessage({ action: 'setTheme', themeValue: themeKind }); + } + } +}); + async function devfileRegistryViewerMessageListener(event: any): Promise { let starterProject = event.selectedProject; switch (event?.action) { @@ -149,6 +159,7 @@ function getAllComponents(eventActionName: string, url?: string, error?: string) action: eventActionName, compDescriptions: Array.from(componentDescriptions), registries: registries, + themeValue: themeKind, errorMessage: error } );