Files
ServerKit/frontend/src/components/RequiresDocker.jsx
T
Juan Denis 0a8c763582 fix(ui): finish focus rings and InfoTip names
InfoTip subjects: theme gallery cards (theme name), profile role badge
(Role), security overview (Extensions, Notifications), Services empty
state, proxy panel, AI fallback toggle, base-domain row, RequiresDocker.

Focus rings: add the shared ring to text inputs/selects that only changed
border colour (forms, settings, servers, applications, security,
migration wizard, db tuner, datagrid, design-system, file manager); make
the slider thumb ring visible.

Clipped rings: inset rings for tabs, sk-seg, settings nav, theme cards,
select/dropdown items, sk-dtable wrap, datagrid cells, resource lists.
2026-11-11 00:26:25 -05:00

71 lines
3.6 KiB
React

import { Link } from 'react-router-dom';
import { Boxes, Terminal } from 'lucide-react';
import { useResourceTier } from '../contexts/useResourceTier.js';
import { useTranslation } from 'react-i18next';
import InfoTip from './InfoTip';
import CopyButton from './CopyButton';
// Shell commands are literal — never route them through t().
const COMMANDS = ['curl -fsSL https://get.docker.com | sh', 'sudo systemctl restart serverkit'];
/**
* Explains a Dockerless install instead of letting the page fail at click time.
*
* The Minimal install profile ships without Docker on purpose. Everything that
* hosts a workload — containers, services, deployments — needs it, and without
* this the pages render as if they work and then error on the first action.
*
* Fails open: when capacity has not loaded, or the viewer is not an admin (the
* context only fetches for admins), `canHostApps` is true and children render
* as normal. A capability probe must never be able to hide a working page.
*/
const RequiresDocker = ({ children, what = 'This page' }) => {
const { t } = useTranslation();
const { canHostApps, loading, profile, profiles } = useResourceTier();
if (loading || canHostApps) return children;
const profileLabel = profiles?.[profile]?.label || 'Minimal';
return (
<div className="requires-docker">
<div className="requires-docker__icon">
<Boxes size={40} />
</div>
<h2 className="requires-docker__title">{t('app.requiresDocker.dockerIsnTAvailable', 'Docker isn\'t available')}</h2>
<p className="requires-docker__text">
{what} {t('app.requiresDocker.needsDocker', 'needs Docker.')}
{' '}<InfoTip>
{what} {t('app.requiresDocker.needsDockerToRunContainersAnd', 'needs Docker to run containers, and this server was installed with the')} <strong>{profileLabel}</strong> {t('app.requiresDocker.profileWhichLeavesItOutNothing', 'profile, which leaves it out. Nothing is locked; adding Docker turns this page on.')}
</InfoTip>
</p>
<div className="requires-docker__how">
<div className="requires-docker__how-label">
<Terminal size={15} />
{t('app.requiresDocker.installItOnTheServerThen', 'Install it on the server, then restart ServerKit:')}
</div>
{COMMANDS.map((cmd) => (
<div className="requires-docker__cmd" key={cmd}>
<code className="requires-docker__cmd-text">{cmd}</code>
<CopyButton value={cmd} label={t('app.requiresDocker.copyCommand', 'Copy command')} copiedLabel={t('app.requiresDocker.copied', 'Copied!')} />
</div>
))}
</div>
<p className="requires-docker__footnote">
{t('app.requiresDocker.checkedAutomatically', 'Re-checked automatically.')}{' '}
<Link to="/settings/system">{t('app.requiresDocker.settingsSystem', 'Settings → System')}</Link>
{' '}<InfoTip subject={t('app.requiresDocker.checkedAutomatically', 'Re-checked automatically.')}>
{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.')}
</InfoTip>
</p>
</div>
);
};
export default RequiresDocker;