Fixes for successful production build
This commit is contained in:
parent
99477f9b12
commit
a657cde275
|
@ -44,19 +44,20 @@ export default function Home() {
|
||||||
background: { default: "#000" },
|
background: { default: "#000" },
|
||||||
primary: { main: "#9d9d9d" },
|
primary: { main: "#9d9d9d" },
|
||||||
secondary: { main: "#262626" },
|
secondary: { main: "#262626" },
|
||||||
error: { main: "#cb0801",A700: "#fff" },
|
error: { main: "#cb0801", A700: "#fff" },
|
||||||
warning: {main:"#cb7c01"}
|
warning: { main: "#cb7c01" },
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
let apiUrl: string;
|
||||||
function sendApi(
|
function sendApi(
|
||||||
path: string,
|
path: string,
|
||||||
method: RequestInit["method"] = "GET",
|
method: RequestInit["method"] = "GET",
|
||||||
body?: any,
|
body?: any,
|
||||||
fetchOptions?: RequestInit
|
fetchOptions?: RequestInit
|
||||||
) {
|
) {
|
||||||
const url = new URL(path, "http://10.0.0.200:3001/");
|
const url = new URL(path, apiUrl);
|
||||||
return fetch(url.toString(), {
|
return fetch(url.toString(), {
|
||||||
method,
|
method,
|
||||||
body: body !== undefined ? JSON.stringify(body) : undefined,
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
||||||
|
@ -116,24 +117,23 @@ export default function Home() {
|
||||||
}>();
|
}>();
|
||||||
const [width, setWidth] = useState(1000);
|
const [width, setWidth] = useState(1000);
|
||||||
const [isLoaded, setIsLoaded] = useState(false);
|
const [isLoaded, setIsLoaded] = useState(false);
|
||||||
// const eventCounter = useMemo(() => {
|
|
||||||
// const eventCounter = new EventCounter<"emptySpaceClick">();
|
|
||||||
// eventCounter.on({
|
|
||||||
// callback: () => {
|
|
||||||
|
|
||||||
// },
|
|
||||||
// count: 3,
|
|
||||||
// name: "emptySpaceClick",
|
|
||||||
// });
|
|
||||||
// return eventCounter;
|
|
||||||
// }, []);
|
|
||||||
const isItMobileDevice = useMemo(
|
const isItMobileDevice = useMemo(
|
||||||
() =>
|
() =>
|
||||||
typeof window !== "undefined" ? isItMobile(navigator.userAgent) : "",
|
typeof window !== "undefined" ? isItMobile(navigator.userAgent) : "",
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
const toggleFullscreen = () => {
|
||||||
|
if (document.fullscreenElement === null)
|
||||||
|
document.documentElement.requestFullscreen();
|
||||||
|
else document.exitFullscreen();
|
||||||
|
};
|
||||||
|
let isFullscreen: boolean = false;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const _apiUrl = new URL(document.URL);
|
||||||
|
_apiUrl.port = "3001";
|
||||||
|
apiUrl = _apiUrl.toString();
|
||||||
|
|
||||||
sendApi("/values")
|
sendApi("/values")
|
||||||
.then((v: Values) => {
|
.then((v: Values) => {
|
||||||
setValues({
|
setValues({
|
||||||
|
@ -152,18 +152,16 @@ export default function Home() {
|
||||||
.catch((e) => console.error(e));
|
.catch((e) => console.error(e));
|
||||||
setSnackBarVisibility(!isSnackBarHidden);
|
setSnackBarVisibility(!isSnackBarHidden);
|
||||||
setWidth(window.innerWidth);
|
setWidth(window.innerWidth);
|
||||||
|
window.onresize = () => {
|
||||||
|
setWidth(window.innerWidth);
|
||||||
|
};
|
||||||
|
isFullscreen = document.fullscreenElement !== null;
|
||||||
}, []);
|
}, []);
|
||||||
const strips = { virtual: 3, physical: 5 };
|
const strips = { virtual: 3, physical: 5 };
|
||||||
const buses = { virtual: 3, physical: 5 };
|
const buses = { virtual: 3, physical: 5 };
|
||||||
const amountOfStrips = strips.physical + strips.virtual;
|
const amountOfStrips = strips.physical + strips.virtual;
|
||||||
const amountOfBuses = buses.physical + buses.virtual;
|
const amountOfBuses = buses.physical + buses.virtual;
|
||||||
const virtualInputNames = useMemo(() => ["VAIO", "AUX", "VAIO3"], []);
|
const virtualInputNames = useMemo(() => ["VAIO", "AUX", "VAIO3"], []);
|
||||||
if (typeof document !== "undefined") {
|
|
||||||
// document.onclick = () => eventCounter.emit("emptySpaceClick");
|
|
||||||
window.onresize = () => {
|
|
||||||
setWidth(window.innerWidth);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const snackBarActionButton = (
|
const snackBarActionButton = (
|
||||||
<>
|
<>
|
||||||
|
@ -266,7 +264,7 @@ export default function Home() {
|
||||||
<Typography variant={"button"} fontWeight={500}>
|
<Typography variant={"button"} fontWeight={500}>
|
||||||
Double {isItMobileDevice ? "tap" : "click"}
|
Double {isItMobileDevice ? "tap" : "click"}
|
||||||
</Typography>{" "}
|
</Typography>{" "}
|
||||||
on any gain slider to reset it's value to 0 dB
|
on any gain slider to reset it's value to 0 dB
|
||||||
<br />
|
<br />
|
||||||
</Typography>
|
</Typography>
|
||||||
{/* <Typography component={"span"}>
|
{/* <Typography component={"span"}>
|
||||||
|
@ -282,22 +280,15 @@ export default function Home() {
|
||||||
<Fab
|
<Fab
|
||||||
size="medium"
|
size="medium"
|
||||||
sx={{
|
sx={{
|
||||||
position: "absolute",
|
position: "fixed",
|
||||||
bottom: 15,
|
bottom: 15,
|
||||||
right: 15,
|
right: 15,
|
||||||
|
zIndex: theme.zIndex.drawer + 2,
|
||||||
}}
|
}}
|
||||||
color="secondary"
|
color="secondary"
|
||||||
onClick={() => {
|
onClick={() => toggleFullscreen()}
|
||||||
if (document.fullscreenElement === null)
|
|
||||||
document.documentElement.requestFullscreen();
|
|
||||||
else document.exitFullscreen();
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{document.fullscreenElement === null ? (
|
{isFullscreen ? <FullscreenExit /> : <FullscreenIcon />}
|
||||||
<FullscreenIcon />
|
|
||||||
) : (
|
|
||||||
<FullscreenExit />
|
|
||||||
)}
|
|
||||||
</Fab>
|
</Fab>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user