excalidraw/src/index.tsx

55 lines
1.4 KiB
TypeScript
Raw Normal View History

2020-01-05 15:10:42 +01:00
import React from "react";
import ReactDOM from "react-dom";
2020-03-31 09:37:51 +01:00
import * as Sentry from "@sentry/browser";
import * as SentryIntegrations from "@sentry/integrations";
import { TopErrorBoundary } from "./components/TopErrorBoundary";
import { IsMobileProvider } from "./is-mobile";
import { App } from "./components/App";
import "./styles.scss";
2020-01-05 15:10:42 +01:00
2020-03-31 09:37:51 +01:00
const SentyEnvHostnameMap: { [key: string]: string } = {
"excalidraw.com": "production",
"now.sh": "staging",
};
const onlineEnv = Object.keys(SentyEnvHostnameMap).find(
(item) => window.location.hostname.indexOf(item) >= 0,
);
Sentry.init({
// Disable Sentry locally to avoid noise
dsn: onlineEnv
? "https://7bfc596a5bf945eda6b660d3015a5460@sentry.io/5179260"
: undefined,
environment: onlineEnv ? SentyEnvHostnameMap[onlineEnv] : undefined,
release: process.env.REACT_APP_GIT_SHA,
integrations: [
new SentryIntegrations.CaptureConsole({
levels: ["error"],
}),
],
2020-03-31 09:37:51 +01:00
});
// Block pinch-zooming on iOS outside of the content area
document.addEventListener(
"touchmove",
function (event) {
// @ts-ignore
if (event.scale !== 1) {
event.preventDefault();
}
},
{ passive: false },
);
2020-01-05 15:10:42 +01:00
const rootElement = document.getElementById("root");
ReactDOM.render(
<TopErrorBoundary>
<IsMobileProvider>
<App />
</IsMobileProvider>
</TopErrorBoundary>,
2020-01-24 12:04:54 +02:00
rootElement,
);