diff --git a/apps/client/src/widgets/dialogs/incorrect_cpu_arch.ts b/apps/client/src/widgets/dialogs/incorrect_cpu_arch.ts deleted file mode 100644 index e28e6699a..000000000 --- a/apps/client/src/widgets/dialogs/incorrect_cpu_arch.ts +++ /dev/null @@ -1,59 +0,0 @@ -import BasicWidget from "../basic_widget.js"; -import { Modal } from "bootstrap"; -import utils from "../../services/utils.js"; -import { t } from "../../services/i18n.js"; - -const TPL = /*html*/` -`; - -export default class IncorrectCpuArchDialog extends BasicWidget { - private modal!: Modal; - private $downloadButton!: JQuery; - - doRender() { - this.$widget = $(TPL); - this.modal = Modal.getOrCreateInstance(this.$widget[0]); - this.$downloadButton = this.$widget.find(".download-correct-version-button"); - - this.$downloadButton.on("click", () => { - // Open the releases page where users can download the correct version - if (utils.isElectron()) { - const { shell } = utils.dynamicRequire("electron"); - shell.openExternal("https://github.com/TriliumNext/Trilium/releases/latest"); - } else { - window.open("https://github.com/TriliumNext/Trilium/releases/latest", "_blank"); - } - }); - - // Auto-focus the download button when shown - this.$widget.on("shown.bs.modal", () => { - this.$downloadButton.trigger("focus"); - }); - } - - showCpuArchWarningEvent() { - this.modal.show(); - } -} diff --git a/apps/client/src/widgets/dialogs/incorrect_cpu_arch.tsx b/apps/client/src/widgets/dialogs/incorrect_cpu_arch.tsx new file mode 100644 index 000000000..7b8675861 --- /dev/null +++ b/apps/client/src/widgets/dialogs/incorrect_cpu_arch.tsx @@ -0,0 +1,53 @@ +import { useRef } from "react"; +import { openDialog } from "../../services/dialog.js"; +import { t } from "../../services/i18n.js"; +import utils from "../../services/utils.js"; +import Button from "../react/Button.js"; +import Modal from "../react/Modal.js"; +import ReactBasicWidget from "../react/ReactBasicWidget.js"; + +function IncorrectCpuArchDialogComponent() { + const downloadButtonRef = useRef(null); + + return ( + downloadButtonRef.current?.focus()} + footerAlignment="between" + footer={<> +