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