From 1c9c0c7dd5c11033f20546160055cd476a1b9c75 Mon Sep 17 00:00:00 2001 From: Juan Denis Date: Mon, 9 Nov 2026 18:40:46 -0500 Subject: [PATCH] fix(ui): give InfoTips one placement and spacing rule The (i) sat 0-16px from the text it explains depending on the page. It now sits ~4px after the text and is centred on that line, in both inline and flex contexts. - inline call sites that were glued to the text get a plain space - flex containers that added their own 8-10px gap are normalized - InfoTip nudged up 1px so it centres on the text line - settings rows wrap on phones so the (i) stays beside its label - Servers level picker uses InfoTip instead of a hover-only tooltip - placement rule documented in the InfoTip header comment --- frontend/src/components/InfoTip.jsx | 3 +++ frontend/src/components/RequiresDocker.jsx | 4 ++-- frontend/src/pages/Downloads.jsx | 4 ++-- frontend/src/pages/RemoteAccess.jsx | 8 +++---- frontend/src/pages/Servers.jsx | 24 +++++++------------ .../src/styles/components/_design-system.scss | 1 + frontend/src/styles/components/_info-tip.scss | 1 + frontend/src/styles/pages/_backups.scss | 4 +++- frontend/src/styles/pages/_monitors.scss | 1 + frontend/src/styles/pages/_servers.scss | 20 +--------------- frontend/src/styles/pages/_settings.scss | 7 +++++- 11 files changed, 32 insertions(+), 45 deletions(-) diff --git a/frontend/src/components/InfoTip.jsx b/frontend/src/components/InfoTip.jsx index d1af8f45..05e39a80 100644 --- a/frontend/src/components/InfoTip.jsx +++ b/frontend/src/components/InfoTip.jsx @@ -11,6 +11,9 @@ import { t } from '../i18n/t'; // pins it open; on a pinned tip they toggle it closed. Narrow screens get a // bottom sheet instead, so the text never sits on top of the content it // explains. Both are portalled (no button-in-button) and above Modal/Sheet. +// Placement: put it right after the label/heading text it explains, inside +// the same element (separate it with a plain space, or let the flex gap do it), +// never on its own line. Standard: ~4px after the text, centred on that line. // `trigger` replaces the (i) glyph (e.g. a whole step pill); `title` heads the sheet. export default function InfoTip({ children, label, title, trigger, side = 'top', size = 'sm', className = '' }) { const [open, setOpen] = useState(false); diff --git a/frontend/src/components/RequiresDocker.jsx b/frontend/src/components/RequiresDocker.jsx index 65fdde59..3f0f4548 100644 --- a/frontend/src/components/RequiresDocker.jsx +++ b/frontend/src/components/RequiresDocker.jsx @@ -37,7 +37,7 @@ const RequiresDocker = ({ children, what = 'This page' }) => {

{what} {t('app.requiresDocker.needsDocker', 'needs Docker.')} - + {' '} {what} {t('app.requiresDocker.needsDockerToRunContainersAnd', 'needs Docker to run containers, and this server was installed with the')} {profileLabel} {t('app.requiresDocker.profileWhichLeavesItOutNothing', 'profile, which leaves it out. Nothing is locked; adding Docker turns this page on.')}

@@ -58,7 +58,7 @@ const RequiresDocker = ({ children, what = 'This page' }) => {

{t('app.requiresDocker.checkedAutomatically', 'Re-checked automatically.')}{' '} {t('app.requiresDocker.settingsSystem', 'Settings → System')} - + {' '} {t('app.requiresDocker.serverkitReChecksForDockerAutomatically', 'ServerKit re-checks for Docker automatically. Monitoring, domains, certificates, cron and DNS keep working without it. See')}{' '} {t('app.requiresDocker.settingsSystem', 'Settings → System')} {t('app.requiresDocker.forThisInstallSProfile', 'for this install\'s profile.')} diff --git a/frontend/src/pages/Downloads.jsx b/frontend/src/pages/Downloads.jsx index 040c6a22..35916be3 100644 --- a/frontend/src/pages/Downloads.jsx +++ b/frontend/src/pages/Downloads.jsx @@ -183,7 +183,7 @@ function Downloads() {

{t('app.downloads.directDownloads', 'Direct downloads')} - {t('app.downloads.downloadTheAgentBinaryForYour', 'Download the agent binary for your platform. After downloading, follow the installation instructions below.')}

+ {' '}{t('app.downloads.downloadTheAgentBinaryForYour', 'Download the agent binary for your platform. After downloading, follow the installation instructions below.')}
{platforms.map((platform) => { @@ -219,7 +219,7 @@ function Downloads() {

{t('app.downloads.quickInstallCommands', 'Quick install commands')} - {t('app.downloads.useTheseOneLinerCommandsTo', 'Use these one-liner commands to download and install the agent. Replace')} YOUR_TOKEN {t('app.downloads.withTheServerRegistrationToken', 'with the server registration token.')}

+ {' '}{t('app.downloads.useTheseOneLinerCommandsTo', 'Use these one-liner commands to download and install the agent. Replace')} YOUR_TOKEN {t('app.downloads.withTheServerRegistrationToken', 'with the server registration token.')}

{t('app.downloads.replaceTokenHint', 'Replace')} YOUR_TOKEN

diff --git a/frontend/src/pages/RemoteAccess.jsx b/frontend/src/pages/RemoteAccess.jsx index d35c3090..be0a38a2 100644 --- a/frontend/src/pages/RemoteAccess.jsx +++ b/frontend/src/pages/RemoteAccess.jsx @@ -223,12 +223,12 @@ const RemoteAccess = ({ serverId }) => { {serverId && currentServer ? (

{t('app.remoteAccess.exposeServicesOn', 'Expose services on')} {currentServer.name}. - {t('app.remoteAccess.exposeServicesRunningOn', 'Expose services running on')} {currentServer.name} {t('app.remoteAccess.toAPublicHostnameOverA', 'to a public hostname over a WireGuard tunnel. ServerKit pairs this host with an edge server that has a public IP.')} + {' '}{t('app.remoteAccess.exposeServicesRunningOn', 'Expose services running on')} {currentServer.name} {t('app.remoteAccess.toAPublicHostnameOverA', 'to a public hostname over a WireGuard tunnel. ServerKit pairs this host with an edge server that has a public IP.')}

) : (

{t('app.remoteAccess.exposeAPrivateServicePublicly', 'Expose a private service publicly.')} - {t('app.remoteAccess.exposeAServiceRunningOnA', 'Expose a service running on a private server (behind NAT, no port-forwarding) to a public hostname over a WireGuard tunnel between two of your agents.')} + {' '}{t('app.remoteAccess.exposeAServiceRunningOnA', 'Expose a service running on a private server (behind NAT, no port-forwarding) to a public hostname over a WireGuard tunnel between two of your agents.')}

)} {serverId && ( @@ -247,12 +247,12 @@ const RemoteAccess = ({ serverId }) => { description={serverId ? ( <> {t('app.remoteAccess.pickAPublicIpEdgeServerShort', 'Pick a public-IP edge server.')} - {t('app.remoteAccess.pickAPublicIpEdgeServer', 'Pick a public-IP edge server and ServerKit will pair it with {{value}} over WireGuard.', { value: currentServer?.name || t('app.remoteAccess.thisHost', 'this host') })} + {' '}{t('app.remoteAccess.pickAPublicIpEdgeServer', 'Pick a public-IP edge server and ServerKit will pair it with {{value}} over WireGuard.', { value: currentServer?.name || t('app.remoteAccess.thisHost', 'this host') })} ) : ( <> {t('app.remoteAccess.pickAnEdgeAndAPrivateHost', 'Pick an edge and a private host.')} - {t('app.remoteAccess.pickAPublicIpEdgeServer2', 'Pick a public-IP edge server and a private host, and ServerKit will pair them over WireGuard and publish your service. No router changes are needed.')} + {' '}{t('app.remoteAccess.pickAPublicIpEdgeServer2', 'Pick a public-IP edge server and a private host, and ServerKit will pair them over WireGuard and publish your service. No router changes are needed.')} )} action={exposeButton} diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx index c80afe52..0ca2cbba 100644 --- a/frontend/src/pages/Servers.jsx +++ b/frontend/src/pages/Servers.jsx @@ -1,9 +1,8 @@ import { useState, useEffect, useCallback, useMemo, useId } from 'react'; import { useNavigate } from 'react-router-dom'; -import { Ban, ChevronRight, ClipboardPaste, Container, Cpu, Database, Flame, Folder, Hash, HardDrive, Info, KeyRound, Lock, MemoryStick, Plus, RefreshCw, Server as ServerLucideIcon, Terminal, X } from 'lucide-react'; +import { Ban, ChevronRight, ClipboardPaste, Container, Cpu, Database, Flame, Folder, Hash, HardDrive, KeyRound, Lock, MemoryStick, Plus, RefreshCw, Server as ServerLucideIcon, Terminal, X } from 'lucide-react'; import InfoTip from '../components/InfoTip'; import IconStepStrip from '../components/IconStepStrip'; -import { Tooltip, TooltipTrigger, TooltipContent } from '@/components/ui/tooltip'; import LevelIllustration from '../components/servers/LevelIllustrations'; import api from '../services/api'; import { useToast } from '../contexts/useToast.js'; @@ -889,20 +888,13 @@ const LevelPicker = ({ value, onChange }) => { })}
- - - - - - {copy[level].can} - {copy[level].cannot} - - + +

{copy[level].can}

+

{copy[level].cannot}

+
))} diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scss index ac0cb447..e4492db2 100644 --- a/frontend/src/styles/components/_design-system.scss +++ b/frontend/src/styles/components/_design-system.scss @@ -1862,6 +1862,7 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet'); &.is-clickable:focus-within { border-color: var(--border); } &__head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; } + &__head > .info-tip { margin-inline-start: -6px; } // 10px gap - 6 = the 4px InfoTip rule &__icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; diff --git a/frontend/src/styles/components/_info-tip.scss b/frontend/src/styles/components/_info-tip.scss index c4ce5e53..1cb490b3 100644 --- a/frontend/src/styles/components/_info-tip.scss +++ b/frontend/src/styles/components/_info-tip.scss @@ -14,6 +14,7 @@ cursor: pointer; vertical-align: middle; position: relative; + inset-block-start: -1px; // optical: middle-aligned glyph sits ~1-2px below the text's centre // Invisible 32px touch target; the glyph and line box stay as they are. &::before { diff --git a/frontend/src/styles/pages/_backups.scss b/frontend/src/styles/pages/_backups.scss index 711aa86a..e1e3c9e6 100644 --- a/frontend/src/styles/pages/_backups.scss +++ b/frontend/src/styles/pages/_backups.scss @@ -96,6 +96,8 @@ svg { flex-shrink: 0; } + &.tip-chip-row { gap: $space-1; } + // Amber, not red: keeping backups only on the same disk is a risk to fix, // not a failure that has already happened. &--warn { @@ -1117,7 +1119,7 @@ flex: 1 1 12rem; flex-wrap: wrap; align-items: center; - gap: 0 $space-2; + gap: 0 $space-1; min-inline-size: 0; font-size: $text-sm; diff --git a/frontend/src/styles/pages/_monitors.scss b/frontend/src/styles/pages/_monitors.scss index 6c925b79..ded9446c 100644 --- a/frontend/src/styles/pages/_monitors.scss +++ b/frontend/src/styles/pages/_monitors.scss @@ -574,6 +574,7 @@ } .mon-panel-hint svg { flex-shrink: 0; color: var(--green); } + .mon-panel-hint .info-tip { margin-inline-start: -$space-1; } // gap is 8px; the tip sits 4px after the text // Wide tables keep their own scroller so the panel never widens the page. .mon-table-scroll { overflow-x: auto; } diff --git a/frontend/src/styles/pages/_servers.scss b/frontend/src/styles/pages/_servers.scss index 03da894a..0b660107 100644 --- a/frontend/src/styles/pages/_servers.scss +++ b/frontend/src/styles/pages/_servers.scss @@ -2651,29 +2651,11 @@ } } + // Corner-positioned InfoTip: deliberately outside the inline spacing rule. &__info { position: absolute; top: $space-1; inset-inline-end: $space-1; - display: inline-flex; - padding: $space-1; - color: $text-tertiary; - background: none; - border: 0; - border-radius: 50%; - cursor: pointer; - - &:hover, - &:focus-visible { - color: $text-primary; - } - } - - &__tip { - flex-direction: column; - align-items: flex-start; - max-width: 260px; - white-space: normal; } &__note { diff --git a/frontend/src/styles/pages/_settings.scss b/frontend/src/styles/pages/_settings.scss index 215df2c5..5d127c62 100644 --- a/frontend/src/styles/pages/_settings.scss +++ b/frontend/src/styles/pages/_settings.scss @@ -1170,6 +1170,7 @@ background: $bg-hover; border-radius: $radius-control; gap: $space-4; + flex-wrap: wrap; // on phones the control drops below the label instead of squeezing it &:not(:last-child) { margin-bottom: $space-3; @@ -1182,12 +1183,15 @@ } .settings-label { - flex: 1; + flex: 1 1 12rem; display: flex; flex-wrap: wrap; align-items: center; column-gap: $space-1; + // `.form-group label` adds a bottom margin; mirror it so align-items: center centres the (i) on the text, not text + margin. + .form-group & > .ui-label + .info-tip { margin-block-end: $space-2; } + > span:first-child { display: block; font-weight: $font-weight-medium; @@ -1416,6 +1420,7 @@ display: flex; align-items: flex-start; justify-content: space-between; + flex-wrap: wrap; gap: $space-3; margin-bottom: $space-3;