Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Move settings onto the shared field components

Juan Deniseecb487d7afd
diff --git a/frontend/src/components/security/FirewallTab.jsx b/frontend/src/components/security/FirewallTab.jsx
index a9f48fab..7012711d 100644
--- a/frontend/src/components/security/FirewallTab.jsx
+++ b/frontend/src/components/security/FirewallTab.jsx
@@ -4,6 +4,8 @@ import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '@/hooks/useConfirm';
import EmptyState from '@/components/EmptyState';
import Modal from '../Modal';
+import { InfoList, InfoItem } from '../InfoList';
+import PortField from '../PortField';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
@@ -485,24 +487,17 @@ const FirewallTab = () => {
<Button variant="outline" size="sm" onClick={loadData}>{t('common.actions.refresh', 'Refresh')}</Button>
</SharedCardHeader>
<SharedCardContent variant="legacy" className="card-body">
- <div className="sec-rows">
- <div className="sk-info-row">
- <span className="k">{t('common.labels.type', 'Type')}</span>
- <span className="v">{activeFirewall?.toUpperCase()}</span>
- </div>
- <div className="sk-info-row">
- <span className="k">{t('common.labels.status', 'Status')}</span>
+ <InfoList>
+ <InfoItem label={t('common.labels.type', 'Type')} value={activeFirewall?.toUpperCase()} mono />
+ <InfoItem label={t('common.labels.status', 'Status')}>
<Pill kind={isActive ? 'green' : 'red'}>
{isActive ? 'Active' : 'Inactive'}
</Pill>
- </div>
+ </InfoItem>
{activeFirewall === 'firewalld' && status?.firewalld?.default_zone && (
- <div className="sk-info-row">
- <span className="k">{t('app.firewallTab.defaultZone', 'Default zone')}</span>
- <span className="v">{status.firewalld.default_zone}</span>
- </div>
+ <InfoItem label={t('app.firewallTab.defaultZone', 'Default zone')} value={status.firewalld.default_zone} mono />
)}
- </div>
+ </InfoList>
</SharedCardContent>
</SharedCard>
)}
@@ -638,23 +633,19 @@ const FirewallTab = () => {
)}
</SharedCardHeader>
<SharedCardContent variant="legacy" className="card-body">
- <div className="sec-rows">
- <div className="sk-info-row">
- <span className="k">{t('app.firewallTab.blockContainerAccessTo169254', 'Block container access to 169.254.169.254')}</span>
+ <InfoList>
+ <InfoItem label={t('app.firewallTab.blockContainerAccessTo169254', 'Block container access to 169.254.169.254')}>
<Switch
checked={!!guard.enabled_setting}
onCheckedChange={handleGuardToggle}
disabled={guardLoading || !guard.supported}
aria-label={t('app.firewallTab.toggleCloudMetadataGuard', 'Toggle cloud metadata guard')}
/>
- </div>
+ </InfoItem>
{guard.supported && guard.backend && (
- <div className="sk-info-row">
- <span className="k">{t('app.firewallTab.backend', 'Backend')}</span>
- <span className="v">{guard.backend}</span>
- </div>
+ <InfoItem label={t('app.firewallTab.backend', 'Backend')} value={guard.backend} mono />
)}
- </div>
+ </InfoList>
<p className="sec-hint">
{t('app.firewallTab.stopsAppContainersFromReachingThe', 'Stops app containers from reaching the cloud metadata endpoint, preventing SSRF attacks from stealing instance credentials.')}
</p>
@@ -688,14 +679,13 @@ const FirewallTab = () => {
<Modal open={showPortModal} onClose={() => setShowPortModal(false)} title={t('app.firewallTab.allowPort', 'Allow Port')}>
<div className="form-row">
<div className="form-group">
- <Label>{t('app.firewallTab.portNumber', 'Port Number')}</Label>
- <Input
- type="number"
+ <Label htmlFor="firewall-allow-port">{t('app.firewallTab.portNumber', 'Port Number')}</Label>
+ <PortField
+ id="firewall-allow-port"
+ host={false}
+ allowPrivileged
value={newPort.port}
- onChange={(e) => setNewPort({ ...newPort, port: e.target.value })}
- placeholder="8080"
- min="1"
- max="65535"
+ onChange={(port) => setNewPort({ ...newPort, port })}
/>
</div>
<div className="form-group">
diff --git a/frontend/src/components/settings/AIManagementSettings.jsx b/frontend/src/components/settings/AIManagementSettings.jsx
index 5639b5f7..34b73dc4 100644
--- a/frontend/src/components/settings/AIManagementSettings.jsx
+++ b/frontend/src/components/settings/AIManagementSettings.jsx
@@ -5,9 +5,13 @@ import { FormField } from '../FormField';
import { Input } from '../ui/input';
import { Button } from '../ui/button';
import { Switch } from '../ui/switch';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '../ui/select';
import ModelBinding from '../ai/ModelBinding';
import EmptyState from '../EmptyState';
+// Radix Select cannot hold an empty value; this stands in for "no override".
+const PROVIDER_DEFAULT = '__default';
+
export default function AIManagementSettings({ connections, defaultId }) {
const { t } = useTranslation();
const [config, setConfig] = useState(null);
@@ -50,9 +54,14 @@ export default function AIManagementSettings({ connections, defaultId }) {
{config[key].map((candidate, index) => <div className="sk-ai-candidates__row" key={`${key}-${index}`}>
<ModelBinding id={`ai-${key}-${index}`} value={candidate} connections={connections} disabled={busy} discover onChange={(next) => change(key, config[key].map((item, i) => i === index ? { ...next, ...(key === 'pool' ? { tier: candidate.tier } : {}) } : item))} />
{key === 'pool' && <FormField htmlFor={`ai-tier-${index}`} label={t('ai.management.tier', 'Capability tier')}>
- <select id={`ai-tier-${index}`} value={candidate.tier} disabled={busy} onChange={(e) => change(key, config[key].map((item, i) => i === index ? { ...item, tier: e.target.value } : item))}>
- <option value="budget">{t('ai.management.utility', 'Utility')}</option><option value="standard">{t('ai.management.standard', 'Standard')}</option><option value="premium">{t('ai.management.advanced', 'Advanced')}</option>
- </select>
+ <Select value={candidate.tier} disabled={busy} onValueChange={(tier) => change(key, config[key].map((item, i) => i === index ? { ...item, tier } : item))}>
+ <SelectTrigger id={`ai-tier-${index}`}><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value="budget">{t('ai.management.utility', 'Utility')}</SelectItem>
+ <SelectItem value="standard">{t('ai.management.standard', 'Standard')}</SelectItem>
+ <SelectItem value="premium">{t('ai.management.advanced', 'Advanced')}</SelectItem>
+ </SelectContent>
+ </Select>
</FormField>}
<div className="settings-actions">
{key === 'fallbacks' && <Button type="button" variant="outline" disabled={busy || index === 0} onClick={() => { const next = [...config[key]]; [next[index - 1], next[index]] = [next[index], next[index - 1]]; change(key, next); }}>{t('ai.management.moveUp', 'Move up')}</Button>}
@@ -82,10 +91,15 @@ export default function AIManagementSettings({ connections, defaultId }) {
<p>{t('ai.management.routingHint', 'Automatic routing uses only the approved pool below. An explicit model choice takes priority. Capability tiers guide selection; speed is not a measured guarantee.')}</p>
{toggle('routing_enabled', t('ai.management.enableRouting', 'Enable automatic routing'))}
<FormField htmlFor="ai-routing-strategy" label={t('ai.management.strategy', 'Strategy')}>
- <select id="ai-routing-strategy" value={config.strategy} disabled={busy} onChange={(e) => change('strategy', e.target.value)}>
- <option value="cost_optimized">{t('ai.management.economical', 'Cost optimized')}</option><option value="balanced">{t('ai.management.balanced', 'Balanced')}</option>
- <option value="quality_first">{t('ai.management.quality', 'Quality first')}</option><option value="fast">{t('ai.management.fast', 'Fast')}</option>
- </select>
+ <Select value={config.strategy} disabled={busy} onValueChange={(value) => change('strategy', value)}>
+ <SelectTrigger id="ai-routing-strategy"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value="cost_optimized">{t('ai.management.economical', 'Cost optimized')}</SelectItem>
+ <SelectItem value="balanced">{t('ai.management.balanced', 'Balanced')}</SelectItem>
+ <SelectItem value="quality_first">{t('ai.management.quality', 'Quality first')}</SelectItem>
+ <SelectItem value="fast">{t('ai.management.fast', 'Fast')}</SelectItem>
+ </SelectContent>
+ </Select>
</FormField>
{candidates('pool')}
<FormField htmlFor="ai-routing-sample" label={t('ai.management.previewTask', 'Preview a task')} hint={t('ai.management.previewHint', 'Uses the current draft. Preview does not send your task to a provider or spend tokens.')}>
@@ -100,11 +114,14 @@ export default function AIManagementSettings({ connections, defaultId }) {
<section className="settings-card">
<h3>{t('ai.management.behavior', 'Generation and spending')}</h3>
<FormField htmlFor="ai-budget-policy" label={t('ai.management.budgetPolicy', 'Conversation budget behavior')}>
- <select id="ai-budget-policy" value={config.budget_policy} disabled={busy} onChange={(e) => change('budget_policy', e.target.value)}>
- <option value="hard_stop">{t('ai.management.stop', 'Stop at the limit')}</option>
- <option value="warn_and_continue">{t('ai.management.warn', 'Warn and continue')}</option>
- <option value="degrade">{t('ai.management.degrade', 'Use a cheaper model near the limit, then stop')}</option>
- </select>
+ <Select value={config.budget_policy} disabled={busy} onValueChange={(value) => change('budget_policy', value)}>
+ <SelectTrigger id="ai-budget-policy"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value="hard_stop">{t('ai.management.stop', 'Stop at the limit')}</SelectItem>
+ <SelectItem value="warn_and_continue">{t('ai.management.warn', 'Warn and continue')}</SelectItem>
+ <SelectItem value="degrade">{t('ai.management.degrade', 'Use a cheaper model near the limit, then stop')}</SelectItem>
+ </SelectContent>
+ </Select>
</FormField>
<div className="ai-connections__fields">
{numberField('max_output_tokens', t('ai.management.outputTokens', 'Maximum output tokens per response'), 64, 65536)}
@@ -119,9 +136,15 @@ export default function AIManagementSettings({ connections, defaultId }) {
<Input id="ai-temperature" type="number" min="0" max="2" step="0.1" disabled={busy} value={config.temperature ?? ''} onChange={(e) => change('temperature', e.target.value === '' ? null : e.target.value)} />
</FormField>
<FormField htmlFor="ai-reasoning" label={t('ai.management.reasoning', 'Reasoning effort')} hint={t('ai.management.reasoningHint', 'Applied to supported OpenAI reasoning models. Other models retain provider defaults.')}>
- <select id="ai-reasoning" disabled={busy} value={config.reasoning_effort || ''} onChange={(e) => change('reasoning_effort', e.target.value || null)}>
- <option value="">{t('ai.management.providerDefault', 'Provider default')}</option><option value="low">{t('ai.management.low', 'Low')}</option><option value="medium">{t('ai.management.medium', 'Medium')}</option><option value="high">{t('ai.management.high', 'High')}</option>
- </select>
+ <Select disabled={busy} value={config.reasoning_effort || PROVIDER_DEFAULT} onValueChange={(value) => change('reasoning_effort', value === PROVIDER_DEFAULT ? null : value)}>
+ <SelectTrigger id="ai-reasoning"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value={PROVIDER_DEFAULT}>{t('ai.management.providerDefault', 'Provider default')}</SelectItem>
+ <SelectItem value="low">{t('ai.management.low', 'Low')}</SelectItem>
+ <SelectItem value="medium">{t('ai.management.medium', 'Medium')}</SelectItem>
+ <SelectItem value="high">{t('ai.management.high', 'High')}</SelectItem>
+ </SelectContent>
+ </Select>
</FormField>
</div>
</details>
diff --git a/frontend/src/components/settings/AIUsageSettings.jsx b/frontend/src/components/settings/AIUsageSettings.jsx
index e5f87fb8..96ca8d34 100644
--- a/frontend/src/components/settings/AIUsageSettings.jsx
+++ b/frontend/src/components/settings/AIUsageSettings.jsx
@@ -5,12 +5,16 @@ import useFormat from '../../hooks/useFormat';
import { FormField } from '../FormField';
import { Input } from '../ui/input';
import { Button } from '../ui/button';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '../ui/select';
import { DataTable } from '../ds/DataTable';
import { DataTableFooter } from '../ds/DataTableFooter';
import EmptyState from '../EmptyState';
import { CardHeader } from '../ui/card';
import { Drawer } from '../ds/Drawer';
+// Radix Select cannot hold an empty value; this stands in for "no filter".
+const ALL = '__all';
+
export default function AIUsageSettings({ connections }) {
const { t } = useTranslation();
const { formatNumber, formatDateTime } = useFormat();
@@ -40,15 +44,37 @@ export default function AIUsageSettings({ connections }) {
<Button variant="outline" disabled={busy} onClick={() => setRevision((value) => value + 1)}>{t('common.actions.refresh', 'Refresh')}</Button>
</CardHeader>
<div className="ai-connections__fields">
- <FormField htmlFor="ai-usage-days" label={t('ai.usage.period', 'Period')}><select id="ai-usage-days" value={filters.days} onChange={(e) => setFilters({ ...filters, days: e.target.value })}>
- <option value="1">{t('ai.usage.day', 'Last 24 hours')}</option><option value="7">{t('ai.usage.week', 'Last 7 days')}</option><option value="30">{t('ai.usage.month', 'Last 30 days')}</option><option value="90">{t('ai.usage.quarter', 'Last 90 days')}</option>
- </select></FormField>
- <FormField htmlFor="ai-usage-role" label={groups.profile}><select id="ai-usage-role" value={filters.profile} onChange={(e) => setFilters({ ...filters, profile: e.target.value })}>
- <option value="">{t('ai.usage.allRoles', 'All task roles')}</option><option value="utility">{t('ai.management.utility', 'Utility')}</option><option value="standard">{t('ai.management.standard', 'Standard')}</option><option value="advanced">{t('ai.management.advanced', 'Advanced')}</option>
- </select></FormField>
- <FormField htmlFor="ai-usage-connection" label={groups.connection_id}><select id="ai-usage-connection" value={filters.connection_id} onChange={(e) => setFilters({ ...filters, connection_id: e.target.value })}>
- <option value="">{t('ai.usage.allConnections', 'All connections')}</option>{connections.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}
- </select></FormField>
+ <FormField htmlFor="ai-usage-days" label={t('ai.usage.period', 'Period')}>
+ <Select value={filters.days} onValueChange={(days) => setFilters({ ...filters, days })}>
+ <SelectTrigger id="ai-usage-days"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value="1">{t('ai.usage.day', 'Last 24 hours')}</SelectItem>
+ <SelectItem value="7">{t('ai.usage.week', 'Last 7 days')}</SelectItem>
+ <SelectItem value="30">{t('ai.usage.month', 'Last 30 days')}</SelectItem>
+ <SelectItem value="90">{t('ai.usage.quarter', 'Last 90 days')}</SelectItem>
+ </SelectContent>
+ </Select>
+ </FormField>
+ <FormField htmlFor="ai-usage-role" label={groups.profile}>
+ <Select value={filters.profile || ALL} onValueChange={(value) => setFilters({ ...filters, profile: value === ALL ? '' : value })}>
+ <SelectTrigger id="ai-usage-role"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value={ALL}>{t('ai.usage.allRoles', 'All task roles')}</SelectItem>
+ <SelectItem value="utility">{t('ai.management.utility', 'Utility')}</SelectItem>
+ <SelectItem value="standard">{t('ai.management.standard', 'Standard')}</SelectItem>
+ <SelectItem value="advanced">{t('ai.management.advanced', 'Advanced')}</SelectItem>
+ </SelectContent>
+ </Select>
+ </FormField>
+ <FormField htmlFor="ai-usage-connection" label={groups.connection_id}>
+ <Select value={filters.connection_id ? String(filters.connection_id) : ALL} onValueChange={(value) => setFilters({ ...filters, connection_id: value === ALL ? '' : value })}>
+ <SelectTrigger id="ai-usage-connection"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ <SelectItem value={ALL}>{t('ai.usage.allConnections', 'All connections')}</SelectItem>
+ {connections.map((item) => <SelectItem key={item.id} value={String(item.id)}>{item.name}</SelectItem>)}
+ </SelectContent>
+ </Select>
+ </FormField>
{['user_id', 'workspace_id'].map((key) => <FormField key={key} htmlFor={`ai-usage-${key}`} label={groups[key]} hint={t('ai.usage.idFilter', 'Optional numeric ID')}><Input id={`ai-usage-${key}`} type="number" min="1" value={filters[key]} onChange={(e) => setFilters({ ...filters, [key]: e.target.value })} /></FormField>)}
</div>
<div className="settings-actions settings-actions--footer"><Button variant="outline" disabled={busy} onClick={() => { setOffset(0); setApplied({ ...filters }); }}>{t('ai.usage.apply', 'Apply filters')}</Button></div>
@@ -64,7 +90,14 @@ export default function AIUsageSettings({ connections }) {
<p className="settings-hint">{t('ai.usage.unknowns', '{{count}} runs have unknown or partial pricing. Known cost is not a complete billing total.', { count: data.totals.unknown_cost_runs })}</p>
<p className="settings-hint">{t('ai.usage.latency', 'Average run duration: {{seconds}} seconds', { seconds: formatNumber(data.totals.average_duration_ms / 1000, { maximumFractionDigits: 1 }) })}</p>
{(data.allowances || []).map((item) => <p key={item.scope}>{t('ai.usage.allowance', '{{scope}} monthly allowance: {{remaining}} remaining of {{limit}}', { scope: item.scope, remaining: money(item.remaining), limit: money(item.limit) })}</p>)}
- <FormField htmlFor="ai-usage-group" label={t('ai.usage.breakdown', 'Cost breakdown')}><select id="ai-usage-group" value={group} onChange={(e) => setGroup(e.target.value)}>{Object.entries(groups).map(([key, label]) => <option key={key} value={key}>{label}</option>)}</select></FormField>
+ <FormField htmlFor="ai-usage-group" label={t('ai.usage.breakdown', 'Cost breakdown')}>
+ <Select value={group} onValueChange={setGroup}>
+ <SelectTrigger id="ai-usage-group"><SelectValue /></SelectTrigger>
+ <SelectContent>
+ {Object.entries(groups).map(([key, label]) => <SelectItem key={key} value={key}>{label}</SelectItem>)}
+ </SelectContent>
+ </Select>
+ </FormField>
<DataTable data={data.groups[group] || []} keyField="label" columns={[
{ key: 'label', header: groups[group], render: (item) => group === 'connection_id' ? connectionName(item.label) : item.label },
{ key: 'runs', header: t('ai.usage.runs', 'Runs') },
diff --git a/frontend/src/components/settings/ApiKeyModal.jsx b/frontend/src/components/settings/ApiKeyModal.jsx
index 82d4b96d..8abb202c 100644
--- a/frontend/src/components/settings/ApiKeyModal.jsx
+++ b/frontend/src/components/settings/ApiKeyModal.jsx
@@ -1,11 +1,11 @@
import { useState } from 'react';
-import { Copy, Check, AlertTriangle } from 'lucide-react';
+import { AlertTriangle } from 'lucide-react';
import Modal from '../Modal';
import ApiKeyScopesModal from '../api/ApiKeyScopesModal';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
-import { copyToClipboard } from '@/utils/clipboard';
+import CopyField from '../CopyField';
import { useTranslation } from 'react-i18next';
const TIER_OPTIONS = [
@@ -21,7 +21,6 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
const [tier, setTier] = useState('standard');
const [expiresAt, setExpiresAt] = useState('');
const [saving, setSaving] = useState(false);
- const [copied, setCopied] = useState(false);
const handleSubmit = async (e) => {
e.preventDefault();
@@ -39,13 +38,6 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
}
};
- const copyKey = async () => {
- if (createdKey && await copyToClipboard(createdKey)) {
- setCopied(true);
- setTimeout(() => setCopied(false), 2000);
- }
- };
-
// Show created key view
if (createdKey) {
return (
@@ -54,13 +46,7 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
<AlertTriangle size={16} />
<span>{t('app.apiKeyModal.copyThisKeyNowItWill', 'Copy this key now. It will not be shown again.')}</span>
</div>
- <div className="api-key-modal__key-display">
- <code>{createdKey}</code>
- <Button variant="outline" size="sm" onClick={copyKey}>
- {copied ? <Check size={14} /> : <Copy size={14} />}
- {copied ? 'Copied' : 'Copy'}
- </Button>
- </div>
+ <CopyField value={createdKey} label={t('app.apiKeyModal.apiKey', 'API key')} secret />
<div className="modal-footer">
<Button variant="default" onClick={onClose}>{t('common.actions.done', 'Done')}</Button>
</div>
diff --git a/frontend/src/components/settings/IconReferenceTab.jsx b/frontend/src/components/settings/IconReferenceTab.jsx
index 107964cf..a90e1166 100644
--- a/frontend/src/components/settings/IconReferenceTab.jsx
+++ b/frontend/src/components/settings/IconReferenceTab.jsx
@@ -12,7 +12,7 @@ import {
Minus, Unlock, ArrowDownLeft, ArrowUpRight
} from 'lucide-react';
import { Input } from '@/components/ui/input';
-import { copyToClipboard } from '@/utils/clipboard';
+import { useClipboard } from '@/hooks/useClipboard';
import { useTranslation } from 'react-i18next';
import { Button as SharedButton } from '@/components/ui/button';
@@ -58,9 +58,11 @@ const IconReferenceTab = () => {
const { t } = useTranslation();
const [searchQuery, setSearchQuery] = useState('');
const [copiedIcon, setCopiedIcon] = useState(null);
+ const { copy } = useClipboard();
async function handleCopyImport(name) {
- if (!await copyToClipboard(name)) return;
+ // The tile itself says "Copied!", so skip the success toast.
+ if (!await copy(name, null)) return;
setCopiedIcon(name);
setTimeout(() => setCopiedIcon(null), 1500);
}
diff --git a/frontend/src/components/settings/InvitationsTab.jsx b/frontend/src/components/settings/InvitationsTab.jsx
index 8c237b78..3f96f92b 100644
--- a/frontend/src/components/settings/InvitationsTab.jsx
+++ b/frontend/src/components/settings/InvitationsTab.jsx
@@ -11,7 +11,7 @@ import {
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import EmptyState from '../EmptyState';
-import { copyToClipboard } from '@/utils/clipboard';
+import { CopyButton } from '../CopyButton';
import { useTranslation } from 'react-i18next';
import useFocusParam from '@/hooks/useFocusParam';
import useFormat from '@/hooks/useFormat';
@@ -72,7 +72,6 @@ const InvitationsTab = () => {
const [invitations, setInvitations] = useState([]);
const [loading, setLoading] = useState(true);
const [showInviteModal, setShowInviteModal] = useState(false);
- const [copied, setCopied] = useState(null);
const [error, setError] = useState('');
const [pendingId, setPendingId] = useState(null);
const actionInFlight = useRef(false);
@@ -137,11 +136,8 @@ const InvitationsTab = () => {
}
}
- async function copyLink(token) {
- const url = `${window.location.origin}/register?invite=${token}`;
- if (!await copyToClipboard(url)) return;
- setCopied(token);
- setTimeout(() => setCopied(null), 2000);
+ function inviteUrl(token) {
+ return `${window.location.origin}/register?invite=${token}`;
}
function formatDate(dateString) {
@@ -241,14 +237,15 @@ const InvitationsTab = () => {
render: (inv) => (
inv.status === 'pending' && !inv.is_expired && (
<>
- <Button
+ <CopyButton
+ value={inviteUrl(inv.token)}
variant="ghost"
size="sm"
- onClick={() => copyLink(inv.token)}
- title={t('app.invitationsTab.copyInviteLink', 'Copy invite link')}
+ label={t('app.invitationsTab.copyInviteLink', 'Copy invite link')}
+ copiedLabel={t('app.copyField.copied', 'Copied')}
>
- {copied === inv.token ? 'Copied!' : 'Copy Link'}
- </Button>
+ {t('app.invitationsTab.copyLink', 'Copy Link')}
+ </CopyButton>
{inv.email && (
<Button
variant="ghost"
diff --git a/frontend/src/components/settings/InviteModal.jsx b/frontend/src/components/settings/InviteModal.jsx
index f82b330e..2195945e 100644
--- a/frontend/src/components/settings/InviteModal.jsx
+++ b/frontend/src/components/settings/InviteModal.jsx
@@ -6,7 +6,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
-import { copyToClipboard } from '@/utils/clipboard';
+import CopyField from '../CopyField';
import { useTranslation } from 'react-i18next';
const InviteModal = ({ onClose, onCreated }) => {
@@ -20,7 +20,6 @@ const InviteModal = ({ onClose, onCreated }) => {
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
const [result, setResult] = useState(null);
- const [copied, setCopied] = useState(false);
useEffect(() => {
api.getPermissionTemplates().then(data => {
@@ -66,14 +65,10 @@ const InviteModal = ({ onClose, onCreated }) => {
}
}
- async function copyLink() {
- if (result?.invite_url && await copyToClipboard(result.invite_url)) {
- setCopied(true);
- window.dispatchEvent(new CustomEvent('serverkit:walkthrough-signal', {
- detail: { type: 'invitation-link-copied' },
- }));
- setTimeout(() => setCopied(false), 2000);
- }
+ function signalLinkCopied() {
+ window.dispatchEvent(new CustomEvent('serverkit:walkthrough-signal', {
+ detail: { type: 'invitation-link-copied' },
+ }));
}
// Show result screen after creation
@@ -81,11 +76,8 @@ const InviteModal = ({ onClose, onCreated }) => {
return (
<Modal open={true} onClose={onClose} title={t('app.inviteModal.invitationCreated', 'Invitation Created')} size="md">
<p>{t('app.inviteModal.shareThisInvitationLink', 'Share this invitation link:')}</p>
- <div className="invite-link-display" data-walkthrough="invite-result">
- <code>{result.invite_url}</code>
- <Button variant="ghost" size="sm" onClick={copyLink}>
- {copied ? 'Copied!' : 'Copy'}
- </Button>
+ <div data-walkthrough="invite-result">
+ <CopyField value={result.invite_url} onCopy={signalLinkCopied} />
</div>
{result.email_sent && (
<p className="text-success invite-result-note">
diff --git a/frontend/src/components/settings/LoginLinksSection.jsx b/frontend/src/components/settings/LoginLinksSection.jsx
index be47009e..8efe8a6b 100644
--- a/frontend/src/components/settings/LoginLinksSection.jsx
+++ b/frontend/src/components/settings/LoginLinksSection.jsx
@@ -1,7 +1,8 @@
import { useState, useEffect, useCallback } from 'react';
import api from '../../services/api';
import { Button } from '@/components/ui/button';
-import { copyToClipboard } from '@/utils/clipboard';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
+import CopyField from '../CopyField';
import { useTranslation } from 'react-i18next';
const TTL_OPTIONS = [15, 30, 60];
@@ -24,7 +25,6 @@ const LoginLinksSection = ({ users, currentUserId }) => {
// Reveal-once state
const [minted, setMinted] = useState(null);
- const [copied, setCopied] = useState(false);
const loadLinks = useCallback(async () => {
try {
@@ -48,7 +48,6 @@ const LoginLinksSection = ({ users, currentUserId }) => {
setError('');
setMinting(true);
setMinted(null);
- setCopied(false);
try {
const body = { user_id: Number(userId), ttl_minutes: ttl };
if (bindIp && boundIp.trim()) body.bound_ip = boundIp.trim();
@@ -65,11 +64,6 @@ const LoginLinksSection = ({ users, currentUserId }) => {
}
}
- async function handleCopy() {
- // On failure the URL stays visible for manual copy.
- if (await copyToClipboard(minted.url)) setCopied(true);
- }
-
async function handleRevoke(id) {
setError('');
try {
@@ -104,22 +98,32 @@ const LoginLinksSection = ({ users, currentUserId }) => {
<form className="login-links__form" onSubmit={handleMint}>
<label className="login-links__field">
<span>{t('common.labels.user', 'User')}</span>
- <select value={userId} onChange={(e) => setUserId(e.target.value)}>
- {(users || []).map((u) => (
- <option key={u.id} value={u.id}>
- {u.username}{u.id === currentUserId ? ' (you)' : ''}
- </option>
- ))}
- </select>
+ <Select value={userId === '' || userId == null ? undefined : String(userId)} onValueChange={setUserId}>
+ <SelectTrigger aria-label={t('common.labels.user', 'User')}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {(users || []).map((u) => (
+ <SelectItem key={u.id} value={String(u.id)}>
+ {u.username}{u.id === currentUserId ? ' (you)' : ''}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</label>
<label className="login-links__field">
<span>{t('app.loginLinksSection.expiresIn', 'Expires in')}</span>
- <select value={ttl} onChange={(e) => setTtl(Number(e.target.value))}>
- {TTL_OPTIONS.map((minutes) => (
- <option key={minutes} value={minutes}>{minutes} minutes</option>
- ))}
- </select>
+ <Select value={String(ttl)} onValueChange={(value) => setTtl(Number(value))}>
+ <SelectTrigger aria-label={t('app.loginLinksSection.expiresIn', 'Expires in')}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {TTL_OPTIONS.map((minutes) => (
+ <SelectItem key={minutes} value={String(minutes)}>{minutes} minutes</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</label>
<label className="login-links__bind">
@@ -159,12 +163,7 @@ const LoginLinksSection = ({ users, currentUserId }) => {
<p className="login-links__reveal-title">
{t('app.loginLinksSection.copyThisUrlNowItWill', 'Copy this URL now — it will not be shown again.')}
</p>
- <div className="login-links__reveal-row">
- <code>{minted.url}</code>
- <Button type="button" size="sm" onClick={handleCopy}>
- {copied ? 'Copied' : 'Copy URL'}
- </Button>
- </div>
+ <CopyField value={minted.url} />
</div>
)}
diff --git a/frontend/src/components/settings/NotificationsTab.jsx b/frontend/src/components/settings/NotificationsTab.jsx
index 4b47f95f..3a5f16de 100644
--- a/frontend/src/components/settings/NotificationsTab.jsx
+++ b/frontend/src/components/settings/NotificationsTab.jsx
@@ -8,6 +8,7 @@ import { Switch } from '@/components/ui/switch';
import { Badge } from '@/components/ui/badge';
import { SegControl } from '../ds/SegControl';
import EmptyState from '../EmptyState';
+import PortField from '../PortField';
import useSettingFocus from '../../hooks/useSettingFocus';
import { useTranslation } from 'react-i18next';
@@ -538,11 +539,13 @@ const NotificationsTab = () => {
/>
</div>
<div className="form-group">
- <Label>{t('app.notificationsTab.smtpPort', 'SMTP Port')}</Label>
- <Input
- type="number"
- value={config.email.smtp_port || 587}
- onChange={(e) => updateChannelConfig('email', 'smtp_port', parseInt(e.target.value))}
+ <Label htmlFor="notify-smtp-port">{t('app.notificationsTab.smtpPort', 'SMTP Port')}</Label>
+ <PortField
+ id="notify-smtp-port"
+ host={false}
+ allowPrivileged
+ value={config.email.smtp_port || ''}
+ onChange={(port) => updateChannelConfig('email', 'smtp_port', port === '' ? null : port)}
placeholder="587"
/>
</div>
diff --git a/frontend/src/components/settings/SecuritySettingsTab.jsx b/frontend/src/components/settings/SecuritySettingsTab.jsx
index 4bb4b810..253c1c30 100644
--- a/frontend/src/components/settings/SecuritySettingsTab.jsx
+++ b/frontend/src/components/settings/SecuritySettingsTab.jsx
@@ -9,7 +9,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Badge } from '@/components/ui/badge';
-import { copyToClipboard } from '@/utils/clipboard';
+import CopyField from '../CopyField';
import { downloadBlob } from '@/utils/downloadBlob';
import { useTranslation } from 'react-i18next';
@@ -286,10 +286,6 @@ Keep these codes in a safe place.`;
downloadBlob(content, 'serverkit-backup-codes.txt');
}
- function copyBackupCodes() {
- copyToClipboard(backupCodes.join('\n'));
- }
-
return (
<div className="settings-section">
<div className="section-header">
@@ -456,13 +452,13 @@ Keep these codes in a safe place.`;
) : (
<div className="qr-fallback">
<p>{t('app.securitySettingsTab.qrCodeUnavailableEnterThisSecret', 'QR code unavailable. Enter this secret manually:')}</p>
- <code className="secret-key">{setupData.secret}</code>
+ <CopyField value={setupData.secret} secret />
</div>
)}
<details className="manual-entry">
<summary>{t('app.securitySettingsTab.canTScanEnterManually', 'Can\'t scan? Enter manually')}</summary>
<p>{t('app.securitySettingsTab.account', 'Account:')} {user?.email ?? ''}</p>
- <p>{t('app.securitySettingsTab.secret', 'Secret:')} <code>{setupData.secret}</code></p>
+ <CopyField label={t('app.securitySettingsTab.secretLabel', 'Secret')} value={setupData.secret} secret />
</details>
</div>
</div>
@@ -549,11 +545,7 @@ Keep these codes in a safe place.`;
</svg>
<p>{t('app.securitySettingsTab.saveTheseBackupCodesInA', 'Save these backup codes in a secure location. They will not be shown again. Each code can only be used once.')}</p>
</div>
- <div className="backup-codes-grid">
- {backupCodes.map((code, index) => (
- <code key={index} className="backup-code">{code}</code>
- ))}
- </div>
+ <CopyField value={backupCodes.join('\n')} multiline />
<div className="backup-codes-actions">
<Button variant="outline" onClick={downloadBackupCodes}>
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
@@ -561,13 +553,6 @@ Keep these codes in a safe place.`;
</svg>
{t('common.actions.download', 'Download')}
</Button>
- <Button variant="outline" onClick={copyBackupCodes}>
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
- <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
- </svg>
- {t('common.actions.copy', 'Copy')}
- </Button>
</div>
</>
) : (
diff --git a/frontend/src/components/settings/SiteSettingsTab.jsx b/frontend/src/components/settings/SiteSettingsTab.jsx
index a17e29b1..b36b3188 100644
--- a/frontend/src/components/settings/SiteSettingsTab.jsx
+++ b/frontend/src/components/settings/SiteSettingsTab.jsx
@@ -4,6 +4,8 @@ import { Switch } from '@/components/ui/switch';
import { Label } from '@/components/ui/label';
import { Input } from '@/components/ui/input';
import { Button } from '@/components/ui/button';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
+import DomainField from '../DomainField';
import { Pill } from '@/components/ds';
import useSettingFocus from '../../hooks/useSettingFocus';
import { useAuth } from '../../contexts/useAuth.js';
@@ -35,6 +37,7 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
// Base-domain registry: add a new base + track which row an action is running on.
const [newDomain, setNewDomain] = useState('');
const [newDnsMode, setNewDnsMode] = useState('wildcard');
+ const [newDomainKey, setNewDomainKey] = useState(0);
const [addingDomain, setAddingDomain] = useState(false);
const [rowBusy, setRowBusy] = useState(''); // domain currently being mutated
@@ -91,6 +94,8 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
const res = await api.addSiteBaseDomain(domain, { dnsMode: newDnsMode });
if (res.success) {
setNewDomain('');
+ // DomainField keeps its own draft; remount it to clear the input.
+ setNewDomainKey((k) => k + 1);
setMessage({ type: 'success', text: `Added base domain ${domain}` });
await loadHttps();
} else {
@@ -345,16 +350,16 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
<Label htmlFor="login-layout">{t('app.siteSettingsTab.loginLayout', 'Login layout')}</Label>
</div>
<div className="settings-control">
- <select
- id="login-layout"
- className="settings-select"
- value={loginLayout}
- onChange={(e) => setLoginLayout(e.target.value)}
- >
- <option value="centered">{t('app.siteSettingsTab.centeredCard', 'Centered card')}</option>
- <option value="split">{t('app.siteSettingsTab.splitHero', 'Split hero')}</option>
- <option value="minimal">{t('app.siteSettingsTab.minimal', 'Minimal')}</option>
- </select>
+ <Select value={loginLayout} onValueChange={setLoginLayout}>
+ <SelectTrigger id="login-layout" className="settings-select">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="centered">{t('app.siteSettingsTab.centeredCard', 'Centered card')}</SelectItem>
+ <SelectItem value="split">{t('app.siteSettingsTab.splitHero', 'Split hero')}</SelectItem>
+ <SelectItem value="minimal">{t('app.siteSettingsTab.minimal', 'Minimal')}</SelectItem>
+ </SelectContent>
+ </Select>
<Button onClick={handleSaveBrand} disabled={savingBrand}>
{savingBrand ? 'Saving…' : 'Save'}
</Button>
@@ -443,13 +448,18 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
{https.providers?.length > 0 ? (
<div className="form-group">
<div className="settings-row">
- <div className="settings-label"><Label>{t('app.siteSettingsTab.dnsProviderForHttps', 'DNS provider for HTTPS')}</Label></div>
+ <div className="settings-label"><Label htmlFor="sites-https-provider">{t('app.siteSettingsTab.dnsProviderForHttps', 'DNS provider for HTTPS')}</Label></div>
<div className="settings-control">
- <select className="settings-select" value={providerId} onChange={(e) => setProviderId(e.target.value)}>
- {https.providers.map((p) => (
- <option key={p.id} value={p.id}>{p.name} ({p.provider})</option>
- ))}
- </select>
+ <Select value={providerId ? String(providerId) : undefined} onValueChange={setProviderId}>
+ <SelectTrigger id="sites-https-provider" className="settings-select">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {https.providers.map((p) => (
+ <SelectItem key={p.id} value={String(p.id)}>{p.name} ({p.provider})</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
</div>
<span className="form-help">{t('app.siteSettingsTab.usedToIssueEachBaseS', 'Used to issue each base\'s wildcard certificate (DNS-01). Each base can use a different connected provider.')}</span>
@@ -483,12 +493,17 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
)}
</div>
<div className="settings-control">
- <select className="settings-select" value={b.dns_mode || 'wildcard'}
- onChange={(e) => handleRowDnsMode(b, e.target.value)}
+ <Select value={b.dns_mode || 'wildcard'}
+ onValueChange={(mode) => handleRowDnsMode(b, mode)}
disabled={rowBusy === b.domain || savingDnsMode}>
- <option value="wildcard">{t('app.siteSettingsTab.wildcardDns', 'Wildcard DNS')}</option>
- <option value="per-site">{t('app.siteSettingsTab.perSiteDns', 'Per-site DNS')}</option>
- </select>
+ <SelectTrigger className="settings-select" aria-label={t('app.siteSettingsTab.dnsModeFor', 'DNS mode for {{domain}}', { domain: b.domain })}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="wildcard">{t('app.siteSettingsTab.wildcardDns', 'Wildcard DNS')}</SelectItem>
+ <SelectItem value="per-site">{t('app.siteSettingsTab.perSiteDns', 'Per-site DNS')}</SelectItem>
+ </SelectContent>
+ </Select>
<Button variant="outline" onClick={() => handleSetupHttpsFor(b)}
disabled={rowBusy === b.domain || !https.providers?.length}>
{rowBusy === b.domain ? 'Working…' : (b.https_enabled ? 'Renew HTTPS' : 'Set up HTTPS')}
@@ -518,12 +533,22 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
<div className="settings-row">
<div className="settings-label"><Label htmlFor="new-base-domain">{t('app.siteSettingsTab.addBaseDomain', 'Add base domain')}</Label></div>
<div className="settings-control">
- <Input id="new-base-domain" type="text" placeholder="toto.com"
- value={newDomain} onChange={(e) => setNewDomain(e.target.value)} />
- <select className="settings-select" value={newDnsMode} onChange={(e) => setNewDnsMode(e.target.value)}>
- <option value="wildcard">{t('app.siteSettingsTab.wildcardDns', 'Wildcard DNS')}</option>
- <option value="per-site">{t('app.siteSettingsTab.perSiteDns', 'Per-site DNS')}</option>
- </select>
+ <DomainField
+ key={newDomainKey}
+ id="new-base-domain"
+ modes={['custom']}
+ exclude={displayBases.map((b) => b.domain)}
+ onChange={setNewDomain}
+ />
+ <Select value={newDnsMode} onValueChange={setNewDnsMode}>
+ <SelectTrigger className="settings-select" aria-label={t('app.siteSettingsTab.newBaseDnsMode', 'DNS mode for the new base domain')}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="wildcard">{t('app.siteSettingsTab.wildcardDns', 'Wildcard DNS')}</SelectItem>
+ <SelectItem value="per-site">{t('app.siteSettingsTab.perSiteDns', 'Per-site DNS')}</SelectItem>
+ </SelectContent>
+ </Select>
<Button onClick={handleAddDomain} disabled={addingDomain || !newDomain.trim()}>
{addingDomain ? 'Adding…' : 'Add'}
</Button>
diff --git a/frontend/src/components/settings/SystemTab.jsx b/frontend/src/components/settings/SystemTab.jsx
index 89068a69..fc6f66d0 100644
--- a/frontend/src/components/settings/SystemTab.jsx
+++ b/frontend/src/components/settings/SystemTab.jsx
@@ -4,8 +4,8 @@ import { useTheme } from '../../contexts/useTheme.js';
import api from '../../services/api';
import useSettingFocus from '../../hooks/useSettingFocus';
import { InfoList, InfoItem } from '../InfoList';
+import DomainField from '../DomainField';
import { Button } from '@/components/ui/button';
-import { Input } from '@/components/ui/input';
import { Switch } from '@/components/ui/switch';
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
import { formatBytes } from '@/utils/formatBytes';
@@ -43,6 +43,7 @@ const SystemTab = () => {
const [domainLoading, setDomainLoading] = useState(false);
const [detectedDomain, setDetectedDomain] = useState(null);
const [canonicalDomain, setCanonicalDomain] = useState('');
+ const [domainFieldKey, setDomainFieldKey] = useState(0);
const [canonicalHttps, setCanonicalHttps] = useState(false);
const [encryptionConfigured, setEncryptionConfigured] = useState(true);
const [savingDomain, setSavingDomain] = useState(false);
@@ -119,6 +120,8 @@ const SystemTab = () => {
async function handleUseDetectedDomain() {
if (!detectedDomain?.detected_domain) return;
setCanonicalDomain(detectedDomain.detected_domain);
+ // DomainField seeds from its value once; remount it to show the new one.
+ setDomainFieldKey((k) => k + 1);
setCanonicalHttps(detectedDomain.is_https);
}
@@ -310,11 +313,12 @@ const SystemTab = () => {
)}
<div className="form-group">
<label htmlFor="canonical-domain">{t('app.systemTab.canonicalDomain', 'Canonical Domain')}</label>
- <Input
+ <DomainField
+ key={domainFieldKey}
id="canonical-domain"
+ modes={['custom']}
value={canonicalDomain}
- onChange={(e) => setCanonicalDomain(e.target.value)}
- placeholder={t('app.systemTab.eGServerkitExampleCom', 'e.g. serverkit.example.com')}
+ onChange={setCanonicalDomain}
disabled={savingDomain}
/>
<span className="form-help">
diff --git a/frontend/src/components/settings/ThemeStudioModal.jsx b/frontend/src/components/settings/ThemeStudioModal.jsx
index 1321a2ae..6bddc5cf 100644
--- a/frontend/src/components/settings/ThemeStudioModal.jsx
+++ b/frontend/src/components/settings/ThemeStudioModal.jsx
@@ -4,6 +4,8 @@ import {
Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription,
} from '@/components/ui/dialog';
import { Button } from '@/components/ui/button';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
+import { SegControl } from '@/components/ds';
import { useTheme } from '../../contexts/useTheme.js';
import { useAuth } from '../../contexts/useAuth.js';
import { useToast } from '../../contexts/useToast.js';
@@ -146,22 +148,29 @@ const ThemeStudioModal = ({ open, onOpenChange }) => {
onChange={(e) => { setSlug(slugify(e.target.value)); setSlugTouched(true); }}
/>
</label>
- <label className="theme-studio__field">
- <span>{t('app.themeStudioModal.base', 'Base')}</span>
- <select value={base} onChange={(e) => setBase(e.target.value)}>
- <option value="dark">dark</option>
- <option value="light">light</option>
- </select>
- </label>
- <label className="theme-studio__field">
- <span>{t('app.themeStudioModal.startFrom', 'Start from')}</span>
- <select defaultValue="" onChange={(e) => { startFrom(e.target.value); e.target.value = ''; }}>
- <option value="" disabled>{t('app.themeStudioModal.choose', 'Choose…')}</option>
- {availableThemes.map((t) => (
- <option key={t.slug} value={t.slug}>{t.name || t.slug}</option>
- ))}
- </select>
- </label>
+ <div className="theme-studio__field">
+ <span id="theme-studio-base">{t('app.themeStudioModal.base', 'Base')}</span>
+ <SegControl
+ aria-labelledby="theme-studio-base"
+ value={base}
+ onChange={setBase}
+ options={['dark', 'light']}
+ />
+ </div>
+ <div className="theme-studio__field">
+ <span id="theme-studio-start">{t('app.themeStudioModal.startFrom', 'Start from')}</span>
+ {/* An action, not a setting: the value resets so the same theme can be picked again. */}
+ <Select value="" onValueChange={startFrom}>
+ <SelectTrigger aria-labelledby="theme-studio-start">
+ <SelectValue placeholder={t('app.themeStudioModal.choose', 'Choose…')} />
+ </SelectTrigger>
+ <SelectContent>
+ {availableThemes.map((theme) => (
+ <SelectItem key={theme.slug} value={theme.slug}>{theme.name || theme.slug}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
</div>
<div className="theme-studio__modebar">
diff --git a/frontend/src/components/settings/WebhooksTab.jsx b/frontend/src/components/settings/WebhooksTab.jsx
index c63e1b0b..3871944c 100644
--- a/frontend/src/components/settings/WebhooksTab.jsx
+++ b/frontend/src/components/settings/WebhooksTab.jsx
@@ -11,9 +11,9 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
-import { Plus, MoreVertical, Copy, RefreshCw, ArrowRightLeft } from 'lucide-react';
+import { Plus, MoreVertical, RefreshCw, ArrowRightLeft } from 'lucide-react';
import EmptyState from '../EmptyState';
-import { copyToClipboard } from '@/utils/clipboard';
+import CopyField from '@/components/CopyField';
import { useTranslation } from 'react-i18next';
const formatDate = (d) => (d ? new Date(d).toLocaleString() : '—');
@@ -282,13 +282,7 @@ export default function WebhooksTab() {
<div className="settings-webhook-secret-field">
<Label>{t('app.webhooksTab.endpoint', 'Endpoint')}</Label>
<Input readOnly value={regeneratedSecret?.name || ''} />
- <Label>{t('app.webhooksTab.secret', 'Secret')}</Label>
- <div className="settings-webhook-secret">
- <Input readOnly type="text" value={regeneratedSecret?.secret || ''} />
- <Button variant="outline" onClick={() => { copyToClipboard(regeneratedSecret?.secret || ''); toast.success(t('app.webhooksTab.copied', 'Copied')) }}>
- <Copy size={14} />
- </Button>
- </div>
+ <CopyField label={t('app.webhooksTab.secret', 'Secret')} value={regeneratedSecret?.secret || ''} secret />
</div>
</Modal>
</div>
diff --git a/frontend/src/components/settings/connections/ConnectProviderModal.jsx b/frontend/src/components/settings/connections/ConnectProviderModal.jsx
index 1f4462cc..3c3157cf 100644
--- a/frontend/src/components/settings/connections/ConnectProviderModal.jsx
+++ b/frontend/src/components/settings/connections/ConnectProviderModal.jsx
@@ -20,6 +20,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Checkbox } from '@/components/ui/checkbox';
+import PortField from '@/components/PortField';
import { ProviderBrandIcon } from '../../icons/ProviderBrands';
import { deriveScope, REGISTRY_PROVIDERS } from './providerCatalog';
import DnsActivity from './DnsActivity';
@@ -835,7 +836,7 @@ function EmailBody({ isAdmin, relayConfig, onSave, onTest, onDisable }) {
</div>
<div className="form-group">
<Label htmlFor="relay-port">{t('common.labels.port', 'Port')}</Label>
- <Input id="relay-port" type="number" value={form.port} onChange={(e) => setForm((f) => ({ ...f, port: e.target.value }))} placeholder="587" />
+ <PortField id="relay-port" host={false} allowPrivileged value={form.port} onChange={(port) => setForm((f) => ({ ...f, port }))} placeholder="587" />
</div>
<div className="form-group">
<Label htmlFor="relay-user">{t('common.labels.username', 'Username')}</Label>
diff --git a/frontend/src/components/setup/SetupStepSecurity.jsx b/frontend/src/components/setup/SetupStepSecurity.jsx
index fc50beb4..6618399a 100644
--- a/frontend/src/components/setup/SetupStepSecurity.jsx
+++ b/frontend/src/components/setup/SetupStepSecurity.jsx
@@ -1,9 +1,9 @@
import { useState, useEffect } from 'react';
-import { ShieldCheck, Copy, Download, AlertTriangle, Check, Loader } from 'lucide-react';
+import { ShieldCheck, Download, AlertTriangle, Check, Loader } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import api from '../../services/api';
-import { copyToClipboard } from '@/utils/clipboard';
+import CopyField from '../CopyField';
import { downloadBlob } from '@/utils/downloadBlob';
import { useTranslation } from 'react-i18next';
@@ -76,11 +76,6 @@ const SetupStepSecurity = ({ onComplete }) => {
}
}
- function copyCodes() {
- copyToClipboard(backupCodes.join('\n'));
- setSavedCodes(true);
- }
-
function downloadCodes() {
const body = [
'ServerKit backup codes',
@@ -201,7 +196,7 @@ const SetupStepSecurity = ({ onComplete }) => {
<div className="security-enroll__manual-label">
{t('app.setupStepSecurity.canTScanEnterThisKey', 'Can\'t scan? Enter this key instead:')}
</div>
- <code className="security-enroll__secret">{setupData?.secret}</code>
+ <CopyField value={setupData?.secret} secret />
</div>
</div>
@@ -254,19 +249,14 @@ const SetupStepSecurity = ({ onComplete }) => {
{t('app.setupStepSecurity.theseAreShownOnceAndNever', 'These are shown once and never again. Each works a single time if you lose your authenticator — keep them somewhere that does not depend on this server being reachable.')}
</p>
- <div className="security-codes">
- {backupCodes.map((backupCode) => (
- <code key={backupCode} className="security-codes__item">
- {backupCode}
- </code>
- ))}
- </div>
+ <CopyField
+ className="security-codes__list"
+ value={backupCodes.join('\n')}
+ multiline
+ onCopy={() => setSavedCodes(true)}
+ />
<div className="security-codes__actions">
- <Button variant="outline" onClick={copyCodes}>
- <Copy size={15} />
- {t('common.actions.copy', 'Copy')}
- </Button>
<Button variant="outline" onClick={downloadCodes}>
<Download size={15} />
{t('common.actions.download', 'Download')}
diff --git a/frontend/src/components/shared/SharedVariableGroups.jsx b/frontend/src/components/shared/SharedVariableGroups.jsx
index caaafb13..0fee680e 100644
--- a/frontend/src/components/shared/SharedVariableGroups.jsx
+++ b/frontend/src/components/shared/SharedVariableGroups.jsx
@@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Checkbox } from '@/components/ui/checkbox';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
import Modal from '@/components/Modal';
import ResourceListPage from '../layouts/ResourceListPage';
import { useTopbarActions } from '@/hooks/useTopbarActions';
@@ -502,15 +503,19 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })
)}
<form className="shared-groups__attach" onSubmit={handleAttach}>
- <select
- value={attachType}
- onChange={(e) => setAttachType(e.target.value)}
- className="shared-groups__attach-type"
- >
- {RESOURCE_TYPES.map((t) => (
- <option key={t} value={t}>{t}</option>
- ))}
- </select>
+ <Select value={attachType} onValueChange={setAttachType}>
+ <SelectTrigger
+ className="shared-groups__attach-type"
+ aria-label={t('app.sharedVariableGroups.resourceType', 'Resource type')}
+ >
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {RESOURCE_TYPES.map((type) => (
+ <SelectItem key={type} value={type}>{type}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
<Input
type="text"
value={attachId}
diff --git a/frontend/src/components/workspaces/WorkspaceOverviewTab.jsx b/frontend/src/components/workspaces/WorkspaceOverviewTab.jsx
index c7c4b57c..94381593 100644
--- a/frontend/src/components/workspaces/WorkspaceOverviewTab.jsx
+++ b/frontend/src/components/workspaces/WorkspaceOverviewTab.jsx
@@ -1,6 +1,7 @@
import { KpiBand, MetricCard } from '@/components/ds';
import { Server, Boxes, Globe, Users } from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import { InfoList, InfoItem } from '../InfoList';
const WorkspaceOverviewTab = ({ ws, since, members, srvIn, services, sites }) => {
const { t } = useTranslation();
@@ -8,10 +9,12 @@ const WorkspaceOverviewTab = ({ ws, since, members, srvIn, services, sites }) =>
<div className="ws-detail__grid">
<section className="ws-detail__card">
<h3>{t('common.labels.workspace', 'Workspace')}</h3>
- <div className="sk-info-row"><span className="k">{t('app.workspaceOverviewTab.slug', 'Slug')}</span><span className="v">/{ws.slug}</span></div>
- <div className="sk-info-row"><span className="k">{t('common.labels.created', 'Created')}</span><span className="v">{since || '—'}</span></div>
- <div className="sk-info-row"><span className="k">{t('app.workspaceOverviewTab.maxServers', 'Max servers')}</span><span className="v">{ws.max_servers > 0 ? ws.max_servers : 'Unlimited'}</span></div>
- <div className="sk-info-row"><span className="k">{t('app.workspaceOverviewTab.maxUsers', 'Max users')}</span><span className="v">{ws.max_users > 0 ? ws.max_users : 'Unlimited'}</span></div>
+ <InfoList>
+ <InfoItem label={t('app.workspaceOverviewTab.slug', 'Slug')} value={`/${ws.slug}`} mono />
+ <InfoItem label={t('common.labels.created', 'Created')} value={since || '—'} />
+ <InfoItem label={t('app.workspaceOverviewTab.maxServers', 'Max servers')} value={ws.max_servers > 0 ? ws.max_servers : t('app.workspaceOverviewTab.unlimited', 'Unlimited')} />
+ <InfoItem label={t('app.workspaceOverviewTab.maxUsers', 'Max users')} value={ws.max_users > 0 ? ws.max_users : t('app.workspaceOverviewTab.unlimited', 'Unlimited')} />
+ </InfoList>
</section>
<section className="ws-detail__card">
<h3>{t('app.workspaceOverviewTab.resources', 'Resources')}</h3>
diff --git a/frontend/src/styles/pages/_settings.scss b/frontend/src/styles/pages/_settings.scss
index 7257f81f..ded0708c 100644
--- a/frontend/src/styles/pages/_settings.scss
+++ b/frontend/src/styles/pages/_settings.scss
@@ -800,6 +800,18 @@
margin-left: $space-1;
}
+// One-time login link form (Settings -> Users). The field's caption rule in
+// _users.scss targets every descendant span, which includes the Select's
+// value; give the trigger back its own type and the old select's width.
+.login-links__field .ui-select-trigger {
+ min-width: 160px;
+
+ span {
+ font-size: inherit;
+ color: inherit;
+ }
+}
+
// IconReferenceTab: leading magnifier inside the search field
.search-input-wrapper {
position: relative;
@@ -1672,13 +1684,14 @@
flex-direction: column;
gap: 4px;
- span {
+ // Direct child only: the Select and SegControl inside carry spans of their own.
+ > span {
font-size: $font-size-xs;
font-weight: $font-weight-medium;
color: var(--text-dim);
}
- input, select {
+ input {
padding: 6px 10px;
font-size: $font-size-sm;
color: var(--text);
@@ -2560,7 +2573,6 @@
.settings-webhook-actions { text-align: right; }
.settings-webhook-action-icon { margin-inline-end: 0.5rem; }
.settings-webhook-event-id { @include truncate(); font-size: 0.75rem; max-width: 200px; }
-.settings-webhook-secret { display: flex; gap: 0.5rem; }
// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
.settings-webhook-row { cursor: pointer; }
diff --git a/frontend/src/styles/pages/_setup-wizard.scss b/frontend/src/styles/pages/_setup-wizard.scss
index 2d1b2e21..53fe9c25 100644
--- a/frontend/src/styles/pages/_setup-wizard.scss
+++ b/frontend/src/styles/pages/_setup-wizard.scss
@@ -438,17 +438,6 @@
margin-bottom: $space-2;
}
- &__secret {
- display: inline-block;
- font-family: $font-mono;
- font-size: $font-size-sm;
- letter-spacing: 1px;
- word-break: break-all;
- padding: $space-2 $space-3;
- background: $bg-tertiary;
- border-radius: $radius-md;
- }
-
&__verify {
margin-bottom: $space-5;
}
@@ -463,22 +452,8 @@
}
.security-codes {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: $space-2;
- padding: $space-4;
- margin-bottom: $space-4;
- background: $bg-elevated;
- border: 1px solid $border-default;
- border-radius: $radius-xl;
-
- &__item {
- font-family: $font-mono;
- font-size: $font-size-sm;
- text-align: center;
- padding: $space-2;
- background: $bg-tertiary;
- border-radius: $radius-md;
+ &__list {
+ margin-bottom: $space-4;
}
&__actions {