in src/theme/DocVersionBanner/index.tsx [113:155]
function DocVersionBannerEnabled({
className,
versionMetadata,
}: Props & {
versionMetadata: PropVersionMetadata;
}): React.ReactElement {
const {
siteConfig: { title: siteTitle },
} = useDocusaurusContext();
const { pluginId } = useActivePlugin({ failfast: true })!;
const getVersionMainDoc = (version: GlobalVersion) => version.docs.find(doc => doc.id === version.mainDocId)!;
const { savePreferredVersionName } = useDocsPreferredVersion(pluginId);
const { latestDocSuggestion, latestVersionSuggestion } = useDocVersionSuggestions(pluginId);
// Try to link to same doc in latest version (not always possible), falling
// back to main doc of latest version
const latestVersionSuggestedDoc = latestDocSuggestion ?? getVersionMainDoc(latestVersionSuggestion);
return (
<div
className={clsx(className, ThemeClassNames.docs.docVersionBanner, 'alert alert--warning margin-bottom--md')}
role="alert"
>
<div>
<BannerLabel siteTitle={siteTitle} versionMetadata={versionMetadata} />
</div>
<div className="margin-top--md">
<LatestVersionSuggestionLabel
versionLabel={latestVersionSuggestion.label}
to={latestVersionSuggestedDoc.path}
realLatestVersion={{
label: '3.0',
to: '/docs/3.0/gettingStarted/what-is-apache-doris',
}}
onClick={() => savePreferredVersionName(latestVersionSuggestion.name)}
/>
</div>
</div>
);
}