Added switch between fetchurls on DEV, updated dependencies
This commit is contained in:
parent
f6197fd142
commit
3245769977
839
package-lock.json
generated
839
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -9,19 +9,19 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^10.4.13",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"postcss": "^8.4.21",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"typescript": "^4.9.5",
|
||||
"vite": "^4.1.4",
|
||||
"vite-plugin-solid": "^2.5.0"
|
||||
"tailwindcss": "^3.3.1",
|
||||
"typescript": "^5.0.3",
|
||||
"vite": "^4.2.1",
|
||||
"vite-plugin-solid": "^2.7.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/diff": "^5.0.2",
|
||||
"@types/diff": "^5.0.3",
|
||||
"diff": "^5.1.0",
|
||||
"solid-headless": "^0.13.1",
|
||||
"solid-heroicons": "^3.1.1",
|
||||
"solid-js": "^1.6.11",
|
||||
"solid-js": "^1.7.2",
|
||||
"xlsx": "^0.18.5"
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,11 @@ import { isTouch } from "./functions/touch";
|
||||
|
||||
type Option = { name: string, value: "NONE" | "TRUE" | "FALSE" | "DEFAULT" | "TRUE_FIRST" | "FALSE_FIRST" };
|
||||
|
||||
const fetchUrls = [
|
||||
"http://localhost:8080/simplify/table/",
|
||||
"https://api.martials.no/simplify-truths/do/simplify/table/"
|
||||
];
|
||||
|
||||
// TODO move some code to new components
|
||||
const TruthTablePage: Component = () => {
|
||||
|
||||
@ -82,6 +87,8 @@ const TruthTablePage: Component = () => {
|
||||
|
||||
const [error, setError] = createSignal<{ title: string, message: string } | null>(null);
|
||||
|
||||
const [useLocalhost, setUseLocalhost] = createSignal(false);
|
||||
|
||||
/**
|
||||
* Updates the state of the current expression to the new search with all whitespace removed.
|
||||
* If the element is not found, reset.
|
||||
@ -106,8 +113,8 @@ hide=${ hideValues().value }&sort=${ sortValues().value }&hideIntermediate=${ hi
|
||||
if (exp !== "") {
|
||||
setError(null);
|
||||
setIsLoaded(false);
|
||||
// TODO add button on DEV to switch between local and remote
|
||||
fetch(`${ import.meta.env.VITE_FETCH_FULL }${ encodeURIComponent(exp) }?
|
||||
|
||||
fetch(`${ fetchUrls[useLocalhost() ? 0 : 1] }${ encodeURIComponent(exp) }?
|
||||
simplify=${ simplifyEnabled() }&hide=${ hideValues().value }&sort=${ sortValues().value }&caseSensitive=false&
|
||||
hideIntermediate=${ hideIntermediates() }`)
|
||||
.then(res => res.json())
|
||||
@ -182,6 +189,12 @@ hideIntermediate=${ hideIntermediates() }`)
|
||||
return (
|
||||
<Layout title={ "Truth tables" }>
|
||||
|
||||
<Show when={ import.meta.env.DEV ?? false } keyed>
|
||||
(DEV) Use localhost:
|
||||
<MySwitch title={ "Use localhost" } defaultValue={ false }
|
||||
onChange={ setUseLocalhost } />
|
||||
</Show>
|
||||
|
||||
<div id={ "truth-content" }>
|
||||
<div class={ "max-w-2xl mx-auto" }>
|
||||
<MyDisclosureContainer>
|
||||
|
Loading…
x
Reference in New Issue
Block a user