Remove releases folder from git and force Desktop UI.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -23,3 +23,4 @@ dist-ssr
|
|||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
/db/
|
/db/
|
||||||
|
/release/
|
||||||
|
|||||||
10
src/main.tsx
10
src/main.tsx
@@ -22,13 +22,11 @@ function useWindowWidth() {
|
|||||||
const newIsMobile = newWidth < 768;
|
const newIsMobile = newWidth < 768;
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|
||||||
// If we've already switched once, don't switch again for a very long time
|
|
||||||
if (hasSwitchedOnce.current && (now - lastSwitchTime.current) < 10000) {
|
if (hasSwitchedOnce.current && (now - lastSwitchTime.current) < 10000) {
|
||||||
setWidth(newWidth);
|
setWidth(newWidth);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only switch if we're actually crossing the threshold AND enough time has passed
|
|
||||||
if (newIsMobile !== isCurrentlyMobile.current && (now - lastSwitchTime.current) > 5000) {
|
if (newIsMobile !== isCurrentlyMobile.current && (now - lastSwitchTime.current) > 5000) {
|
||||||
lastSwitchTime.current = now;
|
lastSwitchTime.current = now;
|
||||||
isCurrentlyMobile.current = newIsMobile;
|
isCurrentlyMobile.current = newIsMobile;
|
||||||
@@ -38,7 +36,7 @@ function useWindowWidth() {
|
|||||||
} else {
|
} else {
|
||||||
setWidth(newWidth);
|
setWidth(newWidth);
|
||||||
}
|
}
|
||||||
}, 2000); // Even longer debounce
|
}, 2000);
|
||||||
};
|
};
|
||||||
window.addEventListener("resize", handleResize);
|
window.addEventListener("resize", handleResize);
|
||||||
|
|
||||||
@@ -54,8 +52,12 @@ function useWindowWidth() {
|
|||||||
function RootApp() {
|
function RootApp() {
|
||||||
const width = useWindowWidth();
|
const width = useWindowWidth();
|
||||||
const isMobile = width < 768;
|
const isMobile = width < 768;
|
||||||
|
const isElectron = (window as any).IS_ELECTRON === true || (window as any).electronAPI?.isElectron === true;
|
||||||
|
|
||||||
|
if (isElectron) {
|
||||||
|
return <DesktopApp />;
|
||||||
|
}
|
||||||
|
|
||||||
// Use a stable key to prevent unnecessary remounting
|
|
||||||
return isMobile ? <MobileApp key="mobile" /> : <DesktopApp key="desktop" />;
|
return isMobile ? <MobileApp key="mobile" /> : <DesktopApp key="desktop" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user