From f8d0aee84eb47c03ac4d6ace1216332ad79fd616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20G=C3=B3mez?= Date: Mon, 23 Sep 2024 06:10:49 +0200 Subject: [PATCH] feat: show channel id in channel info dialog --- frontend/src/dialogs/channel-dialog.ts | 7 +++++++ frontend/src/ui/text-input.ts | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/src/dialogs/channel-dialog.ts b/frontend/src/dialogs/channel-dialog.ts index 8da489e..67919ac 100644 --- a/frontend/src/dialogs/channel-dialog.ts +++ b/frontend/src/dialogs/channel-dialog.ts @@ -9,6 +9,7 @@ import { RemoveDialog } from "./remove-dialog"; export class ChannelDialog extends Dialog { private channel: IChannel; private nameField: TextInput; + private idField: TextInput; private makeDefault: Button; private mergeButton: Button; private deleteButton: Button; @@ -19,6 +20,11 @@ export class ChannelDialog extends Dialog { this.nameField = new TextInput("Channel name"); this.nameField.setPosition(25, 10, 50, 10); this.nameField.setValue(channel.name); + this.idField = new TextInput("Channel ID (for use with API)"); + this.idField.setPosition(45, 10, 50, 10); + this.idField.setReadonly(true); + this.idField.setValue(channel.id.toString()); + this.makeDefault = new Button("Make default"); this.makeDefault.setPosition(20, 70, 10, 10); this.makeDefault.onClick(() => { @@ -39,6 +45,7 @@ export class ChannelDialog extends Dialog { this.deleteChannel(); }); this.add(this.nameField); + this.add(this.idField); this.add(this.makeDefault); this.add(this.mergeButton); this.add(this.deleteButton); diff --git a/frontend/src/ui/text-input.ts b/frontend/src/ui/text-input.ts index dd5a37b..735a05d 100644 --- a/frontend/src/ui/text-input.ts +++ b/frontend/src/ui/text-input.ts @@ -45,4 +45,9 @@ export class TextInput extends UINode { this.inputElement.value = value; return this; } -} \ No newline at end of file + + public setReadonly(readonly: boolean) { + this.inputElement.readOnly = readonly; + return this; + } +}