Expose and pre-populate thread ID in devtools dialog (#10953)

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Travis Ralston 2023-07-07 08:40:25 -06:00 committed by GitHub
parent cfd48b36aa
commit 8a97e5f351
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 286 additions and 48 deletions

View file

@ -65,12 +65,13 @@ const Tools: Record<Category, [label: string, tool: Tool][]> = {
interface IProps {
roomId: string;
threadRootId?: string | null;
onFinished(finished?: boolean): void;
}
type ToolInfo = [label: string, tool: Tool];
const DevtoolsDialog: React.FC<IProps> = ({ roomId, onFinished }) => {
const DevtoolsDialog: React.FC<IProps> = ({ roomId, threadRootId, onFinished }) => {
const [tool, setTool] = useState<ToolInfo | null>(null);
let body: JSX.Element;
@ -125,9 +126,18 @@ const DevtoolsDialog: React.FC<IProps> = ({ roomId, onFinished }) => {
<CopyableText className="mx_DevTools_label_right" getTextToCopy={() => roomId} border={false}>
{_t("Room ID: %(roomId)s", { roomId })}
</CopyableText>
{!threadRootId ? null : (
<CopyableText
className="mx_DevTools_label_right"
getTextToCopy={() => threadRootId}
border={false}
>
{_t("Thread Root ID: %(threadRootId)s", { threadRootId })}
</CopyableText>
)}
<div className="mx_DevTools_label_bottom" />
{cli.getRoom(roomId) && (
<DevtoolsContext.Provider value={{ room: cli.getRoom(roomId)! }}>
<DevtoolsContext.Provider value={{ room: cli.getRoom(roomId)!, threadRootId }}>
{body}
</DevtoolsContext.Provider>
)}