Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: isolation of version 0.26, part 2: automated steps #2229

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
FROM httpd:alpine

RUN rm -r /usr/local/apache2/htdocs/*
COPY /build /usr/local/apache2/htdocs/
COPY /build /usr/local/apache2/htdocs/0.26/

# Remove SSL requirement
RUN sed -i \
'/SERVER_PORT/d;/SERVER_NAME/d' \
/usr/local/apache2/htdocs/.htaccess
/usr/local/apache2/htdocs/0.26/.htaccess

# Enable the rewrite module
RUN sed -i \
Expand Down
52 changes: 0 additions & 52 deletions src/theme/AnnouncementBar/index.js

This file was deleted.

101 changes: 101 additions & 0 deletions src/theme/DocVersionBanner/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// Why is this swizzled?
// To override the message displayed by `LatestVersionSuggestionLabel`. The built-in version
// of this component can only link to another internal version, and the message includes a version
// defined in this app. In an archived version of our documentation, neither of those pre-requisites are met.
// In the `main` branch of these docs, this component exists in an `archive/` folder, so that it is
// ignored by docusaurus. In an archived branch of these docs, the component is moved outside of the `archive/`
// folder, so that it is recognized by docusaurus.
// This is a very simplified version of the built-in DocVersionBanner file, not intended to support
// all use cases. It's only intended to meet the needs of an archived version of the docs.
// Swizzled from version 2.3.1.

import React from "react";
import clsx from "clsx";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import Link from "@docusaurus/Link";
import Translate from "@docusaurus/Translate";
import { ThemeClassNames } from "@docusaurus/theme-common";
import { useDocsVersion } from "@docusaurus/theme-common/internal";

function UnmaintainedVersionLabel({ siteTitle, versionMetadata }) {
return (
<Translate
id="theme.docs.versions.unmaintainedVersionLabels"
description="The label used to tell the user that they're browsing an unmaintained doc version"
values={{
siteTitle,
versionLabel: <b>{versionMetadata.label}</b>,
}}
>
{
"This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained."
}
</Translate>
);
}

function BannerLabel(props) {
return <UnmaintainedVersionLabel {...props} />;
}

function LatestVersionSuggestionLabel({ versionLabel }) {
return (
<Translate
id="theme.docs.versions.latestVersionSuggestionLabel"
description="The label used to tell the user to check the latest version"
values={{
versionLabel,
latestVersionLink: (
<b>
<Link to="https://docs.camunda.io">
<Translate
id="theme.docs.versions.latestVersionLinkLabel"
description="The label used for the latest version suggestion link label"
>
latest version
</Translate>
</Link>
</b>
),
}}
>
{"For up-to-date documentation, see the {latestVersionLink}."}
</Translate>
);
}

function DocVersionBannerEnabled({ className, versionMetadata }) {
const {
siteConfig: { title: siteTitle },
} = useDocusaurusContext();
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 />
</div>
</div>
);
}

export default function DocVersionBanner({ className }) {
const versionMetadata = useDocsVersion();
if (versionMetadata.banner) {
return (
<DocVersionBannerEnabled
className={className}
versionMetadata={versionMetadata}
/>
);
}
return null;
}
2 changes: 2 additions & 0 deletions static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["8.2", "8.1", "8.0", "1.3", "1.2", "1.1", "1.0", "0.26"]
["0.26"]