fix default selection of previous connection input
This commit is contained in:
Vendored
+8
-2
@@ -1154,7 +1154,6 @@
|
||||
function connect() {
|
||||
if (cannotConnect.value == true) return;
|
||||
currentAddress.value = serverAddressInput.value;
|
||||
previousAddresses.add(currentAddress.value);
|
||||
isConnected.value = false;
|
||||
didRequestConnection.value = true;
|
||||
UDN.connect(serverAddressInput.value);
|
||||
@@ -1175,6 +1174,9 @@
|
||||
}
|
||||
UDN.onconnect = () => {
|
||||
isConnected.value = true;
|
||||
if (!previousAddresses.value.has(currentAddress.value)) {
|
||||
previousAddresses.add(currentAddress.value);
|
||||
}
|
||||
subscribeChannels();
|
||||
if (mailboxId.value != "") UDN.connectMailbox(mailboxId.value);
|
||||
};
|
||||
@@ -2181,6 +2183,10 @@
|
||||
|
||||
// src/Views/Overview/connectionSection.tsx
|
||||
function ConnectionSection() {
|
||||
const stringToPreviouAddressOption = (value) => {
|
||||
const isSelected = value == serverAddressInput.value;
|
||||
return /* @__PURE__ */ createElement("option", { "toggle:selected": isSelected }, value);
|
||||
};
|
||||
return /* @__PURE__ */ createElement("div", { class: "flex-column" }, /* @__PURE__ */ createElement("h2", null, translation.connection), /* @__PURE__ */ createElement("label", { class: "tile" }, /* @__PURE__ */ createElement("span", { class: "icon" }, "cell_tower"), /* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement("span", null, translation.serverAddress), /* @__PURE__ */ createElement(
|
||||
"input",
|
||||
{
|
||||
@@ -2200,7 +2206,7 @@
|
||||
"select",
|
||||
{
|
||||
"bind:value": serverAddressInput,
|
||||
"children:append": [previousAddresses, stringToOptionTag]
|
||||
"children:append": [previousAddresses, stringToPreviouAddressOption]
|
||||
}
|
||||
), /* @__PURE__ */ createElement("span", { class: "icon" }, "arrow_drop_down"))), /* @__PURE__ */ createElement("div", { class: "flex-row width-input justify-end" }, /* @__PURE__ */ createElement(
|
||||
"button",
|
||||
|
||||
+4
-1
@@ -42,7 +42,6 @@ export function connect(): void {
|
||||
if (cannotConnect.value == true) return;
|
||||
|
||||
currentAddress.value = serverAddressInput.value;
|
||||
previousAddresses.add(currentAddress.value);
|
||||
|
||||
isConnected.value = false;
|
||||
didRequestConnection.value = true;
|
||||
@@ -71,6 +70,10 @@ export function subscribeChannels() {
|
||||
// listeners
|
||||
UDN.onconnect = () => {
|
||||
isConnected.value = true;
|
||||
if (!previousAddresses.value.has(currentAddress.value)) {
|
||||
previousAddresses.add(currentAddress.value);
|
||||
}
|
||||
|
||||
subscribeChannels();
|
||||
if (mailboxId.value != "") UDN.connectMailbox(mailboxId.value);
|
||||
};
|
||||
|
||||
@@ -21,6 +21,13 @@ import { stringToOptionTag } from "../../utility";
|
||||
import { translation } from "../../translations";
|
||||
|
||||
export function ConnectionSection() {
|
||||
const stringToPreviouAddressOption: React.StateItemConverter<string> = (
|
||||
value
|
||||
) => {
|
||||
const isSelected = value == serverAddressInput.value;
|
||||
return <option toggle:selected={isSelected}>{value}</option>;
|
||||
};
|
||||
|
||||
return (
|
||||
<div class="flex-column">
|
||||
<h2>{translation.connection}</h2>
|
||||
@@ -48,7 +55,7 @@ export function ConnectionSection() {
|
||||
<span>{translation.previousConnections}</span>
|
||||
<select
|
||||
bind:value={serverAddressInput}
|
||||
children:append={[previousAddresses, stringToOptionTag]}
|
||||
children:append={[previousAddresses, stringToPreviouAddressOption]}
|
||||
></select>
|
||||
<span class="icon">arrow_drop_down</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user