Refine routing rule controls and responsive layout
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export const HARBOR_VERSIONS = Object.freeze({
|
||||
macClient: '0.26.0',
|
||||
gatewayClient: '0.27.0',
|
||||
macClient: '0.26.1',
|
||||
gatewayClient: '0.27.1',
|
||||
gatewayBackend: '0.27.0',
|
||||
});
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import { operationBlocked } from '../../state/operations.js';
|
||||
import { ConfirmationDialog } from '../../ui/ConfirmationDialog.js';
|
||||
import { Drawer } from '../../ui/Drawer.js';
|
||||
import { RailAction } from '../../ui/RailAction.js';
|
||||
import { Tooltip } from '../../ui/Tooltip.js';
|
||||
import {
|
||||
beginRuleReorder,
|
||||
crossedRuleIndex,
|
||||
@@ -760,19 +761,26 @@ function RuleOutboundPicker({
|
||||
disabled?: boolean;
|
||||
onChange: (value: RouteRule['outbound']) => void;
|
||||
}) {
|
||||
return <div className="client-rule-outbound" role="group" aria-label={`Маршрут правила ${index + 1}`}>
|
||||
{([['vpn', 'VPN'], ['direct', 'Напрямую']] as const).map(([outbound, label]) => (
|
||||
<button
|
||||
type="button"
|
||||
key={outbound}
|
||||
aria-pressed={value === outbound}
|
||||
disabled={disabled}
|
||||
onClick={() => onChange(outbound)}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>;
|
||||
const direct = value === 'direct';
|
||||
const label = direct ? 'Напрямую' : 'VPN';
|
||||
return <span className="client-rule-outbound client-tooltip-anchor">
|
||||
<button
|
||||
className={direct ? 'is-direct' : 'is-vpn'}
|
||||
type="button"
|
||||
aria-label={`Маршрут правила ${index + 1}: ${label}. Переключить на ${direct ? 'VPN' : 'Напрямую'}`}
|
||||
aria-pressed={direct}
|
||||
disabled={disabled}
|
||||
onClick={() => onChange(direct ? 'vpn' : 'direct')}
|
||||
>
|
||||
{direct ? <svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M4 12h15M14 7l5 5-5 5" />
|
||||
</svg> : <svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M12 3 19 6v5c0 4.4-2.8 8-7 10-4.2-2-7-5.6-7-10V6l7-3Z" />
|
||||
<path d="m9 12 2 2 4-4" />
|
||||
</svg>}
|
||||
</button>
|
||||
<Tooltip>{label}</Tooltip>
|
||||
</span>;
|
||||
}
|
||||
|
||||
export function RoutingToggle({
|
||||
@@ -899,7 +907,11 @@ export function RoutingPanel({ feature, statusSlot }: { feature: RoutingFeature;
|
||||
</span>
|
||||
<section className="client-local-rules-group" aria-labelledby="local-rules-list-title">
|
||||
<span id="local-rules-list-title">Правила</span>
|
||||
<div className="client-local-rules-list">
|
||||
<div
|
||||
className={`client-local-rules-list${draftRules.length > 1 ? ' has-order-flow' : ''}`}
|
||||
role="list"
|
||||
aria-label="Правила применяются сверху вниз"
|
||||
>
|
||||
{feature.rules.map((rule, index) => {
|
||||
const [status, statusLabel] = localRuleStatus(
|
||||
rule,
|
||||
@@ -916,6 +928,7 @@ export function RoutingPanel({ feature, statusSlot }: { feature: RoutingFeature;
|
||||
className={`client-local-rule client-deletable-row is-${status}${rule.enabled ? '' : ' is-disabled'}${rule.removing ? ' is-removing' : ''}${lifted ? ' is-dragging' : ''}`}
|
||||
key={rule._key}
|
||||
data-rule-key={rule._key}
|
||||
role="listitem"
|
||||
style={{ viewTransitionName: rule.removing ? 'none' : rule._key }}
|
||||
inert={rule.removing ? true : undefined}
|
||||
>
|
||||
@@ -974,6 +987,20 @@ export function RoutingPanel({ feature, statusSlot }: { feature: RoutingFeature;
|
||||
value={rule.value}
|
||||
onChange={(event) => feature.change(index, 'value', event.target.value)}
|
||||
/>
|
||||
<RuleOutboundPicker
|
||||
value={rule.outbound}
|
||||
index={index}
|
||||
disabled={editorDisabled}
|
||||
onChange={(outbound) => feature.change(index, 'outbound', outbound)}
|
||||
/>
|
||||
<span
|
||||
className="client-local-rule-status client-tooltip-anchor"
|
||||
role="status"
|
||||
aria-label={`Состояние правила: ${statusLabel}`}
|
||||
>
|
||||
<span className="client-rule-status-dot" aria-hidden="true" />
|
||||
<Tooltip>{statusLabel}</Tooltip>
|
||||
</span>
|
||||
<button
|
||||
className="client-row-delete"
|
||||
type="button"
|
||||
@@ -988,15 +1015,6 @@ export function RoutingPanel({ feature, statusSlot }: { feature: RoutingFeature;
|
||||
aria-hidden="true"
|
||||
onAnimationEnd={() => feature.finishRemove(rule._key)}
|
||||
/>
|
||||
<div className="client-local-rule-meta">
|
||||
<RuleOutboundPicker
|
||||
value={rule.outbound}
|
||||
index={index}
|
||||
disabled={editorDisabled}
|
||||
onChange={(outbound) => feature.change(index, 'outbound', outbound)}
|
||||
/>
|
||||
<span className="client-local-rule-status" role="status">{statusLabel}</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -72,7 +72,32 @@
|
||||
}
|
||||
|
||||
.client-local-rules-list {
|
||||
gap: 2px;
|
||||
position: relative;
|
||||
gap: 0;
|
||||
padding-left: 14px;
|
||||
}
|
||||
|
||||
.client-local-rules-list.has-order-flow::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 22px;
|
||||
bottom: 22px;
|
||||
left: 3px;
|
||||
width: 1px;
|
||||
background: linear-gradient(to bottom, transparent, color-mix(in oklch, var(--client-accent) 46%, transparent) 15%, color-mix(in oklch, var(--client-accent) 46%, transparent) 85%, transparent);
|
||||
box-shadow: 0 0 7px color-mix(in oklch, var(--client-accent) 24%, transparent);
|
||||
}
|
||||
|
||||
.client-local-rules-list.has-order-flow::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 18px;
|
||||
left: 0;
|
||||
width: 7px;
|
||||
height: 6px;
|
||||
background: color-mix(in oklch, var(--client-accent) 64%, transparent);
|
||||
clip-path: polygon(0 0, 100% 0, 50% 100%);
|
||||
filter: drop-shadow(0 0 4px color-mix(in oklch, var(--client-accent) 36%, transparent));
|
||||
}
|
||||
|
||||
.client-local-rule {
|
||||
@@ -81,36 +106,57 @@
|
||||
isolation: isolate;
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
grid-template-columns: 44px 24px 116px minmax(0, 1fr) 28px;
|
||||
grid-template-columns: 44px 24px 104px minmax(84px, 1fr) 34px 16px 28px;
|
||||
align-items: center;
|
||||
column-gap: 8px;
|
||||
row-gap: 2px;
|
||||
padding: 7px 0;
|
||||
column-gap: 6px;
|
||||
padding: 4px 0;
|
||||
animation: client-row-enter 560ms cubic-bezier(0.16, 1, 0.3, 1) both;
|
||||
transition: background-color 180ms ease, box-shadow 180ms ease, opacity 260ms ease, filter 360ms ease;
|
||||
}
|
||||
|
||||
.client-local-rule + .client-local-rule::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 44px;
|
||||
height: 1px;
|
||||
background: linear-gradient(90deg, color-mix(in oklch, var(--client-muted) 24%, transparent), color-mix(in oklch, var(--client-muted) 9%, transparent) 72%, transparent);
|
||||
}
|
||||
|
||||
.client-local-rule:has(.client-rule-type.is-open) {
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.client-local-rule-status {
|
||||
width: 16px;
|
||||
height: 44px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: var(--client-muted);
|
||||
font: var(--type-label);
|
||||
letter-spacing: var(--type-label-tracking);
|
||||
text-transform: var(--type-label-transform);
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
transition: color 280ms ease, opacity 280ms ease, filter 360ms ease;
|
||||
}
|
||||
|
||||
.client-local-rule.is-active .client-local-rule-status {
|
||||
.client-rule-status-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: currentColor;
|
||||
opacity: 0.58;
|
||||
transition: color 280ms ease, opacity 280ms ease, filter 360ms ease, transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
|
||||
}
|
||||
|
||||
.client-local-rule.is-active .client-rule-status-dot {
|
||||
color: var(--client-accent);
|
||||
opacity: 1;
|
||||
filter: drop-shadow(0 0 5px color-mix(in oklch, var(--client-accent) 52%, transparent));
|
||||
transform: scale(1.14);
|
||||
}
|
||||
|
||||
.client-local-rule.is-pending .client-local-rule-status,
|
||||
.client-local-rule.is-unsaved .client-local-rule-status {
|
||||
.client-local-rule.is-pending .client-rule-status-dot,
|
||||
.client-local-rule.is-unsaved .client-rule-status-dot {
|
||||
color: var(--client-warning, oklch(0.72 0.12 72));
|
||||
opacity: 1;
|
||||
filter: drop-shadow(0 0 4px color-mix(in oklch, var(--client-warning, oklch(0.72 0.12 72)) 44%, transparent));
|
||||
}
|
||||
|
||||
.client-local-rule.is-disabled > :not(.client-rule-handle):not(.client-row-delete):not(.client-delete-strike) {
|
||||
@@ -361,42 +407,39 @@
|
||||
text-shadow: 0 0 9px color-mix(in oklch, var(--client-accent) 22%, transparent);
|
||||
}
|
||||
|
||||
.client-local-rule-meta {
|
||||
min-width: 0;
|
||||
grid-column: 2 / -1;
|
||||
grid-row: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.client-rule-outbound {
|
||||
width: 128px;
|
||||
height: 30px;
|
||||
flex: 0 0 128px;
|
||||
display: grid;
|
||||
grid-template-columns: 48px minmax(0, 1fr);
|
||||
align-items: center;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.client-rule-outbound button {
|
||||
height: 30px;
|
||||
padding: 0 5px;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
color: var(--client-muted);
|
||||
font: var(--type-label);
|
||||
letter-spacing: var(--type-label-tracking);
|
||||
text-transform: var(--type-label-transform);
|
||||
cursor: pointer;
|
||||
transition: color 280ms ease, filter 280ms ease, text-shadow 280ms ease;
|
||||
transition: color 220ms ease, filter 320ms ease, background 220ms ease;
|
||||
}
|
||||
|
||||
.client-rule-outbound button[aria-pressed='true'] {
|
||||
.client-rule-outbound button.is-direct {
|
||||
color: var(--client-accent);
|
||||
filter: drop-shadow(0 0 6px color-mix(in oklch, var(--client-accent) 34%, transparent));
|
||||
text-shadow: 0 0 9px color-mix(in oklch, var(--client-accent) 28%, transparent);
|
||||
}
|
||||
|
||||
.client-rule-outbound svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 1.7;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
|
||||
}
|
||||
|
||||
.client-rule-outbound button:disabled {
|
||||
@@ -405,8 +448,25 @@
|
||||
|
||||
.client-rule-outbound button:focus-visible {
|
||||
outline: 0;
|
||||
background: color-mix(in oklch, var(--client-accent) 10%, transparent);
|
||||
color: var(--client-accent);
|
||||
text-shadow: 0 0 9px color-mix(in oklch, var(--client-accent) 42%, transparent);
|
||||
filter: drop-shadow(0 0 5px color-mix(in oklch, var(--client-accent) 36%, transparent));
|
||||
}
|
||||
|
||||
.client-rule-outbound button:hover:not(:disabled) {
|
||||
background: color-mix(in oklch, var(--client-accent) 10%, transparent);
|
||||
color: var(--client-accent);
|
||||
filter: drop-shadow(0 0 5px color-mix(in oklch, var(--client-accent) 36%, transparent));
|
||||
}
|
||||
|
||||
.client-rule-outbound button.is-direct:hover:not(:disabled) svg,
|
||||
.client-rule-outbound button.is-direct:focus-visible svg {
|
||||
transform: translateX(2px);
|
||||
}
|
||||
|
||||
.client-rule-outbound button.is-vpn:hover:not(:disabled) svg,
|
||||
.client-rule-outbound button.is-vpn:focus-visible svg {
|
||||
transform: translateY(-1px) rotate(3deg) scale(1.05);
|
||||
}
|
||||
|
||||
.client-rule-reorder-instructions,
|
||||
|
||||
+44
-17
@@ -704,7 +704,9 @@
|
||||
}
|
||||
|
||||
.client-local-rule {
|
||||
grid-template-columns: 44px 44px minmax(0, 1fr) 44px;
|
||||
grid-template-columns: 44px 44px minmax(0, 1fr) 44px 44px;
|
||||
column-gap: 4px;
|
||||
row-gap: 0;
|
||||
}
|
||||
|
||||
.client-rule-handle,
|
||||
@@ -721,6 +723,10 @@
|
||||
height: 44px;
|
||||
}
|
||||
|
||||
.client-rule-outbound button {
|
||||
width: 44px;
|
||||
}
|
||||
|
||||
.client-rule-type-list button {
|
||||
min-height: 44px;
|
||||
}
|
||||
@@ -734,7 +740,11 @@
|
||||
}
|
||||
|
||||
.client-local-rule {
|
||||
gap: 8px;
|
||||
padding-block: 4px;
|
||||
}
|
||||
|
||||
.client-local-rules-list {
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
.client-rule-handle {
|
||||
@@ -753,18 +763,27 @@
|
||||
}
|
||||
|
||||
.client-row-delete {
|
||||
grid-column: 4;
|
||||
grid-column: 5;
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
.client-local-rule input {
|
||||
grid-column: 2 / -1;
|
||||
grid-column: 2 / 5;
|
||||
grid-row: 2;
|
||||
}
|
||||
|
||||
.client-local-rule-meta {
|
||||
grid-column: 2 / -1;
|
||||
grid-row: 3;
|
||||
.client-rule-outbound {
|
||||
grid-column: 4;
|
||||
grid-row: 1;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
|
||||
.client-local-rule-status {
|
||||
grid-column: 5;
|
||||
grid-row: 2;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
|
||||
.client-instruction-block:nth-child(n) {
|
||||
@@ -784,21 +803,29 @@
|
||||
}
|
||||
|
||||
@media (max-width: 360px) {
|
||||
.client-local-rule-meta {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
.client-local-rule {
|
||||
grid-template-columns: 44px 44px minmax(0, 1fr) 44px;
|
||||
}
|
||||
|
||||
.client-rule-outbound {
|
||||
width: 100%;
|
||||
flex-basis: 100%;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
grid-column: 2;
|
||||
grid-row: 3;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
|
||||
.client-local-rule-status {
|
||||
width: 100%;
|
||||
min-height: 1em;
|
||||
text-align: left;
|
||||
white-space: normal;
|
||||
grid-column: 4;
|
||||
grid-row: 3;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
|
||||
.client-row-delete {
|
||||
grid-column: 4;
|
||||
}
|
||||
|
||||
.client-local-rule input {
|
||||
grid-column: 2 / -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +132,8 @@
|
||||
.client-rule-type-list button,
|
||||
.client-local-rule input,
|
||||
.client-rule-outbound button,
|
||||
.client-rule-outbound svg,
|
||||
.client-rule-status-dot,
|
||||
.client-row-delete,
|
||||
.client-row-add,
|
||||
.client-row-add-slot > span,
|
||||
|
||||
Reference in New Issue
Block a user