(fix): small desktop app bugs
This commit is contained in:
parent
b0cdf0adf2
commit
d16f260a3a
3 changed files with 8 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ import {
|
||||||
} from "react";
|
} from "react";
|
||||||
import { getCurrent, onOpenUrl } from "@tauri-apps/plugin-deep-link";
|
import { getCurrent, onOpenUrl } from "@tauri-apps/plugin-deep-link";
|
||||||
import { isTauri } from "@tauri-apps/api/core";
|
import { isTauri } from "@tauri-apps/api/core";
|
||||||
|
import { useIsMobile } from "@tensamin/ui";
|
||||||
|
|
||||||
type DeeplinkContextValue = {
|
type DeeplinkContextValue = {
|
||||||
deeplinks: readonly string[];
|
deeplinks: readonly string[];
|
||||||
|
|
@ -31,10 +32,10 @@ export default function DeeplinkProvider({
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}) {
|
}) {
|
||||||
const [deeplinks, setDeeplinks] = useState<string[]>([]);
|
const [deeplinks, setDeeplinks] = useState<string[]>([]);
|
||||||
const isTauriEnv = isTauri();
|
const isMobile = useIsMobile();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isTauriEnv) return;
|
if (!isTauri() || !isMobile) return;
|
||||||
|
|
||||||
let mounted = true;
|
let mounted = true;
|
||||||
let unlisten: (() => void) | undefined;
|
let unlisten: (() => void) | undefined;
|
||||||
|
|
@ -57,7 +58,7 @@ export default function DeeplinkProvider({
|
||||||
mounted = false;
|
mounted = false;
|
||||||
unlisten?.();
|
unlisten?.();
|
||||||
};
|
};
|
||||||
}, [isTauriEnv]);
|
}, [isMobile]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<deeplinkContext.Provider
|
<deeplinkContext.Provider
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ export default function Navbar({ forMobile }: { forMobile: boolean }) {
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Controls className="mr-2 ring-border" />
|
<Controls className="mr-2" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Button, cn } from "@tensamin/ui";
|
import { Button, cn, useIsMobile } from "@tensamin/ui";
|
||||||
import { Input } from "@tensamin/ui";
|
import { Input } from "@tensamin/ui";
|
||||||
import { Label } from "@tensamin/ui";
|
import { Label } from "@tensamin/ui";
|
||||||
import { useStorage } from "@tensamin/storage/context";
|
import { useStorage } from "@tensamin/storage/context";
|
||||||
|
|
@ -84,6 +84,7 @@ function parseTuFileContent(rawFileContent: string): {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Form() {
|
export default function Form() {
|
||||||
|
const isMobile = useIsMobile();
|
||||||
const uploadRef = React.useRef<HTMLInputElement | null>(null);
|
const uploadRef = React.useRef<HTMLInputElement | null>(null);
|
||||||
const [isDragging, setIsDragging] = React.useState(false);
|
const [isDragging, setIsDragging] = React.useState(false);
|
||||||
const { save } = useStorage();
|
const { save } = useStorage();
|
||||||
|
|
@ -266,7 +267,7 @@ export default function Form() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative flex md:flex-row flex-col gap-15">
|
<div className="relative flex md:flex-row flex-col gap-15">
|
||||||
{isTauri() ? (
|
{isTauri() && isMobile ? (
|
||||||
<>
|
<>
|
||||||
<QrCodeScanner
|
<QrCodeScanner
|
||||||
onData={async (data) => {
|
onData={async (data) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue