function VersionNotice()

in website/src/components/UpgradeGuide/index.tsx [39:112]


function VersionNotice() {
  const latestVersion = useLatestVersion();
  const activeVersion = useActiveDocContext().activeVersion!;
  const isBrowser = useIsBrowser();
  // It's possible that the user is browsing a snapshot version
  // which is only detectable once we are in the browser
  if (isBrowser) {
    const location = window.location.hostname;
    if (
      location.includes('netlify.app') &&
      !location.includes('deploy-preview')
    ) {
      return (
        <Admonition type="caution">
          <p>
            <Translate
              id="upgradeGuide.archivedVersion.notice"
              values={{
                mainSiteLink: (
                  <Link href="https://docusaurus.io/docs/installation">
                    <Translate id="upgradeGuide.archivedVersion.notice.mainSiteLink.label">
                      main site
                    </Translate>
                  </Link>
                ),
              }}>
              {
                'You are browsing an archived version and the snippet below is outdated. Please go to the {mainSiteLink} and follow the instructions there to upgrade to the latest version.'
              }
            </Translate>
          </p>
        </Admonition>
      );
    }
  }
  if (activeVersion.name === 'current') {
    return (
      <Admonition type="info">
        <p>
          <Translate
            id="upgradeGuide.unreleasedVersion.notice"
            values={{
              canaryDocLink: (
                <Link href="/community/canary">
                  <Translate
                    id="upgradeGuide.unreleasedVersion.notice.canaryDocLink.label"
                    values={{canaryTag: <code>@canary</code>}}>
                    {'{canaryTag} release'}
                  </Translate>
                </Link>
              ),
            }}>
            {
              'You are browsing the documentation of an unreleased version. If you want to use any unreleased feature, you can use the {canaryDocLink}.'
            }
          </Translate>
        </p>
      </Admonition>
    );
  }
  if (activeVersion.name !== latestVersion.name) {
    return (
      <Admonition type="caution">
        <p>
          <Translate id="upgradeGuide.outdatedVersion.notice">
            You are browsing the documentation of an outdated version. The
            snippet below shows how to upgrade to the latest version.
          </Translate>
        </p>
      </Admonition>
    );
  }
  return null;
}