Fix ctrl-click for docs

ctrl-clicking doc links leads to dev branch docs if you are playing on dev branch. Makes this behavior usable before stable branch gets updated.
This commit is contained in:
omuretsu 2023-07-12 19:41:00 -04:00
parent d943f39401
commit 8b008e1b7a

@ -5,6 +5,7 @@ import { MD } from "../../ui/MD/MD";
import { getPage } from "./root";
import { Navigator, useHistory } from "../../ui/React/Documentation";
import { CONSTANTS } from "../../Constants";
const resolveRelativePath = (folder: string, relative: string): string => {
const noLastSlash = folder.endsWith("/") ? folder.slice(0, folder.length - 1) : folder;
@ -29,7 +30,8 @@ export function DocumentationRoot(): React.ReactElement {
navigate(relPath: string, external: boolean) {
const newPath = resolvePath(history.page, relPath);
if (external) {
const url = `https://github.com/bitburner-official/bitburner-src/blob/stable/src/Documentation/ui/doc/${newPath}`;
const ver = CONSTANTS.isDevBranch ? "dev" : "stable";
const url = `https://github.com/bitburner-official/bitburner-src/blob/${ver}/src/Documentation/ui/doc/${newPath}`;
window.open(url, "_newtab");
return;
}