fix default selection of previous connection input
This commit is contained in:
+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>
|
||||
@@ -45,10 +52,10 @@ export function ConnectionSection() {
|
||||
<label class="tile">
|
||||
<span class="icon">history</span>
|
||||
<div>
|
||||
<span>{translation.previousConnections}</span>
|
||||
<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>
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ import { MessageTab } from "./Tabs/messageTab";
|
||||
import { OverviewTab } from "./Tabs/overviewTab";
|
||||
|
||||
document.querySelector("main")!.append(OverviewTab(), MessageTab());
|
||||
document.querySelector("main")!.classList.add("split");
|
||||
document.querySelector("main")!.classList.add("split");
|
||||
Reference in New Issue
Block a user