Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/common/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const getTheme = (): Theme => {
const defaultMainFont = isString(window.mainFont) ? window.mainFont : "";
const defaultCodeFont = isString(window.codeFont) ? window.codeFont : "";

export const App = ({ theme, children }: AppProps) => {
export const App = ({ theme, children, id }: AppProps) => {
const [currentTheme, setCurrentTheme] = useState(theme ?? getTheme());
const [mainFont, setMainFont] = useState(defaultMainFont);
const [codeFont, setCodeFont] = useState(defaultCodeFont);
Expand Down Expand Up @@ -104,7 +104,8 @@ export const App = ({ theme, children }: AppProps) => {
logger.error(error, info);
sendErrorTrackingEvent(error, {
severity: "high",
level: "App react component"
level: "App react component",
app: id
});
};

Expand Down
1 change: 1 addition & 0 deletions src/components/common/App/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { InsightViewType } from "../../Insights/types";
export interface AppProps {
children: ReactNode;
theme?: Theme;
id?: string;
}

export type InstallationType =
Expand Down
6 changes: 4 additions & 2 deletions src/containers/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import { isString } from "../../typeGuards/isString";
import { handleUncaughtError } from "../../utils/handleUncaughtError";
import { GlobalStyle } from "./styles";

const APP_ID = "dashboard";

initializeDigmaMessageListener(dispatcher);

window.sendMessageToDigma = sendMessage;
window.cancelMessageToDigma = cancelMessage;

window.addEventListener("error", (e) => {
handleUncaughtError("dashboard", e);
handleUncaughtError(APP_ID, e);
});

const rootElement = document.getElementById("root");
Expand All @@ -40,7 +42,7 @@ const getView = () => {
if (rootElement) {
const root = createRoot(rootElement);
root.render(
<App>
<App id={APP_ID}>
<GlobalStyle />
{getView()}
</App>
Expand Down
6 changes: 4 additions & 2 deletions src/containers/Documentation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ import { dispatcher } from "../../dispatcher";
import { handleUncaughtError } from "../../utils/handleUncaughtError";
import { GlobalStyle } from "./styles";

const APP_ID = "documentation";

initializeDigmaMessageListener(dispatcher);

window.sendMessageToDigma = sendMessage;
window.cancelMessageToDigma = cancelMessage;

window.addEventListener("error", (e) => {
handleUncaughtError("documentation", e);
handleUncaughtError(APP_ID, e);
});

const rootElement = document.getElementById("root");

if (rootElement) {
const root = createRoot(rootElement);
root.render(
<App>
<App id={APP_ID}>
<GlobalStyle />
<Documentation />
</App>
Expand Down
6 changes: 4 additions & 2 deletions src/containers/InstallationWizard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ import { dispatcher } from "../../dispatcher";
import { handleUncaughtError } from "../../utils/handleUncaughtError";
import { GlobalStyle } from "./styles";

const APP_ID = "installationWizard";

initializeDigmaMessageListener(dispatcher);

window.sendMessageToDigma = sendMessage;
window.cancelMessageToDigma = cancelMessage;

window.addEventListener("error", (e) => {
handleUncaughtError("installationWizard", e);
handleUncaughtError(APP_ID, e);
});

const rootElement = document.getElementById("root");

if (rootElement) {
const root = createRoot(rootElement);
root.render(
<App>
<App id={APP_ID}>
<GlobalStyle />
<InstallationWizard />
</App>
Expand Down
6 changes: 4 additions & 2 deletions src/containers/Main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ import { dispatcher } from "../../dispatcher";
import { handleUncaughtError } from "../../utils/handleUncaughtError";
import { router } from "./router";

const APP_ID = "main";

initializeDigmaMessageListener(dispatcher);

window.sendMessageToDigma = sendMessage;
window.cancelMessageToDigma = cancelMessage;

window.addEventListener("error", (e) => {
handleUncaughtError("main", e);
handleUncaughtError(APP_ID, e);
});

const rootElement = document.getElementById("root");

if (rootElement) {
const root = createRoot(rootElement);
root.render(
<App>
<App id={APP_ID}>
<RouterProvider router={router} />
</App>
);
Expand Down
6 changes: 4 additions & 2 deletions src/containers/Notifications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ import { dispatcher } from "../../dispatcher";
import { handleUncaughtError } from "../../utils/handleUncaughtError";
import { GlobalStyle } from "./styles";

const APP_ID = "notifications";

initializeDigmaMessageListener(dispatcher);

window.sendMessageToDigma = sendMessage;
window.cancelMessageToDigma = cancelMessage;

window.addEventListener("error", (e) => {
handleUncaughtError("notifications", e);
handleUncaughtError(APP_ID, e);
});

const rootElement = document.getElementById("root");

if (rootElement) {
const root = createRoot(rootElement);
root.render(
<App>
<App id={APP_ID}>
<GlobalStyle />
<Notifications />
</App>
Expand Down
6 changes: 4 additions & 2 deletions src/containers/RecentActivity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ import { dispatcher } from "../../dispatcher";
import { handleUncaughtError } from "../../utils/handleUncaughtError";
import { GlobalStyle } from "./styles";

const APP_ID = "recentActivity";

initializeDigmaMessageListener(dispatcher);

window.sendMessageToDigma = sendMessage;
window.cancelMessageToDigma = cancelMessage;

window.addEventListener("error", (e) => {
handleUncaughtError("recentActivity", e);
handleUncaughtError(APP_ID, e);
});

const rootElement = document.getElementById("root");

if (rootElement) {
const root = createRoot(rootElement);
root.render(
<App>
<App id={APP_ID}>
<GlobalStyle />
<RecentActivity />
</App>
Expand Down
6 changes: 4 additions & 2 deletions src/containers/Troubleshooting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ import { dispatcher } from "../../dispatcher";
import { handleUncaughtError } from "../../utils/handleUncaughtError";
import { GlobalStyle } from "./styles";

const APP_ID = "troubleshooting";

initializeDigmaMessageListener(dispatcher);

window.sendMessageToDigma = sendMessage;
window.cancelMessageToDigma = cancelMessage;

window.addEventListener("error", (e) => {
handleUncaughtError("troubleshooting", e);
handleUncaughtError(APP_ID, e);
});

const rootElement = document.getElementById("root");

if (rootElement) {
const root = createRoot(rootElement);
root.render(
<App>
<App id={APP_ID}>
<GlobalStyle />
<Troubleshooting />
</App>
Expand Down