Files
ThreadNet-Web/apps/web/src/components/views/elements/BugReportDialogButton.tsx
T
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>David Baker
c02b970d35 Update dependency @vector-im/compound-web to v9.2.1 (#33270)
* Update dependency @vector-im/compound-web to v9.2.1

* Update button sizes

* More button size updates

* Another button size

* Button size

* Snapshot updates

* Snapshots

* More sm/md

* More button size updates

* snapshot

* and one more from merging develop

* More snapshots

* Phantom typing

* yep, more snapshots

* More snapshots

* More snapshots

* Last ones?

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: David Baker <dbkr@users.noreply.github.com>
2026-04-23 12:18:56 +00:00

44 lines
1.3 KiB
TypeScript

/*
Copyright 2026 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import React, { useCallback } from "react";
import { Button } from "@vector-im/compound-web";
import SdkConfig from "../../../SdkConfig";
import { _t } from "../../../languageHandler";
import Modal from "../../../Modal";
import BugReportDialog, { type BugReportDialogProps } from "../dialogs/BugReportDialog";
import { BugReportEndpointURLLocal } from "../../../IConfigOptions";
/**
* Renders a button to open the BugReportDialog *if* the configuration
* supports it.
*/
export function BugReportDialogButton({
label,
error,
}: Pick<BugReportDialogProps, "label" | "error">): React.ReactElement | null {
const bugReportUrl = SdkConfig.get().bug_report_endpoint_url;
const onClick = useCallback(() => {
Modal.createDialog(BugReportDialog, {
label,
error,
});
}, [label, error]);
if (!bugReportUrl) {
return null;
}
return (
<Button kind="secondary" size="md" onClick={onClick}>
{bugReportUrl === BugReportEndpointURLLocal
? _t("bug_reporting|download_logs")
: _t("bug_reporting|submit_debug_logs")}
</Button>
);
}