mirror of
https://github.com/vector-im/element-call.git
synced 2026-09-22 22:29:30 +00:00
ErrorView needed a widget only to decide whether to offer a close button or a link home. That prop was threaded down through ErrorPage, RichError and GroupCallErrorBoundary from seven call sites, to answer the single question of whether the host can dismiss Element Call — which the host bridge now answers directly through the presence of close(). Read the bridge from context in ErrorView and remove the prop, along with the plumbing that carried it. No functional change: the rendered output is unchanged, as the existing snapshot confirms. Move GroupCallView onto the host bridge GroupCallView asked the widget API to keep it on screen, to close it, and to tell it when a preloaded call should join. Route all three through the host bridge and drop the widget prop.
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
/*
|
|
Copyright 2025 New Vector Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
import { PopOutIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
|
|
|
import type { FC, ReactNode } from "react";
|
|
import { ErrorView } from "./ErrorView";
|
|
|
|
/**
|
|
* An error consisting of a terse message to be logged to the console and a
|
|
* richer message to be shown to the user, as a full-screen page.
|
|
*/
|
|
export class RichError extends Error {
|
|
public constructor(
|
|
message: string,
|
|
/**
|
|
* The pretty, more helpful message to be shown on the error screen.
|
|
*/
|
|
public readonly richMessage: ReactNode,
|
|
) {
|
|
super(message);
|
|
}
|
|
}
|
|
|
|
const OpenElsewhere: FC = () => {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<ErrorView Icon={PopOutIcon} title={t("error.open_elsewhere")}>
|
|
<p>
|
|
{t("error.open_elsewhere_description", {
|
|
brand: import.meta.env.VITE_PRODUCT_NAME || "Element Call",
|
|
})}
|
|
</p>
|
|
</ErrorView>
|
|
);
|
|
};
|
|
|
|
export class OpenElsewhereError extends RichError {
|
|
public constructor() {
|
|
super("App opened in another tab", <OpenElsewhere />);
|
|
}
|
|
}
|