add guard cannotSetPrimaryChannel
This commit is contained in:
Vendored
+15
-2
@@ -653,6 +653,10 @@
|
|||||||
[this.primaryChannel, this.primaryChannelInput],
|
[this.primaryChannel, this.primaryChannelInput],
|
||||||
() => this.primaryChannelInput.value == "" || this.primaryChannelInput.value == this.primaryChannel.value
|
() => this.primaryChannelInput.value == "" || this.primaryChannelInput.value == this.primaryChannel.value
|
||||||
);
|
);
|
||||||
|
cannotAddSecondaryChannel = createProxyState(
|
||||||
|
[this.newSecondaryChannelInput],
|
||||||
|
() => this.newSecondaryChannelInput.value == ""
|
||||||
|
);
|
||||||
cannotSetEncryptionKey;
|
cannotSetEncryptionKey;
|
||||||
cannotSendMessage;
|
cannotSendMessage;
|
||||||
// sorting
|
// sorting
|
||||||
@@ -992,7 +996,8 @@
|
|||||||
{
|
{
|
||||||
class: "primary",
|
class: "primary",
|
||||||
"aria-label": translations.chatPage.settings.addSecondaryChannelButtonAudioLabel,
|
"aria-label": translations.chatPage.settings.addSecondaryChannelButtonAudioLabel,
|
||||||
"on:click": chatViewModel.addSecondaryChannel
|
"on:click": chatViewModel.addSecondaryChannel,
|
||||||
|
"toggle:disabled": chatViewModel.cannotAddSecondaryChannel
|
||||||
},
|
},
|
||||||
/* @__PURE__ */ createElement("span", { class: "icon" }, "add")
|
/* @__PURE__ */ createElement("span", { class: "icon" }, "add")
|
||||||
)), /* @__PURE__ */ createElement(
|
)), /* @__PURE__ */ createElement(
|
||||||
@@ -1045,7 +1050,15 @@
|
|||||||
"on:click": setColor
|
"on:click": setColor
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
})), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("button", { class: "danger width-input flex-no", "on:click": chatViewModel.remove }, translations.chatPage.settings.deleteChatButton, /* @__PURE__ */ createElement("span", { class: "icon" }, "delete_forever"))));
|
})), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement(
|
||||||
|
"button",
|
||||||
|
{
|
||||||
|
class: "danger width-input flex-no",
|
||||||
|
"on:click": chatViewModel.remove
|
||||||
|
},
|
||||||
|
translations.chatPage.settings.deleteChatButton,
|
||||||
|
/* @__PURE__ */ createElement("span", { class: "icon" }, "delete_forever")
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// src/View/chatPage.tsx
|
// src/View/chatPage.tsx
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export function SettingsPage(chatViewModel: ChatViewModel) {
|
|||||||
translations.chatPage.settings.addSecondaryChannelButtonAudioLabel
|
translations.chatPage.settings.addSecondaryChannelButtonAudioLabel
|
||||||
}
|
}
|
||||||
on:click={chatViewModel.addSecondaryChannel}
|
on:click={chatViewModel.addSecondaryChannel}
|
||||||
|
toggle:disabled={chatViewModel.cannotAddSecondaryChannel}
|
||||||
>
|
>
|
||||||
<span class="icon">add</span>
|
<span class="icon">add</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -138,7 +139,10 @@ export function SettingsPage(chatViewModel: ChatViewModel) {
|
|||||||
|
|
||||||
<hr></hr>
|
<hr></hr>
|
||||||
|
|
||||||
<button class="danger width-input flex-no" on:click={chatViewModel.remove}>
|
<button
|
||||||
|
class="danger width-input flex-no"
|
||||||
|
on:click={chatViewModel.remove}
|
||||||
|
>
|
||||||
{translations.chatPage.settings.deleteChatButton}
|
{translations.chatPage.settings.deleteChatButton}
|
||||||
<span class="icon">delete_forever</span>
|
<span class="icon">delete_forever</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ export default class ChatViewModel {
|
|||||||
this.primaryChannelInput.value == "" ||
|
this.primaryChannelInput.value == "" ||
|
||||||
this.primaryChannelInput.value == this.primaryChannel.value
|
this.primaryChannelInput.value == this.primaryChannel.value
|
||||||
);
|
);
|
||||||
|
cannotAddSecondaryChannel: React.State<boolean> = React.createProxyState(
|
||||||
|
[this.newSecondaryChannelInput],
|
||||||
|
() =>
|
||||||
|
this.newSecondaryChannelInput.value == ""
|
||||||
|
);
|
||||||
cannotSetEncryptionKey: React.State<boolean>;
|
cannotSetEncryptionKey: React.State<boolean>;
|
||||||
cannotSendMessage: React.State<boolean>;
|
cannotSendMessage: React.State<boolean>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user