update wording

This commit is contained in:
Eduard Gert
2026-05-07 17:19:56 +02:00
parent 70a755fbae
commit 2c5d52a1bf
3 changed files with 90 additions and 96 deletions

View File

@@ -5,75 +5,71 @@ import { ToggleSwitch } from "@/components/ToggleSwitch";
import { cn } from "@/lib/cn"; import { cn } from "@/lib/cn";
interface Props { interface Props {
value: boolean; value: boolean;
onChange: (value: boolean) => void; onChange: (value: boolean) => void;
helpText?: React.ReactNode; helpText?: React.ReactNode;
label?: React.ReactNode; label?: React.ReactNode;
children?: React.ReactNode; children?: React.ReactNode;
disabled?: boolean; disabled?: boolean;
dataCy?: string; dataCy?: string;
className?: string; className?: string;
labelClassName?: string; labelClassName?: string;
textWrapperClassName?: string; textWrapperClassName?: string;
} }
export default function FancyToggleSwitch({ export default function FancyToggleSwitch({
value, value,
onChange, onChange,
helpText, helpText,
label, label,
children, children,
disabled = false, disabled = false,
dataCy, dataCy,
className, className,
labelClassName, labelClassName,
textWrapperClassName = "max-w-md", textWrapperClassName = "max-w-lg",
}: Readonly<Props>) { }: Readonly<Props>) {
const handleToggle = () => { const handleToggle = () => {
if (disabled) return; if (disabled) return;
onChange(!value); onChange(!value);
}; };
const handleKeyDown = (event: React.KeyboardEvent) => { const handleKeyDown = (event: React.KeyboardEvent) => {
if (disabled) return; if (disabled) return;
if (event.key === "Enter" || event.key === " ") { if (event.key === "Enter" || event.key === " ") {
event.preventDefault(); event.preventDefault();
handleToggle(); handleToggle();
} }
}; };
return ( return (
<div <div
onClick={handleToggle} onClick={handleToggle}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
tabIndex={-1} tabIndex={-1}
role={"switch"} role={"switch"}
aria-checked={value} aria-checked={value}
className={cn( className={cn(
"cursor-default transition-all duration-300 relative z-[1]", "cursor-default transition-all duration-300 relative z-[1]",
"inline-block text-left w-full", "inline-block text-left w-full",
disabled && "opacity-50 pointer-events-none", disabled && "opacity-30 pointer-events-none",
className, className,
)} )}
> >
<div className={"flex justify-between gap-10"}> <div className={"flex justify-between gap-10"}>
<div className={cn(textWrapperClassName)}> <div className={cn(textWrapperClassName)}>
<Label className={labelClassName}>{label}</Label> <Label className={labelClassName}>{label}</Label>
<HelpText margin={false}>{helpText}</HelpText> <HelpText margin={false}>{helpText}</HelpText>
</div>
<div className={"mt-2 pr-1"}>
<ToggleSwitch checked={value} onCheckedChange={onChange} dataCy={dataCy} />
</div>
</div>
{children && value ? (
<div className="mt-4" onClick={(e) => e.stopPropagation()}>
{children}
</div>
) : null}
</div> </div>
<div className={"mt-2 pr-1"}> );
<ToggleSwitch
checked={value}
onCheckedChange={onChange}
dataCy={dataCy}
/>
</div>
</div>
{children && value ? (
<div className="mt-4" onClick={(e) => e.stopPropagation()}>
{children}
</div>
) : null}
</div>
);
} }

View File

@@ -4,23 +4,24 @@ import { useSettings } from "@/modules/settings/SettingsContext.tsx";
export function SettingsNetwork() { export function SettingsNetwork() {
const { config, setField } = useSettings(); const { config, setField } = useSettings();
return ( return (
<> <>
<SectionGroup title={"Connectivity"}> <SectionGroup title={"Connectivity"}>
<FancyToggleSwitch <FancyToggleSwitch
value={config.lazyConnectionEnabled} value={config.lazyConnectionEnabled}
onChange={(v) => setField("lazyConnectionEnabled", v)} onChange={(v) => setField("lazyConnectionEnabled", v)}
label={"Lazy connections"} label={"Lazy Connections"}
helpText={ helpText={
"Only establish peer tunnels on first traffic instead of eagerly at startup." "Instead of maintaining always-on connections, NetBird activates them on-demand based on activity or signaling."
} }
/> />
<FancyToggleSwitch <FancyToggleSwitch
value={config.networkMonitor} value={config.networkMonitor}
onChange={(v) => setField("networkMonitor", v)} onChange={(v) => setField("networkMonitor", v)}
label={"Network monitor"} label={"Reconnect on Network Change"}
helpText={ helpText={
"Reconnect automatically when the host network changes (Wi-Fi switch, VPN, sleep/wake)." "Monitor the network and automatically reconnect on changes such as Wi-Fi switching, Ethernet changes, or resume from sleep."
} }
/> />
</SectionGroup> </SectionGroup>
@@ -30,25 +31,19 @@ export function SettingsNetwork() {
value={!config.disableDns} value={!config.disableDns}
onChange={(v) => setField("disableDns", !v)} onChange={(v) => setField("disableDns", !v)}
label={"Enable DNS"} label={"Enable DNS"}
helpText={ helpText={"Apply NetBird-managed DNS settings to the host resolver."}
"Apply NetBird-managed DNS settings to the host resolver."
}
/> />
<FancyToggleSwitch <FancyToggleSwitch
value={!config.disableClientRoutes} value={!config.disableClientRoutes}
onChange={(v) => setField("disableClientRoutes", !v)} onChange={(v) => setField("disableClientRoutes", !v)}
label={"Enable client routes"} label={"Enable Client Routes"}
helpText={ helpText={"Accept routes from other peers to reach their networks."}
"Accept routes advertised by other peers so this client can reach their networks."
}
/> />
<FancyToggleSwitch <FancyToggleSwitch
value={!config.disableServerRoutes} value={!config.disableServerRoutes}
onChange={(v) => setField("disableServerRoutes", !v)} onChange={(v) => setField("disableServerRoutes", !v)}
label={"Enable server routes"} label={"Enable Server Routes"}
helpText={ helpText={"Advertise this host's local routes to other peers."}
"Advertise this host's local routes to other peers."
}
/> />
</SectionGroup> </SectionGroup>
</> </>

View File

@@ -10,17 +10,17 @@ export function SettingsSecurity() {
<FancyToggleSwitch <FancyToggleSwitch
value={config.blockInbound} value={config.blockInbound}
onChange={(v) => setField("blockInbound", v)} onChange={(v) => setField("blockInbound", v)}
label={"Block inbound traffic"} label={"Block Inbound Traffic"}
helpText={ helpText={
"Drop all unsolicited inbound traffic on the NetBird interface." "Reject unsolicited connections from peers to this device and any networks it routes. Outbound traffic is unaffected."
} }
/> />
<FancyToggleSwitch <FancyToggleSwitch
value={config.blockLanAccess} value={config.blockLanAccess}
onChange={(v) => setField("blockLanAccess", v)} onChange={(v) => setField("blockLanAccess", v)}
label={"Block LAN access"} label={"Block LAN Access"}
helpText={ helpText={
"Prevent peers from reaching this host's local network." "Prevent peers from reaching your local network or its devices when this device routes their traffic."
} }
/> />
</SectionGroup> </SectionGroup>
@@ -28,21 +28,24 @@ export function SettingsSecurity() {
<SectionGroup title={"Encryption"}> <SectionGroup title={"Encryption"}>
<FancyToggleSwitch <FancyToggleSwitch
value={config.rosenpassEnabled} value={config.rosenpassEnabled}
onChange={(v) => setField("rosenpassEnabled", v)} onChange={(v) => {
label={"Quantum-resistant encryption"} setField("rosenpassEnabled", v);
if (!v) setField("rosenpassPermissive", false);
}}
label={"Enable Quantum-Resistance"}
helpText={ helpText={
"Add a post-quantum key exchange (Rosenpass) on top of WireGuard." "Add a post-quantum key exchange via Rosenpass on top of WireGuard®."
} }
> />
<FancyToggleSwitch <FancyToggleSwitch
value={config.rosenpassPermissive} value={config.rosenpassPermissive}
onChange={(v) => setField("rosenpassPermissive", v)} onChange={(v) => setField("rosenpassPermissive", v)}
label={"Permissive mode"} label={"Enable Permissive Mode"}
helpText={ helpText={
"Allow connections to peers without quantum-resistance support." "Allow connections to peers without quantum-resistance support."
} }
/> disabled={!config.rosenpassEnabled}
</FancyToggleSwitch> />
</SectionGroup> </SectionGroup>
</> </>
); );