2024-07-07 22:11:18 +02:00
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
2024-07-09 14:11:20 +02:00
|
|
|
import {
|
|
|
|
|
cannotConnect,
|
|
|
|
|
cannotDeleteMailbox,
|
|
|
|
|
cannotDisonnect,
|
|
|
|
|
cannotRequestMailbox,
|
2024-07-09 14:18:38 +02:00
|
|
|
cannotResetAddress,
|
2024-07-09 14:11:20 +02:00
|
|
|
connect,
|
|
|
|
|
deleteMailbox,
|
|
|
|
|
disconnect,
|
|
|
|
|
requestMailbox,
|
2024-07-09 14:18:38 +02:00
|
|
|
resetAddressInput,
|
2024-07-09 14:11:20 +02:00
|
|
|
serverAddressInput,
|
|
|
|
|
} from "../Model/model";
|
|
|
|
|
|
2024-07-07 22:11:18 +02:00
|
|
|
import { translation } from "../translations";
|
|
|
|
|
|
|
|
|
|
export function ConnectionSection() {
|
|
|
|
|
return (
|
2024-07-09 14:11:20 +02:00
|
|
|
<div class="flex-column">
|
2024-07-09 15:15:17 +02:00
|
|
|
<h2>{translation.connection}</h2>
|
|
|
|
|
|
2024-07-09 14:11:20 +02:00
|
|
|
<label class="tile">
|
|
|
|
|
<span class="icon">cell_tower</span>
|
|
|
|
|
<div>
|
|
|
|
|
<span>{translation.serverAddress}</span>
|
|
|
|
|
<input
|
|
|
|
|
bind:value={serverAddressInput}
|
|
|
|
|
on:enter={connect}
|
|
|
|
|
placeholder={translation.serverAddressPlaceholder}
|
|
|
|
|
></input>
|
|
|
|
|
</div>
|
|
|
|
|
</label>
|
|
|
|
|
<div class="flex-row width-input justify-end">
|
|
|
|
|
<button
|
2024-07-09 14:18:38 +02:00
|
|
|
class="danger width-100 flex-1 justify-center"
|
2024-07-09 14:11:20 +02:00
|
|
|
aria-label={translation.disconnect}
|
|
|
|
|
on:click={disconnect}
|
|
|
|
|
toggle:disabled={cannotDisonnect}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">close</span>
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
2024-07-09 14:18:38 +02:00
|
|
|
class="width-100 flex-1 justify-center"
|
2024-07-09 14:11:20 +02:00
|
|
|
aria-label={translation.resetAddress}
|
2024-07-09 14:18:38 +02:00
|
|
|
on:click={resetAddressInput}
|
|
|
|
|
toggle:disabled={cannotResetAddress}
|
2024-07-09 14:11:20 +02:00
|
|
|
>
|
|
|
|
|
<span class="icon">undo</span>
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
2024-07-09 14:18:38 +02:00
|
|
|
class="primary width-100 flex-1 justify-center"
|
2024-07-09 14:11:20 +02:00
|
|
|
aria-label={translation.connectToServer}
|
|
|
|
|
on:click={connect}
|
|
|
|
|
toggle:disabled={cannotConnect}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">arrow_forward</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr></hr>
|
|
|
|
|
|
|
|
|
|
<div class="tile">
|
|
|
|
|
<span class="icon">inbox</span>
|
|
|
|
|
<div>
|
|
|
|
|
<b>{translation.mailbox}</b>
|
|
|
|
|
<span class="secondary">{translation.mailboxExplanation}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex-row width-input justify-end">
|
|
|
|
|
<button
|
|
|
|
|
class="danger width-100 flex-1"
|
|
|
|
|
on:click={deleteMailbox}
|
|
|
|
|
toggle:disabled={cannotDeleteMailbox}
|
|
|
|
|
>
|
|
|
|
|
{translation.deleteMailbox}
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
class="primary width-100 flex-1"
|
|
|
|
|
on:click={requestMailbox}
|
|
|
|
|
toggle:disabled={cannotRequestMailbox}
|
|
|
|
|
>
|
|
|
|
|
{translation.requestMailbox}
|
|
|
|
|
<span class="icon">arrow_forward</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2024-07-07 22:11:18 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|