Skip to content

Commit

Permalink
[Fix] Default settings init in welcome page
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroxyDev committed Apr 20, 2024
1 parent dc433bd commit 2005e05
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
},
"name": "flightmetrics",
"version": "1.3.6",
"version": "1.3.7",
"private": true,
"scripts": {
"dev": "next dev --port 3000",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flightmetrics"
version = "1.3.6"
version = "1.3.7"
description = "FlightMetrics is a tool for aircraft simulation"
authors = ["you"]
license = ""
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "FlightMetrics",
"version": "1.3.6"
"version": "1.3.7"
},
"tauri": {
"allowlist": {
Expand Down
3 changes: 1 addition & 2 deletions src/app/utils/states.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ export const useLocalStorageState = (key: string, defaultValue: any) => {

useEffect(() => {
if (isClient) {
console.log(key, value);
return
localStorage.setItem(key, JSON.stringify(value));
return
}
}, [key, value, isClient]);

Expand Down
26 changes: 24 additions & 2 deletions src/app/welcome/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import HighlightButton from '../UI/buttons/highlight-button';
import DownloadButton from '../UI/buttons/downloadButton';
import generalSettings from '@/config/general';
import QRGen from '../UI/QR/generateQR';
import { useSwitchState } from '../utils/states';

interface WindowProps extends Window {
__TAURI__?: boolean;
}
declare const window: WindowProps;

export default function Welcome() {
const [isMounted, setIsMounted] = useState<boolean>(false);
const [isTauri, setIsTauri] = useState<boolean>(false);
Expand All @@ -27,10 +28,31 @@ export default function Welcome() {
setIsMounted(true);
}, 0); // Sin retraso para mostrar la bienvenida inmediatamente
return () => clearTimeout(timer);


}, []);


/*
***********************
SET DEFAULT SETTINGS
***********************
*/
function SetDefaultSettings () {
useSwitchState('useSimBriefSwitch', false);
useSwitchState('useLBSwitch', false);
useSwitchState('useInfoViewerSwitch', true);
useSwitchState('useMetarSwitch', true);
useSwitchState('useSimbriefInput', "");
}

SetDefaultSettings()

/*
***********************
SET DEFAULT SETTINGS END
***********************
*/

const handleDownload = () => {
// Hacer la solicitud a la API
fetch(generalSettings.appAPI)
Expand Down

0 comments on commit 2005e05

Please sign in to comment.