From c2bcda925ace424ce30cf2370a2a8fbffec3aab9 Mon Sep 17 00:00:00 2001 From: Felix Kaspar Date: Mon, 12 Aug 2024 22:49:00 +0200 Subject: [PATCH] Fixed Tauri-Build (now using absolute paths again) --- client-tauri/package.json | 2 +- client-tauri/src/App.tsx | 11 +--- client-tauri/src/components/OperatorCard.tsx | 2 +- .../src/components/toolbar/LanguagePicker.tsx | 52 +++++++++---------- client-tauri/src/pages/Home.tsx | 2 - client-tauri/src/pages/Operators.tsx | 2 +- client-tauri/vite.config.ts | 2 +- shared-operations/src/functions/index.ts | 2 +- 8 files changed, 32 insertions(+), 43 deletions(-) diff --git a/client-tauri/package.json b/client-tauri/package.json index ab55d1f59..29f8f89e6 100644 --- a/client-tauri/package.json +++ b/client-tauri/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", - "preview": "vite preview", + "preview (previously built files)": "vite preview", "tauri-dev (currently broken)": "tauri dev", "tauri-build-debug": "tauri build --debug", "tauri-build": "tauri build" diff --git a/client-tauri/src/App.tsx b/client-tauri/src/App.tsx index 1b7b02b59..9c36ad15e 100644 --- a/client-tauri/src/App.tsx +++ b/client-tauri/src/App.tsx @@ -41,7 +41,7 @@ export default function App() { routes for. */} } /> - + }> } /> {listOperatorNames().map((name) => { @@ -49,15 +49,6 @@ export default function App() { })} } /> - - }> - {/* } /> */} - } /> - - }> - {/* } /> */} - } /> - ); diff --git a/client-tauri/src/components/OperatorCard.tsx b/client-tauri/src/components/OperatorCard.tsx index f2e53c453..82ffda937 100644 --- a/client-tauri/src/components/OperatorCard.tsx +++ b/client-tauri/src/components/OperatorCard.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from 'react'; +import { useEffect, useState } from 'react'; import { getSchemaByName } from "@stirling-pdf/shared-operations/src/workflow/operatorAccessor"; diff --git a/client-tauri/src/components/toolbar/LanguagePicker.tsx b/client-tauri/src/components/toolbar/LanguagePicker.tsx index 8680450ab..5d9c7e954 100644 --- a/client-tauri/src/components/toolbar/LanguagePicker.tsx +++ b/client-tauri/src/components/toolbar/LanguagePicker.tsx @@ -1,30 +1,30 @@ -import NavDropdown from "react-bootstrap/NavDropdown"; -import { useTranslation } from "react-i18next"; -import { BsGlobe2 } from "react-icons/bs"; +// import NavDropdown from "react-bootstrap/NavDropdown"; +// import { useTranslation } from "react-i18next"; +// import { BsGlobe2 } from "react-icons/bs"; -function generateSublist() { - const { i18n } = useTranslation(); - const out: JSX.Element[] = []; - const languages = i18n.options.resources; +// function generateSublist() { +// const { i18n } = useTranslation(); +// const out: JSX.Element[] = []; +// const languages = i18n.options.resources; - for (const key in languages) { - const lang: any = languages[key].translation; - const staticKey = key; - out.push(( - i18n.changeLanguage(staticKey)}> - {lang.language?.flag} - {lang.language?.name} - - )); - } - return <>{out}; -} +// for (const key in languages) { +// const lang: any = languages[key].translation; +// const staticKey = key; +// out.push(( +// i18n.changeLanguage(staticKey)}> +// {lang.language?.flag} +// {lang.language?.name} +// +// )); +// } +// return <>{out}; +// } -export default function LanguagePicker() { - return ( - }> - {generateSublist()} - - ); -} +// export default function LanguagePicker() { +// return ( +// }> +// {generateSublist()} +// +// ); +// } diff --git a/client-tauri/src/pages/Home.tsx b/client-tauri/src/pages/Home.tsx index e2f211399..a77c564b7 100644 --- a/client-tauri/src/pages/Home.tsx +++ b/client-tauri/src/pages/Home.tsx @@ -1,5 +1,3 @@ -import { Link } from "react-router-dom"; - import { listOperatorNames } from "@stirling-pdf/shared-operations/src/workflow/operatorAccessor"; import { OperatorCard } from "../components/OperatorCard"; diff --git a/client-tauri/src/pages/Operators.tsx b/client-tauri/src/pages/Operators.tsx index a96b8b4f7..ef0159c89 100644 --- a/client-tauri/src/pages/Operators.tsx +++ b/client-tauri/src/pages/Operators.tsx @@ -26,7 +26,7 @@ function Dynamic() { }); }, [location]); - const inputRef = useRef(); + const inputRef = useRef(null); async function handleSubmit(e: BaseSyntheticEvent) { const formData = new FormData(e.target); diff --git a/client-tauri/vite.config.ts b/client-tauri/vite.config.ts index 3ba1414f2..55d8a70d5 100644 --- a/client-tauri/vite.config.ts +++ b/client-tauri/vite.config.ts @@ -49,5 +49,5 @@ export default defineConfig(async () => ({ // 3. to make use of `TAURI_DEBUG` and other env variables // https://tauri.app/v1/api/config#buildconfig.beforedevcommand envPrefix: ["VITE_"], - base: '', + base: '/', // relative paths sadly don't work with react router dom sub-dirs for some reason... })); diff --git a/shared-operations/src/functions/index.ts b/shared-operations/src/functions/index.ts index 8f2228829..2573483a2 100644 --- a/shared-operations/src/functions/index.ts +++ b/shared-operations/src/functions/index.ts @@ -1,6 +1,6 @@ import { PdfFile } from "../wrappers/PdfFile"; import { Action } from "../../declarations/Action"; -import Joi, { StringRegexOptions } from "@stirling-tools/joi"; +import Joi from "@stirling-tools/joi"; import { MaterialSymbolProps } from "react-material-symbols";