mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-05 14:41:26 +09:00
feat(palette): wrap settings cards for deep-link focus across all tabs
Mechanical wrap-the-card pass: each remaining settings tab component now spreads useSettingFocus's register(id, class) onto its identifiable cards so a palette settings result scrolls to and flashes the exact card. Covers Profile, Appearance, Sidebar, White Label, About, Users, Activity, Site, Modules, Migrations, SSO, API, AI, System, and Connections. Cards whose roots live in non-editable subcomponents (login links, invitations, provider cards) register at the nearest reachable section or fall back to landing on the tab. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e0a47bbb9d
commit
86bd8d70a9
15 files changed
+87
-33
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import api from '../../services/api';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { Label } from '@/components/ui/label';
|
||||
@@ -8,6 +9,7 @@ import { Button } from '@/components/ui/button';
|
||||
const AI_CONFIG_CHANGED_EVENT = 'serverkit:ai-config-changed';
|
||||
|
||||
const AISettingsTab = () => {
|
||||
const register = useSettingFocus();
|
||||
const { isAdmin } = useAuth();
|
||||
const [settings, setSettings] = useState({
|
||||
enabled: false, provider: '', model: '', endpoint: '',
|
||||
@@ -112,7 +114,7 @@ const AISettingsTab = () => {
|
||||
|
||||
{message && <div className={`message ${message.type}`}>{message.text}</div>}
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('ai-provider', 'settings-card')}>
|
||||
<div className="form-group">
|
||||
<div className="settings-row">
|
||||
<div className="settings-label"><Label>Enable AI assistant</Label></div>
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import ServerKitLogo from '../ServerKitLogo';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
|
||||
const STAR_PROMPT_KEY = 'serverkit-star-prompt-dismissed';
|
||||
|
||||
@@ -16,6 +17,7 @@ const AboutTab = () => {
|
||||
const [showStarPrompt, setShowStarPrompt] = useState(() => {
|
||||
return localStorage.getItem(STAR_PROMPT_KEY) !== 'true';
|
||||
});
|
||||
const register = useSettingFocus();
|
||||
|
||||
useEffect(() => {
|
||||
const fetchVersion = async () => {
|
||||
@@ -52,7 +54,7 @@ const AboutTab = () => {
|
||||
<p>Server management made simple</p>
|
||||
</div>
|
||||
|
||||
<div className="about-card">
|
||||
<div {...register('about-version', 'about-card')}>
|
||||
<div className="about-logo">
|
||||
<ServerKitLogo width={64} height={64} />
|
||||
</div>
|
||||
@@ -162,7 +164,7 @@ const AboutTab = () => {
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('about-links', 'settings-card')}>
|
||||
<h3>Links</h3>
|
||||
<div className="link-list">
|
||||
<a href="https://github.com/jhd3197/ServerKit" target="_blank" rel="noopener noreferrer" className="link-item">
|
||||
|
||||
@@ -4,8 +4,10 @@ import ContributionGraph from './ContributionGraph';
|
||||
import { Search, Filter, X, User as UserIcon } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
|
||||
const ActivityTab = () => {
|
||||
const register = useSettingFocus();
|
||||
const [summary, setSummary] = useState(null);
|
||||
const [logs, setLogs] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -130,7 +132,7 @@ const ActivityTab = () => {
|
||||
|
||||
{summary && (
|
||||
<>
|
||||
<div className="activity-stats">
|
||||
<div {...register('activity-dashboard', 'activity-stats')}>
|
||||
<span className="activity-stats__item">
|
||||
<span className="activity-stats__value">{summary.active_users_today}</span>
|
||||
active today
|
||||
@@ -184,7 +186,7 @@ const ActivityTab = () => {
|
||||
</>
|
||||
)}
|
||||
|
||||
<div className="activity-feed-section">
|
||||
<div {...register('activity-audit-log', 'activity-feed-section')}>
|
||||
<div className="section-header">
|
||||
<h4>Audit Log</h4>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
import api from '../../services/api';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
import ApiKeyModal from './ApiKeyModal';
|
||||
import WebhookSubscriptionModal from './WebhookSubscriptionModal';
|
||||
import {
|
||||
@@ -28,6 +29,7 @@ const ApiSettingsTab = () => {
|
||||
|
||||
// ─── API Keys Section ──────────────────────────────────
|
||||
const ApiKeysSection = () => {
|
||||
const register = useSettingFocus();
|
||||
const [keys, setKeys] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
@@ -68,7 +70,7 @@ const ApiKeysSection = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="settings-card">
|
||||
<div {...register('api-keys', 'settings-card')}>
|
||||
<div className="settings-card__header">
|
||||
<div className="settings-card__header-left">
|
||||
<Key size={20} />
|
||||
@@ -184,6 +186,7 @@ const ApiKeysSection = () => {
|
||||
|
||||
// ─── Rate Limits Section ───────────────────────────────
|
||||
const RateLimitsSection = () => {
|
||||
const register = useSettingFocus();
|
||||
const [limits, setLimits] = useState({
|
||||
rate_limit_standard: '100 per minute',
|
||||
rate_limit_elevated: '500 per minute',
|
||||
@@ -227,7 +230,7 @@ const RateLimitsSection = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="settings-card">
|
||||
<div {...register('api-rate-limits', 'settings-card')}>
|
||||
<div className="settings-card__header">
|
||||
<div className="settings-card__header-left">
|
||||
<Activity size={20} />
|
||||
@@ -270,6 +273,7 @@ const RateLimitsSection = () => {
|
||||
|
||||
// ─── Webhook Subscriptions Section ─────────────────────
|
||||
const WebhookSection = () => {
|
||||
const register = useSettingFocus();
|
||||
const [subscriptions, setSubscriptions] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
@@ -328,7 +332,7 @@ const WebhookSection = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="settings-card">
|
||||
<div {...register('api-webhooks', 'settings-card')}>
|
||||
<div className="settings-card__header">
|
||||
<div className="settings-card__header-left">
|
||||
<Zap size={20} />
|
||||
@@ -457,6 +461,7 @@ const WebhookSection = () => {
|
||||
|
||||
// ─── Analytics Section ─────────────────────────────────
|
||||
const AnalyticsSection = () => {
|
||||
const register = useSettingFocus();
|
||||
const [overview, setOverview] = useState(null);
|
||||
const [endpoints, setEndpoints] = useState([]);
|
||||
const [timeseries, setTimeseries] = useState([]);
|
||||
@@ -481,7 +486,7 @@ const AnalyticsSection = () => {
|
||||
const maxCount = Math.max(...timeseries.map(d => d.count), 1);
|
||||
|
||||
return (
|
||||
<div className="settings-card">
|
||||
<div {...register('api-analytics', 'settings-card')}>
|
||||
<div className="settings-card__header">
|
||||
<div className="settings-card__header-left">
|
||||
<BarChart3 size={20} />
|
||||
|
||||
@@ -3,6 +3,7 @@ import useDashboardLayout from '../../hooks/useDashboardLayout';
|
||||
import { ChevronDown, ChevronUp, RotateCcw } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
|
||||
const ACCENT_PRESETS = [
|
||||
{ label: 'Indigo', color: '#6366f1' },
|
||||
@@ -18,6 +19,7 @@ const ACCENT_PRESETS = [
|
||||
const AppearanceTab = () => {
|
||||
const { theme, setTheme, accentColor, setAccentColor } = useTheme();
|
||||
const { widgets, toggleWidget, moveWidget, resetLayout } = useDashboardLayout();
|
||||
const register = useSettingFocus();
|
||||
|
||||
return (
|
||||
<div className="settings-section">
|
||||
@@ -26,7 +28,7 @@ const AppearanceTab = () => {
|
||||
<p>Customize the look and feel of your dashboard</p>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('appearance-theme', 'settings-card')}>
|
||||
<h3>Theme</h3>
|
||||
<p>Select your preferred color scheme</p>
|
||||
<div className="theme-options">
|
||||
@@ -72,7 +74,7 @@ const AppearanceTab = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('appearance-accent-color', 'settings-card')}>
|
||||
<h3>Accent Color</h3>
|
||||
<p>Choose the primary accent color used across the interface</p>
|
||||
<div className="accent-presets">
|
||||
@@ -101,7 +103,7 @@ const AppearanceTab = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('appearance-widgets', 'settings-card')}>
|
||||
<h3>Dashboard Widgets</h3>
|
||||
<p>Toggle visibility and reorder widgets on the dashboard</p>
|
||||
<div className="widget-list">
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Database, Loader, CheckCircle, ArrowUpCircle, ShieldCheck } from 'lucid
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { useToast } from '../../contexts/ToastContext';
|
||||
import { useConfirm } from '../../hooks/useConfirm';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
|
||||
// Revisions in this project are short descriptive slugs (e.g. 016_resource_grants),
|
||||
// so show them in full rather than truncating mid-word.
|
||||
@@ -12,6 +13,7 @@ const short = (rev) => rev || '';
|
||||
const MigrationHistoryTab = () => {
|
||||
const toast = useToast();
|
||||
const { confirm } = useConfirm();
|
||||
const register = useSettingFocus();
|
||||
|
||||
const [revisions, setRevisions] = useState([]);
|
||||
const [status, setStatus] = useState(null);
|
||||
@@ -124,7 +126,7 @@ const MigrationHistoryTab = () => {
|
||||
</div>
|
||||
|
||||
{hasPending ? (
|
||||
<div className="migration-pending-banner">
|
||||
<div {...register('migrations-apply', 'migration-pending-banner')}>
|
||||
<ArrowUpCircle size={20} className="migration-pending-icon" aria-hidden="true" />
|
||||
<div className="migration-pending-body">
|
||||
<p className="migration-pending-title">
|
||||
@@ -186,7 +188,7 @@ const MigrationHistoryTab = () => {
|
||||
<p>No migration history found.</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="table-container">
|
||||
<div {...register('migrations-history', 'table-container')}>
|
||||
<table className="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -6,11 +6,13 @@ import api from '../../services/api';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import EmptyState from '../EmptyState';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
|
||||
// Admin-only card to enable/disable the optional feature verticals (Email,
|
||||
// WordPress). Toggling writes through the /modules API and then refreshes the
|
||||
// shared module state so the sidebar + route guards update immediately.
|
||||
const ModulesTab = () => {
|
||||
const register = useSettingFocus();
|
||||
const { isAdmin } = useAuth();
|
||||
const { modules, refresh } = useModules();
|
||||
const [saving, setSaving] = useState({});
|
||||
@@ -49,7 +51,7 @@ const ModulesTab = () => {
|
||||
{!modules ? (
|
||||
<EmptyState loading title="Loading modules..." />
|
||||
) : (
|
||||
<div className="settings-card">
|
||||
<div {...register('modules-toggle', 'settings-card')}>
|
||||
{modules.map((mod) => (
|
||||
<div className="settings-row" key={mod.name}>
|
||||
<div className="settings-label">
|
||||
|
||||
@@ -3,9 +3,11 @@ import { useAuth } from '../../contexts/AuthContext';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
|
||||
const ProfileTab = () => {
|
||||
const { user, updateUser } = useAuth();
|
||||
const register = useSettingFocus();
|
||||
const [formData, setFormData] = useState({
|
||||
username: '',
|
||||
email: ''
|
||||
@@ -50,7 +52,7 @@ const ProfileTab = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<form onSubmit={handleSubmit} className="settings-form">
|
||||
<form onSubmit={handleSubmit} {...register('profile-username', 'settings-form')}>
|
||||
<div className="form-group">
|
||||
<Label>Username</Label>
|
||||
<Input
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import api from '../../services/api';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
import SSOProviderIcon from '../SSOProviderIcon';
|
||||
import {
|
||||
Save, RefreshCw, CheckCircle, XCircle, AlertTriangle, Shield, Globe,
|
||||
@@ -39,6 +40,7 @@ const FIELD_LABELS = {
|
||||
};
|
||||
|
||||
const SSOConfigTab = () => {
|
||||
const register = useSettingFocus();
|
||||
const [config, setConfig] = useState({});
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [saving, setSaving] = useState({});
|
||||
@@ -162,7 +164,7 @@ const SSOConfigTab = () => {
|
||||
)}
|
||||
|
||||
{/* General Settings */}
|
||||
<div className="settings-card sso-general-card">
|
||||
<div {...register('sso-general-settings', 'settings-card sso-general-card')}>
|
||||
<div className="settings-card__header">
|
||||
<div className="settings-card__header-left">
|
||||
<Globe size={20} />
|
||||
@@ -250,7 +252,7 @@ const SSOConfigTab = () => {
|
||||
const testResult = testResults[provider.id];
|
||||
|
||||
return (
|
||||
<div key={provider.id} className={`settings-card sso-provider-config ${enabled ? 'sso-provider-config--enabled' : ''}`}>
|
||||
<div key={provider.id} {...register(`sso-${provider.id}`, `settings-card sso-provider-config ${enabled ? 'sso-provider-config--enabled' : ''}`)}>
|
||||
<div
|
||||
className="sso-provider-config__header"
|
||||
onClick={() => setExpandedProvider(isExpanded ? null : provider.id)}
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
CATEGORY_LABELS
|
||||
} from '../sidebarItems';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
|
||||
const PRESET_ICONS = {
|
||||
recommended: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>,
|
||||
@@ -27,6 +28,7 @@ const SidebarSettings = () => {
|
||||
const [hiddenItems, setHiddenItems] = useState(currentConfig.hiddenItems || []);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [message, setMessage] = useState(null);
|
||||
const register = useSettingFocus();
|
||||
|
||||
const toggleableItems = useMemo(
|
||||
() => SIDEBAR_ITEMS.filter(item => !item.alwaysVisible),
|
||||
@@ -94,7 +96,7 @@ const SidebarSettings = () => {
|
||||
|
||||
return (
|
||||
<div className="sidebar-settings">
|
||||
<div className="settings-section">
|
||||
<div {...register('sidebar-view-profiles', 'settings-section')}>
|
||||
<h3>View Profiles</h3>
|
||||
<p className="settings-section-desc">
|
||||
Choose a preset or build a custom view. Only visible items appear in your sidebar.
|
||||
@@ -143,7 +145,7 @@ const SidebarSettings = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="settings-section">
|
||||
<div {...register('sidebar-items', 'settings-section')}>
|
||||
<div className="settings-section-header">
|
||||
<h3>Sidebar Items</h3>
|
||||
<span className="sidebar-item-count">{visibleCount} of {SIDEBAR_ITEMS.length} visible</span>
|
||||
|
||||
@@ -5,8 +5,10 @@ import { Label } from '@/components/ui/label';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Pill } from '@/components/ds';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
|
||||
const SiteSettingsTab = ({ onDevModeChange }) => {
|
||||
const register = useSettingFocus();
|
||||
const [settings, setSettings] = useState({
|
||||
registration_enabled: false,
|
||||
dev_mode: false
|
||||
@@ -269,7 +271,7 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
|
||||
<div className={`message ${message.type}`}>{message.text}</div>
|
||||
)}
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('site-registration', 'settings-card')}>
|
||||
<h3>User Registration</h3>
|
||||
<p>Allow new users to create accounts on the login page.</p>
|
||||
|
||||
@@ -290,7 +292,7 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('site-app-ports', 'settings-card')}>
|
||||
<h3>Managed App Ports</h3>
|
||||
<p>Control the host port assigned to new WordPress sites and other managed apps.</p>
|
||||
|
||||
@@ -323,7 +325,7 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('site-base-domains', 'settings-card')}>
|
||||
<h3>Managed Sites — Base Domains</h3>
|
||||
<p>Publish managed sites at <code><name>.<base-domain></code>. Register one or more base domains; a new site can be created under any of them, defaulting to the one marked <strong>Default</strong>. Point a wildcard record <code>*.<base></code> (or per-site A records) at this server.</p>
|
||||
|
||||
@@ -442,7 +444,7 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('site-dev-mode', 'settings-card')}>
|
||||
<h3>Developer Mode</h3>
|
||||
<p>Enable developer tools and diagnostics.</p>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
import api from '../../services/api';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
import { InfoList, InfoItem } from '../InfoList';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -25,6 +26,7 @@ function formatUptime(seconds) {
|
||||
}
|
||||
|
||||
const SystemTab = () => {
|
||||
const register = useSettingFocus();
|
||||
const { isAdmin } = useAuth();
|
||||
const { whiteLabel } = useTheme();
|
||||
const brand = whiteLabel?.enabled && whiteLabel?.brandName ? whiteLabel.brandName : 'ServerKit';
|
||||
@@ -163,7 +165,7 @@ const SystemTab = () => {
|
||||
</div>
|
||||
|
||||
<div className="system-info-grid">
|
||||
<div className="settings-card">
|
||||
<div {...register('system-cpu', 'settings-card')}>
|
||||
<h3>CPU</h3>
|
||||
<InfoList>
|
||||
<InfoItem label="Usage" value={`${metrics?.cpu?.percent?.toFixed(1) || 0}%`} />
|
||||
@@ -175,7 +177,7 @@ const SystemTab = () => {
|
||||
</InfoList>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('system-memory', 'settings-card')}>
|
||||
<h3>Memory</h3>
|
||||
<InfoList>
|
||||
<InfoItem label="Usage" value={`${metrics?.memory?.percent?.toFixed(1) || 0}%`} />
|
||||
@@ -184,7 +186,7 @@ const SystemTab = () => {
|
||||
</InfoList>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('system-disk', 'settings-card')}>
|
||||
<h3>Disk</h3>
|
||||
<InfoList>
|
||||
<InfoItem label="Usage" value={`${metrics?.disk?.percent?.toFixed(1) || 0}%`} />
|
||||
@@ -193,7 +195,7 @@ const SystemTab = () => {
|
||||
</InfoList>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('system-network', 'settings-card')}>
|
||||
<h3>Network</h3>
|
||||
<InfoList>
|
||||
<InfoItem label="Bytes Sent" value={formatBytes(metrics?.network?.bytes_sent)} />
|
||||
@@ -220,7 +222,7 @@ const SystemTab = () => {
|
||||
)}
|
||||
|
||||
{/* Server Time & Timezone */}
|
||||
<div className="settings-card">
|
||||
<div {...register('system-timezone', 'settings-card')}>
|
||||
<h3>Server Time & Timezone</h3>
|
||||
{metrics?.time && (
|
||||
<InfoList style={{ marginBottom: '1rem' }}>
|
||||
@@ -266,7 +268,7 @@ const SystemTab = () => {
|
||||
</div>
|
||||
|
||||
{/* Panel Domain */}
|
||||
<div className="settings-card">
|
||||
<div {...register('system-canonical-domain', 'settings-card')}>
|
||||
<h3>Panel Domain</h3>
|
||||
{!encryptionConfigured && (
|
||||
<div className="alert alert-warning" style={{ marginBottom: '1rem' }}>
|
||||
|
||||
@@ -7,8 +7,10 @@ import LoginLinksSection from './LoginLinksSection';
|
||||
import Modal from '../Modal';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
|
||||
const UsersTab = () => {
|
||||
const register = useSettingFocus();
|
||||
const [users, setUsers] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState('');
|
||||
@@ -123,7 +125,7 @@ const UsersTab = () => {
|
||||
|
||||
{error && <div className="error-message">{error}</div>}
|
||||
|
||||
<div className="users-table-container">
|
||||
<div {...register('users-management', 'users-table-container')}>
|
||||
<table className="users-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
|
||||
const WHITELABEL_MODES = [
|
||||
{ id: 'image_text', label: 'Logo + Text', icon: Layers, desc: 'Mini logo with brand name' },
|
||||
@@ -15,6 +16,7 @@ const WHITELABEL_MODES = [
|
||||
const WhiteLabelTab = () => {
|
||||
const { whiteLabel, setWhiteLabel } = useTheme();
|
||||
const logoInputRef = useRef(null);
|
||||
const register = useSettingFocus();
|
||||
|
||||
return (
|
||||
<div className="settings-section">
|
||||
@@ -23,7 +25,7 @@ const WhiteLabelTab = () => {
|
||||
<p>Replace the default ServerKit branding with your own</p>
|
||||
</div>
|
||||
|
||||
<div className="settings-card">
|
||||
<div {...register('whitelabel-branding', 'settings-card')}>
|
||||
<h3>Custom Branding</h3>
|
||||
<p>Replace the sidebar logo, name, and GitHub star link</p>
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { ShieldAlert } from 'lucide-react';
|
||||
import api from '../../../services/api';
|
||||
import useSettingFocus from '../../../hooks/useSettingFocus';
|
||||
import { useAuth } from '../../../contexts/AuthContext';
|
||||
import { useToast } from '../../../contexts/ToastContext';
|
||||
import {
|
||||
@@ -20,7 +21,23 @@ import {
|
||||
import ProviderCard from './ProviderCard';
|
||||
import ConnectProviderModal from './ConnectProviderModal';
|
||||
|
||||
// The settings-index deep-link id each category section is landable from. The
|
||||
// cards are rendered by ProviderCard (presentational, no ref), so the flash
|
||||
// lands on the section container. The source section carries `connections-github`
|
||||
// (its headline); `connections-gitlab` still deep-links to the tab correctly.
|
||||
// The `chat` category has no settings-index entry, so it is left unregistered.
|
||||
const CATEGORY_FOCUS_ID = {
|
||||
source: 'connections-github',
|
||||
infra: 'connections-cloud-provider',
|
||||
registry: 'connections-container-registry',
|
||||
dns: 'connections-dns-provider',
|
||||
registrar: 'connections-registrar',
|
||||
email: 'connections-email-relay',
|
||||
storage: 'connections-storage',
|
||||
};
|
||||
|
||||
export default function ConnectionsHub() {
|
||||
const register = useSettingFocus();
|
||||
const { isAdmin } = useAuth();
|
||||
const toast = useToast();
|
||||
|
||||
@@ -470,8 +487,14 @@ export default function ConnectionsHub() {
|
||||
CONNECTION_CATEGORIES.map((cat) => {
|
||||
const providers = CONNECTION_PROVIDERS.filter((p) => p.category === cat.key);
|
||||
if (!providers.length) return null;
|
||||
const focusId = CATEGORY_FOCUS_ID[cat.key];
|
||||
return (
|
||||
<section key={cat.key} className="connections-hub__category">
|
||||
<section
|
||||
key={cat.key}
|
||||
{...(focusId
|
||||
? register(focusId, 'connections-hub__category')
|
||||
: { className: 'connections-hub__category' })}
|
||||
>
|
||||
<header className="connections-hub__category-head">
|
||||
<h3>{cat.label}</h3>
|
||||
<p>{cat.blurb}</p>
|
||||
|
||||
Reference in new issue
Block a user