Refine server picker ping labels and layout
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export const HARBOR_VERSIONS = Object.freeze({
|
||||
macClient: '0.8.4',
|
||||
gatewayClient: '0.8.4',
|
||||
macClient: '0.8.5',
|
||||
gatewayClient: '0.8.5',
|
||||
gatewayBackend: '0.8.0',
|
||||
});
|
||||
|
||||
|
||||
@@ -39,19 +39,21 @@ function readAuto() {
|
||||
|
||||
function serverHealthText(ping) {
|
||||
if (ping?.error) return 'Проверка недоступна';
|
||||
if (ping?.ok) return `TCP ${ping.latency} мс`;
|
||||
return ping ? 'TCP недоступен' : 'Не проверен';
|
||||
if (ping?.ok) return `${ping.latency} мс`;
|
||||
return ping ? 'Недоступен' : null;
|
||||
}
|
||||
|
||||
function ServerHealth({ ping, fallback }) {
|
||||
const health = fallback || serverHealthText(ping);
|
||||
if (!health && !ping?.checking) return null;
|
||||
|
||||
return <small
|
||||
className={`client-server-health${ping?.checking ? ' is-checking' : ''}`}
|
||||
title={ping?.checkedAt || undefined}
|
||||
aria-label={ping?.checking ? 'Проверяем TCP' : health}
|
||||
aria-label={ping?.checking ? 'Проверяем пинг' : health}
|
||||
>
|
||||
<span aria-hidden="true">{health}</span>
|
||||
<span className="client-server-health-checking" aria-hidden="true">Проверяем TCP…</span>
|
||||
<span className="client-server-health-checking" aria-hidden="true">Проверяем…</span>
|
||||
</small>;
|
||||
}
|
||||
|
||||
@@ -59,11 +61,11 @@ function ServerCheckButton({ checking, disabled, onClick }) {
|
||||
return <button
|
||||
className={`client-server-check${checking ? ' is-checking' : ''}`}
|
||||
type="button"
|
||||
aria-label={checking ? 'Проверяем доступность серверов по TCP' : 'Проверить доступность серверов по TCP'}
|
||||
aria-label={checking ? 'Проверяем пинг серверов' : 'Проверить пинг серверов'}
|
||||
disabled={checking || disabled}
|
||||
onClick={onClick}
|
||||
>
|
||||
<span>TCP</span>
|
||||
<span>Проверить пинг</span>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M21 12a9 9 0 0 0-15.2-6.5L3 8m0-5v5h5M3 12a9 9 0 0 0 15.2 6.5L21 16m0 5v-5h-5" />
|
||||
</svg>
|
||||
@@ -71,7 +73,7 @@ function ServerCheckButton({ checking, disabled, onClick }) {
|
||||
}
|
||||
|
||||
function ServerRow({ server, selected, favorite, ping, disabled, index, onSelect, onFavorite }) {
|
||||
const health = ping?.checking ? 'Проверяем TCP' : serverHealthText(ping);
|
||||
const health = ping?.checking ? 'Проверяем пинг' : serverHealthText(ping);
|
||||
|
||||
return <div className={`client-server-row${selected ? ' is-selected' : ''}${onFavorite ? ' has-favorite' : ''}`}>
|
||||
<button
|
||||
@@ -79,7 +81,7 @@ function ServerRow({ server, selected, favorite, ping, disabled, index, onSelect
|
||||
type="button"
|
||||
disabled={disabled}
|
||||
aria-pressed={selected}
|
||||
aria-label={`${server.label}, ${server.host}:${server.port}, ${health}`}
|
||||
aria-label={`${server.label}, ${server.host}:${server.port}${health ? `, ${health}` : ''}`}
|
||||
style={{ '--server-index': Math.min(index, 7) }}
|
||||
onClick={() => onSelect(server.id)}
|
||||
>
|
||||
|
||||
+7
-7
@@ -2598,18 +2598,18 @@ p {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 8px;
|
||||
width: min(100%, 150px);
|
||||
width: min(100%, 220px);
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
.client-server {
|
||||
min-width: 0;
|
||||
min-height: 50px;
|
||||
min-height: 44px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: baseline;
|
||||
justify-content: center;
|
||||
gap: 3px;
|
||||
padding: 7px 4px 8px;
|
||||
gap: 9px;
|
||||
padding: 6px 4px 7px;
|
||||
border: 0;
|
||||
border-bottom: 1px solid var(--client-border);
|
||||
border-radius: 0;
|
||||
@@ -2679,9 +2679,9 @@ p {
|
||||
}
|
||||
|
||||
.client-server-health {
|
||||
min-height: 14px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.client-server-health > span {
|
||||
@@ -2749,7 +2749,7 @@ p {
|
||||
.client-server-check {
|
||||
grid-column: 3;
|
||||
justify-self: start;
|
||||
width: 88px;
|
||||
width: 116px;
|
||||
min-height: 32px;
|
||||
padding: 5px 7px;
|
||||
border: 0;
|
||||
|
||||
Reference in New Issue
Block a user