diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index f5aef9bd..e8defe52 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -499,7 +499,7 @@ "panel.seoKeywords.checks": "Checks", "panel.seoKeywords.density.tableTitle": "Frequency", "panel.seoKeywords.density": "Keyword density", - "panel.seoKeywordInfo.validInfo.label": "Used in heading(s)", + "panel.seoKeywordInfo.validInfo.label": "Heading(s)", "panel.seoKeywordInfo.validInfo.content": "Content", "panel.seoKeywords.title": "Keywords", diff --git a/src/dashboardWebView/utils/updateCssVariables.ts b/src/dashboardWebView/utils/updateCssVariables.ts index 95856990..b2be1c1d 100644 --- a/src/dashboardWebView/utils/updateCssVariables.ts +++ b/src/dashboardWebView/utils/updateCssVariables.ts @@ -98,4 +98,17 @@ export const updateCssVariables = (isDarkTheme = true) => { '--frontmatter-border-active', darkenColor(borderColor, isDarkTheme ? -30 : 30) || 'var(--vscode-activityBar-activeBorder)' ); + + // SEO - Success/Warning colors + const successColor = styles.getPropertyValue('--vscode-charts-green'); + document.documentElement.style.setProperty( + '--frontmatter-success-background', + opacityColor(successColor, 0.05) || 'var(--vscode-charts-green)' + ); + + const warningColor = styles.getPropertyValue('--vscode-statusBarItem-warningBackground'); + document.documentElement.style.setProperty( + '--frontmatter-warning-background', + opacityColor(warningColor, 0.05) || 'var(--vscode-statusBarItem-warningBackground)' + ); }; diff --git a/src/panelWebView/components/SeoKeywordInfo.tsx b/src/panelWebView/components/SeoKeywordInfo.tsx index 5bb7e392..871a5e01 100644 --- a/src/panelWebView/components/SeoKeywordInfo.tsx +++ b/src/panelWebView/components/SeoKeywordInfo.tsx @@ -29,7 +29,7 @@ const SeoKeywordInfo: React.FunctionComponent = ({ headings }: React.PropsWithChildren) => { - const tooltipClasses = `!py-[2px] !px-[8px] !rounded-[3px] !border-[var(--vscode-editorHoverWidget-border)] !border !border-solid !bg-[var(--vscode-editorHoverWidget-background)] !text-[var(--vscode-editorHoverWidget-foreground)] !font-normal !opacity-100 shadow-[0_2px_8px_var(--vscode-widget-shadow)] !z-[9999]`; + const tooltipClasses = `!py-[2px] !px-[8px] !rounded-[3px] !border-[var(--vscode-editorHoverWidget-border)] !border !border-solid !bg-[var(--vscode-editorHoverWidget-background)] !text-[var(--vscode-editorHoverWidget-foreground)] !font-normal !opacity-100 shadow-[0_2px_8px_var(--vscode-widget-shadow)] text-left`; const density = () => { if (!wordCount) { @@ -44,7 +44,7 @@ const SeoKeywordInfo: React.FunctionComponent = ({ if (density < 0.75) { return {densityTitle}; } else if (density >= 0.75 && density < 1.5) { - return {densityTitle}; + return {densityTitle}; } else { return {densityTitle}; } @@ -98,11 +98,12 @@ const SeoKeywordInfo: React.FunctionComponent = ({ const tooltipContent = React.useMemo(() => { return ( <> - {localize(LocalizationKey.commonTitle)}:
- {localize(LocalizationKey.commonDescription)}:
- {localize(LocalizationKey.commonSlug)}:
- {localize(LocalizationKey.panelSeoKeywordInfoValidInfoContent)}:
- {localize(LocalizationKey.panelSeoKeywordInfoValidInfoLabel)}: + Keyword present in:
+ {localize(LocalizationKey.commonTitle)}
+ {localize(LocalizationKey.commonDescription)}
+ {localize(LocalizationKey.commonSlug)}
+ {localize(LocalizationKey.panelSeoKeywordInfoValidInfoContent)}
+ {localize(LocalizationKey.panelSeoKeywordInfoValidInfoLabel)} ) }, [checks]); @@ -115,7 +116,7 @@ const SeoKeywordInfo: React.FunctionComponent = ({ return (
diff --git a/src/panelWebView/components/SeoKeywords.tsx b/src/panelWebView/components/SeoKeywords.tsx index 274b5068..cb48fc98 100644 --- a/src/panelWebView/components/SeoKeywords.tsx +++ b/src/panelWebView/components/SeoKeywords.tsx @@ -64,11 +64,11 @@ const SeoKeywords: React.FunctionComponent = ({ {localize(LocalizationKey.panelSeoKeywordsHeaderKeyword)} - + {localize(LocalizationKey.panelSeoKeywordsChecks)} - + diff --git a/src/panelWebView/components/ValidInfo.tsx b/src/panelWebView/components/ValidInfo.tsx index 692260dd..8120aada 100644 --- a/src/panelWebView/components/ValidInfo.tsx +++ b/src/panelWebView/components/ValidInfo.tsx @@ -15,7 +15,7 @@ const ValidInfo: React.FunctionComponent = ({ return (
{isValid ? ( - + ) : ( )} diff --git a/src/panelWebView/index.tsx b/src/panelWebView/index.tsx index 78e1a5a4..fb49908c 100644 --- a/src/panelWebView/index.tsx +++ b/src/panelWebView/index.tsx @@ -5,10 +5,16 @@ import { ViewPanel } from './ViewPanel'; import { RecoilRoot } from 'recoil'; import { I10nProvider } from '../dashboardWebView/providers/I10nProvider'; import { SentryInit } from '../utils/sentryInit'; +import { updateCssVariables } from '../dashboardWebView/utils/updateCssVariables'; import 'vscrui/dist/codicon.css'; import './styles.css'; +const mutationObserver = new MutationObserver((_, __) => { + const darkMode = document.body.classList.contains('vscode-dark'); + updateCssVariables(darkMode); +}); + // eslint-disable-next-line @typescript-eslint/no-unused-vars declare const acquireVsCodeApi: () => { getState: () => T; @@ -24,6 +30,9 @@ if (elm) { const isProd = elm?.getAttribute('data-isProd'); const isCrashDisabled = elm?.getAttribute('data-is-crash-disabled'); + updateCssVariables(document.body.classList.contains('vscode-dark')); + mutationObserver.observe(document.body, { childList: false, attributes: true }); + if (isProd === 'true' && isCrashDisabled === 'false') { Sentry.init(SentryInit(version, environment));