diff --git a/.babelrc b/.babelrc index fbfb0025..0b2c6939 100644 --- a/.babelrc +++ b/.babelrc @@ -13,7 +13,12 @@ ["@babel/typescript", { "isTSX": true, "allExtensions": true }] ], "plugins": [ - "@babel/plugin-transform-runtime", + ["@babel/plugin-proposal-decorators", { "version": "legacy" }], + [ + "@babel/plugin-transform-runtime", + // version defaults to 7.0.0 for which non-legacy decorators produce duplicate code + { "version": "^7.24.3" } + ], ["babel-plugin-inferno", { "imports": true }], ["@babel/plugin-transform-class-properties", { "loose": true }] ] diff --git a/.eslintrc.json b/.eslintrc.json index 4d0e7562..651ba006 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -21,6 +21,10 @@ "@typescript-eslint/explicit-module-boundary-types": 0, "@typescript-eslint/no-empty-function": 0, "@typescript-eslint/no-non-null-assertion": 0, + "@typescript-eslint/no-unused-vars": [ + "error", + { "argsIgnorePattern": "^_" } + ], "arrow-body-style": 0, "curly": 0, "eol-last": 0, diff --git a/src/client/index.tsx b/src/client/index.tsx index f2518e8f..db0a9ef7 100644 --- a/src/client/index.tsx +++ b/src/client/index.tsx @@ -16,6 +16,8 @@ async function startClient() { verifyDynamicImports(true).then(x => console.log(x)); }; + window.history.scrollRestoration = "manual"; + initializeSite(window.isoData.site_res); lazyHighlightjs.enableLazyLoading(); diff --git a/src/shared/components/app/app.tsx b/src/shared/components/app/app.tsx index 30f445f7..1538b045 100644 --- a/src/shared/components/app/app.tsx +++ b/src/shared/components/app/app.tsx @@ -13,15 +13,25 @@ import { Navbar } from "./navbar"; import "./styles.scss"; import { Theme } from "./theme"; import AnonymousGuard from "../common/anonymous-guard"; +import { destroyTippy, setupTippy } from "../../tippy"; export class App extends Component { private isoData: IsoDataOptionalSite = setIsoData(this.context); private readonly mainContentRef: RefObject; + private readonly rootRef = createRef(); constructor(props: any, context: any) { super(props, context); this.mainContentRef = createRef(); } + componentDidMount(): void { + setupTippy(this.rootRef); + } + + componentWillUnmount(): void { + destroyTippy(); + } + handleJumpToContent(event) { event.preventDefault(); this.mainContentRef.current?.focus(); @@ -34,7 +44,7 @@ export class App extends Component { return ( <> -
+