mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-23 06:10:57 +00:00
29 lines
733 B
TypeScript
29 lines
733 B
TypeScript
import { lazy, Suspense } from "react";
|
|
import { useTouchDevice } from "./useTouchDevice";
|
|
|
|
const TouchJoystick = lazy(() =>
|
|
import("@/src/components/TouchJoystick").then((mod) => ({
|
|
default: mod.TouchJoystick,
|
|
})),
|
|
);
|
|
|
|
const KeyboardOverlay = lazy(() =>
|
|
import("@/src/components/KeyboardOverlay").then((mod) => ({
|
|
default: mod.KeyboardOverlay,
|
|
})),
|
|
);
|
|
|
|
export function VisualInput() {
|
|
const isTouch = useTouchDevice();
|
|
|
|
return (
|
|
<Suspense>
|
|
{isTouch ? <TouchJoystick /> : null}
|
|
{isTouch === false ? (
|
|
// isTouch can be `null` before we know for sure; make sure this doesn't
|
|
// render until it's definitively false
|
|
<KeyboardOverlay />
|
|
) : null}
|
|
</Suspense>
|
|
);
|
|
}
|