Skip to content

Commit

Permalink
Fix doc version suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela committed Dec 21, 2020
1 parent 5cca27b commit 8db9f91
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
2 changes: 2 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"scripts": {
"postinstall": "patch-package",
"start": "yarn api && docusaurus start",
"build": "yarn api && docusaurus build",
"deploy": "docusaurus deploy",
Expand All @@ -11,6 +12,7 @@
"@docusaurus/preset-classic": "2.0.0-alpha.69",
"@phenomnomnominal/tsquery": "4.1.1",
"globby": "11.0.1",
"patch-package": "6.2.2",
"react": "17.0.1",
"react-dom": "17.0.1",
"remark-import-partial": "0.0.2",
Expand Down
64 changes: 64 additions & 0 deletions website/patches/@docusaurus+theme-classic+2.0.0-alpha.69.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
diff --git a/node_modules/@docusaurus/theme-classic/lib/theme/DocVersionSuggestions/index.js b/node_modules/@docusaurus/theme-classic/lib/theme/DocVersionSuggestions/index.js
index bc8baa7..b12bebf 100644
--- a/node_modules/@docusaurus/theme-classic/lib/theme/DocVersionSuggestions/index.js
+++ b/node_modules/@docusaurus/theme-classic/lib/theme/DocVersionSuggestions/index.js
@@ -18,58 +18,7 @@ const getVersionMainDoc = (version) =>
version.docs.find((doc) => doc.id === version.mainDocId);

function DocVersionSuggestions() {
- const {
- siteConfig: {title: siteTitle},
- } = useDocusaurusContext();
- const {pluginId} = useActivePlugin({
- failfast: true,
- });
- const {savePreferredVersionName} = useDocsPreferredVersion(pluginId);
- const activeVersion = useActiveVersion(pluginId);
- const {
- latestDocSuggestion,
- latestVersionSuggestion,
- } = useDocVersionSuggestions(pluginId); // No suggestion to be made
-
- if (!latestVersionSuggestion) {
- return <></>;
- } // try to link to same doc in latest version (not always possible)
- // fallback to main doc of latest version
-
- const latestVersionSuggestedDoc =
- latestDocSuggestion ?? getVersionMainDoc(latestVersionSuggestion);
- return (
- <div className="alert alert--warning margin-bottom--md" role="alert">
- {
- // TODO need refactoring
- activeVersion.name === 'current' ? (
- <div>
- This is unreleased documentation for {siteTitle}{' '}
- <strong>{activeVersion.label}</strong> version.
- </div>
- ) : (
- <div>
- This is documentation for {siteTitle}{' '}
- <strong>{activeVersion.label}</strong>, which is no longer actively
- maintained.
- </div>
- )
- }
- <div className="margin-top--md">
- For up-to-date documentation, see the{' '}
- <strong>
- <Link
- to={latestVersionSuggestedDoc.path}
- onClick={() =>
- savePreferredVersionName(latestVersionSuggestion.name)
- }>
- latest version
- </Link>
- </strong>{' '}
- ({latestVersionSuggestion.label}).
- </div>
- </div>
- );
+ return null
}

export default DocVersionSuggestions;

0 comments on commit 8db9f91

Please sign in to comment.