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.

refactor: consolidate frontend reuse and eliminate lint warnings

Juan Denis92a3ffe6c3ab
diff --git a/.githooks/pre-commit b/.githooks/pre-commit
index 7abe00e9..2b0ab8fd 100755
--- a/.githooks/pre-commit
+++ b/.githooks/pre-commit
@@ -16,7 +16,9 @@ cd frontend || exit 0
[ -d node_modules ] || exit 0
rel=$(echo "$files" | sed 's#^frontend/##')
-echo "$rel" | xargs npx eslint
+# Keep each invocation below Windows' command-line limit on broad migrations.
+# xargs still returns a failure if any batch fails.
+echo "$rel" | xargs -n 20 npx eslint
status=$?
# Theme-token guard (plan 60): whitelist/validators/alias expansion/seed themes.
diff --git a/builtin-extensions/serverkit-remote-access/frontend/styles/remote-access.scss b/builtin-extensions/serverkit-remote-access/frontend/styles/remote-access.scss
index 2401ad23..e4f14d03 100644
--- a/builtin-extensions/serverkit-remote-access/frontend/styles/remote-access.scss
+++ b/builtin-extensions/serverkit-remote-access/frontend/styles/remote-access.scss
@@ -254,3 +254,22 @@
}
.ra-svc__right { width: 100%; justify-content: space-between; }
}
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.ra-service-form > * + * { margin-top: 1rem; }
+.ra-service-field > * + * { margin-top: 0.375rem; }
+.ra-service-hint { font-size: 0.75rem; color: $text-tertiary; }
+.ra-service-routing { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 0.75rem; }
+@media (min-width: $breakpoint-sm) {
+ .ra-service-routing { grid-template-columns: repeat(3, minmax(0, 1fr)); }
+}
+@media (min-width: $breakpoint-sm) {
+ .ra-service-field--host { grid-column: span 2 / span 2; }
+}
+.ra-service-field--host > * + * { margin-top: 0.375rem; }
+.ra-service-option { display: flex; align-items: center; justify-content: space-between; }
+.ra-service-credentials { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 0.75rem; }
+@media (min-width: $breakpoint-sm) {
+ .ra-service-credentials { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+}
+.ra-service-description { font-size: 0.875rem; color: $text-tertiary; }
diff --git a/builtin-extensions/serverkit-walkthrough-studio/frontend/index.jsx b/builtin-extensions/serverkit-walkthrough-studio/frontend/index.jsx
index b11b9300..819c07ab 100644
--- a/builtin-extensions/serverkit-walkthrough-studio/frontend/index.jsx
+++ b/builtin-extensions/serverkit-walkthrough-studio/frontend/index.jsx
@@ -409,18 +409,18 @@ export function WalkthroughStudioPage() {
<div className="wts-library__list">
{loading && <p className="wts-muted">{t('common.loading', 'Loading…')}</p>}
{!loading && library.length === 0 && (
- <button type="button" className="wts-library__empty" onClick={newGuide}>
+ <Button variant="unstyled" type="button" className="wts-library__empty" onClick={newGuide}>
<Sparkles size={18} />
<strong>{t('walkthroughStudio.createFirst', 'Create the first custom guide')}</strong>
<span>{t('walkthroughStudio.noCodeRequired', 'No application code required')}</span>
- </button>
+ </Button>
)}
{library.map((guide) => (
<div key={guide.id} className={`wts-library__item${originalId === guide.id ? ' is-active' : ''}`}>
- <button type="button" onClick={() => selectGuide(guide)}>
+ <Button variant="unstyled" type="button" onClick={() => selectGuide(guide)}>
<strong>{guide.title}</strong>
<span>{guide.steps.length} {t('walkthroughStudio.steps', 'steps')}</span>
- </button>
+ </Button>
<Button type="button" variant="ghost" size="icon" onClick={() => deleteGuide(guide)} aria-label={t('common.actions.delete', 'Delete')}>
<Trash2 size={13} />
</Button>
@@ -486,7 +486,7 @@ export function WalkthroughStudioPage() {
<div className="wts-step-workbench">
<div className="wts-step-rail">
{draft.steps.map((step, index) => (
- <button
+ <Button variant="unstyled"
key={`${step.id}-${index}`}
type="button"
className={index === stepIndex ? 'is-active' : ''}
@@ -496,7 +496,7 @@ export function WalkthroughStudioPage() {
<span>{String(index + 1).padStart(2, '0')}</span>
<strong>{step.title || t('walkthroughStudio.untitledStep', 'Untitled step')}</strong>
<small>{step.completion?.type || 'manual'}</small>
- </button>
+ </Button>
))}
</div>
diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js
index f3da3d56..ed6a9a4f 100644
--- a/frontend/eslint.config.js
+++ b/frontend/eslint.config.js
@@ -3,6 +3,7 @@ import globals from 'globals';
import reactPlugin from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
+import noStaticInlineStyles from './scripts/eslint-rules/no-static-inline-styles.mjs';
export default [
{ ignores: ['dist/**', 'node_modules/**'] },
@@ -26,6 +27,7 @@ export default [
react: reactPlugin,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
+ serverkit: { rules: { 'no-static-inline-styles': noStaticInlineStyles } },
},
rules: {
...js.configs.recommended.rules,
@@ -35,21 +37,18 @@ export default [
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'react/prop-types': 'off',
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
+ 'serverkit/no-static-inline-styles': 'warn',
- // Discourage inline styles — prefer SCSS classes and shared components.
+ // Prefer shared controls; static styles are checked separately above.
'no-restricted-syntax': [
'warn',
- {
- selector: 'JSXAttribute[name.name="style"]',
- message: 'Inline styles are discouraged. Use SCSS classes or a shared primitive instead.',
- },
{
selector: 'JSXOpeningElement[name.name="button"]',
message: 'Use the shared Button component (or IconButton for icon-only actions).',
},
{
// Match the legacy card family (.card, .card-header, .card-body, …) as a
- // LEADING class token — not unrelated compounds like `settings-card`,
+ // class token — not unrelated compounds like `settings-card`,
// `sk-spec-card`, or `wp-site-card-skeleton`, which the old `\bcard\b`
// pattern flagged as false positives.
selector: 'JSXOpeningElement[name.name="div"] > JSXAttribute[name.name="className"] > Literal[value=/(^|\\s)card(\\s|$|-)/]',
diff --git a/frontend/package.json b/frontend/package.json
index 610f1f89..fb762a70 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -7,8 +7,12 @@
"dev": "vite",
"build": "vite build",
"test": "node --test",
- "test:browser": "node scripts/settings-browser.mjs",
- "lint": "eslint . && node scripts/check-font-integrity.mjs && node scripts/check-settings-index.mjs && node scripts/check-theme-tokens.mjs && node scripts/check-frontend-boundaries.mjs && node scripts/check-style-ownership.mjs && node scripts/check-status-one-door.mjs && node scripts/check-status-scss.mjs && node scripts/check-i18n-literals.mjs && node scripts/check-intl-door.mjs && node scripts/extract-i18n.mjs --check && node scripts/check-i18n.mjs && node scripts/check-logical-properties.mjs && node scripts/generate-vendor-shims.mjs --check && node ../scripts/check-html-sinks.mjs",
+ "test:browser": "node scripts/settings-browser.mjs",
+ "lint": "node scripts/lint.mjs && node scripts/check-font-integrity.mjs && node scripts/check-settings-index.mjs && node scripts/check-theme-tokens.mjs && node scripts/check-frontend-boundaries.mjs && node scripts/check-style-ownership.mjs && node scripts/check-status-one-door.mjs && node scripts/check-status-scss.mjs && node scripts/check-i18n-literals.mjs && node scripts/check-intl-door.mjs && node scripts/extract-i18n.mjs --check && node scripts/check-i18n.mjs && node scripts/check-logical-properties.mjs && node scripts/generate-vendor-shims.mjs --check && node ../scripts/check-html-sinks.mjs",
+ "lint:baseline": "node scripts/lint.mjs --update",
+ "test:controls": "node scripts/controls-browser.mjs",
+ "test:metrics": "node scripts/metrics-browser.mjs",
+ "test:hooks": "node scripts/hooks-browser.mjs",
"lint:settings-index": "node scripts/check-settings-index.mjs",
"lint:fonts": "node scripts/check-font-integrity.mjs",
"lint:status": "node scripts/check-status-one-door.mjs",
diff --git a/frontend/public/serverkit-vendor/serverkit-sdk.mjs b/frontend/public/serverkit-vendor/serverkit-sdk.mjs
index 7f2f32fb..32edccdf 100644
--- a/frontend/public/serverkit-vendor/serverkit-sdk.mjs
+++ b/frontend/public/serverkit-vendor/serverkit-sdk.mjs
@@ -86,9 +86,9 @@ export const PluginSlot = m.PluginSlot;
export const ResourceListPage = m.ResourceListPage;
export const useLogsDrawer = m.useLogsDrawer;
export const RepoConnectForm = m.RepoConnectForm;
+export const RepoProviderStrip = m.RepoProviderStrip;
export const GIT_PROVIDERS = m.GIT_PROVIDERS;
export const detectProvider = m.detectProvider;
-export const RepoProviderStrip = m.RepoProviderStrip;
export const ProtectionPanel = m.ProtectionPanel;
export const DataTableFooter = m.DataTableFooter;
export const ListToolbar = m.ListToolbar;
diff --git a/frontend/scripts/STYLE_OWNERSHIP_CEILING b/frontend/scripts/STYLE_OWNERSHIP_CEILING
index dee79f10..573541ac 100644
--- a/frontend/scripts/STYLE_OWNERSHIP_CEILING
+++ b/frontend/scripts/STYLE_OWNERSHIP_CEILING
@@ -1 +1 @@
-114
+0
diff --git a/frontend/scripts/check-frontend-boundaries.mjs b/frontend/scripts/check-frontend-boundaries.mjs
index f81ed32b..ba978eda 100644
--- a/frontend/scripts/check-frontend-boundaries.mjs
+++ b/frontend/scripts/check-frontend-boundaries.mjs
@@ -92,8 +92,7 @@ const LEGACY_POLLERS = new Map(Object.entries({
'components/dashboard/widgets/renderers.jsx': 1,
'components/deploy-console/SuccessBanner.jsx': 1,
'components/server/OnboardingWizard.jsx': 1,
- 'hooks/useMetrics.js': 1,
- 'pages/Dashboard.jsx': 2,
+ 'pages/Dashboard.jsx': 1,
'pages/DeployConsole.jsx': 1,
'pages/Monitors.jsx': 1,
'plugins/serverkit-gui/components/ServerGui.jsx': 1,
diff --git a/frontend/scripts/check-status-one-door.mjs b/frontend/scripts/check-status-one-door.mjs
index e01a746e..e38cc983 100644
--- a/frontend/scripts/check-status-one-door.mjs
+++ b/frontend/scripts/check-status-one-door.mjs
@@ -20,7 +20,6 @@ const ALLOWED = new Set([
'components/backups/BackupCalendar.jsx', // STATUS_RANK: severity ordering, not colors
'components/databases/SourceTree.jsx', // STATUS_LABEL: labels only
'pages/DeployConsole.jsx', // STATUS_META: labels+icons+css classes (D4 territory)
- 'components/dashboard/widgets/renderers.jsx', // raw CSS-var renderer (D4 territory)
'components/NotificationBell.jsx', // SEVERITY_DOT hex dots (D4 territory)
'pages/Notifications.jsx', // SEVERITY_DOT hex dots (D4 territory)
'components/LinkedAppsSection.jsx', // css-class map (D4 territory)
diff --git a/frontend/scripts/check-style-cascade.mjs b/frontend/scripts/check-style-cascade.mjs
new file mode 100644
index 00000000..a0d5b1e6
--- /dev/null
+++ b/frontend/scripts/check-style-cascade.mjs
@@ -0,0 +1,211 @@
+// Before a stylesheet ownership change:
+// node scripts/check-style-cascade.mjs --capture /tmp/serverkit-before.css
+// After the change:
+// node scripts/check-style-cascade.mjs --baseline /tmp/serverkit-before.css
+//
+// Unlike the ownership census, this checks rendered cascade behavior. Fixtures
+// cover the legacy shared classes, their descendant/state selectors, and actual
+// static JSX class combinations. It is a supplement to real-page visual review,
+// not a replacement for it. Requires Playwright's installed Chromium browser.
+import { readFileSync, readdirSync, writeFileSync } from 'node:fs';
+import { dirname, resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { compile } from 'sass';
+import postcss from 'postcss';
+import { chromium } from 'playwright';
+
+const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+const args = process.argv.slice(2);
+const option = (name) => args.includes(name) ? args[args.indexOf(name) + 1] : undefined;
+const capturePath = option('--capture');
+const baselinePath = option('--baseline');
+if (!capturePath && !baselinePath) {
+ throw new Error('Provide --capture <css-file> before editing, or --baseline <css-file> afterward.');
+}
+const currentCSS = compile(resolve(root, 'src/styles/main.scss'), { logger: { warn() {} } }).css;
+if (capturePath) {
+ writeFileSync(resolve(capturePath), currentCSS);
+ console.log(`Captured CSS: ${resolve(capturePath)}`);
+ process.exit(0);
+}
+const baselineCSS = readFileSync(resolve(baselinePath), 'utf8');
+const classNames = [
+ 'text-secondary', 'text-tertiary', 'font-medium', 'font-semibold', 'font-bold',
+ 'mono', 'truncate', 'top-bar', 'loading', 'loading-state', 'overview-grid',
+ 'btn-ghost', 'btn-link', 'btn-icon', 'empty-state', 'error-banner', 'modal-lg',
+ 'form-row', 'status-badge', 'status-dot', 'badge', 'badge-warning', 'tab-btn',
+ 'info-list', 'info-item', 'info-label', 'info-value', 'env-list', 'env-item',
+ 'services-grid', 'logs-viewer', 'wp-list', 'legend-item', 'loading-sm',
+ 'deploy-tab', 'btn-xs', 'checkbox-label', 'settings-nav-spacer',
+ 'permission-checkbox', 'sk-modal', 'sk-kpiband-wrap', 'conn-status',
+ 'spinner-inline', 'data-table', 'monitor-detail', 'settings-form',
+ 'events-tab', 'settings-tab', 'metrics-tab', 'spin',
+];
+
+function splitSelectors(selector) {
+ let depth = 0;
+ let start = 0;
+ const parts = [];
+ for (let i = 0; i < selector.length; i += 1) {
+ if ('(['.includes(selector[i])) depth += 1;
+ if (')]'.includes(selector[i])) depth -= 1;
+ if (!depth && selector[i] === ',') {
+ parts.push(selector.slice(start, i).trim());
+ start = i + 1;
+ }
+ }
+ parts.push(selector.slice(start).trim());
+ return parts.filter(Boolean);
+}
+
+const selectors = new Set();
+for (const css of [baselineCSS, currentCSS]) {
+ postcss.parse(css).walkRules((rule) => {
+ for (const selector of splitSelectors(rule.selector)) {
+ if (classNames.some((name) => selector.includes(`.${name}`))) selectors.add(selector);
+ }
+ });
+}
+function walk(directory) {
+ return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
+ const path = resolve(directory, entry.name);
+ return entry.isDirectory() ? walk(path) : [path];
+ });
+}
+for (const path of walk(resolve(root, 'src')).filter((file) => /\.[jt]sx?$/.test(file))) {
+ for (const match of readFileSync(path, 'utf8').matchAll(/className\s*=\s*["']([^"']+)["']/g)) {
+ if (match[1].split(/\s+/).some((name) => classNames.includes(name))) {
+ selectors.add(`.${match[1].trim().replace(/\s+/g, '.')}`);
+ }
+ }
+}
+for (const size of ['', 'btn-sm', 'btn-lg', 'btn-xs']) {
+ for (const variant of ['', 'btn-primary', 'btn-secondary', 'btn-ghost', 'btn-danger', 'btn-link']) {
+ for (const state of ['', ':hover', ':disabled', ':hover:disabled']) {
+ for (const icon of ['', 'btn-icon']) {
+ selectors.add(['button.btn', icon, size, variant].filter(Boolean).join('.') + state);
+ }
+ }
+ }
+}
+
+// Materialize interaction selectors as classes so every state can be checked
+// at once, independently of the mouse position or focus of adjacent fixtures.
+function simulatedStates(css) {
+ return css.replaceAll(':hover', '.test-hover')
+ .replaceAll(':focus-visible', '.test-focus-visible')
+ .replaceAll(':focus-within', '.test-focus-within')
+ .replace(/:focus(?![-\w])/g, '.test-focus');
+}
+
+const browser = await chromium.launch({ headless: true });
+try {
+ const page = await browser.newPage();
+ await page.setContent(`<style id="target"></style><style>
+ .fixture-case { width:600px; height:320px; position:relative; overflow:hidden; margin:12px; contain:layout }
+ *,*::before,*::after { animation-play-state:paused!important; transition:none!important }
+ </style><main></main>`);
+ await page.evaluate((selectors) => {
+ function parts(selector) {
+ let depth = 0;
+ let start = 0;
+ const result = [];
+ for (let i = 0; i < selector.length; i += 1) {
+ if ('(['.includes(selector[i])) depth += 1;
+ if (')]'.includes(selector[i])) depth -= 1;
+ if (!depth && /[ >+~]/.test(selector[i])) {
+ if (selector.slice(start, i).trim()) result.push(selector.slice(start, i).trim());
+ start = i + 1;
+ }
+ }
+ if (selector.slice(start).trim()) result.push(selector.slice(start).trim());
+ return result;
+ }
+ function make(token) {
+ token = token.replace(/:not\([^)]*\)/g, '')
+ .replace(/:(is|where)\(([^)]*)\)/g, (_, name, value) => value.split(',')[0])
+ .replaceAll(':hover', '.test-hover')
+ .replaceAll(':focus-visible', '.test-focus-visible')
+ .replaceAll(':focus-within', '.test-focus-within')
+ .replace(/:focus(?![-\w])/g, '.test-focus');
+ const has = token.match(/:has\(([^)]*)\)/);
+ token = token.replace(/:has\([^)]*\)/g, '');
+ const element = document.createElement(token.match(/^[A-Za-z][\w-]*/)?.[0] || 'div');
+ for (const match of token.matchAll(/\.([\w-]+)/g)) element.classList.add(match[1]);
+ for (const match of token.matchAll(/\[([\w-]+)(?:[~|^$*]?=['"]?([^'"\]]+)['"]?)?\]/g)) {
+ element.setAttribute(match[1], match[2] ?? '');
+ }
+ if (token.includes(':disabled')) element.setAttribute('disabled', '');
+ if (token.includes(':checked')) element.checked = true;
+ if (has) {
+ let parent = element;
+ for (const part of parts(has[1])) {
+ const child = make(part);
+ parent.append(child);
+ parent = child;
+ }
+ }
+ return element;
+ }
+ for (const selector of selectors) {
+ const wrapper = document.createElement('section');
+ wrapper.className = 'fixture-case';
+ wrapper.dataset.selector = selector;
+ let parent = wrapper;
+ for (const part of parts(selector)) {
+ const element = make(part);
+ parent.append(element);
+ parent = element;
+ }
+ if (!parent.children.length && !['INPUT', 'IMG', 'BR', 'HR', 'SVG'].includes(parent.tagName)) {
+ parent.textContent = 'ServerKit sample';
+ }
+ for (const tag of ['span', 'svg', 'h3', 'p', 'input']) {
+ const child = document.createElement(tag);
+ if (tag === 'input') child.type = 'checkbox';
+ else child.textContent = tag === 'svg' ? '' : 'Example';
+ parent.append(child);
+ }
+ document.querySelector('main').append(wrapper);
+ }
+ }, [...selectors]);
+
+ const differences = [];
+ for (const width of [390, 640, 768, 1024, 1440]) {
+ await page.setViewportSize({ width, height: 900 });
+ for (const theme of ['dark', 'light']) {
+ await page.evaluate((theme) => document.documentElement.setAttribute('data-theme', theme), theme);
+ await page.evaluate((css) => { document.querySelector('#target').textContent = css; }, simulatedStates(baselineCSS));
+ // Keep snapshots inside Chromium: serializing every CSS property
+ // across the automation boundary is much slower than comparing here.
+ await page.evaluate(() => {
+ window.fixtureNodes = [...document.querySelectorAll('.fixture-case *')];
+ window.styleBaseline = window.fixtureNodes.map((element) => {
+ const style = getComputedStyle(element);
+ return Object.fromEntries([...style].filter((property) => !property.startsWith('--')).map((property) => [property, style.getPropertyValue(property)]));
+ });
+ });
+ await page.evaluate((css) => { document.querySelector('#target').textContent = css; }, simulatedStates(currentCSS));
+ const changes = await page.evaluate(() => window.fixtureNodes.flatMap((element, index) => {
+ const style = getComputedStyle(element);
+ const before = window.styleBaseline[index];
+ const changed = Object.fromEntries(Object.entries(before).flatMap(([property, value]) => {
+ const after = style.getPropertyValue(property);
+ return value !== after ? [[property, [value, after]]] : [];
+ }));
+ return Object.keys(changed).length ? [{ selector: element.closest('.fixture-case').dataset.selector, element: element.tagName + '.' + element.className, changed }] : [];
+ }));
+ differences.push(...changes.map((change) => ({ width, theme, ...change })));
+ console.log(`${width}px ${theme}: ${changes.length} differing elements`);
+ }
+ }
+ if (differences.length) {
+ const output = option('--output');
+ if (output) writeFileSync(resolve(output), JSON.stringify(differences, null, 2));
+ console.error(JSON.stringify(differences.slice(0, 10), null, 2));
+ throw new Error(`${differences.length} rendered differences across ${selectors.size} fixtures.`);
+ }
+ console.log(`Style cascade preserved across ${selectors.size} fixtures, five widths, and two themes.`);
+} finally {
+ await browser.close();
+}
diff --git a/frontend/scripts/check-style-ownership.mjs b/frontend/scripts/check-style-ownership.mjs
index 9d215fa5..28194b18 100644
--- a/frontend/scripts/check-style-ownership.mjs
+++ b/frontend/scripts/check-style-ownership.mjs
@@ -6,19 +6,12 @@
// the rendered element is a composite nobody wrote and editing any one file
// changes only the properties that file happens to win.
//
-// `.empty-state` is the worked example. Three partials define it —
-// components/_empty-state.scss (flex column, min-height 200px),
-// components/_cards.scss (card background, solid border, radius) and
-// components/_users.scss (padding, colour) — and the compiled stylesheet
-// carries five competing top-level rules for it. What actually renders takes
-// its background and dashed border from one, its padding and display from
-// another, and its colour from a third.
-//
-// This is deliberately a ratchet and not a migration. Merging these correctly
-// means reproducing the computed result of the cascade, and there is no
-// byte-identical-output proof available the way there was for @keyframes — so
-// it needs eyes on the affected pages (plan invariant 9: no repo-wide
-// mechanical rewrite without behavioural tests). The count may only go down.
+// The September 2026 cleanup consolidated 114 competing definitions across
+// 50 class names, including `.empty-state`, and reduced the ceiling to zero.
+// Browser fixture comparisons checked the effective cascade across themes,
+// viewport widths, and interaction states (see check-style-cascade.mjs).
+// Keep that ownership intact: shared classes belong in their shared partial;
+// page-specific variants should be scoped to the page.
//
// Usage (from frontend/):
// node scripts/check-style-ownership.mjs # check against the ceiling
diff --git a/frontend/scripts/controls-browser.mjs b/frontend/scripts/controls-browser.mjs
new file mode 100644
index 00000000..7430eb6b
--- /dev/null
+++ b/frontend/scripts/controls-browser.mjs
@@ -0,0 +1,51 @@
+// Verify that shared-control adoption preserves custom SCSS and native form,
+// disabled, keyboard, ref and asChild behavior. No application backend required.
+import assert from 'node:assert/strict';
+import { createServer } from 'vite';
+import { chromium } from 'playwright';
+
+const server = await createServer({ server: { host: '127.0.0.1', port: 0, strictPort: false, open: false } });
+let browser;
+try {
+ await server.listen();
+ browser = await chromium.launch({ headless: true });
+ const page = await browser.newPage();
+ const errors = [];
+ page.on('pageerror', (error) => errors.push(error.message));
+ await page.goto(`${server.resolvedUrls.local[0]}tests/browser/controls.html`);
+ await page.locator('#shared-submit').waitFor();
+ for (const theme of ['dark', 'light']) {
+ await page.evaluate((value) => { document.documentElement.dataset.theme = value; }, theme);
+ for (const suffix of ['submit', 'custom', 'disabled', 'card', 'header', 'content']) {
+ const pair = await page.evaluate((name) => {
+ const props = ['display', 'height', 'minWidth', 'padding', 'margin', 'border', 'borderRadius',
+ 'backgroundColor', 'backgroundImage', 'color', 'fontFamily', 'fontSize', 'fontWeight',
+ 'opacity', 'cursor', 'pointerEvents', 'boxShadow', 'gap'];
+ return ['native', 'shared'].map((prefix) => {
+ const element = document.getElementById(`${prefix}-${name}`);
+ const css = getComputedStyle(element);
+ return { tag: element.tagName, classes: [...new Set(element.classList)].sort(),
+ css: Object.fromEntries(props.map((property) => [property, css[property]])) };
+ });
+ }, suffix);
+ assert.deepEqual(pair[1], pair[0], `${theme}: ${suffix} changed its DOM/CSS contract`);
+ }
+ }
+ assert.equal(await page.evaluate(() => window.controlRef === document.getElementById('shared-custom')), true);
+ await page.locator('#shared-custom').click();
+ assert.deepEqual(await page.evaluate(() => window.controlEvents), { submits: 0, clicks: 1 });
+ await page.locator('#shared-custom').press('Enter');
+ assert.deepEqual(await page.evaluate(() => window.controlEvents), { submits: 0, clicks: 2 });
+ await page.locator('#shared-submit').click();
+ await page.locator('#native-submit').click();
+ assert.equal(await page.evaluate(() => window.controlEvents.submits), 2, 'implicit submit behavior changed');
+ await page.locator('#shared-disabled').evaluate((node) => node.click());
+ assert.equal(await page.evaluate(() => window.controlEvents.clicks), 2, 'disabled button fired');
+ assert.equal(await page.locator('#shared-link').evaluate((node) => node.tagName), 'A');
+ assert.equal(await page.locator('#shared-link').getAttribute('href'), '#destination');
+ assert.deepEqual(errors, []);
+ console.log('Controls: dark/light CSS equivalence, refs, form submission, keyboard, disabled and asChild contracts passed.');
+} finally {
+ await browser?.close();
+ await server.close();
+}
diff --git a/frontend/scripts/eslint-rules/no-static-inline-styles.mjs b/frontend/scripts/eslint-rules/no-static-inline-styles.mjs
new file mode 100644
index 00000000..0ec58842
--- /dev/null
+++ b/frontend/scripts/eslint-rules/no-static-inline-styles.mjs
@@ -0,0 +1,47 @@
+// Dynamic geometry and runtime colors belong in React; fixed presentation
+// belongs in SCSS. Report once per style prop, including conditional objects.
+const isStaticValue = (node) => {
+ if (!node) return false;
+ if (node.type === 'Literal') return true;
+ if (node.type === 'TemplateLiteral') return node.expressions.every(isStaticValue);
+ if (node.type === 'UnaryExpression') return isStaticValue(node.argument);
+ if (node.type === 'ConditionalExpression') {
+ return isStaticValue(node.consequent) && isStaticValue(node.alternate);
+ }
+ return false;
+};
+
+function staticProperties(node, names = new Set()) {
+ if (!node) return names;
+ if (node.type === 'ObjectExpression') {
+ for (const property of node.properties) {
+ if (property.type === 'Property' && isStaticValue(property.value)) {
+ names.add(property.key.name || String(property.key.value));
+ }
+ }
+ } else if (node.type === 'ConditionalExpression') {
+ staticProperties(node.consequent, names);
+ staticProperties(node.alternate, names);
+ } else if (node.type === 'LogicalExpression') {
+ staticProperties(node.left, names);
+ staticProperties(node.right, names);
+ }
+ return names;
+}
+
+export default {
+ meta: {
+ type: 'suggestion',
+ schema: [],
+ messages: { static: 'Move fixed inline presentation ({{properties}}) to SCSS; keep only computed values in style.' },
+ },
+ create(context) {
+ return {
+ 'JSXAttribute[name.name="style"]'(node) {
+ const names = staticProperties(node.value?.expression);
+ if (node.value?.type === 'Literal') names.add('style');
+ if (names.size) context.report({ node, messageId: 'static', data: { properties: [...names].join(', ') } });
+ },
+ };
+ },
+};
diff --git a/frontend/scripts/eslint-rules/no-static-inline-styles.test.mjs b/frontend/scripts/eslint-rules/no-static-inline-styles.test.mjs
new file mode 100644
index 00000000..1d6ed461
--- /dev/null
+++ b/frontend/scripts/eslint-rules/no-static-inline-styles.test.mjs
@@ -0,0 +1,22 @@
+import { RuleTester } from 'eslint';
+import rule from './no-static-inline-styles.mjs';
+
+const tester = new RuleTester({ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } });
+tester.run('no-static-inline-styles', rule, {
+ valid: [
+ 'const view = <div style={{ width: `${progress}%` }} />;',
+ 'const view = <div style={{ height: rows * rowHeight, color: tone }} />;',
+ 'const view = <div style={style} />;',
+ 'const view = <div style={width ? { width } : undefined} />;',
+ 'const view = <div style={{ "--columns": columns }} />;',
+ 'const view = <div className={expanded ? "section section--expanded" : "section"} />;',
+ ],
+ invalid: [
+ { code: 'const view = <div style={{ marginTop: 8 }} />;', errors: [{ messageId: 'static' }] },
+ { code: 'const view = <div style={{ width, maxWidth: "95vw" }} />;', errors: [{ messageId: 'static' }] },
+ { code: 'const view = <div style={open ? { color: "red" } : undefined} />;', errors: [{ messageId: 'static' }] },
+ { code: 'const view = <div style={{ color: active ? "red" : "blue" }} />;', errors: [{ messageId: 'static' }] },
+ { code: 'const view = <div style={open && { padding: 12 }} />;', errors: [{ messageId: 'static' }] },
+ { code: 'const view = <div style={{ margin: -4, padding: 8 }} />;', errors: [{ messageId: 'static' }] },
+ ],
+});
diff --git a/frontend/scripts/hooks-browser.mjs b/frontend/scripts/hooks-browser.mjs
new file mode 100644
index 00000000..d3341ac6
--- /dev/null
+++ b/frontend/scripts/hooks-browser.mjs
@@ -0,0 +1,108 @@
+import assert from 'node:assert/strict';
+import { existsSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { createServer } from 'vite';
+import react from '@vitejs/plugin-react';
+import { chromium } from 'playwright';
+
+// Exercise the real login/SSO pages and layout hooks under React StrictMode.
+// Only authentication, translation, and HTTP boundaries are replaced by
+// controlled fixtures; no backend server or account credentials are needed.
+const root = fileURLToPath(new URL('../', import.meta.url));
+const fixture = `
+import React, {useState, useRef, useEffect} from 'react';
+import {createRoot} from 'react-dom/client';
+import {MemoryRouter, Routes, Route} from 'react-router-dom';
+import Login from '/src/pages/Login.jsx';
+import SSOCallback from '/src/pages/SSOCallback.jsx';
+import {useOverflowItems} from '/src/hooks/useOverflowItems.js';
+import useFocusTrap from '/src/hooks/ai/useFocusTrap.js';
+window.calls=[]; window.users=[]; window.reads=0;
+window.onUser=user=>window.users.push(user);
+window.testApi={
+ getDemoInfo: async()=>({enabled:false}), setTokens:()=>{},
+ verify2FA:(token,code)=>{window.calls.push({type:'verify',token,code});return new Promise((resolve,reject)=>{window.finish=resolve;window.fail=reject})},
+ completeSSOAuth:(provider,code,state)=>{window.calls.push({type:'sso',provider,code,state});return new Promise(resolve=>{window.finish=resolve})}
+};
+const mode=new URL(location.href).searchParams.get('mode');
+function Overflow(){
+ const [count,setCount]=useState(4);const [extra,setExtra]=useState(0);
+ const {containerRef,itemRefs,hiddenIndices}=useOverflowItems({count,gap:0,moreWidth:20,deps:[extra]});
+ window.changeExtra=()=>setExtra(n=>n+1);window.changeCount=setCount;
+ return <><div ref={containerRef} style={{width:180,display:'flex'}}>{Array.from({length:count},(_,i)=><div key={i} ref={el=>{itemRefs.current[i]=el;if(el)Object.defineProperty(el,'offsetWidth',{configurable:true,get(){window.reads++;return 80}})}} style={{width:80,flexShrink:0}}>Item</div>)}</div><output>{JSON.stringify(hiddenIndices)}</output></>
+}
+function Focus(){
+ const [active,setActive]=useState(true);const box=useRef(null);const first=useRef(null);const second=useRef(null);const restore=useRef(null);
+ useEffect(()=>{restore.current=first.current;window.deactivate=()=>{restore.current=second.current;setActive(false)}},[]);
+ useFocusTrap(box,{active,restoreFocusRef:restore});
+ return <><button id="first" ref={first}>first</button><button id="second" ref={second}>second</button><div ref={box}><button>inside</button></div></>
+}
+function App(){
+ const [,setTick]=useState(0);window.bump=()=>setTick(n=>n+1);
+ if(mode==='overflow')return <Overflow/>;if(mode==='focus')return <Focus/>;
+ const entry=mode==='sso'?'/login/callback/test?code=code1&state=state1':{pathname:'/login',state:{requires2FA:true,tempToken:'challenge1'}};
+ return <MemoryRouter initialEntries={[entry]}><Routes><Route path="/login" element={<Login/>}/><Route path="/login/callback/:provider" element={<SSOCallback/>}/><Route path="*" element={<div id="done">done</div>}/></Routes></MemoryRouter>
+}
+createRoot(document.getElementById('root')).render(<React.StrictMode><App/></React.StrictMode>);
+`;
+const server = await createServer({
+ root, configFile:false, logLevel:'error', resolve:{alias:{'@':path.join(root,'src')}},
+ cacheDir: path.join(root, 'node_modules/.vite-hooks-regression'),
+ optimizeDeps: { entries: [] },
+ server:{host:'127.0.0.1',port:0},
+ plugins:[{
+ name:'hook-regression-fixtures',enforce:'pre',
+ resolveId(id){if(id==='react-i18next')return '\0test-i18n';if(id.endsWith('/hook-fixture.jsx'))return path.join(root,'hook-fixture.jsx')},
+ load(id){
+ const normalized=id.replaceAll('\\','/');
+ if(id==='\0test-i18n')return `const t=(key,fallback)=>typeof fallback==='string'?fallback:key;export const useTranslation=()=>({t});export const Trans=({children})=>children;`;
+ if(normalized.endsWith('/src/contexts/useAuth.js'))return `export const useAuth=()=>({setUser:window.onUser,ssoProviders:[],passwordLoginEnabled:true,publicTitle:'Control panel'});`;
+ if(normalized.endsWith('/src/pages/auth/AuthLayout.jsx'))return `export default function AuthLayout({children}){return children}`;
+ if(normalized.endsWith('/src/services/api.js')||normalized.endsWith('/src/services/api/index.js'))return `export default new Proxy({}, {get:(_,key)=>(...args)=>window.testApi[key](...args)});`;
+ if(normalized.endsWith('/hook-fixture.jsx'))return fixture;
+ },
+ configureServer(server){server.middlewares.use('/hook-check',async(_req,res)=>{res.setHeader('Content-Type','text/html');res.end(await server.transformIndexHtml('/hook-check','<div id="root"></div><script type="module" src="/hook-fixture.jsx"></script>'))})}
+ },react()],
+});
+const executablePath = [
+ process.env.CHROME_PATH,
+ chromium.executablePath(),
+ 'C:/Program Files/Google/Chrome/Application/chrome.exe',
+ 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
+].find(candidate => candidate && existsSync(candidate));
+
+let browser;
+try {
+ await server.listen();const origin=`http://127.0.0.1:${server.httpServer.address().port}`;
+ browser=await chromium.launch({ ...(executablePath ? { executablePath } : {}), headless: true });const page=await browser.newPage();
+ const errors=[];page.on('pageerror',error=>errors.push(error.message));
+ await page.goto(origin+'/hook-check?mode=login');await page.locator('.totp-input').first().waitFor();
+ async function digits(){for(let i=0;i<6;i++)await page.locator('.totp-input').nth(i).fill(String(i+1))}
+ await digits();await page.waitForFunction(()=>window.calls.length===1);
+ await page.evaluate(()=>{window.bump();document.querySelector('form').dispatchEvent(new Event('submit',{bubbles:true,cancelable:true}))});
+ await page.waitForTimeout(100);assert.equal(await page.evaluate(()=>window.calls.length),1);
+ await page.evaluate(()=>window.fail(new Error('Invalid verification code')));
+ await page.waitForFunction(()=>[...document.querySelectorAll('.totp-input')].every(el=>el.value===''));
+ await digits();await page.waitForFunction(()=>window.calls.length===2);
+ await page.evaluate(()=>window.finish({access_token:'a',refresh_token:'r',user:{id:7}}));
+ await page.locator('#done').waitFor();assert.equal(await page.evaluate(()=>window.calls.length),2);
+ console.log('PASS TOTP single in-flight request, rerender guard, retry after rejection and successful navigation');
+ await page.goto(origin+'/hook-check?mode=sso');await page.waitForFunction(()=>window.calls.length===1);
+ await page.evaluate(()=>window.bump());await page.waitForTimeout(100);
+ assert.equal(await page.evaluate(()=>window.calls.length),1);
+ await page.evaluate(()=>window.finish({requires_2fa:true,temp_token:'sso-challenge'}));
+ await page.locator('.totp-input').first().waitFor();assert.equal(await page.evaluate(()=>window.calls.length),1);
+ console.log('PASS SSO exchanges once under StrictMode and rerender, then forwards MFA challenge');
+ await page.goto(origin+'/hook-check?mode=overflow');await page.locator('output').waitFor();await page.waitForTimeout(200);
+ assert.equal(await page.locator('output').textContent(),'[2,3]');
+ const reads=await page.evaluate(()=>window.reads);await page.evaluate(()=>window.bump());await page.waitForTimeout(100);
+ assert.equal(await page.evaluate(()=>window.reads),reads);
+ await page.evaluate(()=>window.changeExtra());await page.waitForFunction(n=>window.reads>n,reads);
+ await page.evaluate(()=>window.changeCount(1));await page.waitForFunction(()=>document.querySelector('output').textContent==='[]');
+ console.log('PASS overflow measurement skips identical dependency values and responds to changed values/count');
+ await page.goto(origin+'/hook-check?mode=focus');await page.locator('#first').waitFor();await page.waitForTimeout(100);
+ await page.evaluate(()=>window.deactivate());await page.waitForFunction(()=>document.activeElement.id==='first');
+ console.log('PASS focus restores activation target after ref changes');
+ assert.deepEqual(errors,[]);
+} finally {await browser?.close();await server.close()}
diff --git a/frontend/scripts/lint-inventory.mjs b/frontend/scripts/lint-inventory.mjs
new file mode 100644
index 00000000..69409eb8
--- /dev/null
+++ b/frontend/scripts/lint-inventory.mjs
@@ -0,0 +1,29 @@
+import { relative } from 'node:path';
+
+export function warningInventory(results, root, sourceFiles) {
+ const inventory = {};
+ for (const result of results) {
+ if (!sourceFiles.has(result.filePath)) continue;
+ const file = relative(root, result.filePath).replaceAll('\\', '/');
+ for (const message of result.messages) {
+ if (message.severity !== 1) continue;
+ const rule = message.ruleId || 'unused-disable';
+ inventory[file] ||= {};
+ inventory[file][rule] = (inventory[file][rule] || 0) + 1;
+ }
+ }
+ return Object.fromEntries(Object.entries(inventory).sort().map(([file, rules]) => [
+ file, Object.fromEntries(Object.entries(rules).sort()),
+ ]));
+}
+
+export function warningRegressions(current, baseline) {
+ const regressions = [];
+ for (const [file, rules] of Object.entries(current)) {
+ for (const [rule, count] of Object.entries(rules)) {
+ const ceiling = baseline[file]?.[rule] || 0;
+ if (count > ceiling) regressions.push(`${file}: ${rule} has ${count} warnings (ceiling ${ceiling})`);
+ }
+ }
+ return regressions;
+}
diff --git a/frontend/scripts/lint-inventory.test.mjs b/frontend/scripts/lint-inventory.test.mjs
new file mode 100644
index 00000000..efa111bb
--- /dev/null
+++ b/frontend/scripts/lint-inventory.test.mjs
@@ -0,0 +1,23 @@
+import assert from 'node:assert/strict';
+import { resolve } from 'node:path';
+import test from 'node:test';
+import { warningInventory, warningRegressions } from './lint-inventory.mjs';
+
+test('warning baseline excludes installed copies but includes newly added source', () => {
+ const root = resolve('fixture');
+ const file = resolve(root, 'src/new.jsx');
+ const installed = resolve(root, 'src/plugins/installed.jsx');
+ const messages = [{ severity: 1, ruleId: 'no-unused-vars' }, { severity: 2, ruleId: 'no-undef' }];
+ assert.deepEqual(warningInventory([{ filePath: file, messages }, { filePath: installed, messages }], root, new Set([file])), {
+ 'src/new.jsx': { 'no-unused-vars': 1 },
+ });
+});
+
+test('new files, new rules, and growing counts fail; reductions pass', () => {
+ const baseline = { 'src/page.jsx': { 'no-unused-vars': 2 } };
+ assert.equal(warningRegressions({ 'src/page.jsx': { 'no-unused-vars': 3 } }, baseline).length, 1);
+ assert.equal(warningRegressions({ 'src/page.jsx': { 'react-hooks/exhaustive-deps': 1 } }, baseline).length, 1);
+ assert.equal(warningRegressions({ 'src/new.jsx': { 'no-unused-vars': 1 } }, baseline).length, 1);
+ assert.deepEqual(warningRegressions({ 'src/page.jsx': { 'no-unused-vars': 1 } }, baseline), []);
+ assert.deepEqual(warningRegressions({}, baseline), []);
+});
diff --git a/frontend/scripts/lint-warning-baseline.json b/frontend/scripts/lint-warning-baseline.json
new file mode 100644
index 00000000..0967ef42
--- /dev/null
+++ b/frontend/scripts/lint-warning-baseline.json
@@ -0,0 +1 @@
+{}
diff --git a/frontend/scripts/lint.mjs b/frontend/scripts/lint.mjs
new file mode 100644
index 00000000..ab2c3d6c
--- /dev/null
+++ b/frontend/scripts/lint.mjs
@@ -0,0 +1,40 @@
+// Run normal ESLint, then prevent tracked-source warnings growing by file/rule.
+// Installed, ignored extensions still receive normal lint diagnostics, but do
+// not change the checked-in baseline on one developer's machine.
+import { ESLint } from 'eslint';
+import { execFileSync } from 'node:child_process';
+import { readFileSync, writeFileSync } from 'node:fs';
+import { dirname, resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { warningInventory, warningRegressions } from './lint-inventory.mjs';
+
+const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+const repo = resolve(root, '..');
+const baselineFile = resolve(root, 'scripts/lint-warning-baseline.json');
+const lint = new ESLint({ cwd: root });
+const results = await lint.lintFiles(['.']);
+const formatter = await lint.loadFormatter('stylish');
+const output = formatter.format(results);
+if (output) console.log(output);
+if (results.some((result) => result.errorCount > 0)) process.exit(1);
+
+// Include new, non-ignored source files so new warnings cannot slip through
+// before the file is first staged. Git paths are repository-relative here.
+const paths = execFileSync('git', ['ls-files', '-z', '--cached', '--others', '--exclude-standard', '--', 'frontend'], {
+ cwd: repo, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'],
+}).split('\0').filter(Boolean);
+const sourceFiles = new Set(paths.map((file) => resolve(repo, file)));
+const inventory = warningInventory(results, root, sourceFiles);
+if (process.argv.includes('--update')) {
+ writeFileSync(baselineFile, `${JSON.stringify(inventory, null, 2)}\n`);
+ console.log('Updated tracked-source warning baseline; review the diff before committing.');
+} else {
+ const baseline = JSON.parse(readFileSync(baselineFile, 'utf8'));
+ const regressions = warningRegressions(inventory, baseline);
+ if (regressions.length) {
+ console.error(`New ESLint warnings:\n ${regressions.join('\n ')}\nFix new warnings; keep the baseline shrinking.`);
+ process.exit(1);
+ }
+ const count = Object.values(inventory).reduce((total, rules) => total + Object.values(rules).reduce((sum, n) => sum + n, 0), 0);
+ console.log(`Tracked-source warnings: ${count}; no file/rule exceeds its reviewed baseline.`);
+}
diff --git a/frontend/scripts/metrics-browser.mjs b/frontend/scripts/metrics-browser.mjs
new file mode 100644
index 00000000..c4e28fd8
--- /dev/null
+++ b/frontend/scripts/metrics-browser.mjs
@@ -0,0 +1,144 @@
+import assert from 'node:assert/strict';
+import { existsSync } from 'node:fs';
+import { chromium } from 'playwright';
+import { createServer } from 'vite';
+
+// Real React mount with controlled HTTP/socket adapters and visibility events.
+const fixture = `
+import React, { useState } from 'react';
+import { createRoot } from 'react-dom/client';
+import { useMetrics } from '/src/hooks/useMetrics.js';
+import api from '/src/services/api/index.js';
+import socket from '/src/services/socket.js';
+import { WorkspaceProvider } from '/src/contexts/WorkspaceContext.jsx';
+import { workspaceStore } from '/src/services/workspaceStore.js';
+import { useMetricHistory } from '/src/components/dashboard/widgets/useWidgetData.js';
+const handlers = new Map();
+let hidden = false;
+const state = { calls: 0, pending: [] };
+api.getSystemMetrics = () => {
+ state.calls += 1;
+ return new Promise((resolve) => state.pending.push(resolve));
+};
+socket.socket = { connected: false };
+socket.connect = () => {};
+socket.on = (name, fn) => { handlers.set(name, fn); return () => handlers.delete(name); };
+socket.subscribeMetrics = () => {};
+socket.unsubscribeMetrics = () => {};
+Object.defineProperty(document, 'visibilityState', { configurable: true, get: () => hidden ? 'hidden' : 'visible' });
+function App() {
+ const [options, setOptions] = useState({ enabled: true, autoRefresh: true });
+ const metrics = useMetrics(true, 60, options);
+ window.metricsFixture = {
+ state, setOptions, metrics,
+ emit: (name, data) => handlers.get(name)?.(data),
+ resolve: () => state.pending.splice(0).forEach((resolve) => resolve({ cpu: 42 })),
+ hide: (value) => { hidden = value; document.dispatchEvent(new Event('visibilitychange')); },
+ };
+ return React.createElement('output', {}, metrics.loading ? 'loading' : 'ready');
+}
+createRoot(document.getElementById('root')).render(React.createElement(App));
+const widgetState = { calls: 0, pending: [], snapshots: [] };
+api.getMetricsHistory = () => {
+ widgetState.calls += 1;
+ return new Promise((resolve) => widgetState.pending.push(resolve));
+};
+function Widget({ index, tick }) {
+ widgetState.snapshots[index] = useMetricHistory('local', '1h', tick);
+ return null;
+}
+function Widgets() {
+ const [tick, setTick] = useState(0);
+ window.widgetFixture = {
+ state: widgetState, refresh: () => setTick((value) => value + 1),
+ resolve: () => widgetState.pending.splice(0).forEach((resolve) => resolve({ points: [widgetState.calls] })),
+ workspace: () => workspaceStore.setActiveWorkspace({ id: 'other-workspace', name: 'Other' }),
+ };
+ return React.createElement(React.Fragment, {},
+ React.createElement(Widget, { index: 0, tick }), React.createElement(Widget, { index: 1, tick }));
+}
+createRoot(document.getElementById('widgets')).render(React.createElement(WorkspaceProvider, {}, React.createElement(Widgets)));
+`;
+const server = await createServer({
+ server: { host: '127.0.0.1', port: 0, open: false },
+ plugins: [{
+ name: 'metrics-regression-fixture',
+ resolveId(id) { if (id === 'virtual:metrics-regression') return '\0metrics-regression'; },
+ load(id) { if (id === '\0metrics-regression') return fixture; },
+ configureServer(vite) {
+ vite.middlewares.use('/__metrics-regression', async (_req, res) => {
+ res.setHeader('Content-Type', 'text/html');
+ res.end(await vite.transformIndexHtml('/__metrics-regression',
+ '<div id="root"></div><div id="widgets"></div><script type="module">import "virtual:metrics-regression"</script>'));
+ });
+ },
+ }],
+});
+await server.listen();
+const executablePath = [
+ process.env.CHROME_PATH, chromium.executablePath(),
+ 'C:/Program Files/Google/Chrome/Application/chrome.exe',
+ 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
+].find((path) => path && existsSync(path));
+let browser;
+try {
+ browser = await chromium.launch({ ...(executablePath ? { executablePath } : {}), headless: true });
+ const page = await browser.newPage();
+ const errors = [];
+ page.on('pageerror', (error) => errors.push(error.message));
+ await page.goto(`http://127.0.0.1:${server.httpServer.address().port}/__metrics-regression`);
+ await page.waitForFunction(() => window.metricsFixture?.state.calls === 1);
+ const calls = () => page.evaluate(() => window.metricsFixture.state.calls);
+ const action = (fn) => page.evaluate(fn);
+ await page.waitForTimeout(240);
+ assert.equal(await calls(), 1, 'slow initial response cannot overlap fallback');
+ await action(() => { window.metricsFixture.metrics.refresh(); window.metricsFixture.metrics.refresh(); });
+ assert.equal(await calls(), 1, 'manual refresh shares initial request');
+ await action(() => window.metricsFixture.emit('connected'));
+ await action(() => window.metricsFixture.resolve());
+ await page.waitForTimeout(180);
+ assert.equal(await calls(), 1, 'connected socket stops fallback');
+ await action(() => window.metricsFixture.emit('disconnected'));
+ await page.waitForFunction(() => window.metricsFixture.state.calls === 2);
+ await action(() => window.metricsFixture.hide(true));
+ await action(() => window.metricsFixture.resolve());
+ await page.waitForTimeout(180);
+ assert.equal(await calls(), 2, 'hidden tabs suspend fallback');
+ await action(() => window.metricsFixture.hide(false));
+ await page.waitForFunction(() => window.metricsFixture.state.calls === 3);
+ await action(() => window.metricsFixture.setOptions({ enabled: false, autoRefresh: true }));
+ await page.waitForTimeout(30);
+ await action(() => window.metricsFixture.resolve());
+ await page.waitForTimeout(180);
+ assert.equal(await calls(), 3, 'remote selection stops local HTTP work');
+ await action(() => window.metricsFixture.setOptions({ enabled: true, autoRefresh: false }));
+ await page.waitForFunction(() => window.metricsFixture.state.calls === 4);
+ await action(() => window.metricsFixture.resolve());
+ await page.waitForTimeout(180);
+ assert.equal(await calls(), 4, 'refresh off loads one snapshot without polling');
+ await action(() => { window.metricsFixture.metrics.refresh(); window.metricsFixture.metrics.refresh(); });
+ await page.waitForFunction(() => window.metricsFixture.state.calls === 5);
+ await action(() => window.metricsFixture.resolve());
+ await page.waitForTimeout(120);
+ assert.equal(await calls(), 5, 'manual refresh while off does not restart timer');
+ await page.waitForFunction(() => window.widgetFixture?.state.calls === 1);
+ await action(() => window.widgetFixture.resolve());
+ await page.waitForFunction(() => window.widgetFixture.state.snapshots.every((item) => !item.loading));
+ await action(() => window.widgetFixture.refresh());
+ await page.waitForFunction(() => window.widgetFixture.state.calls === 2);
+ assert.deepEqual(await action(() => window.widgetFixture.state.snapshots.map((item) => item.data)),
+ [{ points: [1] }, { points: [1] }], 'refresh retains both widgets while sharing one next request');
+ await action(() => window.widgetFixture.resolve());
+ await page.waitForFunction(() => window.widgetFixture.state.snapshots.every((item) => !item.loading));
+ await action(() => window.widgetFixture.workspace());
+ await page.waitForFunction(() => window.widgetFixture.state.calls === 3);
+ assert.deepEqual(await action(() => window.widgetFixture.state.snapshots.map((item) => item.data)),
+ [null, null], 'workspace switching cannot display another workspace payload');
+ await action(() => window.widgetFixture.resolve());
+ await page.waitForFunction(() => window.widgetFixture.state.snapshots.every((item) => !item.loading));
+ assert.deepEqual(errors, []);
+ console.log('Metrics browser regression passed: slow response, manual sharing, socket loss/reconnect, hidden tab, remote selection, refresh off; widget sharing, refresh retention, workspace isolation.');
+} finally {
+ await browser?.close();
+ await server.close();
+}
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 3e3cbdbc..2c7d3672 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -1,6 +1,7 @@
import { Suspense, useEffect } from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate, useLocation, useParams } from 'react-router-dom';
-import { AuthProvider, useAuth } from './contexts/AuthContext';
+import { AuthProvider } from './contexts/AuthContext';
+import { useAuth } from './contexts/useAuth.js';
import { ToastProvider } from './contexts/ToastContext';
import { ThemeProvider } from './contexts/ThemeContext';
import { LocaleProvider } from './contexts/LocaleContext';
diff --git a/frontend/src/components/CommandPalette.jsx b/frontend/src/components/CommandPalette.jsx
index 5314f69a..1c1871aa 100644
--- a/frontend/src/components/CommandPalette.jsx
+++ b/frontend/src/components/CommandPalette.jsx
@@ -17,9 +17,9 @@ import {
CommandItem,
} from '@/components/ui/command';
import { useContributions } from '../plugins/contributions';
-import { useAuth } from '../contexts/AuthContext';
-import { useShellDock } from '../contexts/ShellDockContext';
-import { useTheme } from '../contexts/ThemeContext';
+import { useAuth } from '../contexts/useAuth.js';
+import { useShellDock } from '../contexts/useShellDock.js';
+import { useTheme } from '../contexts/useTheme.js';
import { useWalkthroughs } from '../contexts/walkthroughContextValue';
import usePaletteAuthz from '../hooks/usePaletteAuthz';
import { CREATE_ITEMS } from '../data/createItems';
@@ -30,6 +30,7 @@ import { DOCS_LINKS } from '../utils/docsLinks';
import { scoreItem } from '../utils/paletteScore';
import { frecencyScore, recordUse, recentIds } from '../utils/paletteFrecency';
import { getFavorites, getRecents } from '../utils/recents';
+import { Button as SharedButton } from '@/components/ui/button';
// Group order in the list, plus a per-category icon and a scoring weight so the
// headline categories (Settings, Pages, Actions) outrank raw entity hits on ties.
@@ -427,7 +428,7 @@ const CommandPalette = ({ open, onClose }) => {
);
})}
{hiddenCount > 0 && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="command-palette__more"
onClick={() => setShowMoreCreates((value) => !value)}
@@ -439,7 +440,7 @@ const CommandPalette = ({ open, onClose }) => {
? t('palette.moreIncludingExtensions', '{{count}} more · including extensions', { count: hiddenCount })
: t('palette.moreCreates', '{{count}} more', { count: hiddenCount })}</>
)}
- </button>
+ </SharedButton>
)}
</CommandGroup>
);
diff --git a/frontend/src/components/DocsLink.jsx b/frontend/src/components/DocsLink.jsx
index 796bd5e5..b14b5696 100644
--- a/frontend/src/components/DocsLink.jsx
+++ b/frontend/src/components/DocsLink.jsx
@@ -1,5 +1,5 @@
import { BookOpen } from 'lucide-react';
-import { useTheme } from '../contexts/ThemeContext';
+import { useTheme } from '../contexts/useTheme.js';
import { docsUrl } from '../utils/docsLinks';
// Small "Docs" link (book icon) that opens a serverkit.ai docs page in a new
diff --git a/frontend/src/components/EmailProviders.jsx b/frontend/src/components/EmailProviders.jsx
index 33fccd6c..fe94a576 100644
--- a/frontend/src/components/EmailProviders.jsx
+++ b/frontend/src/components/EmailProviders.jsx
@@ -4,7 +4,7 @@ import api from '../services/api';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useTranslation } from 'react-i18next';
const FIELD_LABELS = {
diff --git a/frontend/src/components/EnvironmentVariables.jsx b/frontend/src/components/EnvironmentVariables.jsx
index bdfbdebd..bc306ed2 100644
--- a/frontend/src/components/EnvironmentVariables.jsx
+++ b/frontend/src/components/EnvironmentVariables.jsx
@@ -3,7 +3,7 @@ import {
Copy, Download, Eye, EyeOff, History, Pencil, Plus, Trash2, Upload, Variable,
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
@@ -70,6 +70,7 @@ const ENV_VIEWS = [
const EnvironmentVariables = ({ appId }) => {
const { t } = useTranslation();
const toast = useToast();
+ const toastError = toast.error;
const { confirm } = useConfirm();
const { copy } = useClipboard();
const [envVars, setEnvVars] = useState([]);
@@ -110,12 +111,7 @@ const EnvironmentVariables = ({ appId }) => {
const fileInputRef = useRef(null);
- useEffect(() => {
- loadEnvVars();
- loadComposeServices();
- }, [appId]);
-
- async function loadComposeServices() {
+ const loadComposeServices = useCallback(async () => {
try {
const data = await api.getComposeServices(appId);
setComposeServices(data.services || []);
@@ -123,20 +119,26 @@ const EnvironmentVariables = ({ appId }) => {
// Non-compose apps or errors: keep single-container UX (no selector).
setComposeServices([]);
}
- }
+ }, [appId]);
- async function loadEnvVars() {
+ const loadEnvVars = useCallback(async () => {
try {
setLoading(true);
const data = await api.getEnvVars(appId);
setEnvVars(data.env_vars || []);
} catch (err) {
- toast.error(t('app.environmentVariables.failedToLoadEnvironmentVariables', 'Failed to load environment variables'));
+ toastError(t('app.environmentVariables.failedToLoadEnvironmentVariables', 'Failed to load environment variables'));
console.error('Failed to load env vars:', err);
} finally {
setLoading(false);
}
- }
+ }, [appId, t, toastError]);
+
+ useEffect(() => {
+ loadEnvVars();
+ loadComposeServices();
+ }, [loadEnvVars, loadComposeServices]);
+
function openAddModal() {
setNewKey('');
@@ -250,7 +252,7 @@ const EnvironmentVariables = ({ appId }) => {
const data = await api.exportEnvFile(appId, includeSecrets);
downloadBlob(data.content, data.filename || 'app.env');
toast.success(t('app.environmentVariables.environmentFileExported', 'Environment file exported'));
- } catch (err) {
+ } catch {
toast.error(t('app.environmentVariables.failedToExport', 'Failed to export'));
}
}
@@ -291,7 +293,7 @@ const EnvironmentVariables = ({ appId }) => {
const data = await api.getEnvVarHistory(appId);
setHistory(data.history || []);
setShowHistoryModal(true);
- } catch (err) {
+ } catch {
toast.error(t('app.environmentVariables.failedToLoadHistory', 'Failed to load history'));
}
}
@@ -312,7 +314,7 @@ const EnvironmentVariables = ({ appId }) => {
await api.clearEnvVars(appId);
toast.success(t('app.environmentVariables.allEnvironmentVariablesCleared', 'All environment variables cleared'));
loadEnvVars();
- } catch (err) {
+ } catch {
toast.error(t('app.environmentVariables.failedToClear', 'Failed to clear'));
}
}
@@ -437,38 +439,38 @@ const EnvironmentVariables = ({ appId }) => {
cellClassName: 'actions-cell',
render: (ev) => (
<>
- <button
+ <Button variant="unstyled"
type="button"
className="btn-icon"
onClick={() => toggleShowValue(ev.id)}
title={showValues[ev.id] ? t('app.environmentVariables.hideValue', 'Hide value') : t('app.environmentVariables.showValue', 'Show value')}
>
{showValues[ev.id] ? <EyeOff size={16} /> : <Eye size={16} />}
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className="btn-icon"
onClick={() => copy(ev.value)}
title={t('app.environmentVariables.copyValue', 'Copy value')}
>
<Copy size={16} />
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className="btn-icon"
onClick={() => startEditing(ev)}
title={t('common.actions.edit', 'Edit')}
>
<Pencil size={16} />
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className="btn-icon btn-danger"
onClick={() => handleDelete(ev.key)}
title={t('common.actions.delete', 'Delete')}
>
<Trash2 size={16} />
- </button>
+ </Button>
</>
),
},
diff --git a/frontend/src/components/FavoriteStar.jsx b/frontend/src/components/FavoriteStar.jsx
index 801a2876..30aea450 100644
--- a/frontend/src/components/FavoriteStar.jsx
+++ b/frontend/src/components/FavoriteStar.jsx
@@ -3,6 +3,7 @@ import { Star } from 'lucide-react';
import { cn } from '@/lib/utils';
import { isFavorite, toggleFavorite } from '@/utils/recents';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Pin/unpin an entity as a favorite (surfaced in the command palette's
// Favorites section). Sits in detail-page title areas.
@@ -17,7 +18,7 @@ export function FavoriteStar({ type, id, path, label, className }) {
};
return (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={cn('fav-star', fav && 'is-on', className)}
onClick={toggle}
@@ -26,7 +27,7 @@ export function FavoriteStar({ type, id, path, label, className }) {
aria-pressed={fav}
>
<Star size={15} fill={fav ? 'currentColor' : 'none'} />
- </button>
+ </SharedButton>
);
}
diff --git a/frontend/src/components/GlobalStatusBar.jsx b/frontend/src/components/GlobalStatusBar.jsx
index bf0f3daa..f03ece1f 100644
--- a/frontend/src/components/GlobalStatusBar.jsx
+++ b/frontend/src/components/GlobalStatusBar.jsx
@@ -7,15 +7,16 @@ import {
import { useTranslation } from 'react-i18next';
import api from '../services/api';
-import { useAuth } from '../contexts/AuthContext';
-import { useNotifications } from '../contexts/NotificationsContext';
+import { useAuth } from '../contexts/useAuth.js';
+import { useNotifications } from '../contexts/useNotifications.js';
import { useOperations } from '../contexts/OperationsContext';
-import { useServerkitAI } from '../contexts/AIContext';
-import { useShellDock } from '../contexts/ShellDockContext';
+import { useServerkitAI } from '../contexts/useServerkitAI.js';
+import { useShellDock } from '../contexts/useShellDock.js';
import { useWalkthroughs } from '../contexts/walkthroughContextValue';
-import { useWorkspace } from '../contexts/WorkspaceContext';
+import { useWorkspace } from '../contexts/useWorkspace.js';
import { timeAgo } from '../utils/time';
import ShellDockTabs from './ShellDockTabs';
+import { Button as SharedButton } from '@/components/ui/button';
const SERVER_SCOPE_KEY = 'serverkit.activeServerScope';
@@ -49,7 +50,7 @@ function ScopeMenu({ label, options, value, onPick, wide = false }) {
>
<div className="statusbar-menu__head mono">{label}</div>
{options.map((option) => (
- <button
+ <SharedButton variant="unstyled"
key={option.id}
type="button"
role="option"
@@ -65,7 +66,7 @@ function ScopeMenu({ label, options, value, onPick, wide = false }) {
{String(option.id) === String(value) && (
<Check size={15} className="statusbar-menu__check" aria-hidden="true" />
)}
- </button>
+ </SharedButton>
))}
</div>
);
@@ -107,7 +108,7 @@ function AlertsPanel({ onClose }) {
<ShellDockTabs />
</header>
<div className="shell-panel__filters">
- <button
+ <SharedButton variant="unstyled"
type="button"
className={view === 'attention' ? 'is-active' : ''}
onClick={() => setView('attention')}
@@ -115,8 +116,8 @@ function AlertsPanel({ onClose }) {
aria-selected={view === 'attention'}
>
{t('app.operationsDock.needsAttention', 'Needs attention')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className={view === 'all' ? 'is-active' : ''}
onClick={() => setView('all')}
@@ -124,12 +125,12 @@ function AlertsPanel({ onClose }) {
aria-selected={view === 'all'}
>
{t('notifications.everything', 'Everything')}
- </button>
+ </SharedButton>
<span className="shell-panel__spacer" />
{items.some((item) => item.kind !== 'notice' && !item.read) && (
- <button type="button" className="shell-panel__action" onClick={markAllRead}>
+ <SharedButton variant="unstyled" type="button" className="shell-panel__action" onClick={markAllRead}>
<Check size={13} /> {t('notifications.markAllRead', 'Mark all read')}
- </button>
+ </SharedButton>
)}
</div>
@@ -143,7 +144,7 @@ function AlertsPanel({ onClose }) {
key={item.delivery_id || item.notice_id}
className={`shell-alerts__row is-${alertTone(item)}${item.read ? ' is-read' : ''}`}
>
- <button type="button" className="shell-alerts__hit" onClick={() => openItem(item)}>
+ <SharedButton variant="unstyled" type="button" className="shell-alerts__hit" onClick={() => openItem(item)}>
<span className="shell-alerts__dot" aria-hidden="true" />
<span className="shell-alerts__copy">
<strong>{item.title}</strong>
@@ -154,16 +155,16 @@ function AlertsPanel({ onClose }) {
? item.action_label || t('notifications.review', 'Review')
: timeAgo(item.created_at)}
</span>
- </button>
+ </SharedButton>
{item.kind === 'notice' && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="shell-alerts__dismiss"
onClick={() => dismissNotice?.(item.notice_id)}
aria-label={t('notifications.dismissItem', 'Dismiss {{title}}', { title: item.title })}
>
<X size={14} />
- </button>
+ </SharedButton>
)}
</div>
))}
@@ -171,9 +172,9 @@ function AlertsPanel({ onClose }) {
<footer className="shell-panel__footer">
<span>{t('notifications.recentActivity', 'Recent system and delivery activity')}</span>
- <button type="button" onClick={() => { navigate('/notifications'); onClose(); }}>
+ <SharedButton variant="unstyled" type="button" onClick={() => { navigate('/notifications'); onClose(); }}>
{t('notifications.seeAll', 'See all notifications')}
- </button>
+ </SharedButton>
</footer>
</section>
);
@@ -304,7 +305,7 @@ export default function GlobalStatusBar({ onOpenPalette }) {
onPick={pickWorkspace}
/>
)}
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`statusbar-select statusbar-select--workspace${scopeMenu === 'workspace' ? ' is-open' : ''}`}
onClick={() => setScopeMenu(scopeMenu === 'workspace' ? null : 'workspace')}
@@ -315,7 +316,7 @@ export default function GlobalStatusBar({ onOpenPalette }) {
<Building2 size={13} aria-hidden="true" />
<span className="statusbar-select__value">{workspaceName}</span>
<ChevronUp size={12} aria-hidden="true" />
- </button>
+ </SharedButton>
</span>
<span className="global-statusbar__separator" aria-hidden="true" />
@@ -329,7 +330,7 @@ export default function GlobalStatusBar({ onOpenPalette }) {
onPick={pickServer}
/>
)}
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`statusbar-select${scopeMenu === 'server' ? ' is-open' : ''}`}
onClick={() => setScopeMenu(scopeMenu === 'server' ? null : 'server')}
@@ -341,12 +342,12 @@ export default function GlobalStatusBar({ onOpenPalette }) {
<Server size={13} className="global-statusbar__mobile-icon" aria-hidden="true" />
<span className="statusbar-select__value mono">{selectedServer.name || selectedServer.id}</span>
<ChevronUp size={12} aria-hidden="true" />
- </button>
+ </SharedButton>
</span>
<span className="global-statusbar__separator" aria-hidden="true" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`global-statusbar__segment${activeTab === 'ops' ? ' is-active' : ''}`}
onClick={() => toggleTab('ops')}
@@ -361,10 +362,10 @@ export default function GlobalStatusBar({ onOpenPalette }) {
: t('app.statusbar.idle', 'idle')}
</span>
{attentionCount > 0 && <span className="global-statusbar__pip is-warning" aria-hidden="true" />}
- </button>
+ </SharedButton>
<span className="global-statusbar__separator" aria-hidden="true" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`global-statusbar__segment${activeTab === 'recipes' ? ' is-active' : ''}`}
onClick={() => toggleTab('recipes')}
@@ -376,12 +377,12 @@ export default function GlobalStatusBar({ onOpenPalette }) {
{activeWalkthrough && (
<span className="global-statusbar__muted mono">{activeProgress?.count || 0}/{activeProgress?.total || 0}</span>
)}
- </button>
+ </SharedButton>
<span className="global-statusbar__spacer" />
{setupSummary && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="global-statusbar__segment global-statusbar__setup"
onClick={() => navigate('/monitoring/doctor')}
@@ -392,12 +393,12 @@ export default function GlobalStatusBar({ onOpenPalette }) {
{t('app.statusbar.setupScore', 'setup {{score}}%', { score: setupSummary.score })}
</span>
<progress max="100" value={setupSummary.score} aria-label={t('app.setupHealthWidget.progress', 'Setup health progress')} />
- </button>
+ </SharedButton>
)}
<span className="global-statusbar__separator" aria-hidden="true" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`global-statusbar__segment${activeTab === 'alerts' ? ' is-active' : ''}`}
onClick={() => toggleTab('alerts')}
@@ -408,11 +409,11 @@ export default function GlobalStatusBar({ onOpenPalette }) {
<span>{t('app.statusbar.alerts', 'Alerts')}</span>
{unreadCount > 0 && <span className="global-statusbar__muted mono">{unreadCount}</span>}
{unreadCount > 0 && <span className="global-statusbar__pip is-critical" aria-hidden="true" />}
- </button>
+ </SharedButton>
<span className="global-statusbar__separator" aria-hidden="true" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`global-statusbar__segment${activeTab === 'assistant' ? ' is-active' : ''}`}
onClick={() => toggleTab('assistant')}
@@ -422,11 +423,11 @@ export default function GlobalStatusBar({ onOpenPalette }) {
<Sparkles size={13} />
<span>{t('app.ai.assistant', 'Assistant')}</span>
{assistantUnread > 0 && <span className="global-statusbar__muted mono">{assistantUnread}</span>}
- </button>
+ </SharedButton>
<span className="global-statusbar__separator" aria-hidden="true" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className="global-statusbar__segment global-statusbar__command"
onClick={onOpenPalette}
@@ -435,7 +436,7 @@ export default function GlobalStatusBar({ onOpenPalette }) {
>
<Command size={12} />
<span className="mono">{t('app.statusbar.commandShortcut', 'Ctrl K')}</span>
- </button>
+ </SharedButton>
</footer>
</>
);
diff --git a/frontend/src/components/JournalControls.jsx b/frontend/src/components/JournalControls.jsx
index fde51af8..62b2d610 100644
--- a/frontend/src/components/JournalControls.jsx
+++ b/frontend/src/components/JournalControls.jsx
@@ -46,13 +46,13 @@ export function JournalControls({
{showQuickUnits && quickUnits.length > 0 && (
<div className="quick-units">
{quickUnits.map(u => (
- <button type="button"
+ <Button variant="unstyled" type="button"
key={u}
className={`unit-chip ${unit === u ? 'active' : ''}`}
onClick={() => onUnitChange?.(unit === u ? '' : u)}
>
{u}
- </button>
+ </Button>
))}
</div>
)}
diff --git a/frontend/src/components/LinkAppModal.jsx b/frontend/src/components/LinkAppModal.jsx
index 895369c9..1225257e 100644
--- a/frontend/src/components/LinkAppModal.jsx
+++ b/frontend/src/components/LinkAppModal.jsx
@@ -1,8 +1,9 @@
-import { useState, useEffect } from 'react';
-import { X, Link2, GitBranch, AlertCircle, Check } from 'lucide-react';
+import { useCallback, useState, useEffect } from 'react';
+import { GitBranch, AlertCircle, Check } from 'lucide-react';
import api from '../services/api';
import Modal from './Modal';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const LinkAppModal = ({ app, onClose, onLinked }) => {
const { t } = useTranslation();
@@ -16,11 +17,7 @@ const LinkAppModal = ({ app, onClose, onLinked }) => {
const [tablePrefix, setTablePrefix] = useState('');
const [propagateCredentials, setPropagateCredentials] = useState(true);
- useEffect(() => {
- loadCompatibleApps();
- }, [app]);
-
- async function loadCompatibleApps() {
+ const loadCompatibleApps = useCallback(async () => {
try {
const data = await api.getApps();
// Filter to same type, not already linked, not self
@@ -31,12 +28,17 @@ const LinkAppModal = ({ app, onClose, onLinked }) => {
a.environment_type === 'standalone'
);
setApps(compatible);
- } catch (err) {
+ } catch {
setError('Failed to load applications');
} finally {
setLoading(false);
}
- }
+ }, [app.id, app.app_type]);
+
+ useEffect(() => {
+ loadCompatibleApps();
+ }, [loadCompatibleApps]);
+
async function handleLink(e) {
e.preventDefault();
@@ -64,11 +66,6 @@ const LinkAppModal = ({ app, onClose, onLinked }) => {
const selectedApp = apps.find(a => a.id === parseInt(selectedAppId));
- const envDescriptions = {
- development: 'This app will be the DEVELOPMENT environment',
- production: 'This app will be the PRODUCTION environment',
- staging: 'This app will be the STAGING environment'
- };
return (
<Modal open={true} onClose={onClose} title={t('app.linkAppModal.linkApplication', 'Link Application')} className="link-app-modal">
@@ -88,9 +85,9 @@ const LinkAppModal = ({ app, onClose, onLinked }) => {
<p>
{t('app.linkAppModal.thereAreNoOther', 'There are no other')} {app.app_type} {t('app.linkAppModal.applicationsAvailableToLinkCreateAnother', 'applications available to link. Create another')} {app.app_type} {t('app.linkAppModal.appFirstOrEnsureExistingApps', 'app first, or ensure existing apps are not already linked.')}
</p>
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <SharedButton variant="outline" type="button" className="btn btn-secondary" onClick={onClose}>
{t('common.actions.close', 'Close')}
- </button>
+ </SharedButton>
</div>
) : (
<form onSubmit={handleLink}>
@@ -195,10 +192,10 @@ const LinkAppModal = ({ app, onClose, onLinked }) => {
)}
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <SharedButton variant="outline" type="button" className="btn btn-secondary" onClick={onClose}>
{t('common.actions.cancel', 'Cancel')}
- </button>
- <button type="submit" className="btn btn-primary" disabled={linking || !selectedAppId}>
+ </SharedButton>
+ <SharedButton variant="primary" type="submit" className="btn btn-primary" disabled={linking || !selectedAppId}>
{linking ? (
<>{t('app.linkAppModal.linking', 'Linking…')}</>
) : (
@@ -207,7 +204,7 @@ const LinkAppModal = ({ app, onClose, onLinked }) => {
{t('app.linkAppModal.linkApps', 'Link Apps')}
</>
)}
- </button>
+ </SharedButton>
</div>
</form>
)}
diff --git a/frontend/src/components/LinkedAppsSection.jsx b/frontend/src/components/LinkedAppsSection.jsx
index 4520e9fc..99bce2d4 100644
--- a/frontend/src/components/LinkedAppsSection.jsx
+++ b/frontend/src/components/LinkedAppsSection.jsx
@@ -1,5 +1,7 @@
import { GitBranch, Link2, Unlink, ExternalLink, Server } from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
+import { Card as SharedCard } from '@/components/ui/card';
const LinkedAppsSection = ({
app,
@@ -33,21 +35,21 @@ const LinkedAppsSection = ({
};
return (
- <div className="card linked-apps-section">
+ <SharedCard variant="legacy" className="card linked-apps-section">
<div className="linked-apps-header">
<h3>
<GitBranch size={18} />
{t('app.linkedAppsSection.environmentLinking', 'Environment Linking')}
</h3>
{!app.has_linked_app && (
- <button type="button"
+ <SharedButton variant="outline" type="button"
className="btn btn-secondary btn-sm"
onClick={onLink}
disabled={loading}
>
<Link2 size={14} />
{t('app.linkedAppsSection.linkApp', 'Link App')}
- </button>
+ </SharedButton>
)}
</div>
@@ -89,21 +91,21 @@ const LinkedAppsSection = ({
</div>
</div>
<div className="linked-app-actions">
- <button type="button"
+ <SharedButton variant="outline" type="button"
className="btn btn-secondary btn-sm btn-icon"
onClick={() => onNavigate(linkedApp.id)}
title={t('app.linkedAppsSection.viewApp', 'View app')}
>
<ExternalLink size={14} />
- </button>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="outline" type="button"
className="btn btn-secondary btn-sm btn-icon"
onClick={onUnlink}
disabled={loading}
title={t('app.linkedAppsSection.unlinkApps', 'Unlink apps')}
>
<Unlink size={14} />
- </button>
+ </SharedButton>
</div>
</div>
))}
@@ -111,14 +113,14 @@ const LinkedAppsSection = ({
) : app.environment_type !== 'standalone' ? (
<div className="linked-apps-empty">
<p>{t('app.linkedAppsSection.noLinkedAppsLinkAnotherApp', 'No linked apps. Link another app to share database resources.')}</p>
- <button type="button"
+ <SharedButton variant="outline" type="button"
className="btn btn-secondary btn-sm"
onClick={onLink}
disabled={loading}
>
<Link2 size={14} />
{t('app.linkedAppsSection.linkApp', 'Link App')}
- </button>
+ </SharedButton>
</div>
) : (
<div className="linked-apps-info">
@@ -144,7 +146,7 @@ const LinkedAppsSection = ({
</div>
)}
</div>
- </div>
+ </SharedCard>
);
};
diff --git a/frontend/src/components/LocaleSync.jsx b/frontend/src/components/LocaleSync.jsx
index 94dd2098..e3ffdbf1 100644
--- a/frontend/src/components/LocaleSync.jsx
+++ b/frontend/src/components/LocaleSync.jsx
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
-import { useAuth } from '../contexts/AuthContext';
-import { useLocale } from '../contexts/LocaleContext';
+import { useAuth } from '../contexts/useAuth.js';
+import { useLocale } from '../contexts/useLocale.js';
import api from '../services/api';
// Bridges auth -> locale (plan 79 B1/B2). LocaleProvider sits above
diff --git a/frontend/src/components/MetricsGraph.jsx b/frontend/src/components/MetricsGraph.jsx
index 9da81e09..e5e45aa8 100644
--- a/frontend/src/components/MetricsGraph.jsx
+++ b/frontend/src/components/MetricsGraph.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect, useMemo } from 'react';
+import { useCallback, useState, useEffect, useMemo } from 'react';
import {
XAxis, YAxis, CartesianGrid,
Tooltip, ResponsiveContainer, Area, AreaChart
@@ -6,6 +6,7 @@ import {
import { Cpu, MemoryStick, HardDrive, TrendingUp } from 'lucide-react';
import api from '../services/api';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Chart series colors — redesign "infra console" palette (see
// docs/REDESIGN_MAP.md). Kept as hex (not CSS var()) on purpose: var() does not
@@ -53,11 +54,7 @@ const MetricsGraph = ({ compact = false, timezone, serverId }) => {
}));
};
- useEffect(() => {
- loadHistory();
- }, [period, serverId]);
-
- async function loadHistory() {
+ const loadHistory = useCallback(async () => {
try {
setLoading(true);
const response = serverId
@@ -70,26 +67,33 @@ const MetricsGraph = ({ compact = false, timezone, serverId }) => {
} finally {
setLoading(false);
}
- }
+ }, [period, serverId]);
- function formatTimestamp(isoString) {
- const date = new Date(isoString);
- const tz = safeTimeZone(timezone);
- if (period === '1h' || period === '6h' || period === '24h') {
- return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', timeZone: tz });
- } else if (period === '7d') {
- return date.toLocaleDateString([], { weekday: 'short', hour: '2-digit', timeZone: tz });
- } else {
- return date.toLocaleDateString([], { month: 'short', day: 'numeric', timeZone: tz });
+ useEffect(() => {
+ loadHistory();
+ }, [loadHistory]);
+
+
+ const chartData = useMemo(() => {
+ function formatTimestamp(isoString) {
+ const date = new Date(isoString);
+ const tz = safeTimeZone(timezone);
+ if (period === '1h' || period === '6h' || period === '24h') {
+ return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', timeZone: tz });
+ } else if (period === '7d') {
+ return date.toLocaleDateString([], { weekday: 'short', hour: '2-digit', timeZone: tz });
+ } else {
+ return date.toLocaleDateString([], { month: 'short', day: 'numeric', timeZone: tz });
+ }
}
- }
- const chartData = data?.data?.map(point => ({
- time: formatTimestamp(point.timestamp),
- cpu: point.cpu?.percent ?? point.cpu_percent ?? 0,
- memory: point.memory?.percent ?? point.memory_percent ?? 0,
- disk: point.disk?.percent ?? point.disk_percent ?? 0
- })) || [];
+ return data?.data?.map(point => ({
+ time: formatTimestamp(point.timestamp),
+ cpu: point.cpu?.percent ?? point.cpu_percent ?? 0,
+ memory: point.memory?.percent ?? point.memory_percent ?? 0,
+ disk: point.disk?.percent ?? point.disk_percent ?? 0
+ })) || [];
+ }, [data, timezone, period]);
// Auto-zoom: compute Y-axis ceiling from visible metrics
const yDomain = useMemo(() => {
@@ -171,13 +175,13 @@ const MetricsGraph = ({ compact = false, timezone, serverId }) => {
</div>
<div className="period-selector">
{periods.map(p => (
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
key={p}
className={`period-btn ${period === p ? 'active' : ''}`}
onClick={() => setPeriod(p)}
>
{p}
- </button>
+ </SharedButton>
))}
</div>
</div>
@@ -229,34 +233,34 @@ const MetricsGraph = ({ compact = false, timezone, serverId }) => {
<span>{t('app.metricsGraph.realTimePerformance', 'Real-time Performance')}</span>
</div>
<div className="metrics-filter-legend">
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className={`filter-btn cpu ${visibleMetrics.cpu ? 'active' : ''}`}
onClick={() => toggleMetric('cpu')}
>
CPU
- </button>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button"
className={`filter-btn memory ${visibleMetrics.memory ? 'active' : ''}`}
onClick={() => toggleMetric('memory')}
>
RAM
- </button>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button"
className={`filter-btn disk ${visibleMetrics.disk ? 'active' : ''}`}
onClick={() => toggleMetric('disk')}
>
{t('common.labels.disk', 'Disk')}
- </button>
+ </SharedButton>
</div>
<div className="period-selector">
{periods.map(p => (
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
key={p}
className={`period-btn ${period === p ? 'active' : ''}`}
onClick={() => setPeriod(p)}
>
{p}
- </button>
+ </SharedButton>
))}
</div>
</div>
diff --git a/frontend/src/components/MobileTopBar.jsx b/frontend/src/components/MobileTopBar.jsx
index 761ec575..a27f344c 100644
--- a/frontend/src/components/MobileTopBar.jsx
+++ b/frontend/src/components/MobileTopBar.jsx
@@ -1,9 +1,10 @@
import { Menu, X } from 'lucide-react';
import { t } from '../i18n/t';
-import { useTheme } from '../contexts/ThemeContext';
+import { useTheme } from '../contexts/useTheme.js';
import ServerKitLogo from './ServerKitLogo';
import NotificationBell from './NotificationBell';
import QuickCreate from './QuickCreate';
+import { Button as SharedButton } from '@/components/ui/button';
// Fixed header shown only on narrow viewports (< 768px). Houses the
// hamburger toggle that opens the sidebar as an off-canvas drawer, since
@@ -16,7 +17,7 @@ const MobileTopBar = ({ navOpen, onToggle }) => {
return (
<header className="mobile-topbar">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="mobile-topbar__toggle"
aria-label={navOpen
@@ -27,7 +28,7 @@ const MobileTopBar = ({ navOpen, onToggle }) => {
onClick={onToggle}
>
{navOpen ? <X size={22} aria-hidden="true" /> : <Menu size={22} aria-hidden="true" />}
- </button>
+ </SharedButton>
<div className="mobile-topbar__brand">
{!branded && (
<span className="mobile-topbar__logo">
diff --git a/frontend/src/components/NotificationBell.jsx b/frontend/src/components/NotificationBell.jsx
index 489ae45c..d98f3f48 100644
--- a/frontend/src/components/NotificationBell.jsx
+++ b/frontend/src/components/NotificationBell.jsx
@@ -1,9 +1,10 @@
import { useState, useRef, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { Bell, Check, X } from 'lucide-react';
-import { useNotifications } from '../contexts/NotificationsContext';
+import { useNotifications } from '../contexts/useNotifications.js';
import { timeAgo } from '../utils/time';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Severity → dot color, mirroring the email/brand palette.
const SEVERITY_DOT = {
@@ -65,7 +66,7 @@ export default function NotificationBell() {
return (
<div className="sk-notif" ref={ref}>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-notif__bell"
onClick={toggle}
@@ -77,16 +78,16 @@ export default function NotificationBell() {
>
<Bell size={16} aria-hidden="true" />
{unreadCount > 0 && <span className="sk-notif__badge">{badge}</span>}
- </button>
+ </SharedButton>
{open && (
<div className="sk-notif__panel" role="menu" aria-label={t('notifications.bell', 'Notifications')}>
<div className="sk-notif__head">
<span className="sk-notif__heading">{t('notifications.heading', 'Notifications')}</span>
{unreadCount > 0 && (
- <button type="button" className="sk-notif__markall" onClick={markAllRead}>
+ <SharedButton variant="unstyled" type="button" className="sk-notif__markall" onClick={markAllRead}>
<Check size={13} aria-hidden="true" /> {t('notifications.markAllRead', 'Mark all read')}
- </button>
+ </SharedButton>
)}
</div>
@@ -97,7 +98,7 @@ export default function NotificationBell() {
items.map((item) => (
item.kind === 'notice' ? (
<div key={item.delivery_id} className="sk-notif__item is-notice">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-notif__hit"
onClick={() => onItemClick(item)}
@@ -114,18 +115,18 @@ export default function NotificationBell() {
<span className="sk-notif__time">{item.action_label} →</span>
)}
</span>
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className="sk-notif__dismiss"
onClick={() => dismissNotice && dismissNotice(item.notice_id)}
aria-label={t('notifications.dismissItem', 'Dismiss {{title}}', { title: item.title })}
>
<X size={14} aria-hidden="true" />
- </button>
+ </SharedButton>
</div>
) : (
- <button
+ <SharedButton variant="unstyled"
key={item.delivery_id}
type="button"
className={`sk-notif__item${item.read ? '' : ' is-unread'}`}
@@ -144,19 +145,19 @@ export default function NotificationBell() {
{item.action_path && <span className="sk-notif__cta"> · {item.action_label || 'Open'} →</span>}
</span>
</span>
- </button>
+ </SharedButton>
)
))
)}
</div>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-notif__seeall"
onClick={() => { setOpen(false); navigate('/notifications'); }}
>
{t('notifications.seeAll', 'See all notifications')}
- </button>
+ </SharedButton>
</div>
)}
</div>
diff --git a/frontend/src/components/OperationsDock.jsx b/frontend/src/components/OperationsDock.jsx
index 85ebf3a5..0e368bb4 100644
--- a/frontend/src/components/OperationsDock.jsx
+++ b/frontend/src/components/OperationsDock.jsx
@@ -17,8 +17,8 @@ import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { useOperations } from '../contexts/OperationsContext';
-import { useShellDock } from '../contexts/ShellDockContext';
-import { useToast } from '../contexts/ToastContext';
+import { useShellDock } from '../contexts/useShellDock.js';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import { usePolling } from '../hooks/usePolling';
import { useShortcut } from '../hooks/useShortcut';
diff --git a/frontend/src/components/PrivateURLSection.jsx b/frontend/src/components/PrivateURLSection.jsx
index d8d56f08..5bd4c0e7 100644
--- a/frontend/src/components/PrivateURLSection.jsx
+++ b/frontend/src/components/PrivateURLSection.jsx
@@ -1,9 +1,10 @@
import { useState } from 'react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import { useClipboard } from '../hooks/useClipboard';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const PrivateURLSection = ({ app, onUpdate }) => {
const { t } = useTranslation();
@@ -128,13 +129,13 @@ const PrivateURLSection = ({ app, onUpdate }) => {
maxLength={50}
/>
</div>
- <button
+ <SharedButton variant="primary"
type="submit"
className="btn btn-primary"
disabled={loading}
>
{loading ? 'Enabling...' : 'Enable Private URL'}
- </button>
+ </SharedButton>
</form>
<p className="slug-hint">
{t('app.privateURLSection.leaveEmptyToAutoGenerateA', 'Leave empty to auto-generate a random slug, or enter your own custom slug.')}
@@ -148,7 +149,7 @@ const PrivateURLSection = ({ app, onUpdate }) => {
<code className="url-value">{privateUrl}</code>
</div>
<div className="url-actions">
- <button type="button"
+ <SharedButton variant="outline" type="button"
className="btn btn-secondary btn-sm"
onClick={copyToClipboard}
title={t('app.privateURLSection.copyToClipboard', 'Copy to clipboard')}
@@ -158,8 +159,8 @@ const PrivateURLSection = ({ app, onUpdate }) => {
<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>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="outline" type="button"
className="btn btn-secondary btn-sm"
onClick={handleRegenerate}
disabled={loading}
@@ -171,7 +172,7 @@ const PrivateURLSection = ({ app, onUpdate }) => {
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" />
</svg>
{t('app.privateURLSection.regenerate', 'Regenerate')}
- </button>
+ </SharedButton>
</div>
</div>
@@ -190,14 +191,14 @@ const PrivateURLSection = ({ app, onUpdate }) => {
autoFocus
/>
</div>
- <button
+ <SharedButton variant="primary"
type="submit"
className="btn btn-primary btn-sm"
disabled={loading || !customSlug}
>
{t('common.actions.save', 'Save')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="outline"
type="button"
className="btn btn-secondary btn-sm"
onClick={() => {
@@ -206,25 +207,25 @@ const PrivateURLSection = ({ app, onUpdate }) => {
}}
>
{t('common.actions.cancel', 'Cancel')}
- </button>
+ </SharedButton>
</form>
) : (
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className="btn-link"
onClick={() => setEditMode(true)}
>
{t('app.privateURLSection.changeSlug', 'Change slug')}
- </button>
+ </SharedButton>
)}
<div className="private-url-footer">
- <button type="button"
+ <SharedButton variant="danger" type="button"
className="btn btn-danger btn-sm"
onClick={handleDisable}
disabled={loading}
>
{t('app.privateURLSection.disablePrivateUrl3', 'Disable Private URL')}
- </button>
+ </SharedButton>
</div>
</div>
)}
diff --git a/frontend/src/components/ProcessTable.jsx b/frontend/src/components/ProcessTable.jsx
index 80fec523..41e575f3 100644
--- a/frontend/src/components/ProcessTable.jsx
+++ b/frontend/src/components/ProcessTable.jsx
@@ -1,3 +1,4 @@
+import { procUser } from './processData';
import { useCallback, useMemo, useState } from 'react';
import { processStateVariant } from '@/components/ds/status';
import { X, AlertTriangle } from 'lucide-react';
@@ -78,7 +79,6 @@ const PROCESS_VIEWS = [
// psutil reports the owner as `username`; the per-PID detail endpoint and the
// style-guide fixtures call it `user`. Read both so the column is never blank
// against a real payload.
-export const procUser = (p) => p.user || p.username || '';
export function UsageCell({ percent = 0, variant = 'cpu', label }) {
const clamped = Math.min(Number(percent) || 0, 100);
diff --git a/frontend/src/components/QuickCreate.jsx b/frontend/src/components/QuickCreate.jsx
index c15fc952..f2ef548b 100644
--- a/frontend/src/components/QuickCreate.jsx
+++ b/frontend/src/components/QuickCreate.jsx
@@ -1,6 +1,7 @@
import { Plus } from 'lucide-react';
import { cn } from '@/lib/utils';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Global quick-create (the "+" button beside the brand). It used to carry its
// own little dropdown; now it opens the command palette, whose empty state
@@ -13,7 +14,7 @@ export function QuickCreate({ className, variant = 'icon' }) {
// create button beside the ServerKit mark and GitHub star.
const header = variant === 'header';
return (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={cn('quick-create', header && 'quick-create--header', className)}
title={t('app.quickCreate.createOrSearch', 'Create or search — Ctrl K')}
@@ -21,7 +22,7 @@ export function QuickCreate({ className, variant = 'icon' }) {
onClick={() => window.dispatchEvent(new CustomEvent('serverkit:open-palette'))}
>
<Plus size={header ? 15 : 16} />
- </button>
+ </SharedButton>
);
}
diff --git a/frontend/src/components/RemoteTerminal.jsx b/frontend/src/components/RemoteTerminal.jsx
index 33953592..806c77dd 100644
--- a/frontend/src/components/RemoteTerminal.jsx
+++ b/frontend/src/components/RemoteTerminal.jsx
@@ -6,6 +6,7 @@ import '@xterm/xterm/css/xterm.css';
import api from '../services/api';
import socketService from '../services/socket';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
/**
* RemoteTerminal - Interactive terminal component for remote server access
@@ -261,7 +262,7 @@ export default function RemoteTerminal({ serverId, onClose }) {
{sessionId && <span className="session-id">{sessionId}</span>}
</div>
<div className="terminal-actions">
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className="terminal-close-btn"
onClick={handleClose}
title={t('app.remoteTerminal.closeTerminal', 'Close terminal')}
@@ -269,7 +270,7 @@ export default function RemoteTerminal({ serverId, onClose }) {
<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
</svg>
- </button>
+ </SharedButton>
</div>
</div>
<div
diff --git a/frontend/src/components/RequiresDocker.jsx b/frontend/src/components/RequiresDocker.jsx
index 309a7a80..a1b00b2d 100644
--- a/frontend/src/components/RequiresDocker.jsx
+++ b/frontend/src/components/RequiresDocker.jsx
@@ -1,6 +1,6 @@
import { Link } from 'react-router-dom';
import { Boxes, Terminal } from 'lucide-react';
-import { useResourceTier } from '../contexts/ResourceTierContext';
+import { useResourceTier } from '../contexts/useResourceTier.js';
import { useTranslation } from 'react-i18next';
/**
diff --git a/frontend/src/components/ResourceAdvisory.jsx b/frontend/src/components/ResourceAdvisory.jsx
index 615cf738..08a76a0a 100644
--- a/frontend/src/components/ResourceAdvisory.jsx
+++ b/frontend/src/components/ResourceAdvisory.jsx
@@ -1,5 +1,5 @@
import { AlertTriangle } from 'lucide-react';
-import { useResourceTier } from '../contexts/ResourceTierContext';
+import { useResourceTier } from '../contexts/useResourceTier.js';
import { useTranslation } from 'react-i18next';
// Approximate steady-state RSS per workload, mirroring WORKLOAD_FOOTPRINTS_MB
diff --git a/frontend/src/components/SchedulePicker.jsx b/frontend/src/components/SchedulePicker.jsx
index dfdbc7e4..3e3563dc 100644
--- a/frontend/src/components/SchedulePicker.jsx
+++ b/frontend/src/components/SchedulePicker.jsx
@@ -3,6 +3,7 @@ import { Check, AlertTriangle } from 'lucide-react';
import { SegControl } from '@/components/ds';
import { Input } from '@/components/ui/input';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// SchedulePicker — one friendly cron schedule picker shared by CronJobs, the
// Backups ScheduleCard, the server-detail Cron tab, and extensions (via the SDK).
@@ -258,7 +259,7 @@ export default function SchedulePicker({ value = '', onChange, compact = false,
{mode === 'presets' && (
<div className="schedule-picker__presets">
{presets.map((p) => (
- <button
+ <SharedButton variant="unstyled"
key={p.cron}
type="button"
className={`schedule-picker__preset${value.trim() === p.cron ? ' is-active' : ''}`}
@@ -266,7 +267,7 @@ export default function SchedulePicker({ value = '', onChange, compact = false,
>
<span className="schedule-picker__preset-label">{p.label}</span>
<span className="schedule-picker__preset-desc">{p.desc}</span>
- </button>
+ </SharedButton>
))}
</div>
)}
@@ -332,14 +333,14 @@ export default function SchedulePicker({ value = '', onChange, compact = false,
<label>{t('app.schedulePicker.onDays', 'On days')}</label>
<div className="schedule-picker__days">
{WEEKDAYS.map((name, d) => (
- <button
+ <SharedButton variant="unstyled"
key={name}
type="button"
className={`schedule-picker__day${builder.weekdays.includes(d) ? ' is-active' : ''}`}
onClick={() => toggleWeekday(d)}
>
{name}
- </button>
+ </SharedButton>
))}
</div>
</div>
diff --git a/frontend/src/components/ScheduledTasksCard.jsx b/frontend/src/components/ScheduledTasksCard.jsx
index feebdf05..06294019 100644
--- a/frontend/src/components/ScheduledTasksCard.jsx
+++ b/frontend/src/components/ScheduledTasksCard.jsx
@@ -3,6 +3,7 @@ import { Clock, CheckCircle2, AlertCircle, History } from 'lucide-react';
import api from '../services/api';
import { Pill, Drawer } from '@/components/ds';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Read-only summary of an app's scheduled (cron) jobs. Rendered on the service
// detail and WordPress detail Overview tabs. The backend endpoint is
@@ -74,14 +75,14 @@ const ScheduledTasksCard = ({ appId }) => {
<div className="scheduled-tasks-card__meta">
<span className="scheduled-tasks-card__next">{formatWhen(job.next_run)}</span>
<StatusHint job={job} />
- <button
+ <SharedButton variant="unstyled"
type="button"
className="scheduled-tasks-card__runs-btn"
onClick={() => openRuns(job)}
title={t('app.scheduledTasksCard.viewRecentRuns', 'View recent runs')}
>
<History size={13} />
- </button>
+ </SharedButton>
<Pill kind={job.enabled ? 'green' : 'gray'}>
{job.enabled ? 'Enabled' : 'Disabled'}
</Pill>
diff --git a/frontend/src/components/ShellDockTabs.jsx b/frontend/src/components/ShellDockTabs.jsx
index 564abb15..817271ce 100644
--- a/frontend/src/components/ShellDockTabs.jsx
+++ b/frontend/src/components/ShellDockTabs.jsx
@@ -1,11 +1,12 @@
import { Maximize2, Minimize2, X } from 'lucide-react';
import { useTranslation } from 'react-i18next';
-import { useNotifications } from '../contexts/NotificationsContext';
+import { useNotifications } from '../contexts/useNotifications.js';
import { useOperations } from '../contexts/OperationsContext';
-import { useServerkitAI } from '../contexts/AIContext';
-import { useShellDock } from '../contexts/ShellDockContext';
+import { useServerkitAI } from '../contexts/useServerkitAI.js';
+import { useShellDock } from '../contexts/useShellDock.js';
import { useWalkthroughs } from '../contexts/walkthroughContextValue';
+import { Button as SharedButton } from '@/components/ui/button';
// Shared header strip for every shell console panel. Wherever a panel opens
// (Operations, Alerts, Recipes bottom console; Assistant right drawer), the
@@ -38,7 +39,7 @@ export default function ShellDockTabs({ controls = null, expandable = true }) {
return (
<div className="shell-dock-tabs" role="tablist" aria-label={t('app.statusbar.consolePanels', 'Console panels')}>
{tabs.map((tab) => (
- <button
+ <SharedButton variant="unstyled"
key={tab.id}
type="button"
role="tab"
@@ -48,12 +49,12 @@ export default function ShellDockTabs({ controls = null, expandable = true }) {
>
{tab.label}
{tab.badge ? <span className="shell-dock-tabs__badge mono">{tab.badge}</span> : null}
- </button>
+ </SharedButton>
))}
<span className="shell-dock-tabs__spacer" />
{controls}
{expandable && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="shell-dock-tabs__control"
onClick={() => setExpanded(!expanded)}
@@ -66,9 +67,9 @@ export default function ShellDockTabs({ controls = null, expandable = true }) {
: t('app.statusbar.expandPanel', 'Expand panel')}
>
{expanded ? <Minimize2 size={14} /> : <Maximize2 size={14} />}
- </button>
+ </SharedButton>
)}
- <button
+ <SharedButton variant="unstyled"
type="button"
className="shell-dock-tabs__control"
onClick={close}
@@ -76,7 +77,7 @@ export default function ShellDockTabs({ controls = null, expandable = true }) {
title={t('app.statusbar.closeEsc', 'Close (Esc)')}
>
<X size={15} />
- </button>
+ </SharedButton>
</div>
);
}
diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx
index c2443de4..26b12694 100644
--- a/frontend/src/components/Sidebar.jsx
+++ b/frontend/src/components/Sidebar.jsx
@@ -1,9 +1,9 @@
import React, { useState, useEffect, useRef, useMemo } from 'react';
import { NavLink, useNavigate, useLocation } from 'react-router-dom';
-import { useAuth } from '../contexts/AuthContext';
-import { useTheme } from '../contexts/ThemeContext';
-import { useLayout } from '../contexts/LayoutContext';
-import { Star, Settings, LogOut, Sun, Moon, Monitor, ChevronRight, ChevronDown, ChevronUp, Layers, Palette, PanelLeft, PanelLeftClose, PanelTop, Check, X, Server } from 'lucide-react';
+import { useAuth } from '../contexts/useAuth.js';
+import { useTheme } from '../contexts/useTheme.js';
+import { useLayout } from '../contexts/useLayout.js';
+import { Star, Settings, LogOut, Sun, Moon, Monitor, ChevronRight, ChevronUp, Layers, Palette, PanelLeft, PanelLeftClose, PanelTop, Check, X, Server } from 'lucide-react';
import { api } from '../services/api';
import { SIDEBAR_CATEGORIES, SIDEBAR_CATEGORY_LABELS, SIDEBAR_PRESETS, getHiddenItemIds, getVisibleItems, applyWorkspaceNavPermissions } from './sidebarItems';
import { useTranslation } from 'react-i18next';
@@ -13,13 +13,14 @@ import { sanitizeSvgInner } from '../utils/sanitizeSvg';
import useModules from '../hooks/useModules';
import useDevMode from '../hooks/useDevMode';
import QuickCreate from './QuickCreate';
-import { useWorkspace } from '../contexts/WorkspaceContext';
+import { useWorkspace } from '../contexts/useWorkspace.js';
+import { Button as SharedButton } from '@/components/ui/button';
const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {} }) => {
const { t } = useTranslation();
const label = useLabel();
const { user, logout, updateUser, hasPermission } = useAuth();
- const { theme, resolvedTheme, setTheme, whiteLabel } = useTheme();
+ const { theme, setTheme, whiteLabel } = useTheme();
const { layout, setLayout } = useLayout();
const { activeWorkspace } = useWorkspace();
const navigate = useNavigate();
@@ -209,7 +210,7 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
// and it defines a nav map. This lets a workspace restrict which sidebar
// items its members see based on their effective workspace role.
return applyWorkspaceNavPermissions(items, activeWorkspace, user);
- }, [user?.sidebar_config, pluginNav, pluginTabs, wpInstalled, gpuAvailable, wordpressEnabled, devMode, user, hasPermission, activeWorkspace]);
+ }, [pluginNav, pluginTabs, wpInstalled, gpuAvailable, wordpressEnabled, devMode, user, hasPermission, activeWorkspace]);
// Group visible items by category
const groupedItems = useMemo(() => {
@@ -269,7 +270,7 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
{label(item)}
</NavLink>
{visibleSubs.length > 0 && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`nav-expand-btn ${isExpanded ? 'expanded' : ''}`}
aria-expanded={isExpanded}
@@ -279,7 +280,7 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
onClick={(e) => { e.stopPropagation(); toggleExpand(item.id); }}
>
<ChevronRight size={14} aria-hidden="true" />
- </button>
+ </SharedButton>
)}
</div>
{isExpanded && visibleSubs.map(sub => (
@@ -307,14 +308,14 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
aria-label={t('nav.mainNavigation', 'Main navigation')}
>
{isMobile && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sidebar__close"
aria-label={t('nav.closeMenu', 'Close navigation menu')}
onClick={onMobileClose}
>
<X size={20} aria-hidden="true" />
- </button>
+ </SharedButton>
)}
{whiteLabel.enabled ? (
<div className="brand-section brand-section--custom">
@@ -442,7 +443,7 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
<div className="context-menu-section">
<div className="context-menu-label" id="theme-switcher-label">{t('nav.theme', 'Theme')}</div>
<div className="theme-switcher" role="group" aria-labelledby="theme-switcher-label">
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`theme-btn ${theme === 'dark' ? 'active' : ''}`}
onClick={() => setTheme('dark')}
@@ -451,8 +452,8 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
title={t('nav.themeDark', 'Dark')}
>
<Moon size={14} aria-hidden="true" />
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className={`theme-btn ${theme === 'light' ? 'active' : ''}`}
onClick={() => setTheme('light')}
@@ -461,8 +462,8 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
title={t('nav.themeLight', 'Light')}
>
<Sun size={14} aria-hidden="true" />
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className={`theme-btn ${theme === 'system' ? 'active' : ''}`}
onClick={() => setTheme('system')}
@@ -471,13 +472,13 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
title={t('nav.themeSystem', 'System')}
>
<Monitor size={14} aria-hidden="true" />
- </button>
+ </SharedButton>
</div>
</div>
<div className="context-menu-section">
<div className="context-menu-label" id="layout-switcher-label">{t('nav.layout', 'Layout')}</div>
<div className="theme-switcher" role="group" aria-labelledby="layout-switcher-label">
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`theme-btn ${layout === 'sidebar' ? 'active' : ''}`}
onClick={() => setLayout('sidebar')}
@@ -486,8 +487,8 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
title={t('nav.layoutSidebar', 'Sidebar')}
>
<PanelLeft size={14} aria-hidden="true" />
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className={`theme-btn ${layout === 'rail' ? 'active' : ''}`}
onClick={() => setLayout('rail')}
@@ -496,8 +497,8 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
title={t('nav.layoutCompact', 'Compact')}
>
<PanelLeftClose size={14} aria-hidden="true" />
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className={`theme-btn ${layout === 'topbar' ? 'active' : ''}`}
onClick={() => setLayout('topbar')}
@@ -506,14 +507,14 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
title={t('nav.layoutTopbar', 'Top bar')}
>
<PanelTop size={14} aria-hidden="true" />
- </button>
+ </SharedButton>
</div>
</div>
<div className="context-menu-section">
<div className="context-menu-label" id="sidebar-view-label">{t('nav.sidebarView', 'Sidebar View')}</div>
<div className="view-switcher" role="group" aria-labelledby="sidebar-view-label">
{Object.entries(SIDEBAR_PRESETS).map(([key, preset]) => (
- <button
+ <SharedButton variant="unstyled"
key={key}
type="button"
className={`view-btn ${currentPreset === key ? 'active' : ''}`}
@@ -523,12 +524,12 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
>
{label(preset)}
{currentPreset === key && <Check size={10} aria-hidden="true" />}
- </button>
+ </SharedButton>
))}
</div>
</div>
<div className="context-menu-divider" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className="context-menu-item"
onClick={() => { navigate('/settings/appearance'); setMenuOpen(false); }}
@@ -536,8 +537,8 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
<Palette size={15} aria-hidden="true" />
{t('nav.appearance', 'Appearance')}
<ChevronRight size={14} className="context-menu-arrow" aria-hidden="true" />
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className="context-menu-item"
onClick={() => { navigate('/settings/sidebar'); setMenuOpen(false); }}
@@ -545,8 +546,8 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
<PanelLeft size={15} aria-hidden="true" />
{t('nav.customizeSidebar', 'Customize Sidebar')}
<ChevronRight size={14} className="context-menu-arrow" aria-hidden="true" />
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className="context-menu-item"
onClick={() => { navigate('/settings'); setMenuOpen(false); }}
@@ -554,16 +555,16 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
<Settings size={15} aria-hidden="true" />
{t('nav.allSettings', 'All Settings')}
<ChevronRight size={14} className="context-menu-arrow" aria-hidden="true" />
- </button>
+ </SharedButton>
<div className="context-menu-divider" />
- <button type="button" className="context-menu-item danger" onClick={logout}>
+ <SharedButton variant="unstyled" type="button" className="context-menu-item danger" onClick={logout}>
<LogOut size={15} aria-hidden="true" />
{t('common.actions.logOut', 'Log out')}
- </button>
+ </SharedButton>
</div>
)}
<div className="sidebar-footer__row">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="user-mini"
onClick={() => setMenuOpen(!menuOpen)}
@@ -579,7 +580,7 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
<span className="user-status">{t('nav.online', 'Online')}</span>
</span>
<ChevronUp size={14} className={`user-menu-arrow ${menuOpen ? 'open' : ''}`} aria-hidden="true" />
- </button>
+ </SharedButton>
</div>
</div>
</aside>
diff --git a/frontend/src/components/SystemNotices.jsx b/frontend/src/components/SystemNotices.jsx
index 12c69776..b037dde2 100644
--- a/frontend/src/components/SystemNotices.jsx
+++ b/frontend/src/components/SystemNotices.jsx
@@ -82,14 +82,14 @@ export default function SystemNotices() {
<Settings size={13} />
)}
</Button>
- <button
+ <Button variant="unstyled"
type="button"
className="system-notice__dismiss"
onClick={() => handleDismiss(notice.id)}
aria-label={t('app.systemNotices.dismiss', 'Dismiss {{title}}', { title: notice.title })}
>
<X size={16} />
- </button>
+ </Button>
</div>
</div>
</div>
diff --git a/frontend/src/components/ThemeSync.jsx b/frontend/src/components/ThemeSync.jsx
index 19113eeb..12fd8c3d 100644
--- a/frontend/src/components/ThemeSync.jsx
+++ b/frontend/src/components/ThemeSync.jsx
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
-import { useAuth } from '../contexts/AuthContext';
-import { useTheme } from '../contexts/ThemeContext';
+import { useAuth } from '../contexts/useAuth.js';
+import { useTheme } from '../contexts/useTheme.js';
import api from '../services/api';
// Bridges auth → theme (plan 60). ThemeProvider sits above AuthProvider, so it
diff --git a/frontend/src/components/WalkthroughHub.jsx b/frontend/src/components/WalkthroughHub.jsx
index 10090f69..eb7d6c10 100644
--- a/frontend/src/components/WalkthroughHub.jsx
+++ b/frontend/src/components/WalkthroughHub.jsx
@@ -17,7 +17,7 @@ import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
-import { useShellDock } from '../contexts/ShellDockContext';
+import { useShellDock } from '../contexts/useShellDock.js';
import { useWalkthroughs } from '../contexts/walkthroughContextValue';
import { getWalkthroughProgress } from '../services/walkthroughState';
import Pill from './ds/Pill';
@@ -59,7 +59,7 @@ function RecipeLibrary({ walkthroughs, state, onStart, onStop, t }) {
const completed = status === 'completed';
return (
<div key={walkthrough.id} className={`shell-recipes__card${active ? ' is-active' : ''}`}>
- <button
+ <Button variant="unstyled"
type="button"
className="shell-recipes__card-hit"
onClick={() => onStart(walkthrough.id)}
@@ -67,7 +67,7 @@ function RecipeLibrary({ walkthroughs, state, onStart, onStop, t }) {
<span className={`shell-recipes__card-icon is-${walkthrough.tone}`}><Icon size={16} /></span>
<span className="shell-recipes__card-name">{walkthrough.title}</span>
<span className="shell-recipes__card-desc">{walkthrough.description}</span>
- </button>
+ </Button>
<span className="shell-recipes__card-meta mono">
<Clock3 size={11} aria-hidden="true" />
{t('app.walkthroughs.stepsMeta', '{{count}} steps · {{duration}}', {
@@ -80,20 +80,20 @@ function RecipeLibrary({ walkthroughs, state, onStart, onStop, t }) {
<Pill kind="neutral">{walkthrough.origin.plugin.replace(/^serverkit-/, '')}</Pill>
)}
{active && (
- <button
+ <Button variant="unstyled"
type="button"
className="shell-recipes__card-stop"
onClick={() => onStop(walkthrough.id)}
>
<Square size={10} aria-hidden="true" /> {t('app.walkthroughs.stopShort', 'Stop')}
- </button>
+ </Button>
)}
</span>
</div>
);
})}
{secondary.length > 0 && (
- <button
+ <Button variant="unstyled"
type="button"
className="shell-recipes__more"
onClick={() => setShowMore((current) => !current)}
@@ -110,7 +110,7 @@ function RecipeLibrary({ walkthroughs, state, onStart, onStop, t }) {
: t('app.walkthroughs.moreGuidesCount', '{{count}} optional guides', { count: secondary.length })}
</small>
</span>
- </button>
+ </Button>
)}
</div>
);
@@ -142,7 +142,7 @@ export default function WalkthroughHub() {
setBrowse(false);
}, [activeWalkthrough?.id]);
- const steps = activeWalkthrough?.steps || [];
+ const steps = useMemo(() => activeWalkthrough?.steps || [], [activeWalkthrough?.steps]);
const viewStep = useMemo(() => {
const chosen = steps.find((step) => step.id === viewStepId);
return chosen || currentStep || steps[steps.length - 1] || null;
@@ -221,7 +221,7 @@ export default function WalkthroughHub() {
const done = completedSteps.includes(step.id);
const viewing = viewStep && step.id === viewStep.id;
return (
- <button
+ <Button variant="unstyled"
key={step.id}
type="button"
role="tab"
@@ -233,7 +233,7 @@ export default function WalkthroughHub() {
{done ? <Check size={12} /> : <span className="mono">{index + 1}</span>}
</span>
<span className="shell-recipes__step-title">{step.title}</span>
- </button>
+ </Button>
);
})}
</div>
diff --git a/frontend/src/components/WorkspaceSwitcher.jsx b/frontend/src/components/WorkspaceSwitcher.jsx
index 86a410ee..0d4e50dd 100644
--- a/frontend/src/components/WorkspaceSwitcher.jsx
+++ b/frontend/src/components/WorkspaceSwitcher.jsx
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import { Building2 } from 'lucide-react';
import { api } from '../services/api';
-import { useWorkspace } from '../contexts/WorkspaceContext';
+import { useWorkspace } from '../contexts/useWorkspace.js';
import { useTranslation } from 'react-i18next';
import {
Select,
diff --git a/frontend/src/components/ai/AIAssistant.jsx b/frontend/src/components/ai/AIAssistant.jsx
index 0bd65b4e..7b788c2b 100644
--- a/frontend/src/components/ai/AIAssistant.jsx
+++ b/frontend/src/components/ai/AIAssistant.jsx
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
-import { useAuth } from '../../contexts/AuthContext';
-import { useServerkitAI } from '../../contexts/AIContext';
+import { useAuth } from '../../contexts/useAuth.js';
+import { useServerkitAI } from '../../contexts/useServerkitAI.js';
import ChatBubble from './ChatBubble';
import ChatDrawer from './ChatDrawer';
diff --git a/frontend/src/components/ai/ChatBubble.jsx b/frontend/src/components/ai/ChatBubble.jsx
index 1a9bec72..3b643d98 100644
--- a/frontend/src/components/ai/ChatBubble.jsx
+++ b/frontend/src/components/ai/ChatBubble.jsx
@@ -1,12 +1,13 @@
import { MessageSquare, X } from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Intercom-style launcher. `raised` lifts it above the serverkit-gui FAB on
// server-detail routes so the two don't overlap.
const ChatBubble = ({ open, unread, streaming, raised, onToggle }) => {
const { t } = useTranslation();
return (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={[
'sk-ai-bubble',
@@ -23,7 +24,7 @@ const ChatBubble = ({ open, unread, streaming, raised, onToggle }) => {
>
{open ? <X size={22} /> : <MessageSquare size={22} />}
{!open && unread > 0 ? <span className="sk-ai-bubble__dot" aria-hidden="true" /> : null}
- </button>
+ </SharedButton>
);
};
diff --git a/frontend/src/components/ai/ChatDrawer.jsx b/frontend/src/components/ai/ChatDrawer.jsx
index 96990984..1973074b 100644
--- a/frontend/src/components/ai/ChatDrawer.jsx
+++ b/frontend/src/components/ai/ChatDrawer.jsx
@@ -1,5 +1,5 @@
import { useCallback, useRef, useState } from 'react';
-import { useServerkitAI } from '../../contexts/AIContext';
+import { useServerkitAI } from '../../contexts/useServerkitAI.js';
import useMediaQuery from '../../hooks/useMediaQuery';
import { useLockBodyScroll } from '../../hooks/useLockBodyScroll';
import useFocusTrap from '../../hooks/ai/useFocusTrap';
diff --git a/frontend/src/components/ai/Composer.jsx b/frontend/src/components/ai/Composer.jsx
index e64c4efe..a68d9e2f 100644
--- a/frontend/src/components/ai/Composer.jsx
+++ b/frontend/src/components/ai/Composer.jsx
@@ -1,6 +1,6 @@
import { useRef, useState } from 'react';
import { Paperclip, Send, Square } from 'lucide-react';
-import { useServerkitAI } from '../../contexts/AIContext';
+import { useServerkitAI } from '../../contexts/useServerkitAI.js';
import { useTranslation } from 'react-i18next';
import ResourcePicker from '../ResourcePicker';
import { Button } from '../ui/button';
diff --git a/frontend/src/components/ai/ConfirmActionCard.jsx b/frontend/src/components/ai/ConfirmActionCard.jsx
index 8b39ecef..a133b846 100644
--- a/frontend/src/components/ai/ConfirmActionCard.jsx
+++ b/frontend/src/components/ai/ConfirmActionCard.jsx
@@ -1,7 +1,8 @@
import { useEffect, useRef } from 'react';
import { ShieldAlert } from 'lucide-react';
-import { useServerkitAI } from '../../contexts/AIContext';
+import { useServerkitAI } from '../../contexts/useServerkitAI.js';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const formatParams = (params) => {
if (!params || !Object.keys(params).length) return null;
@@ -33,21 +34,21 @@ const ConfirmActionCard = () => {
<pre className="sk-ai-code sk-ai-confirm__params"><code>{params}</code></pre>
) : null}
<div className="sk-ai-confirm__actions">
- <button
+ <SharedButton variant="unstyled"
ref={denyRef}
type="button"
className="sk-ai-btn sk-ai-btn--ghost"
onClick={() => confirmAction('deny')}
>
{t('app.confirmActionCard.deny', 'Deny')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className="sk-ai-btn sk-ai-btn--danger"
onClick={() => confirmAction('approve')}
>
{t('app.confirmActionCard.approveRun', 'Approve & run')}
- </button>
+ </SharedButton>
</div>
</div>
);
diff --git a/frontend/src/components/ai/ContextChip.jsx b/frontend/src/components/ai/ContextChip.jsx
index 64297015..e8393eca 100644
--- a/frontend/src/components/ai/ContextChip.jsx
+++ b/frontend/src/components/ai/ContextChip.jsx
@@ -1,6 +1,7 @@
import { MapPin } from 'lucide-react';
-import { useServerkitAI } from '../../contexts/AIContext';
+import { useServerkitAI } from '../../contexts/useServerkitAI.js';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Shows the page the assistant is aware of, and lets the user toggle whether
// that context is attached to the next message. Assistant mode only.
@@ -10,7 +11,7 @@ const ContextChip = () => {
if (mode !== 'assistant') return null;
return (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`sk-ai-context-chip${includeContext ? ' is-on' : ' is-off'}`}
aria-pressed={includeContext}
@@ -21,7 +22,7 @@ const ContextChip = () => {
>
<MapPin size={13} />
<span>{includeContext ? `Asking about: ${pageContext.label}` : 'No page context'}</span>
- </button>
+ </SharedButton>
);
};
diff --git a/frontend/src/components/ai/ConversationMenu.jsx b/frontend/src/components/ai/ConversationMenu.jsx
index 60619664..2d16a308 100644
--- a/frontend/src/components/ai/ConversationMenu.jsx
+++ b/frontend/src/components/ai/ConversationMenu.jsx
@@ -1,7 +1,8 @@
import { useEffect, useRef, useState } from 'react';
import { History, Plus, Trash2 } from 'lucide-react';
-import { useServerkitAI } from '../../contexts/AIContext';
+import { useServerkitAI } from '../../contexts/useServerkitAI.js';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const ConversationMenu = () => {
const { t } = useTranslation();
@@ -23,7 +24,7 @@ const ConversationMenu = () => {
return (
<div className="sk-ai-convo" ref={wrapRef}>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-ai-iconbtn"
aria-label={t('app.conversationMenu.conversations', 'Conversations')}
@@ -31,16 +32,16 @@ const ConversationMenu = () => {
onClick={() => setOpen((v) => !v)}
>
<History size={16} />
- </button>
+ </SharedButton>
{open ? (
<div className="sk-ai-convo__menu" role="menu">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-ai-convo__new"
onClick={() => { newConversation(); setOpen(false); }}
>
<Plus size={14} /> {t('app.conversationMenu.newChat', 'New chat')}
- </button>
+ </SharedButton>
<div className="sk-ai-convo__list">
{conversations.length === 0 ? (
<div className="sk-ai-convo__empty">{t('app.conversationMenu.noPastConversations', 'No past conversations')}</div>
@@ -49,22 +50,22 @@ const ConversationMenu = () => {
key={c.id}
className={`sk-ai-convo__item${c.id === activeId ? ' is-active' : ''}`}
>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-ai-convo__title"
onClick={() => { switchConversation(c.id); setOpen(false); }}
title={c.title}
>
{c.title}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className="sk-ai-convo__del"
aria-label={t('app.conversationMenu.deleteConversation', 'Delete conversation')}
onClick={() => deleteConversation(c.id)}
>
<Trash2 size={13} />
- </button>
+ </SharedButton>
</div>
))}
</div>
diff --git a/frontend/src/components/ai/DrawerHeader.jsx b/frontend/src/components/ai/DrawerHeader.jsx
index 09902214..bdba0de6 100644
--- a/frontend/src/components/ai/DrawerHeader.jsx
+++ b/frontend/src/components/ai/DrawerHeader.jsx
@@ -1,10 +1,11 @@
import { useNavigate } from 'react-router-dom';
import { Settings } from 'lucide-react';
-import { useAuth } from '../../contexts/AuthContext';
-import { useServerkitAI } from '../../contexts/AIContext';
+import { useAuth } from '../../contexts/useAuth.js';
+import { useServerkitAI } from '../../contexts/useServerkitAI.js';
import ModeToggle from './ModeToggle';
import ConversationMenu from './ConversationMenu';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Slim toolbar under the shared console tabs. Close lives in the tab strip
// above, so this row carries only the assistant-specific controls.
@@ -23,14 +24,14 @@ const DrawerHeader = () => {
<ModeToggle />
<ConversationMenu />
{isAdmin ? (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-ai-iconbtn"
aria-label={t('app.drawerHeader.aiSettings', 'AI settings')}
onClick={() => { close(); navigate('/settings/ai'); }}
>
<Settings size={16} />
- </button>
+ </SharedButton>
) : null}
</div>
</header>
diff --git a/frontend/src/components/ai/MessageList.jsx b/frontend/src/components/ai/MessageList.jsx
index 4e030eac..28ffc866 100644
--- a/frontend/src/components/ai/MessageList.jsx
+++ b/frontend/src/components/ai/MessageList.jsx
@@ -1,11 +1,12 @@
import { ArrowDown, Sparkles } from 'lucide-react';
-import { useServerkitAI } from '../../contexts/AIContext';
+import { useServerkitAI } from '../../contexts/useServerkitAI.js';
import { useContributions } from '../../plugins/contributions';
import useAutoScroll from '../../hooks/ai/useAutoScroll';
import Message from './Message';
import TypingIndicator from './TypingIndicator';
import ConfirmActionCard from './ConfirmActionCard';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const routeMatches = (pattern, route) => {
if (!pattern || pattern === '*') return true;
@@ -51,14 +52,14 @@ const MessageList = () => {
) : (
<div className="sk-ai-empty__prompts">
{suggestions.map((p) => (
- <button
+ <SharedButton variant="unstyled"
key={p.label}
type="button"
className="sk-ai-suggested"
onClick={() => ask(p.prompt, { open: true })}
>
{p.label}
- </button>
+ </SharedButton>
))}
</div>
)}
@@ -72,9 +73,9 @@ const MessageList = () => {
)}
{!isPinned && !isEmpty ? (
- <button type="button" className="sk-ai-jump" onClick={scrollToBottom} aria-label={t('app.messageList.jumpToLatest', 'Jump to latest')}>
+ <SharedButton variant="unstyled" type="button" className="sk-ai-jump" onClick={scrollToBottom} aria-label={t('app.messageList.jumpToLatest', 'Jump to latest')}>
<ArrowDown size={16} />
- </button>
+ </SharedButton>
) : null}
</div>
);
diff --git a/frontend/src/components/ai/ModeToggle.jsx b/frontend/src/components/ai/ModeToggle.jsx
index 4b9df013..108c3f5e 100644
--- a/frontend/src/components/ai/ModeToggle.jsx
+++ b/frontend/src/components/ai/ModeToggle.jsx
@@ -1,5 +1,6 @@
-import { useServerkitAI } from '../../contexts/AIContext';
+import { useServerkitAI } from '../../contexts/useServerkitAI.js';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const MODES = [
{ id: 'assistant', labelKey: 'app.modeToggle.assistant', label: 'Assistant' },
@@ -13,7 +14,7 @@ const ModeToggle = () => {
return (
<div className="sk-ai-modes" role="tablist" aria-label={t('app.modeToggle.chatMode', 'Chat mode')}>
{MODES.map((m) => (
- <button
+ <SharedButton variant="unstyled"
key={m.id}
type="button"
role="tab"
@@ -22,7 +23,7 @@ const ModeToggle = () => {
onClick={() => setMode(m.id)}
>
{m.label}
- </button>
+ </SharedButton>
))}
</div>
);
diff --git a/frontend/src/components/ai/ToolCallCard.jsx b/frontend/src/components/ai/ToolCallCard.jsx
index a00a3116..3cbd906f 100644
--- a/frontend/src/components/ai/ToolCallCard.jsx
+++ b/frontend/src/components/ai/ToolCallCard.jsx
@@ -1,7 +1,8 @@
import { useState } from 'react';
import { Wrench, Check, AlertTriangle, Loader2, ChevronDown } from 'lucide-react';
-import { useServerkitAI } from '../../contexts/AIContext';
+import { useServerkitAI } from '../../contexts/useServerkitAI.js';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Strip the "<prefix>__" namespace for display (e.g. core__list_apps -> list_apps).
const displayName = (qualified) => {
@@ -34,7 +35,7 @@ const ToolCallCard = ({ call }) => {
return (
<div className={`sk-ai-tool-card${call.isError ? ' sk-ai-tool-card--error' : ''}`}>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-ai-tool-card__head"
onClick={() => setExpanded((v) => !v)}
@@ -46,7 +47,7 @@ const ToolCallCard = ({ call }) => {
{statusIcon}
</span>
<ChevronDown size={14} className={`sk-ai-tool-card__chev${expanded ? ' is-open' : ''}`} />
- </button>
+ </SharedButton>
{expanded && (
<div className="sk-ai-tool-card__body">
{Custom ? (
diff --git a/frontend/src/components/appdetail/BuildTab.jsx b/frontend/src/components/appdetail/BuildTab.jsx
index e7599365..366983df 100644
--- a/frontend/src/components/appdetail/BuildTab.jsx
+++ b/frontend/src/components/appdetail/BuildTab.jsx
@@ -1,8 +1,8 @@
-import { useState, useEffect } from 'react';
+import { useCallback, useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import api from '../../services/api';
import EmptyState from '../EmptyState';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { InfoList, InfoItem } from '../InfoList';
import BuildpackPreview from '../buildpack/BuildpackPreview';
@@ -11,23 +11,21 @@ import { Input } from '@/components/ui/input';
import { Pill, statusKind } from '@/components/ds';
import Modal from '@/components/Modal';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard } from '@/components/ui/card';
+import { CardHeader as SharedCardHeader, CardFooter as SharedCardFooter } from '@/components/ui/card';
-const BuildTab = ({ appId, appPath, app }) => {
+const BuildTab = ({ appId, app }) => {
const { t } = useTranslation();
const toast = useToast();
const { confirm: confirmBuild } = useConfirm();
const [buildConfig, setBuildConfig] = useState(null);
const [detection, setDetection] = useState(null);
const [deployments, setDeployments] = useState([]);
- const [currentDeployment, setCurrentDeployment] = useState(null);
const [loading, setLoading] = useState(true);
const [building, setBuilding] = useState(false);
const [deploying, setDeploying] = useState(false);
const navigate = useNavigate();
const [showConfigModal, setShowConfigModal] = useState(false);
- const [showLogsModal, setShowLogsModal] = useState(false);
- const [selectedLog, setSelectedLog] = useState(null);
- const [buildLogs, setBuildLogs] = useState([]);
const [error, setError] = useState(null);
const [bpDockerfile, setBpDockerfile] = useState(null);
@@ -53,11 +51,7 @@ const BuildTab = ({ appId, appPath, app }) => {
keepDeployments: 5
});
- useEffect(() => {
- loadData();
- }, [appId]);
-
- async function loadData() {
+ const loadData = useCallback(async () => {
try {
setLoading(true);
const [configRes, detectRes, deploymentsRes] = await Promise.all([
@@ -82,14 +76,18 @@ const BuildTab = ({ appId, appPath, app }) => {
}
setDeployments(deploymentsRes.deployments || []);
- setCurrentDeployment(deploymentsRes.current);
} catch (err) {
setError(err.message);
} finally {
setLoading(false);
}
- }
+ }, [appId]);
+
+ useEffect(() => {
+ loadData();
+ }, [loadData]);
+
async function handleConfigureBuild(e) {
e.preventDefault();
@@ -191,12 +189,12 @@ const BuildTab = ({ appId, appPath, app }) => {
{error && (
<div className="alert alert-danger">
{error}
- <button type="button" onClick={() => setError(null)} className="alert-close">&times;</button>
+ <Button variant="unstyled" type="button" onClick={() => setError(null)} className="alert-close">&times;</Button>
</div>
)}
{detection && (
- <div className="card">
+ <SharedCard variant="legacy" className="card">
<h3>{t('app.buildTab.autoDetectionResults', 'Auto-Detection Results')}</h3>
<div className="detection-results">
<div className="detection-item">
@@ -216,27 +214,27 @@ const BuildTab = ({ appId, appPath, app }) => {
</div>
)}
</div>
- </div>
+ </SharedCard>
)}
{app?.buildpack_plan && (
- <div className="card">
+ <SharedCard variant="legacy" className="card">
<h3>{t('app.buildTab.buildPack', 'Build Pack')}</h3>
<BuildpackPreview
plan={app.buildpack_plan}
dockerfile={bpDockerfile}
overrides={app.buildpack_overrides || {}}
/>
- </div>
+ </SharedCard>
)}
- <div className="card">
- <div className="card-header-row">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy-row" className="card-header-row">
<h3>{t('app.buildTab.buildConfiguration', 'Build Configuration')}</h3>
<Button variant="outline" size="sm" onClick={() => setShowConfigModal(true)}>
{t('app.buildTab.configure', 'Configure')}
</Button>
- </div>
+ </SharedCardHeader>
{buildConfig ? (
<InfoList>
<InfoItem label={t('app.buildTab.method', 'Method')} value={buildConfig.build_method} />
@@ -245,7 +243,7 @@ const BuildTab = ({ appId, appPath, app }) => {
) : (
<p className="hint">{t('app.buildTab.noBuildConfigurationClickConfigureTo', 'No build configuration. Click Configure to set up.')}</p>
)}
- <div className="card-actions">
+ <SharedCardFooter variant="legacy" className="card-actions">
<Button
onClick={() => handleDeploy(false)}
disabled={deploying || building}
@@ -259,11 +257,11 @@ const BuildTab = ({ appId, appPath, app }) => {
>
{building ? 'Building...' : 'Build Only'}
</Button>
- </div>
- </div>
+ </SharedCardFooter>
+ </SharedCard>
{deployments.length > 0 && (
- <div className="card">
+ <SharedCard variant="legacy" className="card">
<h3>{t('app.buildTab.deploymentHistory', 'Deployment History')}</h3>
<div className="deployments-list">
{deployments.map(dep => (
@@ -289,7 +287,7 @@ const BuildTab = ({ appId, appPath, app }) => {
</div>
))}
</div>
- </div>
+ </SharedCard>
)}
<Modal open={showConfigModal} onClose={() => setShowConfigModal(false)} title={t('app.buildTab.buildConfiguration', 'Build Configuration')}>
diff --git a/frontend/src/components/appdetail/CommandsTab.jsx b/frontend/src/components/appdetail/CommandsTab.jsx
deleted file mode 100644
index 8452b4c3..00000000
--- a/frontend/src/components/appdetail/CommandsTab.jsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import { useState } from 'react';
-import api from '../../services/api';
-import { Button } from '@/components/ui/button';
-import { Input } from '@/components/ui/input';
-import { useTranslation } from 'react-i18next';
-
-const CommandsTab = ({ appId, appType }) => {
- const { t } = useTranslation();
- const [command, setCommand] = useState('');
- const [output, setOutput] = useState(null);
- const [running, setRunning] = useState(false);
-
- const quickCommands = appType === 'django' ? [
- { labelKey: 'app.commandsTab.runMigrations', label: 'Run Migrations', cmd: 'python manage.py migrate' },
- { labelKey: 'app.commandsTab.collectStatic', label: 'Collect Static', cmd: 'python manage.py collectstatic --noinput' },
- { labelKey: 'app.commandsTab.createSuperuser', label: 'Create Superuser', cmd: 'python manage.py createsuperuser' },
- { labelKey: 'app.commandsTab.shell', label: 'Shell', cmd: 'python manage.py shell' },
- { labelKey: 'app.commandsTab.check', label: 'Check', cmd: 'python manage.py check' },
- ] : [
- { labelKey: 'app.commandsTab.flaskRoutes', label: 'Flask Routes', cmd: 'flask routes' },
- { labelKey: 'app.commandsTab.flaskShell', label: 'Flask Shell', cmd: 'flask shell' },
- { labelKey: 'app.commandsTab.dbUpgrade', label: 'DB Upgrade', cmd: 'flask db upgrade' },
- { labelKey: 'app.commandsTab.dbMigrate', label: 'DB Migrate', cmd: 'flask db migrate' },
- ];
-
- async function handleRun(cmd) {
- const commandToRun = cmd || command;
- if (!commandToRun.trim()) return;
-
- setRunning(true);
- setOutput(null);
-
- try {
- const result = await api.runPythonCommand(appId, commandToRun);
- setOutput(result);
- } catch (err) {
- setOutput({ success: false, stderr: err.message });
- } finally {
- setRunning(false);
- }
- }
-
- return (
- <div>
- <h3 className="app-eyebrow">{t('app.commandsTab.runCommands', 'Run Commands')}</h3>
- <p className="hint">{t('app.commandsTab.commandsRunInTheAppS', 'Commands run in the app\'s virtual environment context.')}</p>
-
- <div className="quick-commands">
- {quickCommands.map(({ label, cmd }) => (
- <Button
- key={cmd}
- variant="outline"
- size="sm"
- onClick={() => handleRun(cmd)}
- disabled={running}
- >
- {label}
- </Button>
- ))}
- </div>
-
- <div className="command-input">
- <Input
- type="text"
- value={command}
- onChange={(e) => setCommand(e.target.value)}
- placeholder={t('app.commandsTab.enterCommand', 'Enter command…')}
- onKeyDown={(e) => e.key === 'Enter' && handleRun()}
- />
- <Button
- onClick={() => handleRun()}
- disabled={running}
- >
- {running ? 'Running...' : 'Run'}
- </Button>
- </div>
-
- {output && (
- <div className={`command-output ${output.success ? '' : 'error'}`}>
- {output.stdout && <pre>{output.stdout}</pre>}
- {output.stderr && <pre className="stderr">{output.stderr}</pre>}
- {!output.stdout && !output.stderr && (
- <pre>{output.success ? 'Command completed successfully' : 'Command failed'}</pre>
- )}
- </div>
- )}
- </div>
- );
-};
-
-export default CommandsTab;
diff --git a/frontend/src/components/appdetail/DeployTab.jsx b/frontend/src/components/appdetail/DeployTab.jsx
index 082bb65d..67c658b6 100644
--- a/frontend/src/components/appdetail/DeployTab.jsx
+++ b/frontend/src/components/appdetail/DeployTab.jsx
@@ -1,8 +1,8 @@
-import { useState, useEffect } from 'react';
+import { useCallback, useState, useEffect } from 'react';
import { GitMerge } from 'lucide-react';
import api from '../../services/api';
import EmptyState from '../EmptyState';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { InfoList, InfoItem } from '../InfoList';
import DeploymentTimeline from '../deployments/DeploymentTimeline';
@@ -12,24 +12,23 @@ import { Textarea } from '@/components/ui/textarea';
import { Pill, statusKind } from '@/components/ds';
import Modal from '@/components/Modal';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard } from '@/components/ui/card';
+import { CardFooter as SharedCardFooter } from '@/components/ui/card';
// `embedded` renders this inside the Settings → Git & Deploy section, where the
// shared RepoConnectForm already owns the connect/disconnect + repo identity. In
// that mode we drop the empty-state CTA and the repo-config fields (repo/branch/
// auto-deploy) and surface only the deploy pipeline: run actions, deploy scripts,
// history and config checkpoints.
-const DeployTab = ({ appId, appPath, embedded = false }) => {
+const DeployTab = ({ appId, embedded = false }) => {
const { t } = useTranslation();
const toast = useToast();
const { confirm: confirmDeploy } = useConfirm();
const [config, setConfig] = useState(null);
- const [gitStatus, setGitStatus] = useState(null);
const [history, setHistory] = useState([]);
const [loading, setLoading] = useState(true);
const [deploying, setDeploying] = useState(false);
const [showConfigModal, setShowConfigModal] = useState(false);
- const [loadingBranches, setLoadingBranches] = useState(false);
- const [branches, setBranches] = useState([]);
const [error, setError] = useState(null);
const [configForm, setConfigForm] = useState({
@@ -40,11 +39,7 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
postDeployScript: ''
});
- useEffect(() => {
- loadData();
- }, [appId]);
-
- async function loadData() {
+ const loadData = useCallback(async () => {
try {
setLoading(true);
const [configRes, historyRes] = await Promise.all([
@@ -61,10 +56,6 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
preDeployScript: configRes.config.pre_deploy_script || '',
postDeployScript: configRes.config.post_deploy_script || ''
});
- try {
- const statusRes = await api.getAppGitStatus(appId);
- setGitStatus(statusRes);
- } catch { /* git status is optional context for the deploy tab */ }
} else {
setConfig(null);
}
@@ -75,7 +66,12 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
} finally {
setLoading(false);
}
- }
+ }, [appId]);
+
+ useEffect(() => {
+ loadData();
+ }, [loadData]);
+
async function handleConfigureDeployment(e) {
e.preventDefault();
@@ -101,7 +97,6 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
try {
await api.removeDeployment(appId);
setConfig(null);
- setGitStatus(null);
loadData();
} catch (err) {
setError(err.message);
@@ -153,7 +148,7 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
{error && (
<div className="alert alert-danger">
{error}
- <button type="button" onClick={() => setError(null)} className="alert-close">&times;</button>
+ <Button variant="unstyled" type="button" onClick={() => setError(null)} className="alert-close">&times;</Button>
</div>
)}
@@ -212,7 +207,7 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
</div>
<div className="deploy-grid">
- <div className="card">
+ <SharedCard variant="legacy" className="card">
<h3>{embedded ? 'Deploy Scripts' : 'Configuration'}</h3>
{embedded ? (
<InfoList>
@@ -226,7 +221,7 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
<InfoItem label={t('app.deployTab.autoDeploy', 'Auto Deploy')} value={config.auto_deploy ? 'Enabled' : 'Disabled'} />
</InfoList>
)}
- <div className="card-actions">
+ <SharedCardFooter variant="legacy" className="card-actions">
<Button variant="outline" size="sm" onClick={() => setShowConfigModal(true)}>
{embedded ? 'Edit Scripts' : 'Edit'}
</Button>
@@ -235,11 +230,11 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
{t('common.actions.remove', 'Remove')}
</Button>
)}
- </div>
- </div>
+ </SharedCardFooter>
+ </SharedCard>
{history.length > 0 && (
- <div className="card">
+ <SharedCard variant="legacy" className="card">
<h3>{t('app.deployTab.deploymentHistory', 'Deployment History')}</h3>
<div className="deployments-list">
{history.slice(0, 5).map((dep, idx) => (
@@ -249,7 +244,7 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
</div>
))}
</div>
- </div>
+ </SharedCard>
)}
</div>
</>
@@ -257,13 +252,13 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
{/* Config snapshot timeline + diff — additive, independent of git
config so it shows the deploy history & config changes for any app. */}
- <div className="card deploy-timeline-card">
+ <SharedCard variant="legacy" className="card deploy-timeline-card">
<h3>{t('app.deployTab.configCheckpoints', 'Config Checkpoints')}</h3>
<p className="deploy-timeline-card__hint">
{t('app.deployTab.anImmutableConfigCheckpointEnvKeys', 'An immutable config checkpoint (env keys, domains, image, build method, volumes) is captured before each deployment. Secret values are masked. Open a checkpoint to diff it against the previous one or restore it.')}
</p>
<DeploymentTimeline appId={appId} />
- </div>
+ </SharedCard>
<Modal open={showConfigModal} onClose={() => setShowConfigModal(false)} title={embedded ? t('app.deployTab.editDeployScripts', 'Edit Deploy Scripts') : t('app.deployTab.configureDeployment', 'Configure Deployment')}>
<form onSubmit={handleConfigureDeployment}>
diff --git a/frontend/src/components/appdetail/GunicornTab.jsx b/frontend/src/components/appdetail/GunicornTab.jsx
deleted file mode 100644
index 9912fec0..00000000
--- a/frontend/src/components/appdetail/GunicornTab.jsx
+++ /dev/null
@@ -1,65 +0,0 @@
-import { useState, useEffect } from 'react';
-import api from '../../services/api';
-import EmptyState from '../EmptyState';
-import { useToast } from '../../contexts/ToastContext';
-import { Button } from '@/components/ui/button';
-import { useTranslation } from 'react-i18next';
-
-const GunicornTab = ({ appId }) => {
- const { t } = useTranslation();
- const toast = useToast();
- const [config, setConfig] = useState('');
- const [loading, setLoading] = useState(true);
- const [saving, setSaving] = useState(false);
-
- useEffect(() => {
- loadConfig();
- }, [appId]);
-
- async function loadConfig() {
- try {
- const data = await api.getGunicornConfig(appId);
- setConfig(data.content || '');
- } catch (err) {
- console.error('Failed to load config:', err);
- } finally {
- setLoading(false);
- }
- }
-
- async function handleSave() {
- setSaving(true);
- try {
- await api.updateGunicornConfig(appId, config);
- toast.success(t('app.gunicornTab.configurationSavedRestartTheAppTo', 'Configuration saved. Restart the app to apply changes.'));
- } catch (err) {
- toast.error(t('app.gunicornTab.failedToSaveConfiguration', 'Failed to save configuration'));
- console.error('Failed to save config:', err);
- } finally {
- setSaving(false);
- }
- }
-
- if (loading) {
- return <EmptyState loading loadingVariant="form" title={t('app.gunicornTab.loadingGunicornConfiguration', 'Loading Gunicorn configuration…')} />;
- }
-
- return (
- <div>
- <div className="section-header">
- <h3>{t('app.gunicornTab.gunicornConfiguration', 'Gunicorn Configuration')}</h3>
- <Button onClick={handleSave} disabled={saving}>
- {saving ? 'Saving...' : 'Save'}
- </Button>
- </div>
- <textarea
- className="code-editor"
- value={config}
- onChange={(e) => setConfig(e.target.value)}
- spellCheck={false}
- />
- </div>
- );
-};
-
-export default GunicornTab;
diff --git a/frontend/src/components/appdetail/LogsTab.jsx b/frontend/src/components/appdetail/LogsTab.jsx
deleted file mode 100644
index 47a90d3e..00000000
--- a/frontend/src/components/appdetail/LogsTab.jsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import { useState, useEffect } from 'react';
-import { logsToText } from '@/utils/logText';
-import api from '../../services/api';
-import { Button } from '@/components/ui/button';
-import { usePolling } from '../../hooks/usePolling';
-import { useTranslation } from 'react-i18next';
-
-const LOG_REFRESH_MS = 5000;
-
-const LogsTab = ({ app }) => {
- const { t } = useTranslation();
- const [logs, setLogs] = useState('');
- const [loading, setLoading] = useState(true);
- const [autoRefresh, setAutoRefresh] = useState(false);
-
- const isDockerApp = app.app_type === 'docker';
- const isPythonApp = ['flask', 'django'].includes(app.app_type);
-
- useEffect(() => {
- loadLogs();
- }, [app.id]);
-
- // immediate: false — the effect above already loads on mount and on app
- // change; this adds only the repeat while auto-refresh is on.
- usePolling(loadLogs, LOG_REFRESH_MS, { enabled: autoRefresh, immediate: false });
-
- async function loadLogs() {
- try {
- let data;
- if (isDockerApp) {
- data = await api.getDockerAppLogs(app.id, 200);
- } else if (isPythonApp) {
- data = await api.getPythonAppLogs(app.id, 200);
- } else {
- data = { logs: 'Logs not available for this app type.' };
- }
- setLogs(logsToText(data) || 'No logs available');
- } catch (err) {
- console.error('Failed to load logs:', err);
- setLogs('Failed to load logs');
- } finally {
- setLoading(false);
- }
- }
-
- return (
- <div className="logs-tab">
- <div className="logs-header">
- <h3>{t('app.logsTab.applicationLogs', 'Application Logs')}</h3>
- <div className="logs-controls">
- {isPythonApp && (
- <span className="hint">{t('app.logsTab.gunicornSystemdLogs', 'Gunicorn/systemd Logs')}</span>
- )}
- {isDockerApp && (
- <span className="hint">{t('app.logsTab.dockerComposeLogs', 'Docker Compose Logs')}</span>
- )}
- <label className="checkbox-inline">
- <input
- type="checkbox"
- checked={autoRefresh}
- onChange={(e) => setAutoRefresh(e.target.checked)}
- />
- {t('app.logsTab.autoRefresh', 'Auto-refresh')}
- </label>
- <Button variant="outline" size="sm" onClick={loadLogs}>
- {t('common.actions.refresh', 'Refresh')}
- </Button>
- </div>
- </div>
- <pre className="log-viewer">{loading ? 'Loading...' : logs}</pre>
- </div>
- );
-};
-
-export default LogsTab;
diff --git a/frontend/src/components/appdetail/OverviewTab.jsx b/frontend/src/components/appdetail/OverviewTab.jsx
deleted file mode 100644
index 5f735074..00000000
--- a/frontend/src/components/appdetail/OverviewTab.jsx
+++ /dev/null
@@ -1,372 +0,0 @@
-import { useState, useEffect } from 'react';
-import { useNavigate } from 'react-router-dom';
-import api from '../../services/api';
-import { formatBytes } from '@/utils/formatBytes';
-import { useConfirm } from '../../hooks/useConfirm';
-import PrivateURLSection from '../PrivateURLSection';
-import LinkedAppsSection from '../LinkedAppsSection';
-import LinkAppModal from '../LinkAppModal';
-import TagsPanel from '../shared/TagsPanel';
-import EnvironmentVariablesPanel from '../shared/EnvironmentVariablesPanel';
-import { Button } from '@/components/ui/button';
-import { useTranslation } from 'react-i18next';
-
-// Overview Tab with new grid layout
-const OverviewTab = ({ app, onUpdate }) => {
- const { t } = useTranslation();
- const navigate = useNavigate();
- const { confirm: confirmOverview } = useConfirm();
- const [status, setStatus] = useState(null);
- const [appStatus, setAppStatus] = useState(null);
- const [linkedApps, setLinkedApps] = useState([]);
- const [showLinkModal, setShowLinkModal] = useState(false);
- const [linkLoading, setLinkLoading] = useState(false);
- const [containerStats, setContainerStats] = useState(null);
-
- useEffect(() => {
- if (['flask', 'django'].includes(app.app_type)) {
- loadStatus();
- }
- loadAppStatus();
- loadLinkedApps();
- if (app.app_type === 'docker') {
- loadContainerStats();
- }
- }, [app]);
-
- async function loadStatus() {
- try {
- const data = await api.getPythonAppStatus(app.id);
- setStatus(data);
- } catch (err) {
- console.error('Failed to load status:', err);
- }
- }
-
- async function loadAppStatus() {
- try {
- const data = await api.getAppStatus(app.id);
- setAppStatus(data);
- } catch (err) {
- console.error('Failed to load app status:', err);
- }
- }
-
- async function loadLinkedApps() {
- try {
- const data = await api.getLinkedApps(app.id);
- setLinkedApps(data.linked_apps || []);
- } catch (err) {
- console.error('Failed to load linked apps:', err);
- }
- }
-
- async function loadContainerStats() {
- try {
- // Try to get container stats for docker apps
- const containers = await api.getContainers(true);
- const appContainer = containers.containers?.find(c =>
- c.name?.includes(app.name) || c.name?.includes(app.slug)
- );
- if (appContainer && appContainer.state === 'running') {
- const stats = await api.getContainerStats(appContainer.id);
- setContainerStats(stats.stats);
- }
- } catch (err) {
- console.error('Failed to load container stats:', err);
- }
- }
-
- async function handleUnlink() {
- const confirmed = await confirmOverview({ titleKey: 'app.overviewTab.unlinkApps', title: 'Unlink Apps', messageKey: 'app.overviewTab.areYouSureYouWantTo', message: 'Are you sure you want to unlink these apps? Database credentials will remain unchanged.', variant: 'warning' });
- if (!confirmed) {
- return;
- }
- setLinkLoading(true);
- try {
- await api.unlinkApp(app.id);
- onUpdate();
- loadLinkedApps();
- } catch (err) {
- console.error('Failed to unlink apps:', err);
- } finally {
- setLinkLoading(false);
- }
- }
-
- function handleLinked() {
- onUpdate();
- loadLinkedApps();
- }
-
- function parseResourceValue(value) {
- if (!value) return 0;
- return parseFloat(value.replace('%', '')) || 0;
- }
-
- return (
- <div className="app-overview-grid">
- {/* Left Column */}
- <div className="app-overview-left">
- {/* Application Info Panel */}
- <div className="app-panel">
- <div className="app-panel-header">{t('app.overviewTab.applicationInfo', 'Application Info')}</div>
- <div className="app-panel-body">
- <div className="app-info-grid">
- <div className="app-info-item">
- <span className="app-info-label">{t('common.labels.type', 'Type')}</span>
- <span className="app-info-value">{app.app_type === 'docker' ? 'Docker Container' : app.app_type.toUpperCase()}</span>
- </div>
- <div className="app-info-item">
- <span className="app-info-label">{t('common.labels.port', 'Port')}</span>
- <span className="app-info-value">
- {app.port || '-'}
- {appStatus && app.port && (
- <span className={`port-indicator ${appStatus.port_accessible ? 'accessible' : ''}`}>
- {appStatus.port_accessible ? ' (accessible)' : ' (not accessible)'}
- </span>
- )}
- </span>
- </div>
- {app.python_version && (
- <div className="app-info-item">
- <span className="app-info-label">{t('app.overviewTab.pythonVersion', 'Python Version')}</span>
- <span className="app-info-value">{app.python_version}</span>
- </div>
- )}
- {app.php_version && (
- <div className="app-info-item">
- <span className="app-info-label">{t('app.overviewTab.phpVersion', 'PHP Version')}</span>
- <span className="app-info-value">{app.php_version}</span>
- </div>
- )}
- <div className="app-info-item full-width">
- <span className="app-info-label">{t('app.overviewTab.rootPath', 'Root Path')}</span>
- <div><span className="app-path-value">{app.root_path || `/var/serverkit/apps/${app.name}`}</span></div>
- </div>
- </div>
- </div>
- </div>
-
- {/* Routing Diagnostics Panel (Docker apps only) */}
- {app.app_type === 'docker' && (
- <RoutingDiagnosticsPanel appId={app.id} />
- )}
-
- {/* Environment Linking Panel */}
- <div className="app-panel">
- <div className="app-panel-header">{t('app.overviewTab.environmentLinking', 'Environment Linking')}</div>
- <div className="app-panel-body">
- <p className="app-panel-hint">
- {t('app.overviewTab.linkThisAppToAnotherTo', 'Link this app to another to create a production/development pair. Linked apps can share database credentials.')}
- </p>
- <LinkedAppsSection
- app={app}
- linkedApps={linkedApps}
- onLink={() => setShowLinkModal(true)}
- onUnlink={handleUnlink}
- onNavigate={(appId) => navigate(`/apps/${appId}`)}
- loading={linkLoading}
- compact
- />
- </div>
- </div>
-
- {/* Process Status (Python apps) */}
- {status && (
- <div className="app-panel">
- <div className="app-panel-header">{t('app.overviewTab.processStatus', 'Process Status')}</div>
- <div className="app-panel-body">
- <div className="app-info-grid">
- <div className="app-info-item">
- <span className="app-info-label">{t('common.labels.service', 'Service')}</span>
- <span className="app-info-value mono">{status.service_name}</span>
- </div>
- <div className="app-info-item">
- <span className="app-info-label">{t('common.labels.state', 'State')}</span>
- <span className="app-info-value">{status.active_state} ({status.sub_state})</span>
- </div>
- {status.main_pid !== '0' && (
- <div className="app-info-item">
- <span className="app-info-label">PID</span>
- <span className="app-info-value mono">{status.main_pid}</span>
- </div>
- )}
- {status.memory && status.memory !== '0' && (
- <div className="app-info-item">
- <span className="app-info-label">{t('common.labels.memory', 'Memory')}</span>
- <span className="app-info-value">{formatBytes(parseInt(status.memory))}</span>
- </div>
- )}
- </div>
- </div>
- </div>
- )}
-
- {/* Domains Panel */}
- {app.domains && app.domains.length > 0 && (
- <div className="app-panel">
- <div className="app-panel-header">{t('common.labels.domains', 'Domains')}</div>
- <div className="app-panel-body">
- <div className="domains-list">
- {app.domains.map(domain => (
- <div key={domain.id} className="domain-item">
- <a href={`https://${domain.name}`} target="_blank" rel="noopener noreferrer">
- {domain.name}
- </a>
- {domain.ssl_enabled && (
- <span className="ssl-badge">SSL</span>
- )}
- </div>
- ))}
- </div>
- </div>
- </div>
- )}
- </div>
-
- {/* Right Column */}
- <div className="app-overview-right">
- {/* Private URL Panel (Docker apps with port) */}
- {app.app_type === 'docker' && app.port && (
- <PrivateURLSection app={app} onUpdate={onUpdate} />
- )}
-
- {/* Live Resources Panel */}
- {app.app_type === 'docker' && (
- <div className="app-panel">
- <div className="app-panel-header">{t('app.overviewTab.liveResources', 'Live Resources')}</div>
- <div className="app-panel-body">
- <div className="resource-bar-container">
- <div className="resource-bar-header">
- <span className="resource-bar-label">{t('app.overviewTab.cpuLoad', 'CPU Load')}</span>
- <span className="resource-bar-value">
- {containerStats ? `${parseResourceValue(containerStats.CPUPerc).toFixed(0)}%` : '-'}
- </span>
- </div>
- <div className="resource-bar-track">
- <div
- className="resource-bar-fill cpu"
- style={{ width: `${containerStats ? parseResourceValue(containerStats.CPUPerc) : 0}%` }}
- />
- </div>
- </div>
- <div className="resource-bar-container">
- <div className="resource-bar-header">
- <span className="resource-bar-label">{t('app.overviewTab.ramUsage', 'RAM Usage')}</span>
- <span className="resource-bar-value">
- {containerStats?.MemUsage || '-'}
- </span>
- </div>
- <div className="resource-bar-track">
- <div
- className="resource-bar-fill ram"
- style={{ width: `${containerStats ? parseResourceValue(containerStats.MemPerc) : 0}%` }}
- />
- </div>
- </div>
- {!containerStats && app.status !== 'running' && (
- <p className="resource-hint">{t('app.overviewTab.startTheContainerToSeeLive', 'Start the container to see live resources.')}</p>
- )}
- </div>
- </div>
- )}
-
- {/* Tags Panel (polymorphic shared resource) */}
- <div className="app-panel">
- <div className="app-panel-header">{t('app.overviewTab.tags', 'Tags')}</div>
- <div className="app-panel-body">
- <TagsPanel resourceType="application" resourceId={app.id} />
- </div>
- </div>
-
- {/* Shared Variables Panel (resolved from attached groups) */}
- <div className="app-panel">
- <div className="app-panel-body">
- <EnvironmentVariablesPanel resourceType="application" resourceId={app.id} />
- </div>
- </div>
- </div>
-
- {showLinkModal && (
- <LinkAppModal
- app={app}
- onClose={() => setShowLinkModal(false)}
- onLinked={handleLinked}
- />
- )}
- </div>
- );
-};
-
-// Routing Diagnostics Panel
-const RoutingDiagnosticsPanel = ({ appId }) => {
- const { t } = useTranslation();
- const [diagnostics, setDiagnostics] = useState(null);
- const [loading, setLoading] = useState(false);
- const [lastChecked, setLastChecked] = useState(null);
-
- async function runDiagnostics() {
- setLoading(true);
- try {
- const data = await api.getDomainRoutingDiagnostics(appId);
- setDiagnostics(data);
- setLastChecked(new Date());
- } catch (err) {
- console.error('Failed to run diagnostics:', err);
- } finally {
- setLoading(false);
- }
- }
-
- const isHealthy = diagnostics?.health?.overall;
-
- return (
- <div className="app-panel">
- <div className="app-panel-header">
- <span>{t('app.overviewTab.routingDiagnostics', 'Routing Diagnostics')}</span>
- <span className="app-panel-header-actions">
- <Button
- variant="ghost"
- size="sm"
- onClick={runDiagnostics}
- disabled={loading}
- >
- {loading ? 'Checking...' : 'Run Diagnostics'}
- </Button>
- </span>
- </div>
- <div className="app-panel-body">
- {diagnostics ? (
- <>
- <div className={`diag-status ${isHealthy ? 'healthy' : 'unhealthy'}`}>
- <div className={`diag-icon ${isHealthy ? 'healthy' : 'unhealthy'}`}>
- {isHealthy ? '✓' : '✗'}
- </div>
- <div className="diag-text">
- <h4>{isHealthy ? 'Configuration Healthy' : 'Issues Detected'}</h4>
- <p>
- {lastChecked && `Last checked: ${Math.round((Date.now() - lastChecked) / 60000)} minutes ago. `}
- {isHealthy ? 'No routing issues detected.' : 'Some checks failed.'}
- </p>
- </div>
- </div>
- {diagnostics.health?.issues?.length > 0 && (
- <ul className="diag-issues">
- {diagnostics.health.issues.map((issue, i) => (
- <li key={i}>{issue}</li>
- ))}
- </ul>
- )}
- </>
- ) : (
- <p className="app-panel-hint">
- {t('app.overviewTab.clickRunDiagnosticsToCheckRouting', 'Click "Run Diagnostics" to check routing configuration and identify issues.')}
- </p>
- )}
- </div>
- </div>
- );
-};
-
-export default OverviewTab;
diff --git a/frontend/src/components/appdetail/PackagesTab.jsx b/frontend/src/components/appdetail/PackagesTab.jsx
deleted file mode 100644
index 53ef095e..00000000
--- a/frontend/src/components/appdetail/PackagesTab.jsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import { useState, useEffect } from 'react';
-import api from '../../services/api';
-import EmptyState from '../EmptyState';
-import { useToast } from '../../contexts/ToastContext';
-import { Button } from '@/components/ui/button';
-import { Input } from '@/components/ui/input';
-import { useTranslation } from 'react-i18next';
-
-const PackagesTab = ({ appId }) => {
- const { t } = useTranslation();
- const toast = useToast();
- const [packages, setPackages] = useState([]);
- const [loading, setLoading] = useState(true);
- const [installing, setInstalling] = useState(false);
- const [newPackage, setNewPackage] = useState('');
-
- useEffect(() => {
- loadPackages();
- }, [appId]);
-
- async function loadPackages() {
- try {
- const data = await api.getPythonPackages(appId);
- setPackages(data.packages || []);
- } catch (err) {
- console.error('Failed to load packages:', err);
- } finally {
- setLoading(false);
- }
- }
-
- async function handleInstall(e) {
- e.preventDefault();
- if (!newPackage.trim()) return;
-
- setInstalling(true);
- try {
- await api.installPythonPackages(appId, [newPackage.trim()]);
- setNewPackage('');
- loadPackages();
- } catch (err) {
- console.error('Failed to install package:', err);
- } finally {
- setInstalling(false);
- }
- }
-
- async function handleFreeze() {
- try {
- await api.freezePythonRequirements(appId);
- toast.success(t('app.packagesTab.requirementsTxtUpdated', 'requirements.txt updated'));
- } catch (err) {
- toast.error(t('app.packagesTab.failedToFreezeRequirements', 'Failed to freeze requirements'));
- console.error('Failed to freeze requirements:', err);
- }
- }
-
- if (loading) {
- return <EmptyState loading loadingVariant="table" title={t('app.packagesTab.loadingPackages', 'Loading packages…')} />;
- }
-
- return (
- <div>
- <div className="section-header">
- <h3>{t('app.packagesTab.installedPackages', 'Installed Packages')}</h3>
- <Button variant="outline" size="sm" onClick={handleFreeze}>
- {t('app.packagesTab.freezeToRequirementsTxt', 'Freeze to requirements.txt')}
- </Button>
- </div>
-
- <form className="install-form" onSubmit={handleInstall}>
- <Input
- type="text"
- value={newPackage}
- onChange={(e) => setNewPackage(e.target.value)}
- placeholder={t('app.packagesTab.packageNameEGRequestsFlask', 'Package name (e.g., requests, flask==2.0.0)')}
- />
- <Button type="submit" disabled={installing}>
- {installing ? 'Installing...' : 'Install'}
- </Button>
- </form>
-
- <div className="packages-list">
- {packages.map(pkg => (
- <div key={pkg.name} className="package-item">
- <span className="package-name">{pkg.name}</span>
- <span className="package-version">{pkg.version}</span>
- </div>
- ))}
- </div>
- </div>
- );
-};
-
-export default PackagesTab;
diff --git a/frontend/src/components/appdetail/SettingsTab.jsx b/frontend/src/components/appdetail/SettingsTab.jsx
index fe9bab8d..64a3e7b4 100644
--- a/frontend/src/components/appdetail/SettingsTab.jsx
+++ b/frontend/src/components/appdetail/SettingsTab.jsx
@@ -6,6 +6,7 @@ import { DangerZone } from '../DangerZone';
import { Button } from '@/components/ui/button';
import { EnvTag } from '@/components/ds';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard } from '@/components/ui/card';
const SettingsTab = ({ app, onUpdate }) => {
const { t } = useTranslation();
@@ -85,7 +86,7 @@ const SettingsTab = ({ app, onUpdate }) => {
<div>
<h3 className="app-eyebrow">{t('app.settingsTab.applicationSettings', 'Application Settings')}</h3>
- <div className="card settings-section">
+ <SharedCard variant="legacy" className="card settings-section">
<h4>{t('app.settingsTab.environmentConfiguration', 'Environment Configuration')}</h4>
<div className="settings-row">
<div className="settings-label">
@@ -137,7 +138,7 @@ const SettingsTab = ({ app, onUpdate }) => {
</div>
</div>
)}
- </div>
+ </SharedCard>
<DangerZone
title={t('app.settingsTab.dangerZone', 'Danger Zone')}
diff --git a/frontend/src/components/apps/AppWafPanel.jsx b/frontend/src/components/apps/AppWafPanel.jsx
index 1f2037b6..a4a44f6b 100644
--- a/frontend/src/components/apps/AppWafPanel.jsx
+++ b/frontend/src/components/apps/AppWafPanel.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback } from 'react';
import { ShieldCheck, ListChecks, X, RefreshCw } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Pill, SegControl } from '../ds';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -314,14 +314,14 @@ const AppWafPanel = ({ app, onChanged }) => {
{policy.disabled_rule_ids.map((id) => (
<span key={id} className="waf-panel__chip">
<span className="mono">{id}</span>
- <button
+ <Button variant="unstyled"
type="button"
className="waf-panel__chip-remove"
onClick={() => handleRemoveRule(id)}
aria-label={t('app.appWafPanel.removeRule', 'Remove rule {{id}}', { id: id })}
>
<X size={13} />
- </button>
+ </Button>
</span>
))}
</div>
diff --git a/frontend/src/components/apps/ContainerOpsPanel.jsx b/frontend/src/components/apps/ContainerOpsPanel.jsx
index acb45eb1..61c11570 100644
--- a/frontend/src/components/apps/ContainerOpsPanel.jsx
+++ b/frontend/src/components/apps/ContainerOpsPanel.jsx
@@ -3,7 +3,7 @@ import { statusKind } from '@/components/ds/status';
import { RefreshCw, ArrowUpCircle, Moon, Sun, Gauge as GaugeIcon, Boxes } from 'lucide-react';
import { Link } from 'react-router-dom';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { Pill } from '../ds';
import { Button } from '@/components/ui/button';
diff --git a/frontend/src/components/apps/HtaccessConverter.jsx b/frontend/src/components/apps/HtaccessConverter.jsx
index 392c9e1a..90c1a73d 100644
--- a/frontend/src/components/apps/HtaccessConverter.jsx
+++ b/frontend/src/components/apps/HtaccessConverter.jsx
@@ -5,7 +5,7 @@ import { Button } from '@/components/ui/button';
import { Textarea } from '@/components/ui/textarea';
import { CopyButton } from '@/components/CopyButton';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useTranslation } from 'react-i18next';
// Paste-in .htaccess -> nginx converter for the per-site custom nginx rules
diff --git a/frontend/src/components/apps/MicroCachePanel.jsx b/frontend/src/components/apps/MicroCachePanel.jsx
index 004a73ee..53090ca5 100644
--- a/frontend/src/components/apps/MicroCachePanel.jsx
+++ b/frontend/src/components/apps/MicroCachePanel.jsx
@@ -1,7 +1,7 @@
import { useState } from 'react';
import { Zap, Eraser } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Switch } from '@/components/ui/switch';
import { useConfirm } from '@/hooks/useConfirm';
diff --git a/frontend/src/components/apps/ResourceLimitsPanel.jsx b/frontend/src/components/apps/ResourceLimitsPanel.jsx
index 511c03df..faa09078 100644
--- a/frontend/src/components/apps/ResourceLimitsPanel.jsx
+++ b/frontend/src/components/apps/ResourceLimitsPanel.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback } from 'react';
import { Gauge } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
diff --git a/frontend/src/components/apps/VolumesPanel.jsx b/frontend/src/components/apps/VolumesPanel.jsx
index 64a8b40d..46e74114 100644
--- a/frontend/src/components/apps/VolumesPanel.jsx
+++ b/frontend/src/components/apps/VolumesPanel.jsx
@@ -1,7 +1,8 @@
+import { formatBytes } from '@/utils/formatBytes';
import { useState, useEffect, useCallback } from 'react';
import { HardDrive, Plus, Trash2, AlertTriangle } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Pill } from '../ds';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -9,14 +10,6 @@ import { Label } from '@/components/ui/label';
import { Checkbox } from '@/components/ui/checkbox';
import { useTranslation } from 'react-i18next';
-function formatBytes(bytes) {
- if (bytes == null) return '—';
- if (bytes === 0) return '0 B';
- const units = ['B', 'KB', 'MB', 'GB', 'TB'];
- const i = Math.min(units.length - 1, Math.floor(Math.log(bytes) / Math.log(1024)));
- return `${(bytes / 1024 ** i).toFixed(i ? 1 : 0)} ${units[i]}`;
-}
-
// A single volume row with an inline detach confirm (the "also delete data"
// checkbox is off by default and disabled while the app is running, so a detach
// can never nuke live data by accident).
@@ -43,7 +36,7 @@ function VolumeRow({ volume, appRunning, onDetach }) {
<strong>{volume.name}</strong>
<span className="app-volumes__mono">{volume.mount_path}</span>
</div>
- <div className="app-volumes__cell">{formatBytes(volume.size_bytes)}</div>
+ <div className="app-volumes__cell">{formatBytes(volume.size_bytes, { defaultValue: '—' })}</div>
<div className="app-volumes__cell app-volumes__pills">
{volume.read_only && <Pill kind="gray">read-only</Pill>}
<Pill kind={volume.present === false ? 'red' : 'green'}>
@@ -96,7 +89,7 @@ const VolumesPanel = ({ app, onChanged }) => {
} finally {
setLoading(false);
}
- }, [app.id, toast]);
+ }, [app.id, toast, t]);
useEffect(() => { load(); }, [load]);
diff --git a/frontend/src/components/backups/BackupCalendar.jsx b/frontend/src/components/backups/BackupCalendar.jsx
index 7f1c0ede..9150809b 100644
--- a/frontend/src/components/backups/BackupCalendar.jsx
+++ b/frontend/src/components/backups/BackupCalendar.jsx
@@ -1,7 +1,8 @@
import { useState, useMemo } from 'react';
import { ChevronLeft, ChevronRight } from 'lucide-react';
-import { statusKind } from './format';
+
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Card of the backup "Protection" panel: a Monday-first month grid of backup
// runs. Pairs with the .backup-calendar styles. Uses native Date math (no libs).
@@ -103,17 +104,17 @@ export default function BackupCalendar({ runs, onDayClick }) {
return (
<div className="backup-calendar">
<div className="backup-calendar__head">
- <button type="button" className="backup-calendar__nav" onClick={prevMonth} aria-label={t('app.backupCalendar.previousMonth', 'Previous month')}><ChevronLeft size={16} /></button>
+ <SharedButton variant="unstyled" type="button" className="backup-calendar__nav" onClick={prevMonth} aria-label={t('app.backupCalendar.previousMonth', 'Previous month')}><ChevronLeft size={16} /></SharedButton>
<span className="backup-calendar__month">{monthLabel}</span>
- <button type="button" className="backup-calendar__nav" onClick={nextMonth} aria-label={t('app.backupCalendar.nextMonth', 'Next month')}><ChevronRight size={16} /></button>
- <button type="button" className="backup-calendar__today" onClick={goToday}>{t('app.backupCalendar.today', 'Today')}</button>
+ <SharedButton variant="unstyled" type="button" className="backup-calendar__nav" onClick={nextMonth} aria-label={t('app.backupCalendar.nextMonth', 'Next month')}><ChevronRight size={16} /></SharedButton>
+ <SharedButton variant="unstyled" type="button" className="backup-calendar__today" onClick={goToday}>{t('app.backupCalendar.today', 'Today')}</SharedButton>
</div>
<div className="backup-calendar__grid">
{WEEKDAYS.map((d) => <div key={d} className="backup-calendar__dow">{d}</div>)}
{cells.map((cell, i) => (
cell
? (
- <button
+ <SharedButton variant="unstyled"
type="button"
key={i}
className={`backup-calendar__cell ${cell.count ? `backup-calendar__cell--has is-${cell.worst}` : ''}`}
@@ -122,7 +123,7 @@ export default function BackupCalendar({ runs, onDayClick }) {
>
<span className="backup-calendar__daynum">{cell.day}</span>
{cell.count > 0 && <span className="backup-calendar__badge">{cell.count}</span>}
- </button>
+ </SharedButton>
)
: <span key={i} className="backup-calendar__cell backup-calendar__cell--empty" />
))}
diff --git a/frontend/src/components/backups/BackupHistoryList.jsx b/frontend/src/components/backups/BackupHistoryList.jsx
index e0456520..bdb17218 100644
--- a/frontend/src/components/backups/BackupHistoryList.jsx
+++ b/frontend/src/components/backups/BackupHistoryList.jsx
@@ -78,7 +78,7 @@ function RestoreDrills({ drills }) {
const isOpen = expanded === drill.id;
return (
<li key={drill.id} className="backup-drills__item">
- <button
+ <Button variant="unstyled"
type="button"
className="backup-drills__row"
onClick={() => setExpanded(isOpen ? null : drill.id)}
@@ -96,7 +96,7 @@ function RestoreDrills({ drills }) {
{drill.bytes_restored != null && (
<span className="backup-drills__meta">{humanSize(drill.bytes_restored)}</span>
)}
- </button>
+ </Button>
{isOpen && (
<div className="backup-drills__detail">
{drill.error && <p className="backup-drills__error">{drill.error}</p>}
diff --git a/frontend/src/components/backups/BackupsOverview.jsx b/frontend/src/components/backups/BackupsOverview.jsx
index 7cb57108..733487c8 100644
--- a/frontend/src/components/backups/BackupsOverview.jsx
+++ b/frontend/src/components/backups/BackupsOverview.jsx
@@ -1,3 +1,5 @@
+import { Button } from '@/components/ui/button';
+import { nextFire, untilLabel } from '@/utils/backupSchedule';
import { useState, useEffect, useMemo } from 'react';
import {
AlertTriangle, Archive, ChevronRight, Cloud, Database, Globe, HardDrive,
@@ -55,46 +57,6 @@ function formatDuration(seconds) {
return s ? `${m}m ${s}s` : `${m}m`;
}
-// "in 1h 12m" / "in 3d" — the shape the mock's Next-scheduled tile uses.
-function untilLabel(date) {
- const ms = date.getTime() - Date.now();
- if (ms <= 0) return 'due now';
- const mins = Math.round(ms / 60000);
- if (mins < 60) return `in ${mins}m`;
- const h = Math.floor(mins / 60);
- if (h < 24) return `in ${h}h ${mins % 60}m`;
- return `in ${Math.round(h / 24)}d`;
-}
-
-// Next fire of a legacy schedule row ({ schedule_time: '02:00', days: [...] }).
-// Deliberately reads the same list the Schedules tab renders rather than
-// parsing policy crons — the number on the tile then matches the rows you'd
-// click through to. Returns null for anything it can't place.
-const DAY_INDEX = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };
-
-function nextFire(schedule) {
- const [hh, mm] = String(schedule.schedule_time || '').split(':').map(Number);
- if (Number.isNaN(hh) || Number.isNaN(mm)) return null;
-
- const days = Array.isArray(schedule.days) ? schedule.days : ['daily'];
- const daily = days.length === 0 || days.includes('daily');
- const wanted = daily
- ? null
- : new Set(days.map((d) => DAY_INDEX[String(d).slice(0, 3).toLowerCase()]).filter((n) => n != null));
- if (!daily && (!wanted || wanted.size === 0)) return null;
-
- // Walk forward a week at most; the first slot that is still in the future
- // on an allowed weekday wins.
- for (let offset = 0; offset <= 7; offset += 1) {
- const candidate = new Date();
- candidate.setDate(candidate.getDate() + offset);
- candidate.setHours(hh, mm, 0, 0);
- if (candidate.getTime() <= Date.now()) continue;
- if (daily || wanted.has(candidate.getDay())) return candidate;
- }
- return null;
-}
-
// DataTable columns for the "Latest snapshots" digest. The hand-rolled table
// had no thead; the shared primitive always renders one, so the cells keep
// their exact markup (.sk-cell-name, .bk-ico, .sk-cell-sub) and the columns
@@ -148,6 +110,7 @@ export default function BackupsOverview({
stats, storageConfig, costSummary, schedules = [], backups = [], onGo,
}) {
const { t } = useTranslation();
+ const now = new Date();
const [policies, setPolicies] = useState(null);
const [runs, setRuns] = useState(null);
@@ -283,14 +246,14 @@ export default function BackupsOverview({
return { rows, peak, count: rows.length };
}, [stats, storageConfig, costSummary]);
- const nextScheduled = useMemo(() => {
+ const nextScheduled = (() => {
const upcoming = (schedules || [])
.filter((s) => s.enabled !== false)
- .map((s) => ({ schedule: s, at: nextFire(s) }))
+ .map((s) => ({ schedule: s, at: nextFire(s, now) }))
.filter((x) => x.at)
.sort((a, b) => a.at - b.at);
return upcoming[0] || null;
- }, [schedules]);
+ })();
const totalBytes = (stats?.total_size || 0) + (stats?.remote_size || 0);
const latest = events.slice(0, 5);
@@ -332,7 +295,7 @@ export default function BackupsOverview({
<MetricCard
tone="violet"
icon={<Timer size={16} />}
- value={nextScheduled ? untilLabel(nextScheduled.at) : 'Not set'}
+ value={nextScheduled ? untilLabel(nextScheduled.at, now) : 'Not set'}
label={t('app.backupsOverview.nextScheduled', 'Next scheduled')}
>
<div className="sk-kpi__sub">
@@ -389,9 +352,9 @@ export default function BackupsOverview({
<section className="bk-panel">
<div className="bk-panel__head">
<h3>{t('app.backupsOverview.recentActivity', 'Recent activity')}</h3>
- <button type="button" className="bk-link" onClick={() => onGo('snapshots')}>
+ <Button variant="unstyled" type="button" className="bk-link" onClick={() => onGo('snapshots')}>
{t('app.backupsOverview.allSnapshots', 'All snapshots')} <ChevronRight size={14} />
- </button>
+ </Button>
</div>
{events.length === 0 ? (
<p className="bk-hint">{t('app.backupsOverview.nothingHasRunYetTheFirst', 'Nothing has run yet — the first backup will show up here.')}</p>
@@ -427,9 +390,9 @@ export default function BackupsOverview({
<section className="bk-panel">
<div className="bk-panel__head">
<h3>{t('app.backupsOverview.storageDestinations', 'Storage destinations')}</h3>
- <button type="button" className="bk-link" onClick={() => onGo('storage')}>
+ <Button variant="unstyled" type="button" className="bk-link" onClick={() => onGo('storage')}>
{t('app.backupsOverview.manage', 'Manage')} <ChevronRight size={14} />
- </button>
+ </Button>
</div>
{destinations.rows.map((row) => (
<div key={row.key} className="bk-dest__row">
diff --git a/frontend/src/components/backups/ProtectionPanel.jsx b/frontend/src/components/backups/ProtectionPanel.jsx
index 46749342..73f3f9ab 100644
--- a/frontend/src/components/backups/ProtectionPanel.jsx
+++ b/frontend/src/components/backups/ProtectionPanel.jsx
@@ -7,7 +7,7 @@ import { useNavigate } from 'react-router-dom';
import { History, RefreshCw, Loader2, List, CalendarDays, X } from 'lucide-react';
import api from '@/services/api';
-import { useToast } from '@/contexts/ToastContext';
+import { useToast } from '@/contexts/useToast.js';
import { useOperations } from '@/contexts/OperationsContext';
import { useConfirm } from '@/hooks/useConfirm';
import { Button } from '@/components/ui/button';
@@ -80,7 +80,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, show
} finally {
setLoading(false);
}
- }, [targetType, targetId, toast]);
+ }, [targetId, targetType, toast, t]);
useEffect(() => {
setLoading(true);
@@ -113,7 +113,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, show
} finally {
setSaving(false);
}
- }, [targetType, targetId, toast]);
+ }, [targetType, targetId, toast, t]);
const handleSaveSchedule = useCallback(async (fields) => {
setSaving(true);
@@ -126,7 +126,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, show
} finally {
setSaving(false);
}
- }, [targetType, targetId, toast]);
+ }, [targetType, targetId, toast, t]);
const handleBackupNow = useCallback(async () => {
setBackingUp(true);
@@ -140,7 +140,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, show
} finally {
setBackingUp(false);
}
- }, [targetType, targetId, toast, scheduleReloads, openRun]);
+ }, [targetType, targetId, openRun, toast, t, scheduleReloads]);
const handleRunDrill = useCallback(async () => {
setDrilling(true);
@@ -153,7 +153,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, show
} finally {
setDrilling(false);
}
- }, [targetType, targetId, toast, scheduleReloads]);
+ }, [targetType, targetId, toast, t, scheduleReloads]);
// Restore is always initiated from a run — opening the restore drawer.
const openRestore = useCallback((run) => setRestoreRun(run), []);
@@ -172,7 +172,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, show
} catch (err) {
toast.error(err.message || t('app.protectionPanel.failedToStartRestore', 'Failed to start restore'));
}
- }, [restoreRun, targetType, targetId, showMaintenanceModeOption, toast, scheduleReloads]);
+ }, [restoreRun, targetType, targetId, showMaintenanceModeOption, toast, t, scheduleReloads]);
const handleVerify = useCallback(async (run) => {
try {
@@ -183,7 +183,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, show
} catch (err) {
toast.error(err.message || t('app.protectionPanel.verificationFailed', 'Verification failed'));
}
- }, [targetType, targetId, toast, load]);
+ }, [targetType, targetId, toast, t, load]);
const handleDelete = useCallback(async (run) => {
const ok = await confirm({
@@ -201,7 +201,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, show
} catch (err) {
toast.error(err.message || t('app.protectionPanel.failedToDeleteBackup', 'Failed to delete backup'));
}
- }, [confirm, targetType, targetId, toast, load, detailRun]);
+ }, [confirm, t, targetType, targetId, toast, detailRun?.id, load]);
const visibleRuns = useMemo(
() => (dayFilter ? runs.filter((r) => sameLocalDay(r.started_at, dayFilter)) : runs),
@@ -236,31 +236,31 @@ export default function ProtectionPanel({ targetType, targetId, targetName, show
<span>{t('app.protectionPanel.backupHistory', 'Backup history')}</span>
<span className="app-panel-header-actions backup-history-card__tools">
{dayFilter && (
- <button
+ <Button variant="unstyled"
type="button"
className="backup-history-card__chip"
onClick={() => setDayFilter(null)}
>
{dayFilter.toLocaleDateString()} <X size={12} />
- </button>
+ </Button>
)}
<div className="backup-history-card__toggle">
- <button
+ <Button variant="unstyled"
type="button"
className={historyView === 'list' ? 'is-active' : ''}
onClick={() => setHistoryView('list')}
aria-label={t('app.protectionPanel.listView', 'List view')}
>
<List size={14} />
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className={historyView === 'calendar' ? 'is-active' : ''}
onClick={() => setHistoryView('calendar')}
aria-label={t('app.protectionPanel.calendarView', 'Calendar view')}
>
<CalendarDays size={14} />
- </button>
+ </Button>
</div>
<Button size="sm" variant="outline" onClick={load} disabled={loading} title={t('common.actions.refresh', 'Refresh')}>
{loading ? <Loader2 size={14} className="spin" /> : <RefreshCw size={14} />}
diff --git a/frontend/src/components/backups/SchedulesTable.jsx b/frontend/src/components/backups/SchedulesTable.jsx
index ebabcad7..7b6cf774 100644
--- a/frontend/src/components/backups/SchedulesTable.jsx
+++ b/frontend/src/components/backups/SchedulesTable.jsx
@@ -1,3 +1,5 @@
+import { Button } from '@/components/ui/button';
+import { nextFire, untilLabel, frequencyLabel } from '@/utils/backupSchedule';
import { Archive, Database, Globe, HardDrive, Package, Play, ShieldCheck, Trash2 } from 'lucide-react';
import { Switch } from '@/components/ui/switch';
import { DataTable, DataTableFooter } from '@/components/ds';
@@ -11,40 +13,6 @@ const KIND_ICON = {
server: HardDrive,
};
-const DAY_INDEX = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };
-const DAY_LABEL = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
-
-// Next fire of a schedule row. Deliberately the same walk-forward the overview
-// tile uses, so "in 4h 48m" here and on Overview can never disagree.
-function nextFire(schedule) {
- const [hh, mm] = String(schedule.schedule_time || '').split(':').map(Number);
- if (Number.isNaN(hh) || Number.isNaN(mm)) return null;
- const days = Array.isArray(schedule.days) ? schedule.days : ['daily'];
- const daily = days.length === 0 || days.includes('daily');
- const wanted = daily
- ? null
- : new Set(days.map((d) => DAY_INDEX[String(d).slice(0, 3).toLowerCase()]).filter((n) => n != null));
- if (!daily && (!wanted || wanted.size === 0)) return null;
- for (let offset = 0; offset <= 7; offset += 1) {
- const candidate = new Date();
- candidate.setDate(candidate.getDate() + offset);
- candidate.setHours(hh, mm, 0, 0);
- if (candidate.getTime() <= Date.now()) continue;
- if (daily || wanted.has(candidate.getDay())) return candidate;
- }
- return null;
-}
-
-function untilLabel(date) {
- const ms = date.getTime() - Date.now();
- if (ms <= 0) return 'due now';
- const mins = Math.round(ms / 60000);
- if (mins < 60) return `in ${mins}m`;
- const h = Math.floor(mins / 60);
- if (h < 24) return `in ${h}h ${mins % 60}m`;
- return `in ${Math.round(h / 24)}d`;
-}
-
function agoLabel(iso) {
if (!iso) return 'Never';
const diff = (Date.now() - new Date(iso).getTime()) / 1000;
@@ -55,18 +23,6 @@ function agoLabel(iso) {
return `${Math.round(diff / 86400)}d ago`;
}
-// Frequency in the mock's phrasing: "Daily · 03:00" / "Weekly · Sun 02:00".
-function frequencyLabel(schedule) {
- const time = schedule.schedule_time || '—';
- const days = Array.isArray(schedule.days) ? schedule.days : ['daily'];
- if (days.length === 0 || days.includes('daily')) return `Daily · ${time}`;
- if (days.length === 1) {
- const idx = DAY_INDEX[String(days[0]).slice(0, 3).toLowerCase()];
- return `Weekly · ${idx == null ? days[0] : DAY_LABEL[idx]} ${time}`;
- }
- return `${days.length}×/week · ${time}`;
-}
-
// Policy list in the design mock's shape: what runs, how often, how long it is
// kept, where it lands, and whether it is on. The columns the mock fills from
// its fixtures but this panel has no source for (per-policy size, run-now) are
@@ -75,6 +31,7 @@ export default function SchedulesTable({
schedules, retentionDays, remoteLabel, onToggle, onRemove, onRun,
}) {
const { t } = useTranslation();
+ const now = new Date();
// DataTable columns. Cell markup and classNames are identical to the
// hand-rolled table they replace, so _backups.scss keeps applying
// (.bk-name, .bk-ret, .bk-lastrun, .bk-paused, .bk-col-on, .bk-actions).
@@ -151,14 +108,14 @@ export default function SchedulesTable({
headerKey: 'app.schedulesTable.next', header: 'Next',
sortable: true,
sortValue: (s) => {
- const next = s.enabled ? nextFire(s) : null;
+ const next = s.enabled ? nextFire(s, now) : null;
return next ? next.getTime() : null;
},
cellClassName: 'sk-cell-mono',
render: (schedule) => {
- const next = schedule.enabled ? nextFire(schedule) : null;
+ const next = schedule.enabled ? nextFire(schedule, now) : null;
return schedule.enabled
- ? (next ? untilLabel(next) : '—')
+ ? (next ? untilLabel(next, now) : '—')
: <span className="bk-paused">paused</span>;
},
},
@@ -187,7 +144,7 @@ export default function SchedulesTable({
render: (schedule) => (
<div className="bk-actions">
{onRun && (
- <button
+ <Button variant="unstyled"
type="button"
className="bk-iconbtn"
onClick={() => onRun(schedule)}
@@ -195,9 +152,9 @@ export default function SchedulesTable({
aria-label={t('app.schedulesTable.runNow', 'Run {{name}} now', { name: schedule.name })}
>
<Play size={15} />
- </button>
+ </Button>
)}
- <button
+ <Button variant="unstyled"
type="button"
className="bk-iconbtn bk-iconbtn--danger"
onClick={() => onRemove(schedule.id)}
@@ -205,7 +162,7 @@ export default function SchedulesTable({
aria-label={t('app.schedulesTable.delete', 'Delete {{name}}', { name: schedule.name })}
>
<Trash2 size={15} />
- </button>
+ </Button>
</div>
),
},
diff --git a/frontend/src/components/backups/StorageDestinations.jsx b/frontend/src/components/backups/StorageDestinations.jsx
index 2ce2ef13..3193dd6b 100644
--- a/frontend/src/components/backups/StorageDestinations.jsx
+++ b/frontend/src/components/backups/StorageDestinations.jsx
@@ -118,10 +118,10 @@ export default function StorageDestinations({
{/* Only one remote can be active at a time, so this reveals the
configuration form below rather than adding a second card. */}
- <button type="button" className="bk-destcard bk-destcard--add" onClick={onAdd}>
+ <Button variant="unstyled" type="button" className="bk-destcard bk-destcard--add" onClick={onAdd}>
<Plus size={24} />
<span>{remote ? 'Change destination' : 'Add destination'}</span>
- </button>
+ </Button>
</div>
);
}
diff --git a/frontend/src/components/buildpack/BuildpackPreview.jsx b/frontend/src/components/buildpack/BuildpackPreview.jsx
index 1e9e136a..311281fb 100644
--- a/frontend/src/components/buildpack/BuildpackPreview.jsx
+++ b/frontend/src/components/buildpack/BuildpackPreview.jsx
@@ -3,6 +3,7 @@ import { Boxes, ChevronDown, FileCode2, Layers, Terminal, Zap } from 'lucide-rea
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Map a plan's language to the primary version-override field.
const VERSION_FIELD = {
@@ -179,7 +180,7 @@ function BuildpackPreview({ plan, dockerfile, overrides = {}, onChange, loading
{dockerfile && !present && (
<div className="buildpack-preview__dockerfile">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="buildpack-preview__dockerfile-toggle"
onClick={() => setDockerfileOpen((open) => !open)}
@@ -193,7 +194,7 @@ function BuildpackPreview({ plan, dockerfile, overrides = {}, onChange, loading
size={16}
className={dockerfileOpen ? 'buildpack-preview__chevron--open' : ''}
/>
- </button>
+ </SharedButton>
{dockerfileOpen && (
<pre className="buildpack-preview__code">
<code>{dockerfile}</code>
diff --git a/frontend/src/components/dashboard/AccountSecurityNudge.jsx b/frontend/src/components/dashboard/AccountSecurityNudge.jsx
index bcba5ce2..15ba6651 100644
--- a/frontend/src/components/dashboard/AccountSecurityNudge.jsx
+++ b/frontend/src/components/dashboard/AccountSecurityNudge.jsx
@@ -65,9 +65,9 @@ const AccountSecurityNudge = () => {
<Button size="sm" onClick={() => navigate(item.fix?.to || '/settings/security')}>
{t('app.accountSecurityNudge.addAPasskeyOr2fa', 'Add a passkey or 2FA')}
</Button>
- <button type="button" className="account-security-nudge__close" onClick={dismiss} aria-label={t('common.actions.dismiss', 'Dismiss')}>
+ <Button variant="unstyled" type="button" className="account-security-nudge__close" onClick={dismiss} aria-label={t('common.actions.dismiss', 'Dismiss')}>
<X size={16} />
- </button>
+ </Button>
</div>
);
};
diff --git a/frontend/src/components/dashboard/SetupHealthWidget.jsx b/frontend/src/components/dashboard/SetupHealthWidget.jsx
index 5a418584..d8dd9f0d 100644
--- a/frontend/src/components/dashboard/SetupHealthWidget.jsx
+++ b/frontend/src/components/dashboard/SetupHealthWidget.jsx
@@ -57,7 +57,7 @@ const SetupHealthWidget = () => {
// Clean → slim "all set" line, not a big empty card.
if (openCount === 0) {
return (
- <button
+ <Button variant="unstyled"
type="button"
className="setup-health-widget setup-health-widget--clean"
onClick={() => navigate('/monitoring/doctor')}
@@ -67,7 +67,7 @@ const SetupHealthWidget = () => {
{t('app.setupHealthWidget.allSet', 'All set —')} {summary.score}{t('app.setupHealthWidget.setupHealth2', '% setup health')}
</span>
<ChevronRight size={14} />
- </button>
+ </Button>
);
}
@@ -100,7 +100,7 @@ const SetupHealthWidget = () => {
>
{t('app.setupHealthWidget.review', 'Review')}
</Button>
- <button
+ <Button variant="unstyled"
type="button"
className="setup-health-widget__dismiss"
onClick={dismiss}
@@ -108,7 +108,7 @@ const SetupHealthWidget = () => {
title={t('app.setupHealthWidget.dismissHint', 'Dismiss — setup health stays in the status bar')}
>
<X size={14} />
- </button>
+ </Button>
</div>
);
};
diff --git a/frontend/src/components/dashboard/grid/WidgetEditor.jsx b/frontend/src/components/dashboard/grid/WidgetEditor.jsx
index 185b155b..4a44c56c 100644
--- a/frontend/src/components/dashboard/grid/WidgetEditor.jsx
+++ b/frontend/src/components/dashboard/grid/WidgetEditor.jsx
@@ -16,6 +16,7 @@ import { QUICK_ACTION_OPTIONS, WidgetBody } from '../widgets/renderers';
import { deriveWidgetTitle } from '../widgets/registry';
import { GRID_COLS, GRID_GAP, GRID_ROW } from './layout';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Tallest a widget may be dragged/stepped to. Twelve columns wide is the board;
// height is only bounded so a stepper can't run away.
@@ -133,7 +134,7 @@ function Stepper({ label, value, onStep, suffix }) {
const { t } = useTranslation();
return (
<div className="skwe-stepper">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="skwe-stepper__btn"
title={t('app.widgetEditor.decrease', 'Decrease {{label}}', { label: label })}
@@ -141,9 +142,9 @@ function Stepper({ label, value, onStep, suffix }) {
onClick={() => onStep(-1)}
>
<Minus size={13} aria-hidden="true" />
- </button>
+ </SharedButton>
<span className="skwe-stepper__val mono">{value}{suffix ? ` ${suffix}` : ''}</span>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="skwe-stepper__btn"
title={t('app.widgetEditor.increase', 'Increase {{label}}', { label: label })}
@@ -151,7 +152,7 @@ function Stepper({ label, value, onStep, suffix }) {
onClick={() => onStep(1)}
>
<Plus size={13} aria-hidden="true" />
- </button>
+ </SharedButton>
</div>
);
}
@@ -184,7 +185,7 @@ function SeriesColor({ value, fallback, index, onChange }) {
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="skwe-edit__color"
aria-label={t('app.widgetEditor.seriesColour', 'Series {{value}} colour', { value: index + 1 })}
@@ -194,7 +195,7 @@ function SeriesColor({ value, fallback, index, onChange }) {
</PopoverTrigger>
<PopoverContent align="start" sideOffset={6} className="skwe-palette">
{SERIES_COLORS.map(([option, name]) => (
- <button
+ <SharedButton variant="unstyled"
key={option || 'default'}
type="button"
aria-label={name}
@@ -437,7 +438,7 @@ export function WidgetEditor({
onChange={(value) => setSeries(index, 'metric', value)}
options={metricOptionsFor(series.resource, series.metric)}
/>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="skwe-edit__del"
title={t('app.widgetEditor.removeSeries', 'Remove series {{value}}', { value: index + 1 })}
@@ -448,10 +449,10 @@ export function WidgetEditor({
)}
>
<Trash2 size={13} aria-hidden="true" />
- </button>
+ </SharedButton>
</div>
))}
- <button
+ <SharedButton variant="unstyled"
type="button"
className="skwe-edit__add"
onClick={() => set('series', [
@@ -460,7 +461,7 @@ export function WidgetEditor({
])}
>
<Plus size={12} aria-hidden="true" /> {t('app.widgetEditor.addSeries', 'Add series')}
- </button>
+ </SharedButton>
</div>
</Field>
<Field label={t('app.widgetEditor.legend', 'Legend')} inline>
@@ -627,16 +628,16 @@ export function WidgetEditor({
</div>
<div className="skwe-edit__foot">
- <button type="button" className="btn btn-sm" onClick={onDuplicate}>
+ <SharedButton variant="unstyled" type="button" className="btn btn-sm" onClick={onDuplicate}>
<Copy size={13} aria-hidden="true" /> {t('app.widgetEditor.duplicate', 'Duplicate')}
- </button>
- <button type="button" className="btn btn-sm btn-danger" onClick={onRemove}>
+ </SharedButton>
+ <SharedButton variant="danger" type="button" className="btn btn-sm btn-danger" onClick={onRemove}>
<Trash2 size={13} aria-hidden="true" /> {t('common.actions.remove', 'Remove')}
- </button>
+ </SharedButton>
<span className="skwe-edit__spacer" />
- <button type="button" className="btn btn-sm btn-primary" onClick={onClose}>
+ <SharedButton variant="primary" type="button" className="btn btn-sm btn-primary" onClick={onClose}>
{t('common.actions.done', 'Done')}
- </button>
+ </SharedButton>
</div>
</div>
</Drawer>
diff --git a/frontend/src/components/dashboard/grid/WidgetFrame.jsx b/frontend/src/components/dashboard/grid/WidgetFrame.jsx
index af8f5eeb..2c56d355 100644
--- a/frontend/src/components/dashboard/grid/WidgetFrame.jsx
+++ b/frontend/src/components/dashboard/grid/WidgetFrame.jsx
@@ -5,6 +5,7 @@ import {
import { WidgetBody } from '../widgets/renderers';
import { deriveWidgetTitle } from '../widgets/registry';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Chrome around one placed widget: a header (drag handle + title + actions),
// the renderer body, and — in edit mode — the bottom-right resize grip.
@@ -74,7 +75,7 @@ export function WidgetFrame({
{widget.type === 'logs' && <span className="skw-frame__live" aria-hidden="true" />}
<div className="skw-frame__actions">
{edit && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="skw-iconbtn skw-iconbtn--bare"
title={t('app.widgetFrame.configureWidget', 'Configure widget')}
@@ -82,9 +83,9 @@ export function WidgetFrame({
onClick={(event) => { event.stopPropagation(); fire('config'); }}
>
<SlidersHorizontal size={13} />
- </button>
+ </SharedButton>
)}
- <button
+ <SharedButton variant="unstyled"
type="button"
className="skw-iconbtn skw-iconbtn--bare"
title={t('app.widgetFrame.viewFullscreen', 'View fullscreen')}
@@ -92,9 +93,9 @@ export function WidgetFrame({
onClick={(event) => { event.stopPropagation(); fire('full'); }}
>
<Maximize2 size={13} />
- </button>
+ </SharedButton>
<div className="skw-frame__menu-wrap" ref={menuRef}>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="skw-iconbtn skw-iconbtn--bare"
title={t('app.widgetFrame.widgetMenu', 'Widget menu')}
@@ -104,23 +105,23 @@ export function WidgetFrame({
onClick={(event) => { event.stopPropagation(); setMenuOpen((open) => !open); }}
>
<MoreVertical size={14} />
- </button>
+ </SharedButton>
{menuOpen && (
<div className="skw-menu" role="menu" onClick={(event) => event.stopPropagation()}>
- <button type="button" className="skw-menu__item" role="menuitem" onClick={() => fire('config')}>
+ <SharedButton variant="unstyled" type="button" className="skw-menu__item" role="menuitem" onClick={() => fire('config')}>
<span className="skw-menu__ic"><SlidersHorizontal size={14} /></span>
{t('app.widgetFrame.configure', 'Configure')}
- </button>
- <button type="button" className="skw-menu__item" role="menuitem" onClick={() => fire('dup')}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="skw-menu__item" role="menuitem" onClick={() => fire('dup')}>
<span className="skw-menu__ic"><Copy size={14} /></span>
{t('app.widgetFrame.duplicate', 'Duplicate')}
- </button>
- <button type="button" className="skw-menu__item" role="menuitem" onClick={() => fire('full')}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="skw-menu__item" role="menuitem" onClick={() => fire('full')}>
<span className="skw-menu__ic"><Maximize2 size={14} /></span>
{t('app.widgetFrame.viewFullscreen', 'View fullscreen')}
- </button>
+ </SharedButton>
<div className="skw-menu__sep" role="separator" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className="skw-menu__item skw-menu__item--danger"
role="menuitem"
@@ -128,7 +129,7 @@ export function WidgetFrame({
>
<span className="skw-menu__ic"><Trash2 size={14} /></span>
{t('common.actions.remove', 'Remove')}
- </button>
+ </SharedButton>
</div>
)}
</div>
diff --git a/frontend/src/components/dashboard/grid/WidgetFullscreen.jsx b/frontend/src/components/dashboard/grid/WidgetFullscreen.jsx
index 5240a4d4..973e4a59 100644
--- a/frontend/src/components/dashboard/grid/WidgetFullscreen.jsx
+++ b/frontend/src/components/dashboard/grid/WidgetFullscreen.jsx
@@ -3,6 +3,7 @@ import { X } from 'lucide-react';
import { deriveWidgetTitle, getWidgetType, useWidgetTypes } from '../widgets/registry';
import { WidgetBody } from '../widgets/renderers';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
/**
* Modal that blows one widget up to a comfortable reading size. Escape or a
@@ -45,7 +46,7 @@ export function WidgetFullscreen({ widget, type, ctx, onClose }) {
<div className="skw-frame__head">
<span className="skw-frame__title">{title}</span>
<div className="skw-frame__actions">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="skw-iconbtn skw-iconbtn--bare"
title={t('common.actions.close', 'Close')}
@@ -53,7 +54,7 @@ export function WidgetFullscreen({ widget, type, ctx, onClose }) {
onClick={onClose}
>
<X size={15} />
- </button>
+ </SharedButton>
</div>
</div>
<div className="skw-frame__body">
diff --git a/frontend/src/components/dashboard/grid/WidgetLibrary.jsx b/frontend/src/components/dashboard/grid/WidgetLibrary.jsx
index 6a77151d..6d834691 100644
--- a/frontend/src/components/dashboard/grid/WidgetLibrary.jsx
+++ b/frontend/src/components/dashboard/grid/WidgetLibrary.jsx
@@ -2,6 +2,7 @@ import { useMemo, useState } from 'react';
import { LayoutGrid, Plus } from 'lucide-react';
import { Drawer, SearchField } from '@/components/ds';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Registry entries carry a lucide component in `icon`. Guard against a type
// that shipped without one (or with a plain string) so the card still renders.
@@ -252,16 +253,16 @@ export function WidgetLibrary({ types = [], onAdd, onClose }) {
placeholder={t('app.widgetLibrary.searchWidgets', 'Search widgets…')}
/>
<div className="skw-lib__chips">
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`skw-lib__chip${category ? '' : ' skw-lib__chip--on'}`}
aria-pressed={!category}
onClick={() => setCategory(null)}
>
{t('common.labels.all', 'All')}
- </button>
+ </SharedButton>
{categories.map((name) => (
- <button
+ <SharedButton variant="unstyled"
key={name}
type="button"
className={`skw-lib__chip${category === name ? ' skw-lib__chip--on' : ''}`}
@@ -269,7 +270,7 @@ export function WidgetLibrary({ types = [], onAdd, onClose }) {
onClick={() => setCategory(category === name ? null : name)}
>
{name}
- </button>
+ </SharedButton>
))}
</div>
</div>
diff --git a/frontend/src/components/dashboard/widgets/renderers.jsx b/frontend/src/components/dashboard/widgets/renderers.jsx
index a395b3a3..b33171ff 100644
--- a/frontend/src/components/dashboard/widgets/renderers.jsx
+++ b/frontend/src/components/dashboard/widgets/renderers.jsx
@@ -1,3 +1,6 @@
+import { statusColor } from '@/components/ds/status';
+import { Button } from '@/components/ui/button';
+import { formatRelativeTime } from '@/utils/time';
/**
* The 13 core dashboard widget renderers (plan 62).
*
@@ -23,7 +26,7 @@ import {
ShieldCheck,
Terminal,
} from 'lucide-react';
-import { Gauge, Pill } from '@/components/ds';
+import { Gauge, Pill, serviceStatusKind, statusKind, alertStatusKind } from '@/components/ds';
import { getWidgetType } from './registry';
import { useTranslation } from 'react-i18next';
import { t } from '../../../i18n/t';
@@ -80,28 +83,6 @@ function Failed({ error, subject = 'data' }) {
);
}
-function relTime(value) {
- if (!value) return '';
- const stamp = new Date(value).getTime();
- if (Number.isNaN(stamp)) return '';
- const minutes = Math.floor(Math.max(0, Date.now() - stamp) / 60000);
- if (minutes < 1) return 'just now';
- if (minutes < 60) return `${minutes}m ago`;
- const hours = Math.floor(minutes / 60);
- if (hours < 24) return `${hours}h ago`;
- return `${Math.floor(hours / 24)}d ago`;
-}
-
-const OK_STATE = /^(running|healthy|online|succeeded|success|completed|up|active)$/i;
-const BAD_STATE = /^(failed|error|down|exited|stopped|offline|cancelled)$/i;
-
-function pillKind(state) {
- const value = String(state || '');
- if (OK_STATE.test(value)) return 'green';
- if (BAD_STATE.test(value)) return 'red';
- return 'amber';
-}
-
/**
* Multi-series area chart. Hand-rolled rather than reusing ds/AreaChart
* because a widget needs the fill toggle and a height that tracks its cell.
@@ -537,12 +518,12 @@ function WTable({ cfg, ctx }) {
if (key === 'status' || key === 'state') {
return (
<td key={label}>
- <Pill kind={pillKind(value)}>{value || 'unknown'}</Pill>
+ <Pill kind={(cfg.source === 'deploys' ? statusKind(value) : serviceStatusKind(value))}>{value || 'unknown'}</Pill>
</td>
);
}
const isName = key === 'name' || key === 'app_name';
- const text = key === 'created_at' ? relTime(value) : value;
+ const text = key === 'created_at' ? formatRelativeTime(value) : value;
return (
<td key={label} className={isName ? 'nm' : 'mono'}>
{text === null || text === undefined || text === '' ? '—' : String(text)}
@@ -608,13 +589,6 @@ function WLogs({ cfg, ctx }) {
/* ----------------------------------------------------------------- deploys */
-const DEPLOY_COLOR = {
- succeeded: 'var(--green)',
- completed: 'var(--green)',
- failed: 'var(--red)',
- running: 'var(--amber)',
-};
-
// A job reports total_steps + current_step; derive each dot's state from those
// rather than inventing per-step records the API does not return.
function stepState(index, job) {
@@ -643,7 +617,7 @@ function WDeploys({ cfg, ctx }) {
>
<div className="skw-dep__top">
<span className="skw-dep__name">{job.app_name || job.kind || 'deployment'}</span>
- <span className="skw-dep__state mono" style={{ color: DEPLOY_COLOR[job.status] || 'var(--text-faint)' }}>
+ <span className="skw-dep__state mono" style={{ color: statusColor(job.status) }}>
{job.status}
</span>
</div>
@@ -655,7 +629,7 @@ function WDeploys({ cfg, ctx }) {
</div>
)}
<div className="skw-dep__meta mono">
- {job.trigger || 'manual'} · {job.target_server_name || 'local'} · {relTime(job.created_at) || '—'}
+ {job.trigger || 'manual'} · {job.target_server_name || 'local'} · {formatRelativeTime(job.created_at) || '—'}
</div>
</div>
))}
@@ -665,8 +639,6 @@ function WDeploys({ cfg, ctx }) {
/* ------------------------------------------------------------------ alerts */
-const SEVERITY_COLOR = { critical: 'var(--red)', warning: 'var(--amber)' };
-
function WAlerts({ cfg, ctx }) {
const { t } = useTranslation();
const { alerts, loading, error } = useOpenAlerts(cfg.limit, ctx.tick);
@@ -683,17 +655,17 @@ function WAlerts({ cfg, ctx }) {
return (
<div className="skw-list">
{shown.map((alert) => {
- const color = SEVERITY_COLOR[alert.severity] || 'var(--cyan)';
+ const color = statusColor(alert.severity);
return (
<div className="skw-alert" key={alert.id} onClick={() => ctx.navigate?.('/monitoring')}>
<span className="skw-alert__sev" style={{ background: color, boxShadow: `0 0 7px ${color}` }} />
<div className="skw-alert__body">
<div className="skw-alert__title">{alert.title}</div>
<div className="skw-alert__meta mono">
- {alert.target}{alert.time ? ` · ${relTime(alert.time)}` : ''}
+ {alert.target}{alert.time ? ` · ${formatRelativeTime(alert.time)}` : ''}
</div>
</div>
- <Pill kind={alert.state === 'firing' ? 'red' : 'amber'}>{alert.state}</Pill>
+ <Pill kind={alertStatusKind(alert.state)}>{alert.state}</Pill>
</div>
);
})}
@@ -703,8 +675,6 @@ function WAlerts({ cfg, ctx }) {
/* ------------------------------------------------------------------ status */
-const STATE_COLOR = { up: 'var(--green)', down: 'var(--red)', unknown: 'var(--amber)' };
-
function WStatus({ cfg, ctx }) {
const { t } = useTranslation();
const { cells, loading, error, source } = useStatusCells(cfg.source, cfg.limit, ctx.tick);
@@ -718,7 +688,7 @@ function WStatus({ cfg, ctx }) {
return (
<div className="skw-status">
{cells.map((cell) => {
- const color = STATE_COLOR[cell.state] || 'var(--amber)';
+ const color = statusColor(cell.state);
return (
<div
className="skw-status__cell"
@@ -768,7 +738,7 @@ function WFeed({ cfg, ctx }) {
<span className="skw-feed__dot" />
<div className="skw-feed__body">
<div className="skw-feed__text">{describeLog(entry)}</div>
- <div className="skw-feed__time mono">{relTime(entry.created_at)}</div>
+ <div className="skw-feed__time mono">{formatRelativeTime(entry.created_at)}</div>
</div>
</div>
))}
@@ -811,10 +781,10 @@ function WActions({ cfg, ctx }) {
{items.map((key) => {
const [label, Icon, href] = ACTIONS[key];
return (
- <button type="button" className="skw-actions__row" key={key} onClick={() => ctx.navigate?.(href)}>
+ <Button variant="unstyled" type="button" className="skw-actions__row" key={key} onClick={() => ctx.navigate?.(href)}>
<span className="skw-actions__label">{label}</span>
<span className="skw-actions__icon"><Icon size={15} /></span>
- </button>
+ </Button>
);
})}
</div>
diff --git a/frontend/src/components/dashboard/widgets/useWidgetData.js b/frontend/src/components/dashboard/widgets/useWidgetData.js
index 98179fb4..cbba9813 100644
--- a/frontend/src/components/dashboard/widgets/useWidgetData.js
+++ b/frontend/src/components/dashboard/widgets/useWidgetData.js
@@ -5,12 +5,15 @@
*
* De-duplication: a board can easily hold ten stat widgets pointed at the same
* server and range. Each one asks for the SAME history payload, so requests are
- * collapsed through a tiny module-level promise cache keyed by
+ * collapsed through the shared query client, with workspace-scoped keys for
* `<kind>|<resource>|<metric>|<range>|<tick>`. Ten widgets on one tick produce
* one HTTP request; the next tick makes a new key and refetches.
*/
-import { useEffect, useMemo, useRef, useState } from 'react';
+import { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from 'react';
import api from '@/services/api';
+import { queryClient } from '@/services/queryClient';
+import { fetchShared, widgetQueryKey, pruneWidgetQueries } from '@/services/widgetQueries';
+import { useWorkspace } from '@/contexts/useWorkspace.js';
import {
RANGE_IDS,
getMetric,
@@ -21,44 +24,6 @@ import {
stampsFrom,
} from './metrics';
-// Requests for the same key inside this window share one in-flight promise.
-const CACHE_TTL_MS = 4000;
-const CACHE_MAX_ENTRIES = 96;
-
-const cache = new Map();
-
-function prune(now) {
- if (cache.size <= CACHE_MAX_ENTRIES) return;
- for (const [key, entry] of cache) {
- if (now - entry.at > CACHE_TTL_MS) cache.delete(key);
- }
- // Still oversized (a burst of distinct keys) — drop oldest-first.
- while (cache.size > CACHE_MAX_ENTRIES) {
- const oldest = cache.keys().next();
- if (oldest.done) break;
- cache.delete(oldest.value);
- }
-}
-
-/** Share one in-flight promise per key. Exported for tests and for the
- * fullscreen view, which mounts a second copy of the same widget. */
-export function fetchShared(key, loader) {
- const now = Date.now();
- const hit = cache.get(key);
- if (hit && now - hit.at < CACHE_TTL_MS) return hit.promise;
-
- const promise = Promise.resolve().then(loader);
- cache.set(key, { at: now, promise });
- // A failure must not be replayed to a later mount, and must not surface as
- // an unhandled rejection when no consumer is attached yet.
- promise.catch(() => {
- const current = cache.get(key);
- if (current && current.promise === promise) cache.delete(key);
- });
- prune(now);
- return promise;
-}
-
/**
* Normalise a thrown API error into what a widget needs to render.
* ApiClient attaches `status`, so a permission problem (403 from
@@ -80,31 +45,45 @@ function toWidgetError(err) {
* effect — the key is the identity.
*/
function useShared(key, loader, enabled = true) {
+ const { activeWorkspaceId } = useWorkspace();
+ const queryKey = useMemo(() => widgetQueryKey(key, activeWorkspaceId), [key, activeWorkspaceId]);
const loaderRef = useRef(loader);
loaderRef.current = loader;
-
- const [state, setState] = useState({ data: null, loading: Boolean(enabled), error: null });
+ const subscribe = useCallback((listener) => {
+ // Fullscreen can remount while a request is pending. Keep that request
+ // shared until it settles, then bound the unobserved retained results.
+ const unsubscribe = queryClient.subscribe(queryKey, listener, { cancelOnUnsubscribe: false });
+ return () => { unsubscribe(); pruneWidgetQueries(); };
+ }, [queryKey]);
+ const getSnapshot = useCallback(() => queryClient.getSnapshot(queryKey), [queryKey]);
+ const state = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
+ const previous = useRef(null);
+ // Tick is the trailing numeric segment of refreshable widget keys. Keep
+ // the last successful payload during a board refresh, but never carry it
+ // across a changed resource, range, or workspace.
+ const resourceKey = key.replace(/\|\d+$/, '');
+ if (state.status === 'success') {
+ previous.current = { resourceKey, workspaceId: activeWorkspaceId, data: state.data };
+ } else if (state.status === 'error') {
+ previous.current = null;
+ }
+ const previousData = previous.current?.resourceKey === resourceKey
+ && previous.current?.workspaceId === activeWorkspaceId
+ ? previous.current.data : null;
useEffect(() => {
- if (!enabled) {
- setState({ data: null, loading: false, error: null });
- return undefined;
- }
- let cancelled = false;
- setState((prev) => ({ data: prev.data, loading: true, error: null }));
-
- fetchShared(key, () => loaderRef.current())
- .then((data) => {
- if (!cancelled) setState({ data, loading: false, error: null });
- })
- .catch((err) => {
- if (!cancelled) setState({ data: null, loading: false, error: toWidgetError(err) });
- });
-
- return () => { cancelled = true; };
- }, [key, enabled]);
+ if (!enabled) return;
+ fetchShared(key, () => loaderRef.current(), activeWorkspaceId).catch(() => {
+ // The shared snapshot owns errors; keep permission failures visible.
+ });
+ }, [key, activeWorkspaceId, enabled, state.revision]);
- return state;
+ if (!enabled) return { data: null, loading: false, error: null };
+ return {
+ data: state.status === 'error' ? null : state.data ?? previousData,
+ loading: state.status === 'idle' || state.status === 'loading' || state.isFetching,
+ error: state.error ? toWidgetError(state.error) : null,
+ };
}
function safeRange(range) {
diff --git a/frontend/src/components/databases/AdminerSsoButton.jsx b/frontend/src/components/databases/AdminerSsoButton.jsx
index 6ba2942c..eb245ae4 100644
--- a/frontend/src/components/databases/AdminerSsoButton.jsx
+++ b/frontend/src/components/databases/AdminerSsoButton.jsx
@@ -1,7 +1,7 @@
import { useState } from 'react';
import { ExternalLink } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { useTranslation } from 'react-i18next';
diff --git a/frontend/src/components/databases/BackupsTab.jsx b/frontend/src/components/databases/BackupsTab.jsx
index 5ebef208..45f502df 100644
--- a/frontend/src/components/databases/BackupsTab.jsx
+++ b/frontend/src/components/databases/BackupsTab.jsx
@@ -12,6 +12,7 @@ import {
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// The backend reports the engine as the bare wire name it derived from the
// filename prefix; these are what the row (and therefore every rule) says.
@@ -169,9 +170,9 @@ export default function BackupsTab() {
className: 'text-right',
cellClassName: 'dbx-grid-actions',
render: (b) => (
- <button type="button" className="dbx-icon-btn is-danger" onClick={() => remove(b.filename)} aria-label={t('app.backupsTab.delete', 'Delete {{filename}}', { filename: b.filename })}>
+ <SharedButton variant="unstyled" type="button" className="dbx-icon-btn is-danger" onClick={() => remove(b.filename)} aria-label={t('app.backupsTab.delete', 'Delete {{filename}}', { filename: b.filename })}>
<Trash2 size={14} aria-hidden="true" />
- </button>
+ </SharedButton>
),
},
];
diff --git a/frontend/src/components/databases/ConfigTunerPanel.jsx b/frontend/src/components/databases/ConfigTunerPanel.jsx
index c4cffefd..eeef2faf 100644
--- a/frontend/src/components/databases/ConfigTunerPanel.jsx
+++ b/frontend/src/components/databases/ConfigTunerPanel.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback } from 'react';
import { RefreshCw, Undo2, Wand2 } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { Button } from '@/components/ui/button';
import { useTranslation } from 'react-i18next';
diff --git a/frontend/src/components/databases/ConsoleTab.jsx b/frontend/src/components/databases/ConsoleTab.jsx
index bc0215f0..ae80dd4a 100644
--- a/frontend/src/components/databases/ConsoleTab.jsx
+++ b/frontend/src/components/databases/ConsoleTab.jsx
@@ -1,11 +1,12 @@
import { useEffect, useRef, useState, useCallback } from 'react';
import { Play, History, Download, Eraser, Lock, Unlock, Clock } from 'lucide-react';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { runQuery, connKey } from './dbAdapter';
import ResultsGrid from './ResultsGrid';
import SqlEditor from './SqlEditor';
import { downloadBlob } from '@/utils/downloadBlob';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const HISTORY_KEY = 'serverkit_query_history';
const MAX_HISTORY = 50;
@@ -116,7 +117,7 @@ export default function ConsoleTab({ conn, tabId, active, isAdmin, initialQuery
return (
<div className="dbx-console">
<div className="dbx-console-toolbar">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-run"
onClick={execute}
@@ -126,10 +127,10 @@ export default function ConsoleTab({ conn, tabId, active, isAdmin, initialQuery
<Play size={14} aria-hidden="true" />
{loading ? 'Running…' : 'Run'}
<kbd>{MOD_KEY} ↵</kbd>
- </button>
+ </SharedButton>
{isAdmin && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`dbx-toggle ${readonly ? '' : 'is-write'}`}
onClick={() => setReadonly((r) => !r)}
@@ -138,25 +139,25 @@ export default function ConsoleTab({ conn, tabId, active, isAdmin, initialQuery
>
{readonly ? <Lock size={13} aria-hidden="true" /> : <Unlock size={13} aria-hidden="true" />}
{readonly ? 'Read-only' : 'Writes on'}
- </button>
+ </SharedButton>
)}
<div className="dbx-console-toolbar-spacer" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`dbx-chip ${showHistory ? 'is-active' : ''}`}
onClick={() => setShowHistory((s) => !s)}
aria-pressed={showHistory}
>
<History size={14} aria-hidden="true" /> {t('app.consoleTab.history', 'History')}
- </button>
- <button type="button" className="dbx-chip" onClick={() => { setQuery(''); editorRef.current?.focus(); }}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="dbx-chip" onClick={() => { setQuery(''); editorRef.current?.focus(); }}>
<Eraser size={14} aria-hidden="true" /> {t('common.actions.clear', 'Clear')}
- </button>
- <button type="button" className="dbx-chip" onClick={exportCsv} disabled={!results?.rows?.length}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="dbx-chip" onClick={exportCsv} disabled={!results?.rows?.length}>
<Download size={14} aria-hidden="true" /> {t('app.consoleTab.export', 'Export')}
- </button>
+ </SharedButton>
</div>
<div className="dbx-console-split">
@@ -185,7 +186,7 @@ export default function ConsoleTab({ conn, tabId, active, isAdmin, initialQuery
<ul>
{history.map((item, idx) => (
<li key={idx}>
- <button
+ <SharedButton variant="unstyled"
type="button"
onClick={() => { setQuery(item.query); setShowHistory(false); editorRef.current?.focus(); }}
>
@@ -194,7 +195,7 @@ export default function ConsoleTab({ conn, tabId, active, isAdmin, initialQuery
<Clock size={11} aria-hidden="true" />
{new Date(item.timestamp).toLocaleString()}
</span>
- </button>
+ </SharedButton>
</li>
))}
</ul>
diff --git a/frontend/src/components/databases/CreateTableModal.jsx b/frontend/src/components/databases/CreateTableModal.jsx
index 20a7a5d9..8356301c 100644
--- a/frontend/src/components/databases/CreateTableModal.jsx
+++ b/frontend/src/components/databases/CreateTableModal.jsx
@@ -286,9 +286,9 @@ export default function CreateTableModal({ preset, engines = [], isAdmin = false
? 'ServerKit could not reach any database server. Check that MySQL or PostgreSQL is running, then try again.'
: 'Create a database first — the builder writes into an existing one.'}
</p>
- <button type="button" className="dbx-inline-link" onClick={load}>
+ <Button variant="unstyled" type="button" className="dbx-inline-link" onClick={load}>
<RefreshCw size={13} aria-hidden="true" /> {t('app.createTableModal.tryAgain', 'Try again')}
- </button>
+ </Button>
</div>
</div>
) : (
@@ -413,7 +413,7 @@ export default function CreateTableModal({ preset, engines = [], isAdmin = false
</select>
<ChevronDown size={12} aria-hidden="true" />
</div>
- <button
+ <Button variant="unstyled"
type="button"
className={`dbx-cbox${c.pk ? ' is-on' : ''}`}
onClick={() => setKeyCol(i)}
@@ -421,8 +421,8 @@ export default function CreateTableModal({ preset, engines = [], isAdmin = false
aria-label={t('app.createTableModal.onColumn', '{{key}} on column {{value}}', { key: words.key, value: i + 1 })}
>
{c.pk && <Check size={12} aria-hidden="true" />}
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className={`dbx-cbox${c.notNull ? ' is-on' : ''}`}
onClick={() => setCol(i, 'notNull', !c.notNull)}
@@ -430,7 +430,7 @@ export default function CreateTableModal({ preset, engines = [], isAdmin = false
aria-label={t('app.createTableModal.onColumn2', '{{required}} on column {{value}}', { required: words.required, value: i + 1 })}
>
{c.notNull && <Check size={12} aria-hidden="true" />}
- </button>
+ </Button>
<div className="dbx-input dbx-input--sm">
<input
value={c.def}
@@ -440,7 +440,7 @@ export default function CreateTableModal({ preset, engines = [], isAdmin = false
aria-label={t('app.createTableModal.defaultForColumn', 'Default for column {{value}}', { value: i + 1 })}
/>
</div>
- <button
+ <Button variant="unstyled"
type="button"
className="dbx-icon-xs"
onClick={() => removeCol(i)}
@@ -448,13 +448,13 @@ export default function CreateTableModal({ preset, engines = [], isAdmin = false
aria-label={t('app.createTableModal.removeColumn', 'Remove column {{value}}', { value: i + 1 })}
>
<Trash2 size={13} aria-hidden="true" />
- </button>
+ </Button>
</div>
))}
</div>
- <button type="button" className="dbx-inline-link dbx-colgrid__add" onClick={addCol}>
+ <Button variant="unstyled" type="button" className="dbx-inline-link dbx-colgrid__add" onClick={addCol}>
<Plus size={13} aria-hidden="true" /> {t('common.actions.add', 'Add')} {target?.dialect ? 'column' : 'field'}
- </button>
+ </Button>
</div>
<p className="dbx-field-hint">
{target?.dialect ? (
diff --git a/frontend/src/components/databases/DbUsersPanel.jsx b/frontend/src/components/databases/DbUsersPanel.jsx
index a9641761..fbbd803e 100644
--- a/frontend/src/components/databases/DbUsersPanel.jsx
+++ b/frontend/src/components/databases/DbUsersPanel.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback } from 'react';
import { Copy, Plus, Trash2, UserRound } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { Button } from '@/components/ui/button';
import { copyToClipboard } from '@/utils/clipboard';
@@ -31,7 +31,7 @@ export default function DbUsersPanel({ databaseId }) {
} finally {
setLoading(false);
}
- }, [databaseId, toast]);
+ }, [databaseId, t, toast]);
useEffect(() => { load(); }, [load]);
diff --git a/frontend/src/components/databases/EngineCatalogDrawer.jsx b/frontend/src/components/databases/EngineCatalogDrawer.jsx
index 5f93dc8d..169e2c1e 100644
--- a/frontend/src/components/databases/EngineCatalogDrawer.jsx
+++ b/frontend/src/components/databases/EngineCatalogDrawer.jsx
@@ -6,13 +6,14 @@ import {
import api from '../../services/api';
import { Drawer, SearchField } from '@/components/ds';
import EmptyState from '../EmptyState';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import EngineGlyph from './EngineGlyph';
import { useTranslation } from 'react-i18next';
import {
engineInstanceKey, engineLocation, engineMeta, engineTreeStatus, familiesOf,
formatMemory,
} from './engineHelpers';
+import { Button as SharedButton } from '@/components/ui/button';
// "Add a database engine" — the browse half of the install flow.
//
@@ -80,7 +81,7 @@ function EngineCard({ entry, onPick }) {
return (
<li className="dbx-engine-card">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-engine-card__hit"
onClick={() => onPick(entry)}
@@ -106,7 +107,7 @@ function EngineCard({ entry, onPick }) {
{entry.installed_count > 0 ? 'Add another' : 'Install'}
</span>
</span>
- </button>
+ </SharedButton>
</li>
);
}
@@ -198,16 +199,16 @@ export default function EngineCatalogDrawer({
/>
{families.length > 0 && (
<div className="dbx-cat-chips" role="group" aria-label={t('app.engineCatalogDrawer.filterByFamily', 'Filter by family')}>
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`dbx-cat-chip${family ? '' : ' is-on'}`}
onClick={() => setFamily(null)}
aria-pressed={!family}
>
{t('common.labels.all', 'All')}
- </button>
+ </SharedButton>
{families.map((f) => (
- <button
+ <SharedButton variant="unstyled"
key={f}
type="button"
className={`dbx-cat-chip${family === f ? ' is-on' : ''}`}
@@ -215,7 +216,7 @@ export default function EngineCatalogDrawer({
aria-pressed={family === f}
>
{f}
- </button>
+ </SharedButton>
))}
</div>
)}
@@ -266,7 +267,7 @@ export default function EngineCatalogDrawer({
</div>
<footer className="dbx-drawer__foot dbx-drawer__foot--split">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-inline-link"
onClick={syncRepos}
@@ -274,7 +275,7 @@ export default function EngineCatalogDrawer({
>
<RefreshCw size={13} className={syncing ? 'dbx-spin' : undefined} aria-hidden="true" />
{syncing ? 'Syncing…' : 'Sync template repositories'}
- </button>
+ </SharedButton>
<Link
className="dbx-inline-link"
to="/templates"
diff --git a/frontend/src/components/databases/EngineGlyph.jsx b/frontend/src/components/databases/EngineGlyph.jsx
index 09ea038b..27470360 100644
--- a/frontend/src/components/databases/EngineGlyph.jsx
+++ b/frontend/src/components/databases/EngineGlyph.jsx
@@ -1,5 +1,6 @@
import { useState } from 'react';
-import { EngineIcon, hasBrandIcon } from '../icons/DatabaseBrands';
+import { EngineIcon } from '../icons/DatabaseBrands';
+import { hasBrandIcon } from '../icons/databaseBrandData';
import { engineMeta } from './engineHelpers';
// The engine icon, resolved in three steps: the brand glyph we ship, then the
diff --git a/frontend/src/components/databases/EngineInstallDrawer.jsx b/frontend/src/components/databases/EngineInstallDrawer.jsx
index 3de99cef..376805f5 100644
--- a/frontend/src/components/databases/EngineInstallDrawer.jsx
+++ b/frontend/src/components/databases/EngineInstallDrawer.jsx
@@ -9,7 +9,7 @@ import { Drawer, SegControl } from '@/components/ds';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Switch } from '@/components/ui/switch';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import EngineGlyph from './EngineGlyph';
import { copyToClipboard } from '@/utils/clipboard';
import { useTranslation } from 'react-i18next';
@@ -49,7 +49,7 @@ function SecretRow({ password, onRegenerate, disabled }) {
<div className="dbx-secret">
<span className="dbx-secret__value">{revealed ? password : '•'.repeat(20)}</span>
<span className="dbx-secret__actions">
- <button
+ <Button variant="unstyled"
type="button"
className="dbx-icon-xs"
onClick={() => setRevealed((r) => !r)}
@@ -57,9 +57,9 @@ function SecretRow({ password, onRegenerate, disabled }) {
title={revealed ? t('app.engineInstallDrawer.hide', 'Hide') : t('app.engineInstallDrawer.reveal', 'Reveal')}
>
{revealed ? <EyeOff size={13} aria-hidden="true" /> : <Eye size={13} aria-hidden="true" />}
- </button>
+ </Button>
{onRegenerate && (
- <button
+ <Button variant="unstyled"
type="button"
className="dbx-icon-xs"
onClick={() => { onRegenerate(); setRevealed(true); }}
@@ -68,9 +68,9 @@ function SecretRow({ password, onRegenerate, disabled }) {
title={t('app.engineInstallDrawer.regenerate', 'Regenerate')}
>
<RefreshCw size={13} aria-hidden="true" />
- </button>
+ </Button>
)}
- <button
+ <Button variant="unstyled"
type="button"
className="dbx-icon-xs"
onClick={copy}
@@ -78,7 +78,7 @@ function SecretRow({ password, onRegenerate, disabled }) {
title={t('common.actions.copy', 'Copy')}
>
<Copy size={13} aria-hidden="true" />
- </button>
+ </Button>
</span>
</div>
);
@@ -316,13 +316,13 @@ export default function EngineInstallDrawer({ entry, open, onOpenChange, onInsta
{suggestedPort && (
<>
{' '}
- <button
+ <Button variant="unstyled"
type="button"
className="dbx-inline-link"
onClick={() => { setPort(String(suggestedPort)); setError(''); }}
>
{t('app.engineInstallDrawer.usePort', 'Use port')} {suggestedPort}
- </button>
+ </Button>
</>
)}
</div>
diff --git a/frontend/src/components/databases/ImportDumpModal.jsx b/frontend/src/components/databases/ImportDumpModal.jsx
index dc536c23..dd57a1c8 100644
--- a/frontend/src/components/databases/ImportDumpModal.jsx
+++ b/frontend/src/components/databases/ImportDumpModal.jsx
@@ -175,9 +175,9 @@ export default function ImportDumpModal({ preset, isAdmin = false, onClose, onIm
? 'Neither MySQL nor PostgreSQL answered. Check that the server is running, then try again.'
: `Importing is only wired for ${RESTORABLE.map((e) => ENGINE_META[e].short).join(' and ')} databases on this host — SQLite files and containerised databases have no restore route.`}
</p>
- <button type="button" className="dbx-inline-link" onClick={load}>
+ <Button variant="unstyled" type="button" className="dbx-inline-link" onClick={load}>
<RefreshCw size={13} aria-hidden="true" /> {t('app.importDumpModal.tryAgain', 'Try again')}
- </button>
+ </Button>
</div>
</div>
) : (
@@ -217,7 +217,7 @@ export default function ImportDumpModal({ preset, isAdmin = false, onClose, onIm
<span className="dbx-field__label">{t('app.importDumpModal.dumpFile', 'Dump file')}</span>
<div className="dbx-choice" role="group" aria-label={t('app.importDumpModal.whereTheDumpLives', 'Where the dump lives')}>
{SOURCES.map((s) => (
- <button
+ <Button variant="unstyled"
key={s.id}
type="button"
className={`dbx-choice__btn${source === s.id ? ' is-on' : ''}`}
@@ -225,7 +225,7 @@ export default function ImportDumpModal({ preset, isAdmin = false, onClose, onIm
aria-pressed={source === s.id}
>
{s.label}
- </button>
+ </Button>
))}
</div>
@@ -241,7 +241,7 @@ export default function ImportDumpModal({ preset, isAdmin = false, onClose, onIm
{t('app.importDumpModal.noDumpsInServerkitSBackup', 'No dumps in ServerKit\'s backup directory yet. Back up a database, or point at a path below.')}
</p>
) : backups.map((b) => (
- <button
+ <Button variant="unstyled"
key={b.filename}
type="button"
className={`dbx-dump${picked === b.filename ? ' is-on' : ''}`}
@@ -258,7 +258,7 @@ export default function ImportDumpModal({ preset, isAdmin = false, onClose, onIm
<span className={`dbx-dump__tag is-${b.type}`}>
{ENGINE_META[b.type]?.short || b.type}
</span>
- </button>
+ </Button>
))}
</div>
) : (
diff --git a/frontend/src/components/databases/ManagedDatabasesPanel.jsx b/frontend/src/components/databases/ManagedDatabasesPanel.jsx
index 501191f0..92679543 100644
--- a/frontend/src/components/databases/ManagedDatabasesPanel.jsx
+++ b/frontend/src/components/databases/ManagedDatabasesPanel.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback } from 'react';
import { Copy, ShieldCheck, Trash2, RefreshCw, Link2, Users } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { Button } from '@/components/ui/button';
import { Pill } from '../ds';
@@ -32,7 +32,7 @@ export default function ManagedDatabasesPanel() {
} finally {
setLoading(false);
}
- }, [toast]);
+ }, [t, toast]);
useEffect(() => { load(); }, [load]);
diff --git a/frontend/src/components/databases/ProcessListPanel.jsx b/frontend/src/components/databases/ProcessListPanel.jsx
index 33f1e872..6b29a28b 100644
--- a/frontend/src/components/databases/ProcessListPanel.jsx
+++ b/frontend/src/components/databases/ProcessListPanel.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
import { Ban, Activity, TimerReset } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { usePolling } from '../../hooks/usePolling';
import EmptyState from '../EmptyState';
@@ -13,6 +13,7 @@ import {
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const REFRESH_MS = 5000;
const QUERY_PREVIEW_LEN = 120;
@@ -241,7 +242,7 @@ export default function ProcessListPanel({ conn, engine, active, isAdmin }) {
className: 'text-right',
cellClassName: 'dbp-actions',
render: (p) => (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-icon-btn is-danger"
onClick={() => killProcess(p)}
@@ -250,7 +251,7 @@ export default function ProcessListPanel({ conn, engine, active, isAdmin }) {
title={isPg ? t('app.processListPanel.terminateBackend', 'Terminate backend') : t('app.processListPanel.killProcess2', 'Kill process')}
>
<Ban size={14} aria-hidden="true" />
- </button>
+ </SharedButton>
),
});
}
diff --git a/frontend/src/components/databases/ResultsGrid.jsx b/frontend/src/components/databases/ResultsGrid.jsx
index 0ede2e80..b1c537d9 100644
--- a/frontend/src/components/databases/ResultsGrid.jsx
+++ b/frontend/src/components/databases/ResultsGrid.jsx
@@ -2,6 +2,7 @@ import { useMemo, useState } from 'react';
import { ChevronUp, ChevronDown, Database } from 'lucide-react';
import EmptyState from '../EmptyState';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Semantic cell tints (prototype `cellEl`): emails/URLs read as string values,
// positive/negative status words get green/amber.
@@ -90,14 +91,14 @@ export default function ResultsGrid({ columns, rows, loading, error, emptyTitle
scope="col"
aria-sort={sort.col === idx ? (sort.dir === 'asc' ? 'ascending' : 'descending') : 'none'}
>
- <button type="button" className="dbx-grid-th" onClick={() => toggleSort(idx)}>
+ <SharedButton variant="unstyled" type="button" className="dbx-grid-th" onClick={() => toggleSort(idx)}>
<span className="dbx-grid-th-name">{col}</span>
{sort.col === idx && (
sort.dir === 'asc'
? <ChevronUp size={13} aria-hidden="true" />
: <ChevronDown size={13} aria-hidden="true" />
)}
- </button>
+ </SharedButton>
</th>
))}
</tr>
diff --git a/frontend/src/components/databases/SourceTree.jsx b/frontend/src/components/databases/SourceTree.jsx
index 71c5e5f9..4450d1f0 100644
--- a/frontend/src/components/databases/SourceTree.jsx
+++ b/frontend/src/components/databases/SourceTree.jsx
@@ -2,6 +2,7 @@ import { ChevronRight, ChevronDown, Table2, Loader2, MoreHorizontal, Plus, Downl
import { EngineIcon } from '../icons/DatabaseBrands';
import EngineGlyph from './EngineGlyph';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Icon per node kind / engine. Brand glyphs come from DatabaseBrands; tint comes
// from `.is-<engine>` in SCSS (the brand icons use currentColor). An engine
@@ -86,7 +87,7 @@ function TreeRow({ node, depth, expanded, childrenCache, loading, activeKey, sel
onContextMenu={(e) => handlers.onContext(e, node)}
>
{node.expandable ? (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-tree-chevron"
onClick={(e) => { e.stopPropagation(); handlers.onToggle(node); }}
@@ -96,7 +97,7 @@ function TreeRow({ node, depth, expanded, childrenCache, loading, activeKey, sel
{isLoading
? <Loader2 size={13} className="dbx-spin" aria-hidden="true" />
: isOpen ? <ChevronDown size={14} aria-hidden="true" /> : <ChevronRight size={14} aria-hidden="true" />}
- </button>
+ </SharedButton>
) : (
<span className="dbx-tree-chevron dbx-tree-chevron--leaf" aria-hidden="true" />
)}
@@ -130,7 +131,7 @@ function TreeRow({ node, depth, expanded, childrenCache, loading, activeKey, sel
Unlike the row's other buttons this one keeps its place in the
tab order: it is the only way out of the state it announces. */}
{canInstall && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-tree-install-btn"
onClick={(e) => { e.stopPropagation(); handlers.onInstall(node); }}
@@ -138,7 +139,7 @@ function TreeRow({ node, depth, expanded, childrenCache, loading, activeKey, sel
title={t('app.sourceTree.install', 'Install {{label}}', { label: node.label })}
>
<Download size={11} aria-hidden="true" /> {t('app.sourceTree.install2', 'Install')}
- </button>
+ </SharedButton>
)}
{!canInstall && node.installHint && (
<span className="dbx-tree-hint">{node.installHint}</span>
@@ -157,7 +158,7 @@ function TreeRow({ node, depth, expanded, childrenCache, loading, activeKey, sel
)}
{node.canCreate && handlers.onCreateChild && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-tree-add"
onClick={(e) => { e.stopPropagation(); handlers.onCreateChild(node); }}
@@ -166,10 +167,10 @@ function TreeRow({ node, depth, expanded, childrenCache, loading, activeKey, sel
tabIndex={-1}
>
<Plus size={12} aria-hidden="true" />
- </button>
+ </SharedButton>
)}
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-tree-more"
onClick={(e) => { e.stopPropagation(); handlers.onContext(e, node); }}
@@ -177,7 +178,7 @@ function TreeRow({ node, depth, expanded, childrenCache, loading, activeKey, sel
tabIndex={-1}
>
<MoreHorizontal size={14} aria-hidden="true" />
- </button>
+ </SharedButton>
</div>
{node.expandable && isOpen && (
@@ -193,13 +194,13 @@ function TreeRow({ node, depth, expanded, childrenCache, loading, activeKey, sel
{!isLoading && !hadError && childNodes.length === 0 && (
<li className="dbx-tree-leaf-msg" style={{ paddingLeft: `${(depth + 1) * 14 + 22}px` }}>
{canInstall ? (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-tree-leaf-link"
onClick={() => handlers.onInstall(node)}
>
{t('app.sourceTree.notInstalledInstall', 'Not installed — install')} {node.label}
- </button>
+ </SharedButton>
) : emptyLabel(node)}
</li>
)}
diff --git a/frontend/src/components/databases/TableDataTab.jsx b/frontend/src/components/databases/TableDataTab.jsx
index 03b77057..cbf98333 100644
--- a/frontend/src/components/databases/TableDataTab.jsx
+++ b/frontend/src/components/databases/TableDataTab.jsx
@@ -10,6 +10,7 @@ import {
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const PAGE_SIZE = 100;
@@ -242,7 +243,7 @@ export default function TableDataTab({ conn, tabId, table, rowsEstimate, active,
<div className="dbx-table-tab">
<div className="dbx-table-toolbar">
<div className="dbx-segmented" role="tablist" aria-label={t('app.tableDataTab.tableView', 'Table view')}>
- <button
+ <SharedButton variant="unstyled"
type="button"
role="tab"
aria-selected={view === 'data'}
@@ -250,8 +251,8 @@ export default function TableDataTab({ conn, tabId, table, rowsEstimate, active,
onClick={() => setView('data')}
>
<Table2 size={14} aria-hidden="true" /> {t('app.tableDataTab.data', 'Data')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
role="tab"
aria-selected={view === 'structure'}
@@ -259,12 +260,12 @@ export default function TableDataTab({ conn, tabId, table, rowsEstimate, active,
onClick={() => setView('structure')}
>
<Columns3 size={14} aria-hidden="true" /> {t('app.tableDataTab.structure', 'Structure')}
- </button>
+ </SharedButton>
</div>
{view === 'data' && (
<div className="dbx-pager">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-icon-btn"
onClick={() => setPage((p) => Math.max(0, p - 1))}
@@ -272,14 +273,14 @@ export default function TableDataTab({ conn, tabId, table, rowsEstimate, active,
aria-label={t('app.tableDataTab.previousPage', 'Previous page')}
>
<ChevronLeft size={15} aria-hidden="true" />
- </button>
+ </SharedButton>
<span className="dbx-pager-label">
{rowsEstimate === 0
? '0 rows'
: `${page * PAGE_SIZE + 1}–${page * PAGE_SIZE + (data?.row_count || 0)}`}
{rowsEstimate != null && rowsEstimate > 0 && <span className="dbx-pager-total"> {t('app.tableDataTab.of', 'of ≈')}{rowsEstimate.toLocaleString()}</span>}
</span>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-icon-btn"
onClick={() => setPage((p) => p + 1)}
@@ -287,20 +288,20 @@ export default function TableDataTab({ conn, tabId, table, rowsEstimate, active,
aria-label={t('app.tableDataTab.nextPage', 'Next page')}
>
<ChevronRight size={15} aria-hidden="true" />
- </button>
+ </SharedButton>
</div>
)}
<div className="dbx-table-toolbar-spacer" />
- <button type="button" className="dbx-chip" onClick={() => onOpenConsole?.(`SELECT * FROM ${table} LIMIT 100;`)}>
+ <SharedButton variant="unstyled" type="button" className="dbx-chip" onClick={() => onOpenConsole?.(`SELECT * FROM ${table} LIMIT 100;`)}>
<Terminal size={14} aria-hidden="true" /> {t('app.tableDataTab.query', 'Query')}
- </button>
+ </SharedButton>
{/* Data only. The structure table's refresh lives in its own
"⋮" with the rest of its table-wide actions, so the schema
never carries two ways to reload it. */}
{view === 'data' && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-icon-btn"
onClick={() => loadData(page)}
@@ -308,7 +309,7 @@ export default function TableDataTab({ conn, tabId, table, rowsEstimate, active,
aria-label={t('common.actions.refresh', 'Refresh')}
>
<RefreshCw size={14} className={dataLoading ? 'dbx-spin' : ''} aria-hidden="true" />
- </button>
+ </SharedButton>
)}
</div>
diff --git a/frontend/src/components/databases/engineHelpers.js b/frontend/src/components/databases/engineHelpers.js
index 7ad16f41..b18578f7 100644
--- a/frontend/src/components/databases/engineHelpers.js
+++ b/frontend/src/components/databases/engineHelpers.js
@@ -6,7 +6,7 @@
// `GET /api/v1/databases/engines` returns, which is what lets a brand-new
// engine template work with zero UI changes.
-import { hasBrandIcon } from '../icons/DatabaseBrands';
+import { hasBrandIcon } from '../icons/databaseBrandData';
// Templates put their engine metadata in `engine`; an installed engine is an
// Application whose template metadata was resolved onto it the same way.
diff --git a/frontend/src/components/databases/modals.jsx b/frontend/src/components/databases/modals.jsx
index 48632760..4e5d21f4 100644
--- a/frontend/src/components/databases/modals.jsx
+++ b/frontend/src/components/databases/modals.jsx
@@ -55,7 +55,7 @@ function EnginePicker({ value, onChange, status, onInstallEngine }) {
{CREATABLE_ENGINES.map((engine) => {
const running = Boolean(status?.[engine]?.installed && status?.[engine]?.running);
return (
- <button
+ <Button variant="unstyled"
key={engine}
type="button"
className={`dbx-eng-opt${value === engine ? ' is-on' : ''}`}
@@ -70,11 +70,11 @@ function EnginePicker({ value, onChange, status, onInstallEngine }) {
<span className="dbx-eng-opt__name">{ENGINE_META[engine].label}</span>
<span className="dbx-eng-opt__sub">{running ? 'running' : 'not running'}</span>
</span>
- </button>
+ </Button>
);
})}
{onInstallEngine && (
- <button
+ <Button variant="unstyled"
type="button"
className="dbx-eng-opt dbx-eng-opt--ghost"
onClick={onInstallEngine}
@@ -84,7 +84,7 @@ function EnginePicker({ value, onChange, status, onInstallEngine }) {
<span className="dbx-eng-opt__name">{t('app.modals.installAnEngine', 'Install an engine')}</span>
<span className="dbx-eng-opt__sub">{t('app.modals.fromTheTemplateCatalog', 'from the template catalog')}</span>
</span>
- </button>
+ </Button>
)}
</div>
);
diff --git a/frontend/src/components/deploy-console/ConsoleToolbar.jsx b/frontend/src/components/deploy-console/ConsoleToolbar.jsx
index 45591561..5f8971ab 100644
--- a/frontend/src/components/deploy-console/ConsoleToolbar.jsx
+++ b/frontend/src/components/deploy-console/ConsoleToolbar.jsx
@@ -1,5 +1,6 @@
import { ArrowDown, ArrowUp, Copy, Download, Maximize2, Minimize2, Search } from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const LEVELS = ['all', 'info', 'warn', 'error', 'debug'];
@@ -25,30 +26,30 @@ export default function ConsoleToolbar({
return (
<div className="deploy-console__toolbar">
<div className="deploy-console__toolbar-group">
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`deploy-console__toggle ${follow ? 'is-active' : ''}`}
onClick={onToggleFollow}
aria-pressed={follow}
>
{t('app.consoleToolbar.follow', 'Follow')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className={`deploy-console__toggle ${wrap ? 'is-active' : ''}`}
onClick={onToggleWrap}
aria-pressed={wrap}
>
{t('app.consoleToolbar.wrap', 'Wrap')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className={`deploy-console__toggle ${timestamps ? 'is-active' : ''}`}
onClick={onToggleTimestamps}
aria-pressed={timestamps}
>
{t('app.consoleToolbar.timestamps', 'Timestamps')}
- </button>
+ </SharedButton>
<label className="deploy-console__level">
<span className="sr-only">{t('app.consoleToolbar.logLevel', 'Log level')}</span>
<select value={level} onChange={(e) => onLevelChange(e.target.value)}>
@@ -58,24 +59,24 @@ export default function ConsoleToolbar({
</select>
</label>
{errorCount > 0 && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`deploy-console__chip deploy-console__chip--error ${level === 'error' ? 'is-active' : ''}`}
onClick={() => toggleLevel('error')}
aria-pressed={level === 'error'}
>
{errorCount} error{errorCount === 1 ? '' : 's'}
- </button>
+ </SharedButton>
)}
{warnCount > 0 && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`deploy-console__chip deploy-console__chip--warn ${level === 'warn' ? 'is-active' : ''}`}
onClick={() => toggleLevel('warn')}
aria-pressed={level === 'warn'}
>
{warnCount} warning{warnCount === 1 ? '' : 's'}
- </button>
+ </SharedButton>
)}
</div>
@@ -95,7 +96,7 @@ export default function ConsoleToolbar({
<span className="deploy-console__nav-count">
{navCount ? `${Math.min(navPos + 1, navCount)}/${navCount}` : ''} {navLabel}
</span>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="deploy-console__toggle"
onClick={onNavPrev}
@@ -103,8 +104,8 @@ export default function ConsoleToolbar({
title={t('app.consoleToolbar.previous', 'Previous {{value}}', { value: navLabel || 'match' })}
>
<ArrowUp size={14} />
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className="deploy-console__toggle"
onClick={onNavNext}
@@ -112,15 +113,15 @@ export default function ConsoleToolbar({
title={t('app.consoleToolbar.next', 'Next {{value}}', { value: navLabel || 'match' })}
>
<ArrowDown size={14} />
- </button>
+ </SharedButton>
</div>
- <button type="button" className="deploy-console__toggle" onClick={onCopy} title={t('app.consoleToolbar.copyAllLogs', 'Copy all logs')}>
+ <SharedButton variant="unstyled" type="button" className="deploy-console__toggle" onClick={onCopy} title={t('app.consoleToolbar.copyAllLogs', 'Copy all logs')}>
<Copy size={14} /> {t('common.actions.copy', 'Copy')}
- </button>
- <button type="button" className="deploy-console__toggle" onClick={onDownload} title={t('app.consoleToolbar.downloadLogsAsTxt', 'Download logs as .txt')}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="deploy-console__toggle" onClick={onDownload} title={t('app.consoleToolbar.downloadLogsAsTxt', 'Download logs as .txt')}>
<Download size={14} /> {t('common.actions.download', 'Download')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className={`deploy-console__toggle ${focused ? 'is-active' : ''}`}
onClick={onToggleFocus}
@@ -129,7 +130,7 @@ export default function ConsoleToolbar({
>
{focused ? <Minimize2 size={14} /> : <Maximize2 size={14} />}
{focused ? 'Exit' : 'Expand'}
- </button>
+ </SharedButton>
</div>
</div>
);
diff --git a/frontend/src/components/deploy-console/ErrorCard.jsx b/frontend/src/components/deploy-console/ErrorCard.jsx
index 59562927..73b0b687 100644
--- a/frontend/src/components/deploy-console/ErrorCard.jsx
+++ b/frontend/src/components/deploy-console/ErrorCard.jsx
@@ -1,8 +1,9 @@
import { useContext, useState } from 'react';
import { AlertTriangle, RefreshCw, Copy, Sparkles, ChevronDown, ChevronRight } from 'lucide-react';
-import { AIContext } from '../../contexts/AIContext';
+import { AIContext } from '../../contexts/useServerkitAI.js';
import { copyToClipboard } from '@/utils/clipboard';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Pinned failure card (plan 51 §1.1): failed step name, the one-line error, a
// plain-language hint when a heuristic matched, actions (Retry / Copy / Ask AI)
@@ -66,20 +67,20 @@ export default function ErrorCard({ failedStepName, failureTail, hint, errorMess
)}
<div className="deploy-console__error-actions">
- <button type="button" className="deploy-console__btn deploy-console__btn--primary" onClick={onRetry} disabled={retrying}>
+ <SharedButton variant="unstyled" type="button" className="deploy-console__btn deploy-console__btn--primary" onClick={onRetry} disabled={retrying}>
<RefreshCw size={14} className={retrying ? 'deploy-console__spin' : ''} />
{retrying ? 'Retrying…' : 'Retry deploy'}
- </button>
- <button type="button" className="deploy-console__btn" onClick={copyError}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="deploy-console__btn" onClick={copyError}>
<Copy size={14} /> {t('app.errorCard.copyError', 'Copy error')}
- </button>
+ </SharedButton>
{ai?.open && (
- <button type="button" className="deploy-console__btn" onClick={askAI}>
+ <SharedButton variant="unstyled" type="button" className="deploy-console__btn" onClick={askAI}>
<Sparkles size={14} /> {t('app.errorCard.askAi', 'Ask AI')}
- </button>
+ </SharedButton>
)}
{tailLines.length > 0 && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="deploy-console__error-toggle"
onClick={() => setShowTail((v) => !v)}
@@ -89,7 +90,7 @@ export default function ErrorCard({ failedStepName, failureTail, hint, errorMess
{showTail
? 'Hide output'
: `Show output (${tailLines.length} line${tailLines.length === 1 ? '' : 's'})`}
- </button>
+ </SharedButton>
)}
</div>
</div>
diff --git a/frontend/src/components/deploy-console/LogPane.jsx b/frontend/src/components/deploy-console/LogPane.jsx
index e5a5e01e..cb982417 100644
--- a/frontend/src/components/deploy-console/LogPane.jsx
+++ b/frontend/src/components/deploy-console/LogPane.jsx
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { ArrowDown, ChevronDown, ChevronRight } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { scrollBehavior } from '@/utils/reducedMotion';
+import { Button as SharedButton } from '@/components/ui/button';
// How many slices the severity map is divided into. Enough to resolve a single
// error in a long log without rendering a node per line.
@@ -181,7 +182,7 @@ export default function LogPane({
return (
<div className="deploy-console__sec" key={section.key}>
{showSections && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`deploy-console__sec-head ${isShut ? 'is-shut' : ''}`}
data-step={section.step ?? undefined}
@@ -197,7 +198,7 @@ export default function LogPane({
)}
{section.warns > 0 && ` · ${section.warns} warning${section.warns === 1 ? '' : 's'}`}
</span>
- </button>
+ </SharedButton>
)}
{!isShut && section.rows.map(({ ln, i }) => {
const ts = timestamps && ln.ts
@@ -240,9 +241,9 @@ export default function LogPane({
</div>
)}
{showJump && (
- <button type="button" className="deploy-console__jump" onClick={jumpToLive}>
+ <SharedButton variant="unstyled" type="button" className="deploy-console__jump" onClick={jumpToLive}>
<ArrowDown size={14} /> {t('app.logPane.jumpToLive', 'Jump to live')}
- </button>
+ </SharedButton>
)}
</div>
);
diff --git a/frontend/src/components/deploy-console/PipelineStrip.jsx b/frontend/src/components/deploy-console/PipelineStrip.jsx
index 210e84dd..a2ef3d3d 100644
--- a/frontend/src/components/deploy-console/PipelineStrip.jsx
+++ b/frontend/src/components/deploy-console/PipelineStrip.jsx
@@ -1,5 +1,6 @@
import { Check, Loader2, X, Circle } from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Per-step duration formatter (seconds -> "3s" / "1m 4s").
const fmtSeconds = (s) => {
@@ -33,7 +34,7 @@ export default function PipelineStrip({ steps, selected, onStepClick }) {
const Icon = STATE_ICON[step.state] || Circle;
const pct = Math.round(((step.seconds || 0) / total) * 100);
return (
- <button
+ <SharedButton variant="unstyled"
type="button"
role="listitem"
key={step.index}
@@ -62,7 +63,7 @@ export default function PipelineStrip({ steps, selected, onStepClick }) {
? 'running…'
: fmtSeconds(step.seconds) || (step.state === 'pending' ? 'pending' : '—')}
</span>
- </button>
+ </SharedButton>
);
})}
</div>
diff --git a/frontend/src/components/deploy-console/SuccessBanner.jsx b/frontend/src/components/deploy-console/SuccessBanner.jsx
index de0e944a..ac93cd1c 100644
--- a/frontend/src/components/deploy-console/SuccessBanner.jsx
+++ b/frontend/src/components/deploy-console/SuccessBanner.jsx
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { CheckCircle2, Database, ExternalLink, LayoutGrid, ScrollText } from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const fmtSeconds = (s) => {
if (s == null) return '—';
@@ -80,13 +81,13 @@ export default function SuccessBanner({ job, appUrl, engineTarget = null, armAut
: `${returnLabel} is waiting in Databases.`}
</span>
{counting && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="deploy-console__btn"
onClick={() => { setStayed(true); setCountdown(null); }}
>
{t('app.successBanner.stayHere', 'Stay here')}
- </button>
+ </SharedButton>
)}
</div>
)}
diff --git a/frontend/src/components/deployments/ConfigDiffModal.jsx b/frontend/src/components/deployments/ConfigDiffModal.jsx
index 2664fc27..aa3ac61e 100644
--- a/frontend/src/components/deployments/ConfigDiffModal.jsx
+++ b/frontend/src/components/deployments/ConfigDiffModal.jsx
@@ -4,7 +4,7 @@ import api from '../../services/api';
import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
import { Pill } from '@/components/ds';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { useTranslation } from 'react-i18next';
diff --git a/frontend/src/components/docker/ComposeTab.jsx b/frontend/src/components/docker/ComposeTab.jsx
index e89e023c..35d5c5e2 100644
--- a/frontend/src/components/docker/ComposeTab.jsx
+++ b/frontend/src/components/docker/ComposeTab.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useMemo, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import EmptyState from '../EmptyState';
import Modal from '@/components/Modal';
@@ -263,13 +263,13 @@ const ComposeTab = ({ onStatsChange }) => {
sortable: false,
hideable: false,
width: 132,
- className: 'text-right',
+ className: 'docker-compose-actions-column',
render: (project) => {
const busy = !!actionLoading[projectName(project)];
const running = isProjectRunning(project);
return (
<div className="dx-row-actions">
- <button
+ <Button variant="unstyled"
type="button"
className="dx-row-action"
onClick={() => setLogsProject(project)}
@@ -277,10 +277,10 @@ const ComposeTab = ({ onStatsChange }) => {
title={t('common.labels.logs', 'Logs')}
>
<FileText size={13} />
- </button>
+ </Button>
{running ? (
<>
- <button
+ <Button variant="unstyled"
type="button"
className="dx-row-action"
onClick={() => handleAction(project, 'restart')}
@@ -288,8 +288,8 @@ const ComposeTab = ({ onStatsChange }) => {
title={t('common.actions.restart', 'Restart')}
>
<RotateCw size={13} />
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className="dx-row-action is-danger"
onClick={() => handleAction(project, 'down')}
@@ -297,10 +297,10 @@ const ComposeTab = ({ onStatsChange }) => {
title={t('common.actions.stop', 'Stop')}
>
<Square size={13} />
- </button>
+ </Button>
</>
) : (
- <button
+ <Button variant="unstyled"
type="button"
className="dx-row-action is-success"
onClick={() => handleAction(project, 'up')}
@@ -308,9 +308,9 @@ const ComposeTab = ({ onStatsChange }) => {
title={t('common.actions.start', 'Start')}
>
<Play size={13} />
- </button>
+ </Button>
)}
- <button
+ <Button variant="unstyled"
type="button"
className="dx-row-action"
onClick={() => handleAction(project, 'pull')}
@@ -318,7 +318,7 @@ const ComposeTab = ({ onStatsChange }) => {
title={t('app.composeTab.pullImages', 'Pull images')}
>
<Download size={13} />
- </button>
+ </Button>
</div>
);
},
@@ -489,12 +489,12 @@ const ComposeLogsModal = ({ project, onClose }) => {
return (
<Modal open onClose={onClose} title={t('app.composeTab.logs2', 'Logs: {{name}}', { name: name })} size="lg">
<div className="modal-body">
- <div className="logs-controls flex flex-wrap items-center gap-2 mb-2">
+ <div className="logs-controls docker-compose-log-controls">
<label>{t('app.composeTab.service', 'Service:')}</label>
<select
value={selectedService}
onChange={(e) => setSelectedService(e.target.value)}
- className="py-2 px-2"
+ className="docker-compose-log-select"
>
<option value="">{t('app.composeTab.allServices', 'All Services')}</option>
{services.map(service => (
@@ -502,7 +502,7 @@ const ComposeLogsModal = ({ project, onClose }) => {
))}
</select>
<label>{t('app.composeTab.lines', 'Lines:')}</label>
- <select value={tail} onChange={(e) => setTail(Number(e.target.value))} className="py-2 px-2">
+ <select value={tail} onChange={(e) => setTail(Number(e.target.value))} className="docker-compose-log-select">
<option value={50}>50</option>
<option value={100}>100</option>
<option value={200}>200</option>
diff --git a/frontend/src/components/docker/ContainersTab.jsx b/frontend/src/components/docker/ContainersTab.jsx
index 30bb46ee..c0fe988c 100644
--- a/frontend/src/components/docker/ContainersTab.jsx
+++ b/frontend/src/components/docker/ContainersTab.jsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useMemo, useRef, useCallback } from 'react';
import { statusKind } from '@/components/ds/status';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import LogToolbar from '../log-viewer/LogToolbar';
import LogContent from '../log-viewer/LogContent';
@@ -502,7 +502,6 @@ const ContainersTab = ({ onStatsChange }) => {
boxShadow: isRunning
? `0 0 6px hsl(${containerHue(getContainerName(container))} 60% 60% / 0.55)`
: 'none',
- opacity: isRunning ? 1 : 0.4,
}}
/>
<span title={getContainerName(container)}>{getContainerName(container)}</span>
@@ -659,13 +658,13 @@ const ContainersTab = ({ onStatsChange }) => {
const isProtected = isProtectedContainer(container);
return (
<div className="dx-row-actions" onClick={(e) => e.stopPropagation()}>
- <button type="button" className="dx-row-action" onClick={() => setLogsContainer(container)} title={t('common.labels.logs', 'Logs')}>
+ <Button variant="unstyled" type="button" className="dx-row-action" onClick={() => setLogsContainer(container)} title={t('common.labels.logs', 'Logs')}>
<FileText size={13} />
- </button>
+ </Button>
{isRunning && !isRemote && (
- <button type="button" className="dx-row-action" onClick={() => setExecContainer(container)} title={t('app.containersTab.exec', 'Exec')}>
+ <Button variant="unstyled" type="button" className="dx-row-action" onClick={() => setExecContainer(container)} title={t('app.containersTab.exec', 'Exec')}>
<TerminalLucide size={13} />
- </button>
+ </Button>
)}
{isProtected ? (
<span className="dx-row-protected" title={t('app.containersTab.serverkitSystemContainerManagedByThe', 'ServerKit system container — managed by the panel, lifecycle controls are disabled')}>
@@ -673,21 +672,21 @@ const ContainersTab = ({ onStatsChange }) => {
</span>
) : isRunning ? (
<>
- <button type="button" className="dx-row-action" onClick={() => handleAction(containerId, 'restart')} title={t('common.actions.restart', 'Restart')}>
+ <Button variant="unstyled" type="button" className="dx-row-action" onClick={() => handleAction(containerId, 'restart')} title={t('common.actions.restart', 'Restart')}>
<RotateCw size={13} />
- </button>
- <button type="button" className="dx-row-action is-danger" onClick={() => handleAction(containerId, 'stop')} title={t('common.actions.stop', 'Stop')}>
+ </Button>
+ <Button variant="unstyled" type="button" className="dx-row-action is-danger" onClick={() => handleAction(containerId, 'stop')} title={t('common.actions.stop', 'Stop')}>
<Square size={13} />
- </button>
+ </Button>
</>
) : (
<>
- <button type="button" className="dx-row-action is-success" onClick={() => handleAction(containerId, 'start')} title={t('common.actions.start', 'Start')}>
+ <Button variant="unstyled" type="button" className="dx-row-action is-success" onClick={() => handleAction(containerId, 'start')} title={t('common.actions.start', 'Start')}>
<Play size={13} />
- </button>
- <button type="button" className="dx-row-action is-danger" onClick={() => handleAction(containerId, 'remove')} title={t('common.actions.remove', 'Remove')}>
+ </Button>
+ <Button variant="unstyled" type="button" className="dx-row-action is-danger" onClick={() => handleAction(containerId, 'remove')} title={t('common.actions.remove', 'Remove')}>
<Trash2 size={13} />
- </button>
+ </Button>
</>
)}
</div>
@@ -776,15 +775,15 @@ const ContainersTab = ({ onStatsChange }) => {
you cannot undo, and the per-row action already asks. Protected
system containers are skipped, not silently failed. */}
<GridBulkBar count={picked.length} noun="container" onClear={() => setPicked([])}>
- <button type="button" onClick={() => handleBulkAction('restart')} disabled={bulkBusy}>
+ <Button variant="unstyled" type="button" onClick={() => handleBulkAction('restart')} disabled={bulkBusy}>
<RotateCw size={13} /> {t('common.actions.restart', 'Restart')}
- </button>
- <button type="button" onClick={() => handleBulkAction('stop')} disabled={bulkBusy}>
+ </Button>
+ <Button variant="unstyled" type="button" onClick={() => handleBulkAction('stop')} disabled={bulkBusy}>
<Square size={13} /> {t('common.actions.stop', 'Stop')}
- </button>
- <button type="button" onClick={() => handleBulkAction('start')} disabled={bulkBusy}>
+ </Button>
+ <Button variant="unstyled" type="button" onClick={() => handleBulkAction('start')} disabled={bulkBusy}>
<Play size={13} /> {t('common.actions.start', 'Start')}
- </button>
+ </Button>
</GridBulkBar>
{/* Only the SEARCH can empty the pane outright. A column rule that
@@ -955,12 +954,12 @@ const ContainerInspector = ({ container, stats, onAction, onOpenLogs, onOpenExec
<h3 title={getContainerName(container)}>{getContainerName(container)}</h3>
<span>{shortId(containerId)}</span>
</div>
- <button type="button" className="dx-row-action" onClick={copyContainerId} title={t('app.containersTab.copyContainerId', 'Copy container ID')}>
+ <Button variant="unstyled" type="button" className="dx-row-action" onClick={copyContainerId} title={t('app.containersTab.copyContainerId', 'Copy container ID')}>
<Copy size={13} />
- </button>
- <button type="button" className="dx-row-action" onClick={onClose} title={t('app.containersTab.closeDetails', 'Close details')}>
+ </Button>
+ <Button variant="unstyled" type="button" className="dx-row-action" onClick={onClose} title={t('app.containersTab.closeDetails', 'Close details')}>
<X size={13} />
- </button>
+ </Button>
</div>
<div className="dx-inspector-status">
@@ -971,13 +970,13 @@ const ContainerInspector = ({ container, stats, onAction, onOpenLogs, onOpenExec
</div>
<div className="dx-inspector-actions">
- <button type="button" className="dx-action-btn" onClick={() => onOpenLogs(container)}>
+ <Button variant="unstyled" type="button" className="dx-action-btn" onClick={() => onOpenLogs(container)}>
<FileText size={13} /> {t('common.labels.logs', 'Logs')}
- </button>
+ </Button>
{isRunning && !isRemote && (
- <button type="button" className="dx-action-btn" onClick={() => onOpenExec(container)}>
+ <Button variant="unstyled" type="button" className="dx-action-btn" onClick={() => onOpenExec(container)}>
<TerminalLucide size={13} /> {t('app.containersTab.exec', 'Exec')}
- </button>
+ </Button>
)}
{isProtected ? (
<span className="dx-action-protected" title={t('app.containersTab.serverkitSystemContainerManagedByThe', 'ServerKit system container — managed by the panel, lifecycle controls are disabled')}>
@@ -985,34 +984,34 @@ const ContainerInspector = ({ container, stats, onAction, onOpenLogs, onOpenExec
</span>
) : isRunning ? (
<>
- <button type="button" className="dx-action-btn" onClick={() => onAction(containerId, 'restart')}>
+ <Button variant="unstyled" type="button" className="dx-action-btn" onClick={() => onAction(containerId, 'restart')}>
<RotateCw size={13} /> {t('common.actions.restart', 'Restart')}
- </button>
- <button type="button" className="dx-action-btn is-danger" onClick={() => onAction(containerId, 'stop')}>
+ </Button>
+ <Button variant="unstyled" type="button" className="dx-action-btn is-danger" onClick={() => onAction(containerId, 'stop')}>
<Square size={13} /> {t('common.actions.stop', 'Stop')}
- </button>
+ </Button>
</>
) : (
<>
- <button type="button" className="dx-action-btn is-success" onClick={() => onAction(containerId, 'start')}>
+ <Button variant="unstyled" type="button" className="dx-action-btn is-success" onClick={() => onAction(containerId, 'start')}>
<Play size={13} /> {t('common.actions.start', 'Start')}
- </button>
- <button type="button" className="dx-action-btn is-danger" onClick={() => onAction(containerId, 'remove')}>
+ </Button>
+ <Button variant="unstyled" type="button" className="dx-action-btn is-danger" onClick={() => onAction(containerId, 'remove')}>
<Trash2 size={13} /> {t('common.actions.remove', 'Remove')}
- </button>
+ </Button>
</>
)}
</div>
<div className="dx-inspector-tabs">
{['overview', 'ports', 'mounts', 'env'].map(section => (
- <button type="button"
+ <Button variant="unstyled" type="button"
key={section}
className={activeSection === section ? 'active' : ''}
onClick={() => setActiveSection(section)}
>
{section}
- </button>
+ </Button>
))}
</div>
diff --git a/frontend/src/components/docker/ImagesTab.jsx b/frontend/src/components/docker/ImagesTab.jsx
index c1728242..f63b6be1 100644
--- a/frontend/src/components/docker/ImagesTab.jsx
+++ b/frontend/src/components/docker/ImagesTab.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useMemo, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import EmptyState from '../EmptyState';
import Modal from '@/components/Modal';
@@ -311,14 +311,14 @@ const ImagesTab = ({ onStatsChange }) => {
className: 'text-right',
render: (image) => (
<div className="dx-row-actions">
- <button
+ <Button variant="unstyled"
type="button"
className="dx-row-action is-danger"
onClick={() => handleRemove(image)}
title={t('app.imagesTab.removeImage2', 'Remove image')}
>
<Trash2 size={13} />
- </button>
+ </Button>
</div>
),
},
diff --git a/frontend/src/components/docker/NetworksTab.jsx b/frontend/src/components/docker/NetworksTab.jsx
index 221f3052..14059312 100644
--- a/frontend/src/components/docker/NetworksTab.jsx
+++ b/frontend/src/components/docker/NetworksTab.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useMemo, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import EmptyState from '../EmptyState';
import Modal from '@/components/Modal';
@@ -241,14 +241,14 @@ const NetworksTab = ({ onStatsChange }) => {
<Lock size={11} /> {t('common.labels.system', 'System')}
</span>
) : (
- <button
+ <Button variant="unstyled"
type="button"
className="dx-row-action is-danger"
onClick={() => handleRemove(network)}
title={t('app.networksTab.removeNetwork2', 'Remove network')}
>
<Trash2 size={13} />
- </button>
+ </Button>
)}
</div>
),
diff --git a/frontend/src/components/docker/PruneButton.jsx b/frontend/src/components/docker/PruneButton.jsx
index 46e0f3d0..7c10cb37 100644
--- a/frontend/src/components/docker/PruneButton.jsx
+++ b/frontend/src/components/docker/PruneButton.jsx
@@ -1,6 +1,6 @@
import { useState } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { Button } from '@/components/ui/button';
import { useServer } from './dockerHelpers';
diff --git a/frontend/src/components/docker/VolumesTab.jsx b/frontend/src/components/docker/VolumesTab.jsx
index f98fe895..1d8dd7d2 100644
--- a/frontend/src/components/docker/VolumesTab.jsx
+++ b/frontend/src/components/docker/VolumesTab.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useMemo, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import EmptyState from '../EmptyState';
import Modal from '@/components/Modal';
@@ -238,14 +238,14 @@ const VolumesTab = ({ onStatsChange }) => {
className: 'text-right',
render: (volume) => (
<div className="dx-row-actions">
- <button
+ <Button variant="unstyled"
type="button"
className="dx-row-action is-danger"
onClick={() => handleRemove(volume)}
title={t('app.volumesTab.removeVolume2', 'Remove volume')}
>
<Trash2 size={13} />
- </button>
+ </Button>
</div>
),
},
diff --git a/frontend/src/components/domains/CutoverDrawer.jsx b/frontend/src/components/domains/CutoverDrawer.jsx
index ba773038..0e425284 100644
--- a/frontend/src/components/domains/CutoverDrawer.jsx
+++ b/frontend/src/components/domains/CutoverDrawer.jsx
@@ -9,7 +9,7 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { ConfirmDialog } from '@/components/ConfirmDialog';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import Spinner from '../Spinner';
import { useTranslation } from 'react-i18next';
diff --git a/frontend/src/components/domains/DdnsTokenCallout.jsx b/frontend/src/components/domains/DdnsTokenCallout.jsx
index e3a770c3..4c932ce1 100644
--- a/frontend/src/components/domains/DdnsTokenCallout.jsx
+++ b/frontend/src/components/domains/DdnsTokenCallout.jsx
@@ -4,6 +4,7 @@
import { AlertTriangle } from 'lucide-react';
import CopyButton from '../CopyButton';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
export default function DdnsTokenCallout({ host, onDismiss }) {
const { t } = useTranslation();
@@ -18,9 +19,9 @@ export default function DdnsTokenCallout({ host, onDismiss }) {
{t('app.ddnsTokenCallout.tokenFor', 'Token for')} <strong>{host.hostname || host.record_name}</strong> {t('app.ddnsTokenCallout.shownOnceSaveItNow', '— shown once. Save it now.')}
</span>
{onDismiss && (
- <button type="button" className="ddns-token-callout__close" onClick={onDismiss} aria-label={t('common.actions.dismiss', 'Dismiss')}>
+ <SharedButton variant="unstyled" type="button" className="ddns-token-callout__close" onClick={onDismiss} aria-label={t('common.actions.dismiss', 'Dismiss')}>
&times;
- </button>
+ </SharedButton>
)}
</div>
diff --git a/frontend/src/components/domains/DomainDnsPanel.jsx b/frontend/src/components/domains/DomainDnsPanel.jsx
index c01f9069..bb1ae7a8 100644
--- a/frontend/src/components/domains/DomainDnsPanel.jsx
+++ b/frontend/src/components/domains/DomainDnsPanel.jsx
@@ -9,7 +9,7 @@ import { useState, useEffect, useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import { Plus, RefreshCw, Cloud, ShieldCheck, Radio, Download, Activity } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { ProviderBrandIcon } from '../icons/ProviderBrands';
import DdnsTokenCallout from './DdnsTokenCallout';
import { Button } from '@/components/ui/button';
diff --git a/frontend/src/components/domains/RegistrarPortfolio.jsx b/frontend/src/components/domains/RegistrarPortfolio.jsx
index b5331098..b7471abd 100644
--- a/frontend/src/components/domains/RegistrarPortfolio.jsx
+++ b/frontend/src/components/domains/RegistrarPortfolio.jsx
@@ -7,6 +7,7 @@ import { useEffect, useState, useCallback } from 'react';
import { Globe, RefreshCw, AlertTriangle } from 'lucide-react';
import api from '../../services/api';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
function expiryTone(days) {
if (days == null) return 'neutral';
@@ -53,9 +54,9 @@ export default function RegistrarPortfolio() {
<span className="reg-portfolio__warn"><AlertTriangle size={13} /> {expiringSoon} {t('app.registrarPortfolio.expiring30d', 'expiring ≤30d')}</span>
)}
</div>
- <button type="button" className="reg-portfolio__refresh" onClick={refresh} disabled={syncing}>
+ <SharedButton variant="unstyled" type="button" className="reg-portfolio__refresh" onClick={refresh} disabled={syncing}>
<RefreshCw size={14} className={syncing ? 'is-spinning' : ''} /> {syncing ? 'Syncing…' : 'Sync'}
- </button>
+ </SharedButton>
</header>
<div className="reg-portfolio__list">
diff --git a/frontend/src/components/ds/ColumnsMenu.jsx b/frontend/src/components/ds/ColumnsMenu.jsx
index 8ff7a75a..804e4929 100644
--- a/frontend/src/components/ds/ColumnsMenu.jsx
+++ b/frontend/src/components/ds/ColumnsMenu.jsx
@@ -39,7 +39,7 @@ export function ColumnsMenu({ columns = [], hiddenKeys = [], onToggle, onShowAll
{hideable.map((column) => {
const hidden = hiddenKeys.includes(column.key);
return (
- <button
+ <Button variant="unstyled"
key={column.key}
type="button"
className={cn('sk-tablemenu__item', 'sk-tablemenu__item--toggle', hidden && 'is-off')}
@@ -48,7 +48,7 @@ export function ColumnsMenu({ columns = [], hiddenKeys = [], onToggle, onShowAll
>
{hidden ? <EyeOff size={13} /> : <Eye size={13} />}
{labelFor(column)}
- </button>
+ </Button>
);
})}
</div>
diff --git a/frontend/src/components/ds/DataTable.jsx b/frontend/src/components/ds/DataTable.jsx
index 826300a6..6a5e0536 100644
--- a/frontend/src/components/ds/DataTable.jsx
+++ b/frontend/src/components/ds/DataTable.jsx
@@ -17,6 +17,7 @@ import ColumnMenu from './grid/ColumnMenu';
import { applyFilters, isDecorative, withInferredTypes } from './grid/fields';
import { useTranslation } from 'react-i18next';
import { translateLabel } from '../../i18n/labels';
+import { Button as SharedButton } from '@/components/ui/button';
/**
* Declarative data table built on top of the shadcn/ui Table primitives.
@@ -457,12 +458,12 @@ export function DataTable({
<TableRow className="sk-dtable__nomatch">
<TableCell colSpan={columnCount}>
<span>{t('app.dataTable.noRowsMatchTheActiveColumn', 'No rows match the active column filters.')}</span>
- <button
+ <SharedButton variant="unstyled"
type="button"
onClick={() => setFilters({ match: filters.match, rules: [] })}
>
{t('common.actions.clearFilters', 'Clear filters')}
- </button>
+ </SharedButton>
</TableCell>
</TableRow>
) : groups
diff --git a/frontend/src/components/ds/Drawer.jsx b/frontend/src/components/ds/Drawer.jsx
index 5679c8b2..0528e115 100644
--- a/frontend/src/components/ds/Drawer.jsx
+++ b/frontend/src/components/ds/Drawer.jsx
@@ -40,7 +40,7 @@ export function Drawer({
}) {
return (
<Sheet open={open} onOpenChange={onOpenChange}>
- <SheetContent side={side} className={cn('sk-drawer', className)} style={{ width, maxWidth: '95vw' }}>
+ <SheetContent side={side} className={cn('sk-drawer', className)} style={{ width }}>
<div className="sk-drawer__head">
{icon && (
<span className="sk-drawer__ico" style={iconColor ? { color: iconColor } : undefined}>
diff --git a/frontend/src/components/ds/FilterDrawer.jsx b/frontend/src/components/ds/FilterDrawer.jsx
index 4520c2c1..c16d6815 100644
--- a/frontend/src/components/ds/FilterDrawer.jsx
+++ b/frontend/src/components/ds/FilterDrawer.jsx
@@ -1,3 +1,4 @@
+import { countActiveFilters, emptyFilterValue } from './filterValues';
import { SlidersHorizontal } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils';
@@ -29,23 +30,6 @@ import { useTranslation } from 'react-i18next';
//
// `single` groups hold a string ('' = none); `multi` groups hold a string[].
-// Count how many filter selections are active — a single-select group counts 1
-// when set, a multi-select group counts its selected length. Drives the
-// FilterButton badge.
-export function countActiveFilters(value = {}) {
- return Object.values(value).reduce((total, entry) => {
- if (Array.isArray(entry)) return total + entry.length;
- return total + (entry ? 1 : 0);
- }, 0);
-}
-
-// Empty value object for a given schema — used to clear/initialise state.
-export function emptyFilterValue(groups = []) {
- const next = {};
- groups.forEach((group) => { next[group.key] = group.type === 'multi' ? [] : ''; });
- return next;
-}
-
// The trigger button, with an active-count badge. Kept here so hosts get the
// button + drawer as a matched pair.
export function FilterButton({ count = 0, onClick, className, label = 'Filters' }) {
@@ -126,7 +110,7 @@ export function FilterDrawer({
<div className="sk-filter__label">{group.label}</div>
<div className="sk-filter__chips">
{group.options.map((option) => (
- <button
+ <Button variant="unstyled"
key={option.value}
type="button"
className={cn('sk-filter__chip', isOn(group, option.value) && 'is-on')}
@@ -140,7 +124,7 @@ export function FilterDrawer({
{option.count != null && (
<span className="sk-filter__chip-count">{option.count}</span>
)}
- </button>
+ </Button>
))}
</div>
</div>
diff --git a/frontend/src/components/ds/GroupMenu.jsx b/frontend/src/components/ds/GroupMenu.jsx
index e8044e50..3e3601b4 100644
--- a/frontend/src/components/ds/GroupMenu.jsx
+++ b/frontend/src/components/ds/GroupMenu.jsx
@@ -35,22 +35,22 @@ export function GroupMenu({ columns = [], groupBy = null, onChange, className })
<PopoverContent align="end" className="sk-tablemenu">
<div className="sk-tablemenu__title">{t('app.groupMenu.groupBy', 'Group by')}</div>
<div className="sk-tablemenu__list">
- <button
+ <Button variant="unstyled"
type="button"
className={cn('sk-tablemenu__item', !active && 'is-on')}
onClick={() => onChange?.(null)}
>
{t('app.groupMenu.noGrouping', 'No grouping')}
- </button>
+ </Button>
{groupable.map((column) => (
- <button
+ <Button variant="unstyled"
key={column.key}
type="button"
className={cn('sk-tablemenu__item', active?.key === column.key && 'is-on')}
onClick={() => onChange?.(column.key)}
>
{labelFor(column)}
- </button>
+ </Button>
))}
</div>
</PopoverContent>
diff --git a/frontend/src/components/ds/KpiBand.jsx b/frontend/src/components/ds/KpiBand.jsx
index 439a898a..8557ef2b 100644
--- a/frontend/src/components/ds/KpiBand.jsx
+++ b/frontend/src/components/ds/KpiBand.jsx
@@ -1,5 +1,6 @@
import { Children, useState } from 'react';
import { cn } from '@/lib/utils';
+import { Button as SharedButton } from '@/components/ui/button';
// KpiBand — the one responsive grid wrapper for KPI/stat tiles (design-system
// primitive, plan 20). Lays a row of <MetricCard> tiles into a single grid so
@@ -86,14 +87,14 @@ export function KpiBand({
{secondary.length > 0 && (
<>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-kpiband__more"
aria-expanded={expanded}
onClick={() => setExpanded((v) => !v)}
>
{expanded ? 'Fewer stats' : `More stats (${secondary.length})`}
- </button>
+ </SharedButton>
{expanded && (
<div className="sk-kpiband__strip">
{secondary.map((child, i) => (
diff --git a/frontend/src/components/ds/MetricCard.jsx b/frontend/src/components/ds/MetricCard.jsx
index 3ed27e68..249d1267 100644
--- a/frontend/src/components/ds/MetricCard.jsx
+++ b/frontend/src/components/ds/MetricCard.jsx
@@ -1,5 +1,6 @@
import { cn } from '@/lib/utils';
import { formatCompact, formatFull } from '../../utils/formatNumber';
+import { Button as SharedButton } from '@/components/ui/button';
// KPI / stat tile: icon chip + big value (+ optional unit) + label, with an
// optional trend delta in the top-right.
@@ -76,14 +77,14 @@ export function MetricCard({
if (onClick) {
return (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={cn('sk-kpi', 'sk-kpi--clickable', className)}
onClick={onClick}
{...props}
>
{inner}
- </button>
+ </SharedButton>
);
}
diff --git a/frontend/src/components/ds/PageTopbar.jsx b/frontend/src/components/ds/PageTopbar.jsx
index ed68bd52..077a91be 100644
--- a/frontend/src/components/ds/PageTopbar.jsx
+++ b/frontend/src/components/ds/PageTopbar.jsx
@@ -5,6 +5,7 @@ import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover
import { cn } from '@/lib/utils';
import { useOverflowItems } from '@/hooks/useOverflowItems';
import { t } from '@/i18n/t';
+import { Button as SharedButton } from '@/components/ui/button';
// The demo's page top bar (see docs/REDESIGN_MAP.md §6 decision 3): infra pages
// carry their own top bar — an icon + title, an optional routed sub-nav that
@@ -107,7 +108,7 @@ function TopbarTabs({ tabs, label }) {
{hiddenIndices.length > 0 && (
<Popover open={popoverOpen} onOpenChange={setPopoverOpen}>
<PopoverTrigger asChild>
- <button
+ <SharedButton variant="unstyled"
ref={moreBtnRef}
type="button"
className="sk-topbar__tab sk-topbar__more"
@@ -115,7 +116,7 @@ function TopbarTabs({ tabs, label }) {
>
<MoreHorizontal size={16} />
{t('common.more', 'More')}
- </button>
+ </SharedButton>
</PopoverTrigger>
<PopoverContent align="end" sideOffset={6} className="ui-popover-content">
<div className="tabs-overflow-list">
diff --git a/frontend/src/components/ds/SegControl.jsx b/frontend/src/components/ds/SegControl.jsx
index 36a80bc9..7d9a295c 100644
--- a/frontend/src/components/ds/SegControl.jsx
+++ b/frontend/src/components/ds/SegControl.jsx
@@ -1,4 +1,5 @@
import { cn } from '@/lib/utils';
+import { Button as SharedButton } from '@/components/ui/button';
// Segmented toggle. Replaces native <select> / filter-chip clusters.
// options: array of strings, or { value, label, icon?, count? } objects.
@@ -7,7 +8,7 @@ export function SegControl({ options = [], value, onChange, className, ...props
return (
<div className={cn('sk-seg', className)} role="tablist" {...props}>
{items.map((o) => (
- <button
+ <SharedButton variant="unstyled"
key={o.value}
type="button"
role="tab"
@@ -18,7 +19,7 @@ export function SegControl({ options = [], value, onChange, className, ...props
{o.icon}
{o.label}
{o.count != null && <span className="sk-seg__count">{o.count}</span>}
- </button>
+ </SharedButton>
))}
</div>
);
diff --git a/frontend/src/components/ds/SortChipBar.jsx b/frontend/src/components/ds/SortChipBar.jsx
index 9df6b98a..1cc72399 100644
--- a/frontend/src/components/ds/SortChipBar.jsx
+++ b/frontend/src/components/ds/SortChipBar.jsx
@@ -2,6 +2,7 @@ import { ArrowUp, ArrowDown, X } from 'lucide-react';
import { cn } from '@/lib/utils';
import { useTranslation } from 'react-i18next';
import { translateLabel } from '../../i18n/labels';
+import { Button as SharedButton } from '@/components/ui/button';
// Active-sort chip bar (Twenty's EditableSortChip pattern). Renders one chip
// per sort level above the table: click the chip body to flip direction, ✕ to
@@ -34,7 +35,7 @@ export function SortChipBar({ columns = [], sorts = [], onChange, className }) {
{sorts.length > 1 && (
<span className="sk-sortchips__priority">{index + 1}</span>
)}
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-sortchips__body"
onClick={() => flip(sort.key)}
@@ -42,24 +43,24 @@ export function SortChipBar({ columns = [], sorts = [], onChange, className }) {
>
<span className="sk-sortchips__label">{labelFor(sort.key)}</span>
{sort.direction === 'asc' ? <ArrowUp size={12} /> : <ArrowDown size={12} />}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className="sk-sortchips__remove"
onClick={() => remove(sort.key)}
aria-label={t('app.sortChipBar.removeSortOn', 'Remove sort on {{value}}', { value: labelFor(sort.key) })}
>
<X size={12} />
- </button>
+ </SharedButton>
</span>
))}
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-sortchips__reset"
onClick={() => onChange?.([])}
>
{t('app.sortChipBar.reset', 'Reset')}
- </button>
+ </SharedButton>
</div>
);
}
diff --git a/frontend/src/components/ds/SortMenu.jsx b/frontend/src/components/ds/SortMenu.jsx
index 877de8ff..39af2201 100644
--- a/frontend/src/components/ds/SortMenu.jsx
+++ b/frontend/src/components/ds/SortMenu.jsx
@@ -57,7 +57,7 @@ export function SortMenu({ columns = [], sorts = [], onChange, className }) {
<span className="sk-tablemenu__priority">{index + 1}</span>
)}
<span className="sk-tablemenu__field">{labelFor(sort.key)}</span>
- <button
+ <Button variant="unstyled"
type="button"
className="sk-tablemenu__dir"
onClick={() => flip(sort.key)}
@@ -65,15 +65,15 @@ export function SortMenu({ columns = [], sorts = [], onChange, className }) {
title={sort.direction === 'asc' ? t('app.sortMenu.ascending', 'Ascending') : t('app.sortMenu.descending', 'Descending')}
>
{sort.direction === 'asc' ? <ArrowUp size={13} /> : <ArrowDown size={13} />}
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className="sk-tablemenu__remove"
onClick={() => remove(sort.key)}
aria-label={t('app.sortMenu.removeSortOn', 'Remove sort on {{value}}', { value: labelFor(sort.key) })}
>
<X size={13} />
- </button>
+ </Button>
</div>
))}
{available.length > 0 && (
@@ -81,14 +81,14 @@ export function SortMenu({ columns = [], sorts = [], onChange, className }) {
<div className="sk-tablemenu__section">{t('app.sortMenu.addSortLevel', 'Add sort level')}</div>
<div className="sk-tablemenu__list">
{available.map((c) => (
- <button
+ <Button variant="unstyled"
key={c.key}
type="button"
className="sk-tablemenu__item"
onClick={() => add(c.key)}
>
{labelFor(c.key)}
- </button>
+ </Button>
))}
</div>
</>
diff --git a/frontend/src/components/ds/ViewMenu.jsx b/frontend/src/components/ds/ViewMenu.jsx
index be9c8166..cabf2c5a 100644
--- a/frontend/src/components/ds/ViewMenu.jsx
+++ b/frontend/src/components/ds/ViewMenu.jsx
@@ -3,7 +3,7 @@ import { LayoutList, Star, Trash2, Check } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { cn } from '@/lib/utils';
-import { useToast } from '@/contexts/ToastContext';
+import { useToast } from '@/contexts/useToast.js';
import { useTranslation } from 'react-i18next';
// Saved-view picker (CRM style: Twenty view switcher / Frappe view dropdown).
@@ -66,17 +66,17 @@ export function ViewMenu({ views, className }) {
key={view.builtin ? `b-${view.name}` : `u-${view.id}`}
className={cn('sk-viewmenu__row', isActive(view) && 'is-active')}
>
- <button
+ <Button variant="unstyled"
type="button"
className="sk-viewmenu__apply"
onClick={() => { applyView(view); setOpen(false); }}
>
{isActive(view) && <Check size={13} aria-hidden="true" />}
<span className="sk-viewmenu__name">{view.name}</span>
- </button>
+ </Button>
{!view.builtin && (
<>
- <button
+ <Button variant="unstyled"
type="button"
className={cn('sk-viewmenu__star', view.is_default && 'is-on')}
onClick={() => toggleDefault(view)}
@@ -85,8 +85,8 @@ export function ViewMenu({ views, className }) {
aria-pressed={view.is_default}
>
<Star size={13} />
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className="sk-viewmenu__delete"
onClick={() => handleDelete(view)}
@@ -94,7 +94,7 @@ export function ViewMenu({ views, className }) {
aria-label={t('app.viewMenu.deleteView', 'Delete view {{name}}', { name: view.name })}
>
<Trash2 size={13} />
- </button>
+ </Button>
</>
)}
</div>
diff --git a/frontend/src/components/ds/filterValues.js b/frontend/src/components/ds/filterValues.js
new file mode 100644
index 00000000..f329628e
--- /dev/null
+++ b/frontend/src/components/ds/filterValues.js
@@ -0,0 +1,16 @@
+// Count how many filter selections are active — a single-select group counts 1
+// when set, a multi-select group counts its selected length. Drives the
+// FilterButton badge.
+export function countActiveFilters(value = {}) {
+ return Object.values(value).reduce((total, entry) => {
+ if (Array.isArray(entry)) return total + entry.length;
+ return total + (entry ? 1 : 0);
+ }, 0);
+}
+
+// Empty value object for a given schema — used to clear/initialise state.
+export function emptyFilterValue(groups = []) {
+ const next = {};
+ groups.forEach((group) => { next[group.key] = group.type === 'multi' ? [] : ''; });
+ return next;
+}
diff --git a/frontend/src/components/ds/grid/ColumnMenu.jsx b/frontend/src/components/ds/grid/ColumnMenu.jsx
index 308e929d..9b39bcf0 100644
--- a/frontend/src/components/ds/grid/ColumnMenu.jsx
+++ b/frontend/src/components/ds/grid/ColumnMenu.jsx
@@ -10,6 +10,7 @@ import {
OPS, columnLabel, coerceValue, isFilterable, isGroupable, isSortable,
optionsFor, ruleId, valueCounts,
} from './fields';
+import { Button as SharedButton } from '@/components/ui/button';
// The per-column header menu — one popover that owns everything you can do to
// a column, so a toolbar stops being a parking lot of Sort/Columns/Group
@@ -102,14 +103,14 @@ export function ColumnMenu({
return (
<Popover open={open} onOpenChange={onOpenChange}>
<PopoverTrigger asChild>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-colmenu-btn"
aria-label={t('app.columnMenu.columnOptions', '{{label}} column options', { label: label })}
onClick={(e) => { e.stopPropagation(); }}
>
<span className="sk-colmenu-btn__dots" aria-hidden="true" />
- </button>
+ </SharedButton>
</PopoverTrigger>
<PopoverContent
align="start"
@@ -120,34 +121,34 @@ export function ColumnMenu({
>
{canSort && (
<>
- <button
+ <SharedButton variant="unstyled"
type="button"
className={cn('sk-gridmenu__opt', sortDir === 'asc' && 'is-on')}
onClick={() => { onSort(column.key, 'asc'); onOpenChange(false); }}
>
<ArrowUp size={13} />
{ordered ? 'Sort low to high' : 'Sort A to Z'}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className={cn('sk-gridmenu__opt', sortDir === 'desc' && 'is-on')}
onClick={() => { onSort(column.key, 'desc'); onOpenChange(false); }}
>
<ArrowDown size={13} />
{ordered ? 'Sort high to low' : 'Sort Z to A'}
- </button>
+ </SharedButton>
</>
)}
{canGroup && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={cn('sk-gridmenu__opt', grouped && 'is-on')}
onClick={() => { onToggleGroup(column.key); onOpenChange(false); }}
>
<Rows3 size={13} />
{grouped ? 'Remove grouping' : 'Group by this field'}
- </button>
+ </SharedButton>
)}
{filterable && (
@@ -176,7 +177,7 @@ export function ColumnMenu({
: picked.includes(option);
const text = type === 'bool' ? (option === 'true' ? 'On' : 'Off') : option;
return (
- <button
+ <SharedButton variant="unstyled"
key={option}
type="button"
className={cn('sk-gridmenu__opt', on && 'is-on')}
@@ -186,7 +187,7 @@ export function ColumnMenu({
<span className="sk-gridmenu__box"><Check size={11} /></span>
<span className="sk-gridmenu__val">{text}</span>
<span className="sk-gridmenu__rest">{counts.get(option) || 0}</span>
- </button>
+ </SharedButton>
);
})}
</div>
@@ -217,13 +218,13 @@ export function ColumnMenu({
{!!column.quick?.length && (
<div className="sk-gridmenu__quick">
{column.quick.map((q) => (
- <button
+ <SharedButton variant="unstyled"
key={q.label}
type="button"
onClick={() => writeValue(String(q.value), q.op)}
>
{q.label}
- </button>
+ </SharedButton>
))}
</div>
)}
@@ -235,46 +236,46 @@ export function ColumnMenu({
{(canMove || canHideHere) && <div className="sk-gridmenu__sep" />}
{canMove && (
<>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridmenu__opt"
disabled={!canMoveLeft}
onClick={() => { onMove(column.key, -1); onOpenChange(false); }}
>
<ChevronLeft size={13} />{t('app.columnMenu.moveLeft', 'Move left')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridmenu__opt"
disabled={!canMoveRight}
onClick={() => { onMove(column.key, 1); onOpenChange(false); }}
>
<ChevronRight size={13} />{t('app.columnMenu.moveRight', 'Move right')}
- </button>
+ </SharedButton>
</>
)}
{canHideHere && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridmenu__opt"
onClick={() => { onHide(column.key); onOpenChange(false); }}
>
<EyeOff size={13} />{t('app.columnMenu.hideThisField', 'Hide this field')}
- </button>
+ </SharedButton>
)}
{filterable && (
<div className="sk-gridmenu__foot">
- <button
+ <SharedButton variant="unstyled"
type="button"
onClick={() => { writeRule(null); setDraft(''); }}
disabled={!rule}
>
{t('app.columnMenu.clearFilter', 'Clear filter')}
- </button>
- <button type="button" className="is-primary" onClick={() => onOpenChange(false)}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="is-primary" onClick={() => onOpenChange(false)}>
{t('common.actions.done', 'Done')}
- </button>
+ </SharedButton>
</div>
)}
</PopoverContent>
diff --git a/frontend/src/components/ds/grid/DataGrid.jsx b/frontend/src/components/ds/grid/DataGrid.jsx
index 354fa20e..5de71388 100644
--- a/frontend/src/components/ds/grid/DataGrid.jsx
+++ b/frontend/src/components/ds/grid/DataGrid.jsx
@@ -3,6 +3,7 @@ import { ArrowUp, ArrowDown, Check, ChevronDown, ChevronRight, Filter, Minus } f
import { cn } from '@/lib/utils';
import ColumnMenu from './ColumnMenu';
import { byKey, columnLabel, fieldValue, isSortable } from './fields';
+import { Button as SharedButton } from '@/components/ui/button';
// The grid itself: a CSS-grid table (NOT a <table>) whose header and rows share
// one `--sk-grid-tpl` track list, so a column's width is declared once next to
@@ -155,7 +156,7 @@ export function DataGrid({
: groups.map(([label, rows]) => (
<div key={label ?? '__all__'} className="sk-grid__group-wrap">
{label != null && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-grid__group"
onClick={() => toggleGroupOpen(label)}
@@ -165,7 +166,7 @@ export function DataGrid({
{label}
<i />
<span className="sk-grid__groupcount">{rows.length}</span>
- </button>
+ </SharedButton>
)}
{(label != null && collapsed.has(label) ? [] : rows).map((row) => {
const key = keyOf(row);
diff --git a/frontend/src/components/ds/grid/GridBulkBar.jsx b/frontend/src/components/ds/grid/GridBulkBar.jsx
index 50679b7c..3ac348a5 100644
--- a/frontend/src/components/ds/grid/GridBulkBar.jsx
+++ b/frontend/src/components/ds/grid/GridBulkBar.jsx
@@ -1,5 +1,6 @@
import { X } from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// The selection bar: one component, one place on screen. Appears only when rows
// are picked, and holds the actions that only make sense in bulk — so the
@@ -30,14 +31,14 @@ export function GridBulkBar({ count, noun = 'row', onClear, children }) {
</span>
<div className="sk-bulkbar__actions">{children}</div>
{onClear && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-bulkbar__clear"
onClick={onClear}
aria-label={t('app.gridBulkBar.clearSelection', 'Clear selection')}
>
<X size={14} />
- </button>
+ </SharedButton>
)}
</div>
);
diff --git a/frontend/src/components/ds/grid/GridChips.jsx b/frontend/src/components/ds/grid/GridChips.jsx
index 1374212d..1adea7b9 100644
--- a/frontend/src/components/ds/grid/GridChips.jsx
+++ b/frontend/src/components/ds/grid/GridChips.jsx
@@ -1,6 +1,7 @@
import { X } from 'lucide-react';
import { byKey, columnLabel, opLabel, ruleText } from './fields';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Active filter rules, spelled out above the grid. A filter you cannot see is
// a filter you will blame the data for — every rule gets a chip, and every chip
@@ -14,14 +15,14 @@ export function GridChips({ cfg, columns, onRemove, onClear, onMatchChange }) {
return (
<div className="sk-gridchips">
{rules.length > 1 && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridchip sk-gridchip--match"
onClick={() => onMatchChange(cfg.filters.match === 'all' ? 'any' : 'all')}
title={t('app.gridChips.toggleWhetherRowsMustMatchEvery', 'Toggle whether rows must match every condition or any one')}
>
match {cfg.filters.match}
- </button>
+ </SharedButton>
)}
{rules.map((rule) => {
const column = map.get(rule.field);
@@ -31,18 +32,18 @@ export function GridChips({ cfg, columns, onRemove, onClear, onMatchChange }) {
<span className="sk-gridchip__k">{columnLabel(column)}</span>
<span className="sk-gridchip__op">{opLabel(column.type, rule.op)}</span>
<span className="sk-gridchip__v">{ruleText(rule, columns)}</span>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridchip__x"
onClick={() => onRemove(rule.id)}
aria-label={t('app.gridChips.removeFilter', 'Remove {{value}} filter', { value: columnLabel(column) })}
>
<X size={12} />
- </button>
+ </SharedButton>
</span>
);
})}
- <button type="button" className="sk-gridchips__clear" onClick={onClear}>{t('app.gridChips.clearAll', 'Clear all')}</button>
+ <SharedButton variant="unstyled" type="button" className="sk-gridchips__clear" onClick={onClear}>{t('app.gridChips.clearAll', 'Clear all')}</SharedButton>
</div>
);
}
diff --git a/frontend/src/components/ds/grid/GridFilterButton.jsx b/frontend/src/components/ds/grid/GridFilterButton.jsx
index f0ffb8d4..20332119 100644
--- a/frontend/src/components/ds/grid/GridFilterButton.jsx
+++ b/frontend/src/components/ds/grid/GridFilterButton.jsx
@@ -1,12 +1,13 @@
import { SlidersHorizontal } from 'lucide-react';
import { cn } from '@/lib/utils';
+import { Button as SharedButton } from '@/components/ui/button';
// The top bar's filter affordance. Icon-only with a count badge so it occupies
// the same width whether or not filters are active — the search field next to
// it must not shift when you add a condition.
export function GridFilterButton({ count = 0, onClick, title = 'Filters & fields (⌘F)' }) {
return (
- <button
+ <SharedButton variant="unstyled"
type="button"
className={cn('sk-gridicon', count > 0 && 'is-on')}
onClick={onClick}
@@ -15,7 +16,7 @@ export function GridFilterButton({ count = 0, onClick, title = 'Filters & fields
>
<SlidersHorizontal size={16} />
{count > 0 && <span className="sk-gridicon__count">{count}</span>}
- </button>
+ </SharedButton>
);
}
diff --git a/frontend/src/components/ds/grid/GridFilterDrawer.jsx b/frontend/src/components/ds/grid/GridFilterDrawer.jsx
index f7b8094b..f8bfa1f0 100644
--- a/frontend/src/components/ds/grid/GridFilterDrawer.jsx
+++ b/frontend/src/components/ds/grid/GridFilterDrawer.jsx
@@ -6,7 +6,7 @@ import { Switch } from '@/components/ui/switch';
import { cn } from '@/lib/utils';
import { useTranslation } from 'react-i18next';
import {
- OPS, byKey, columnLabel, coerceValue, emptyValueFor, fieldValue,
+ OPS, byKey, columnLabel, coerceValue, emptyValueFor,
isFilterable, isSortable, optionsFor,
} from './fields';
@@ -71,7 +71,7 @@ export function GridFilterDrawer({
{optionsFor(rows, column).map((option) => {
const on = selected.includes(option);
return (
- <button
+ <Button variant="unstyled"
key={option}
type="button"
className={cn('sk-gridrule__tag', on && 'is-on')}
@@ -80,7 +80,7 @@ export function GridFilterDrawer({
})}
>
{option}
- </button>
+ </Button>
);
})}
</div>
@@ -112,14 +112,14 @@ export function GridFilterDrawer({
<div className="sk-griddrawer__tabs">
{[['filters', Filter, 'Filters', rules.length], ['fields', Layers, 'Fields', cfg.cols.length]]
.map(([key, Icon, text, n]) => (
- <button
+ <Button variant="unstyled"
key={key}
type="button"
className={cn(tab === key && 'is-on')}
onClick={() => setTab(key)}
>
<Icon size={14} />{text}<span className="n">{n}</span>
- </button>
+ </Button>
))}
</div>
@@ -128,23 +128,23 @@ export function GridFilterDrawer({
<div className="sk-gridsec">
<div className="sk-gridsec__head">
<div className="sk-gridsec__t">{t('app.gridFilterDrawer.conditions', 'Conditions')}</div>
- <button type="button" className="sk-gridsec__add" onClick={() => grid.addRule(columns)}>
+ <Button variant="unstyled" type="button" className="sk-gridsec__add" onClick={() => grid.addRule(columns)}>
<Plus size={13} />{t('app.gridFilterDrawer.addCondition', 'Add condition')}
- </button>
+ </Button>
</div>
<div className="sk-gridmatch">
{t('app.gridFilterDrawer.match', 'Match')}
<div className="sk-gridseg">
{['all', 'any'].map((value) => (
- <button
+ <Button variant="unstyled"
key={value}
type="button"
className={cn(cfg.filters.match === value && 'is-on')}
onClick={() => grid.setMatch(value)}
>
{value}
- </button>
+ </Button>
))}
</div>
{t('app.gridFilterDrawer.ofTheFollowing', 'of the following')}
@@ -202,14 +202,14 @@ export function GridFilterDrawer({
</select>
<ChevronDown size={13} />
</div>
- <button
+ <Button variant="unstyled"
type="button"
className="sk-gridrule__del"
onClick={() => grid.removeRule(rule.id)}
aria-label={t('app.gridFilterDrawer.removeCondition', 'Remove condition')}
>
<X size={14} />
- </button>
+ </Button>
<div className="sk-gridrule__value">{valueEditor(rule)}</div>
</div>
</div>
@@ -267,7 +267,7 @@ export function GridFilterDrawer({
{columns.filter((c) => !c.locked && isSortable(c)).map((c) => {
const on = cfg.sub.includes(c.key);
return (
- <button
+ <Button variant="unstyled"
key={c.key}
type="button"
className={cn('sk-gridrule__tag', on && 'is-on')}
@@ -276,7 +276,7 @@ export function GridFilterDrawer({
)}
>
{columnLabel(c)}
- </button>
+ </Button>
);
})}
</div>
@@ -285,19 +285,19 @@ export function GridFilterDrawer({
{showDensity && (
<>
- <div className="sk-gridsec__head" style={showRowDetail ? { marginTop: 18 } : undefined}>
+ <div className={`sk-gridsec__head${showRowDetail ? ' sk-gridsec__head--separated' : ''}`}>
<div className="sk-gridsec__t">{t('app.gridFilterDrawer.density', 'Density')}</div>
</div>
<div className="sk-gridseg sk-gridseg--wide">
{[['cozy', 'Cozy'], ['compact', 'Compact']].map(([value, text]) => (
- <button
+ <Button variant="unstyled"
key={value}
type="button"
className={cn(cfg.density === value && 'is-on')}
onClick={() => grid.setDensity(value)}
>
{text}
- </button>
+ </Button>
))}
</div>
</>
diff --git a/frontend/src/components/ds/grid/GridFooter.jsx b/frontend/src/components/ds/grid/GridFooter.jsx
index 59c1eb92..79b94add 100644
--- a/frontend/src/components/ds/grid/GridFooter.jsx
+++ b/frontend/src/components/ds/grid/GridFooter.jsx
@@ -1,6 +1,7 @@
import { ChevronDown, ChevronsLeft, ChevronsRight, ChevronLeft, ChevronRight } from 'lucide-react';
import { byKey, columnLabel } from './fields';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Footer: what you are looking at on the left, how to page through it on the
// right. The sort/group summary is here rather than in a toolbar chip because
@@ -43,19 +44,19 @@ export function GridFooter({
</select>
<ChevronDown size={12} />
</div>
- <button type="button" disabled={page <= 1} onClick={() => onPage(1)} aria-label={t('app.gridFooter.firstPage', 'First page')}>
+ <SharedButton variant="unstyled" type="button" disabled={page <= 1} onClick={() => onPage(1)} aria-label={t('app.gridFooter.firstPage', 'First page')}>
<ChevronsLeft size={13} />
- </button>
- <button type="button" disabled={page <= 1} onClick={() => onPage(page - 1)} aria-label={t('app.gridFooter.previousPage', 'Previous page')}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" disabled={page <= 1} onClick={() => onPage(page - 1)} aria-label={t('app.gridFooter.previousPage', 'Previous page')}>
<ChevronLeft size={14} />
- </button>
+ </SharedButton>
<span className="sk-gridpager__pos">{page} / {pageCount}</span>
- <button type="button" disabled={page >= pageCount} onClick={() => onPage(page + 1)} aria-label={t('app.gridFooter.nextPage', 'Next page')}>
+ <SharedButton variant="unstyled" type="button" disabled={page >= pageCount} onClick={() => onPage(page + 1)} aria-label={t('app.gridFooter.nextPage', 'Next page')}>
<ChevronRight size={14} />
- </button>
- <button type="button" disabled={page >= pageCount} onClick={() => onPage(pageCount)} aria-label={t('app.gridFooter.lastPage', 'Last page')}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" disabled={page >= pageCount} onClick={() => onPage(pageCount)} aria-label={t('app.gridFooter.lastPage', 'Last page')}>
<ChevronsRight size={13} />
- </button>
+ </SharedButton>
</div>
</div>
);
diff --git a/frontend/src/components/ds/grid/GridToolsMenu.jsx b/frontend/src/components/ds/grid/GridToolsMenu.jsx
index 09e72c97..a43651d7 100644
--- a/frontend/src/components/ds/grid/GridToolsMenu.jsx
+++ b/frontend/src/components/ds/grid/GridToolsMenu.jsx
@@ -4,6 +4,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover
import { cn } from '@/lib/utils';
import { byKey, exportRows } from './fields';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// The toolbar's "⋮" — everything that is neither a filter nor a per-column
// action: export, refresh, row density, and discarding unsaved view changes.
@@ -46,15 +47,15 @@ export function GridToolsMenu({
onOpenChange={(o) => { setOpen(o); if (!o) setPane('root'); }}
>
<PopoverTrigger asChild>
- <button type="button" className="sk-gridicon" aria-label={t('app.gridToolsMenu.moreTableOptions', 'More table options')}>
+ <SharedButton variant="unstyled" type="button" className="sk-gridicon" aria-label={t('app.gridToolsMenu.moreTableOptions', 'More table options')}>
<MoreVertical size={16} />
- </button>
+ </SharedButton>
</PopoverTrigger>
<PopoverContent align="end" sideOffset={6} className="ui-popover-panel sk-gridmenu">
{pane === 'root' ? (
<>
{onCopyLink && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridmenu__opt"
onClick={async () => {
@@ -67,26 +68,26 @@ export function GridToolsMenu({
{copied === 'ok' ? 'Link copied'
: copied === 'fail' ? 'Copy failed — check permissions'
: 'Copy link to this view'}
- </button>
+ </SharedButton>
)}
- <button type="button" className="sk-gridmenu__opt" onClick={() => setPane('export')}>
+ <SharedButton variant="unstyled" type="button" className="sk-gridmenu__opt" onClick={() => setPane('export')}>
<Download size={13} />{t('app.gridToolsMenu.export', 'Export…')}
- </button>
+ </SharedButton>
{onRefresh && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridmenu__opt"
onClick={() => { onRefresh(); close(); }}
>
<RefreshCw size={13} />{t('app.gridToolsMenu.refreshData', 'Refresh data')}
- </button>
+ </SharedButton>
)}
{showDensity && (
<>
<div className="sk-gridmenu__sep" />
<div className="sk-gridmenu__head">{t('app.gridToolsMenu.rowDensity', 'Row density')}</div>
{[['cozy', 'Cozy', Rows2], ['compact', 'Compact', Rows3]].map(([value, text, Icon]) => (
- <button
+ <SharedButton variant="unstyled"
key={value}
type="button"
className={cn('sk-gridmenu__opt', cfg.density === value && 'is-on')}
@@ -94,23 +95,23 @@ export function GridToolsMenu({
>
<span className="sk-gridmenu__box"><Check size={11} /></span>
<Icon size={13} />{text}
- </button>
+ </SharedButton>
))}
</>
)}
<div className="sk-gridmenu__sep" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridmenu__opt"
onClick={() => { onReset(); close(); }}
>
<History size={13} />{t('app.gridToolsMenu.resetViewChanges', 'Reset view changes')}
- </button>
+ </SharedButton>
</>
) : (
<>
<div className="sk-gridmenu__head">{t('app.gridToolsMenu.export2', 'Export')}</div>
- <button
+ <SharedButton variant="unstyled"
type="button"
className={cn('sk-gridmenu__opt', scope === 'view' && 'is-on')}
onClick={() => setScope('view')}
@@ -118,8 +119,8 @@ export function GridToolsMenu({
<span className="sk-gridmenu__box"><Check size={11} /></span>
{t('app.gridToolsMenu.rowsInThisView', 'Rows in this view')}
<span className="sk-gridmenu__rest">{rows.length}</span>
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className={cn('sk-gridmenu__opt', scope === 'picked' && 'is-on')}
disabled={!selectedRows.length}
@@ -128,9 +129,9 @@ export function GridToolsMenu({
<span className="sk-gridmenu__box"><Check size={11} /></span>
{t('app.gridToolsMenu.selectedRows', 'Selected rows')}
<span className="sk-gridmenu__rest">{selectedRows.length}</span>
- </button>
+ </SharedButton>
<div className="sk-gridmenu__sep" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className={cn('sk-gridmenu__opt', allCols && 'is-on')}
onClick={() => setAllCols((v) => !v)}
@@ -138,10 +139,10 @@ export function GridToolsMenu({
<span className="sk-gridmenu__box"><Check size={11} /></span>
{t('app.gridToolsMenu.includeHiddenFields', 'Include hidden fields')}
<span className="sk-gridmenu__rest">{exportCols.length}</span>
- </button>
+ </SharedButton>
<div className="sk-gridmenu__foot">
- <button type="button" onClick={() => go('json')}>JSON</button>
- <button type="button" className="is-primary" onClick={() => go('csv')}>{t('app.gridToolsMenu.downloadCsv', 'Download CSV')}</button>
+ <SharedButton variant="unstyled" type="button" onClick={() => go('json')}>JSON</SharedButton>
+ <SharedButton variant="unstyled" type="button" className="is-primary" onClick={() => go('csv')}>{t('app.gridToolsMenu.downloadCsv', 'Download CSV')}</SharedButton>
</div>
</>
)}
diff --git a/frontend/src/components/ds/grid/GridViewPicker.jsx b/frontend/src/components/ds/grid/GridViewPicker.jsx
index 3d171d06..d39ce7a3 100644
--- a/frontend/src/components/ds/grid/GridViewPicker.jsx
+++ b/frontend/src/components/ds/grid/GridViewPicker.jsx
@@ -5,6 +5,7 @@ import {
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { cn } from '@/lib/utils';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// The saved-view selector, rendered as the page's own heading rather than yet
// another toolbar button — the view IS what you are looking at, so its name is
@@ -52,45 +53,45 @@ export function GridViewPicker({ views, counts, onCreate, label = 'items', actio
const isActive = active && (active.builtin ? active.name === view.name : active.id === view.id);
return (
<div key={key} className={cn('sk-viewpick__row', isActive && 'is-on')}>
- <button type="button" className="sk-viewpick__rowmain" onClick={() => pick(view)}>
+ <SharedButton variant="unstyled" type="button" className="sk-viewpick__rowmain" onClick={() => pick(view)}>
<span className="sk-viewpick__dot" data-builtin={view.builtin ? 'true' : 'false'} />
<span className="sk-viewpick__nm">{view.name}</span>
{view.is_default && <Star size={11} className="sk-viewpick__star" />}
{counts && <span className="sk-viewpick__n">{counts(view)}</span>}
- </button>
+ </SharedButton>
{!view.builtin && (
<Popover
open={menuFor === key}
onOpenChange={(o) => setMenuFor(o ? key : null)}
>
<PopoverTrigger asChild>
- <button type="button" className="sk-viewpick__cog" aria-label={`${view.name} options`}>
+ <SharedButton variant="unstyled" type="button" className="sk-viewpick__cog" aria-label={`${view.name} options`}>
<MoreVertical size={14} />
- </button>
+ </SharedButton>
</PopoverTrigger>
<PopoverContent align="end" sideOffset={4} className="ui-popover-panel sk-gridmenu">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridmenu__opt"
onClick={() => { views.toggleDefault(view); setMenuFor(null); }}
>
<Star size={13} />{view.is_default ? 'Unset as default' : 'Make default'}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridmenu__opt"
onClick={() => { pick(view); onCreate(`${view.name} copy`, true); setMenuFor(null); }}
>
<Copy size={13} />{t('app.gridViewPicker.duplicateView', 'Duplicate view')}
- </button>
+ </SharedButton>
<div className="sk-gridmenu__sep" />
- <button
+ <SharedButton variant="unstyled"
type="button"
className="sk-gridmenu__opt is-danger"
onClick={() => { views.removeView(view); setMenuFor(null); }}
>
<Trash2 size={13} />{t('app.gridViewPicker.deleteView', 'Delete view')}
- </button>
+ </SharedButton>
</PopoverContent>
</Popover>
)}
@@ -102,11 +103,11 @@ export function GridViewPicker({ views, counts, onCreate, label = 'items', actio
<div className="sk-viewbar">
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
- <button type="button" className={cn('sk-viewpick', open && 'is-open')}>
+ <SharedButton variant="unstyled" type="button" className={cn('sk-viewpick', open && 'is-open')}>
<span className="sk-viewpick__title">{activeName}</span>
{views.isDirty && <span className="sk-viewpick__ast">*</span>}
<ChevronDown size={16} />
- </button>
+ </SharedButton>
</PopoverTrigger>
<PopoverContent align="start" sideOffset={6} className="ui-popover-panel sk-gridmenu sk-viewpick__menu">
{!!builtins.length && <div className="sk-gridmenu__head">{t('app.gridViewPicker.builtIn', 'Built in')}</div>}
@@ -132,25 +133,25 @@ export function GridViewPicker({ views, counts, onCreate, label = 'items', actio
}}
/>
</div>
- <button
+ <SharedButton variant="unstyled"
type="button"
className={cn('sk-gridmenu__opt', fromCurrent && 'is-on')}
onClick={() => setFromCurrent((v) => !v)}
>
<span className="sk-gridmenu__box"><Check size={11} /></span>
{t('app.gridViewPicker.startFromCurrentFiltersColumns', 'Start from current filters & columns')}
- </button>
+ </SharedButton>
<div className="sk-gridmenu__foot">
- <button type="button" onClick={() => setCreating(false)}>{t('common.actions.cancel', 'Cancel')}</button>
- <button type="button" className="is-primary" disabled={!name.trim()} onClick={submitNew}>
+ <SharedButton variant="unstyled" type="button" onClick={() => setCreating(false)}>{t('common.actions.cancel', 'Cancel')}</SharedButton>
+ <SharedButton variant="unstyled" type="button" className="is-primary" disabled={!name.trim()} onClick={submitNew}>
{t('common.actions.create', 'Create')}
- </button>
+ </SharedButton>
</div>
</>
) : (
- <button type="button" className="sk-gridmenu__opt" onClick={() => setCreating(true)}>
+ <SharedButton variant="unstyled" type="button" className="sk-gridmenu__opt" onClick={() => setCreating(true)}>
<Plus size={13} />{t('app.gridViewPicker.saveCurrentView', 'Save current view…')}
- </button>
+ </SharedButton>
)}
</PopoverContent>
</Popover>
@@ -159,10 +160,10 @@ export function GridViewPicker({ views, counts, onCreate, label = 'items', actio
<div className="sk-viewbar__dirty">
<AlertTriangle size={13} />
{t('app.gridViewPicker.unsaved', 'Unsaved')}
- <button type="button" onClick={views.resetView}>
+ <SharedButton variant="unstyled" type="button" onClick={views.resetView}>
<History size={12} />{t('app.gridViewPicker.reset', 'Reset')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
className="is-primary"
onClick={() => {
@@ -171,7 +172,7 @@ export function GridViewPicker({ views, counts, onCreate, label = 'items', actio
}}
>
{active && !active.builtin ? 'Save' : 'Save as…'}
- </button>
+ </SharedButton>
</div>
)}
diff --git a/frontend/src/components/ds/grid/useTableChrome.js b/frontend/src/components/ds/grid/useTableChrome.js
index ec98acc6..ff8e6798 100644
--- a/frontend/src/components/ds/grid/useTableChrome.js
+++ b/frontend/src/components/ds/grid/useTableChrome.js
@@ -136,7 +136,7 @@ export function useTableChrome({
// leaves the previous view's filters silently applied.
setFilters(state.columnFilters ?? NO_FILTERS);
setColumnOrder(state.columnOrder ?? null);
- // eslint-disable-next-line react-hooks/exhaustive-deps
+
}, [applyPage, setSorts, setHiddenKeys, setGroupBy]);
const { views, copyLink, createView } = useGridViews({
diff --git a/frontend/src/components/ds/index.js b/frontend/src/components/ds/index.js
index 7c98ab29..a21f2569 100644
--- a/frontend/src/components/ds/index.js
+++ b/frontend/src/components/ds/index.js
@@ -19,9 +19,8 @@ export { ScoreGauge } from './ScoreGauge';
export { Feed, FeedItem } from './Feed';
export { Drawer } from './Drawer';
export { SearchField } from './SearchField';
-export {
- FilterDrawer, FilterButton, countActiveFilters, emptyFilterValue,
-} from './FilterDrawer';
+export { FilterDrawer, FilterButton } from './FilterDrawer';
+export { countActiveFilters, emptyFilterValue } from './filterValues';
export { PageTopbar } from './PageTopbar';
export { DataTable } from './DataTable';
export { SortChipBar } from './SortChipBar';
diff --git a/frontend/src/components/ds/status.js b/frontend/src/components/ds/status.js
index d6c9edd8..0bddc94c 100644
--- a/frontend/src/components/ds/status.js
+++ b/frontend/src/components/ds/status.js
@@ -20,6 +20,7 @@ const STATUS_KIND = {
success: 'green',
succeeded: 'green',
completed: 'green',
+ complete: 'green',
done: 'green',
passed: 'green',
pass: 'green',
@@ -97,6 +98,7 @@ const STATUS_KIND = {
created: 'gray',
paused: 'gray',
stopped: 'gray',
+ exited: 'gray',
inactive: 'gray',
skipped: 'gray',
unknown: 'gray',
@@ -175,7 +177,7 @@ export function statusLabel(status) {
// ---------------------------------------------------------------------------
// Fleet alert lifecycle: an ACTIVE alert is the bad state.
-const ALERT_STATUS_OVERRIDES = { active: 'red' };
+const ALERT_STATUS_OVERRIDES = { active: 'red', firing: 'red' };
/** Alert lifecycle status → Pill kind (active→red, acknowledged→amber, resolved→green). */
export function alertStatusKind(status) {
@@ -220,3 +222,12 @@ export function serviceStatusVariant(status) {
export function serviceStatusDotClass(status) {
return KIND_DOT[SERVICE_STATUS_OVERRIDES[normalize(status)] || statusKind(status)];
}
+
+// CSS colors for small status indicators that do not render a Pill.
+const KIND_COLOR = {
+ green: 'var(--green)', red: 'var(--red)', amber: 'var(--amber)',
+ cyan: 'var(--cyan)', violet: 'var(--violet)', gray: 'var(--text-faint)',
+};
+export function statusColor(status) {
+ return KIND_COLOR[statusKind(status)];
+}
diff --git a/frontend/src/components/file-manager/ContextMenu.jsx b/frontend/src/components/file-manager/ContextMenu.jsx
index c74bebdf..05ed66a4 100644
--- a/frontend/src/components/file-manager/ContextMenu.jsx
+++ b/frontend/src/components/file-manager/ContextMenu.jsx
@@ -2,6 +2,7 @@ import { useTranslation } from 'react-i18next';
import {
Folder, Eye, Download, Edit3, Lock, Copy, Trash2,
} from 'lucide-react';
+import { Button as SharedButton } from '@/components/ui/button';
export default function ContextMenu({
menu, // { x, y, entry }
@@ -25,28 +26,28 @@ export default function ContextMenu({
style={{ top: y, left: x }}
onClick={(e) => e.stopPropagation()}
>
- <button type="button" onClick={() => { onOpen(entry); onClose(); }}>
+ <SharedButton variant="unstyled" type="button" onClick={() => { onOpen(entry); onClose(); }}>
{entry.is_dir ? <Folder size={14} /> : <Eye size={14} />}
{entry.is_dir ? 'Open' : 'Preview'}
- </button>
+ </SharedButton>
{!entry.is_dir && (
- <button type="button" onClick={() => { onDownload(entry); onClose(); }}>
+ <SharedButton variant="unstyled" type="button" onClick={() => { onDownload(entry); onClose(); }}>
<Download size={14} /> {t('common.actions.download', 'Download')}
- </button>
+ </SharedButton>
)}
- <button type="button" onClick={() => { onRename(entry); onClose(); }}>
+ <SharedButton variant="unstyled" type="button" onClick={() => { onRename(entry); onClose(); }}>
<Edit3 size={14} /> {t('app.contextMenu.rename', 'Rename')}
- </button>
- <button type="button" onClick={() => { onPermissions(entry); onClose(); }}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" onClick={() => { onPermissions(entry); onClose(); }}>
<Lock size={14} /> {t('common.labels.permissions', 'Permissions')}
- </button>
- <button type="button" onClick={() => { onCopyPath(entry.path); onClose(); }}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" onClick={() => { onCopyPath(entry.path); onClose(); }}>
<Copy size={14} /> {t('app.contextMenu.copyPath', 'Copy path')}
- </button>
+ </SharedButton>
<div className="context-menu-divider" />
- <button type="button" className="danger" onClick={() => { onDelete(entry); onClose(); }}>
+ <SharedButton variant="unstyled" type="button" className="danger" onClick={() => { onDelete(entry); onClose(); }}>
<Trash2 size={14} /> {t('common.actions.delete', 'Delete')}{multi ? ` ${selectionCount} items` : ''}
- </button>
+ </SharedButton>
</div>
);
}
diff --git a/frontend/src/components/file-manager/FileCard.jsx b/frontend/src/components/file-manager/FileCard.jsx
index 9654980b..b63bfef4 100644
--- a/frontend/src/components/file-manager/FileCard.jsx
+++ b/frontend/src/components/file-manager/FileCard.jsx
@@ -4,6 +4,7 @@ import FileIcon from './FileIcon';
import ImageThumb from './ImageThumb';
import { getFileType, getFileExt } from './fileTypes';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
function FileCard({
entry,
@@ -35,7 +36,7 @@ function FileCard({
}}
onContextMenu={(e) => onContext(e, entry)}
>
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className="file-card-check"
onClick={(e) => {
e.stopPropagation();
@@ -46,7 +47,7 @@ function FileCard({
<span className={`checkbox ${selected ? 'checked' : ''}`}>
{selected && <Check size={12} />}
</span>
- </button>
+ </SharedButton>
<div className="file-card-thumb">
{showThumb ? (
diff --git a/frontend/src/components/file-manager/FileRow.jsx b/frontend/src/components/file-manager/FileRow.jsx
index 70eb79a6..78f08175 100644
--- a/frontend/src/components/file-manager/FileRow.jsx
+++ b/frontend/src/components/file-manager/FileRow.jsx
@@ -2,6 +2,7 @@ import { memo } from 'react';
import { Check, Download, Edit3, Lock, Trash2 } from 'lucide-react';
import FileIcon from './FileIcon';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
function FileRow({
entry,
@@ -33,7 +34,7 @@ function FileRow({
onContextMenu={(e) => onContext(e, entry)}
>
<span className="col-check" onClick={(e) => e.stopPropagation()}>
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className="checkbox-btn"
onClick={(e) => onToggleSelect(entry, { ...e, ctrlKey: true })}
aria-label={selected ? t('app.fileRow.deselect', 'Deselect') : t('app.fileRow.select', 'Select')}
@@ -41,7 +42,7 @@ function FileRow({
<span className={`checkbox ${selected ? 'checked' : ''}`}>
{selected && <Check size={12} />}
</span>
- </button>
+ </SharedButton>
</span>
<span className="col-name">
<FileIcon entry={entry} size={16} />
@@ -56,19 +57,19 @@ function FileRow({
<span className="col-owner">{entry.owner}</span>
<span className="col-actions" onClick={(e) => e.stopPropagation()}>
{!entry.is_dir && (
- <button type="button" className="row-action" onClick={() => onDownload(entry)} title={t('common.actions.download', 'Download')}>
+ <SharedButton variant="unstyled" type="button" className="row-action" onClick={() => onDownload(entry)} title={t('common.actions.download', 'Download')}>
<Download size={14} />
- </button>
+ </SharedButton>
)}
- <button type="button" className="row-action" onClick={() => onRename(entry)} title={t('app.fileRow.rename', 'Rename')}>
+ <SharedButton variant="unstyled" type="button" className="row-action" onClick={() => onRename(entry)} title={t('app.fileRow.rename', 'Rename')}>
<Edit3 size={14} />
- </button>
- <button type="button" className="row-action" onClick={() => onPermissions(entry)} title={t('common.labels.permissions', 'Permissions')}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="row-action" onClick={() => onPermissions(entry)} title={t('common.labels.permissions', 'Permissions')}>
<Lock size={14} />
- </button>
- <button type="button" className="row-action danger" onClick={() => onDelete(entry)} title={t('common.actions.delete', 'Delete')}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="row-action danger" onClick={() => onDelete(entry)} title={t('common.actions.delete', 'Delete')}>
<Trash2 size={14} />
- </button>
+ </SharedButton>
</span>
</div>
);
diff --git a/frontend/src/components/file-manager/FolderTree.jsx b/frontend/src/components/file-manager/FolderTree.jsx
index 459d8108..8bfe7624 100644
--- a/frontend/src/components/file-manager/FolderTree.jsx
+++ b/frontend/src/components/file-manager/FolderTree.jsx
@@ -1,6 +1,7 @@
import { ChevronRight, ChevronDown, Folder, FolderOpen } from 'lucide-react';
import Spinner from '../Spinner';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
function TreeNode({ node, level, expanded, treeCache, treeLoading, currentPath, onNavigate, onToggle }) {
const { t } = useTranslation();
@@ -16,7 +17,7 @@ function TreeNode({ node, level, expanded, treeCache, treeLoading, currentPath,
style={{ paddingLeft: 6 + level * 14 }}
onClick={() => onNavigate(node.path)}
>
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className="tree-chevron"
onClick={(e) => { e.stopPropagation(); onToggle(node.path); }}
aria-label={isExpanded ? t('app.folderTree.collapse', 'Collapse') : t('app.folderTree.expand', 'Expand')}
@@ -28,7 +29,7 @@ function TreeNode({ node, level, expanded, treeCache, treeLoading, currentPath,
) : (
<ChevronRight size={12} />
)}
- </button>
+ </SharedButton>
{isExpanded ? (
<FolderOpen size={14} className="tree-folder-icon open" />
) : (
diff --git a/frontend/src/components/file-manager/PreviewDrawer.jsx b/frontend/src/components/file-manager/PreviewDrawer.jsx
index cf115cf4..09e411c9 100644
--- a/frontend/src/components/file-manager/PreviewDrawer.jsx
+++ b/frontend/src/components/file-manager/PreviewDrawer.jsx
@@ -54,9 +54,9 @@ export default function PreviewDrawer({
<h3>{file.name}</h3>
<p className="preview-drawer-path">{file.path}</p>
</div>
- <button type="button" className="preview-drawer-close" onClick={onClose} aria-label={t('common.actions.close', 'Close')}>
+ <Button variant="unstyled" type="button" className="preview-drawer-close" onClick={onClose} aria-label={t('common.actions.close', 'Close')}>
<X size={18} />
- </button>
+ </Button>
</header>
<div className="preview-drawer-meta">
@@ -90,22 +90,22 @@ export default function PreviewDrawer({
<div className="preview-drawer-actions">
{!file.is_dir && (
- <button type="button" className="drawer-action-btn" onClick={() => onDownload(file)}>
+ <Button variant="unstyled" type="button" className="drawer-action-btn" onClick={() => onDownload(file)}>
<Download size={14} /> {t('common.actions.download', 'Download')}
- </button>
+ </Button>
)}
- <button type="button" className="drawer-action-btn" onClick={() => onCopyPath(file.path)}>
+ <Button variant="unstyled" type="button" className="drawer-action-btn" onClick={() => onCopyPath(file.path)}>
<Copy size={14} /> {t('app.previewDrawer.copyPath', 'Copy path')}
- </button>
- <button type="button" className="drawer-action-btn" onClick={() => onRename(file)}>
+ </Button>
+ <Button variant="unstyled" type="button" className="drawer-action-btn" onClick={() => onRename(file)}>
<Edit3 size={14} /> {t('app.previewDrawer.rename', 'Rename')}
- </button>
- <button type="button" className="drawer-action-btn" onClick={() => onPermissions(file)}>
+ </Button>
+ <Button variant="unstyled" type="button" className="drawer-action-btn" onClick={() => onPermissions(file)}>
<Lock size={14} /> {t('common.labels.permissions', 'Permissions')}
- </button>
- <button type="button" className="drawer-action-btn danger" onClick={() => onDelete(file)}>
+ </Button>
+ <Button variant="unstyled" type="button" className="drawer-action-btn danger" onClick={() => onDelete(file)}>
<Trash2 size={14} /> {t('common.actions.delete', 'Delete')}
- </button>
+ </Button>
</div>
<div className="preview-drawer-body">
diff --git a/frontend/src/components/git/GitProviders.jsx b/frontend/src/components/git/GitProviders.jsx
index c36253d8..df5c5cea 100644
--- a/frontend/src/components/git/GitProviders.jsx
+++ b/frontend/src/components/git/GitProviders.jsx
@@ -7,33 +7,9 @@
//
// Simple Icons render with `fill="currentColor"`, so the surrounding SCSS controls
// the color with no inline styles.
-import { SiGithub, SiGitlab, SiBitbucket, SiGitea } from 'react-icons/si';
-import { GitBranch } from 'lucide-react';
+import { GIT_PROVIDERS } from './gitProviderData';
import { useTranslation } from 'react-i18next';
-
-// Ordered list rendered in the provider strip. `match` recognizes a clone URL's
-// host; the trailing "other" entry is the catch-all (self-hosted, SSH, anything
-// unrecognized).
-// `oauth` marks hosts that support a one-click connection (a backend OAuth app);
-// `placeholder` is the URL hint shown when that provider is chosen.
-export const GIT_PROVIDERS = [
- { key: 'github', labelKey: 'app.gitProviders.github', label: 'GitHub', Icon: SiGithub, hintKey: 'app.gitProviders.oneClickOrUrl', hint: 'One-click or URL', match: /github\.com/i, oauth: true, placeholder: 'https://github.com/user/repo.git' },
- { key: 'gitlab', labelKey: 'app.gitProviders.gitlab', label: 'GitLab', Icon: SiGitlab, hintKey: 'app.gitProviders.cloudOrSelfManaged', hint: 'Cloud or self-managed', match: /gitlab\./i, oauth: true, placeholder: 'https://gitlab.com/group/project.git' },
- { key: 'bitbucket', labelKey: 'app.gitProviders.bitbucket', label: 'Bitbucket', Icon: SiBitbucket, hintKey: 'app.gitProviders.oneClickOrUrl', hint: 'One-click or URL', match: /bitbucket\.org/i, oauth: true, placeholder: 'https://bitbucket.org/user/repo.git' },
- { key: 'gitea', labelKey: 'app.gitProviders.gitea', label: 'Gitea', Icon: SiGitea, hintKey: 'app.gitProviders.selfHosted', hint: 'Self-hosted', match: /gitea/i, local: true, placeholder: 'https://gitea.example.com/user/repo.git' },
- { key: 'other', labelKey: 'app.gitProviders.sshOther', label: 'SSH / Other', Icon: GitBranch, hintKey: 'app.gitProviders.anyGitRemote', hint: 'Any Git remote', match: null, placeholder: 'git@host:user/repo.git' },
-];
-
-const OTHER_PROVIDER = GIT_PROVIDERS[GIT_PROVIDERS.length - 1];
-
-// Resolve a clone URL to a provider. Returns null for an empty field (so callers
-// can render a neutral, nothing-detected state) and the "other" catch-all when a
-// non-empty URL matches no known host.
-export function detectProvider(url) {
- const trimmed = (url || '').trim();
- if (!trimmed) return null;
- return GIT_PROVIDERS.find((p) => p.match && p.match.test(trimmed)) || OTHER_PROVIDER;
-}
+import { Button as SharedButton } from '@/components/ui/button';
// The provider strip: every supported host as a chip with its brand mark, label,
// and one-liner. Static by default (just "explains the others"); pass `onSelect`
@@ -65,7 +41,7 @@ export function RepoProviderStrip({ detected, selected, onSelect, giteaStatus })
</>
);
return interactive ? (
- <button
+ <SharedButton variant="unstyled"
type="button"
key={key}
className={className}
@@ -74,7 +50,7 @@ export function RepoProviderStrip({ detected, selected, onSelect, giteaStatus })
onClick={() => onSelect(key)}
>
{inner}
- </button>
+ </SharedButton>
) : (
<div key={key} role="listitem" className={className}>
{inner}
diff --git a/frontend/src/components/git/PathSelector.jsx b/frontend/src/components/git/PathSelector.jsx
index 956a0584..fbd01534 100644
--- a/frontend/src/components/git/PathSelector.jsx
+++ b/frontend/src/components/git/PathSelector.jsx
@@ -53,7 +53,7 @@ const PathSelector = ({ paths, onChange, label, hint, id }) => {
{QUICK_PATHS.map(({ label: quickLabel, value }) => {
const active = paths.includes(value);
return (
- <button
+ <Button variant="unstyled"
type="button"
key={value}
className={`git-path-selector__chip git-path-selector__chip--quick${active ? ' is-active' : ''}`}
@@ -62,7 +62,7 @@ const PathSelector = ({ paths, onChange, label, hint, id }) => {
>
{active ? <X size={12} aria-hidden="true" /> : <Plus size={12} aria-hidden="true" />}
{quickLabel}
- </button>
+ </Button>
);
})}
</div>
@@ -88,14 +88,14 @@ const PathSelector = ({ paths, onChange, label, hint, id }) => {
{paths.map((path) => (
<li key={path} className="git-path-selector__item">
<code>{path}</code>
- <button
+ <Button variant="unstyled"
type="button"
className="git-path-selector__remove"
onClick={() => removePath(path)}
aria-label={t('app.pathSelector.remove', 'Remove {{path}}', { path: path })}
>
<X size={12} aria-hidden="true" />
- </button>
+ </Button>
</li>
))}
</ul>
diff --git a/frontend/src/components/git/RepoConnectForm.jsx b/frontend/src/components/git/RepoConnectForm.jsx
index 92523947..a55a0831 100644
--- a/frontend/src/components/git/RepoConnectForm.jsx
+++ b/frontend/src/components/git/RepoConnectForm.jsx
@@ -5,7 +5,8 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Switch } from '@/components/ui/switch';
import api from '../../services/api';
-import { RepoProviderStrip, ProviderBadge, detectProvider, GIT_PROVIDERS } from './GitProviders';
+import { RepoProviderStrip, ProviderBadge } from './GitProviders';
+import { detectProvider, GIT_PROVIDERS } from './gitProviderData';
import GithubRepoPicker from './GithubRepoPicker';
import GitlabRepoPicker from './GitlabRepoPicker';
import BitbucketRepoPicker from './BitbucketRepoPicker';
diff --git a/frontend/src/components/git/RepoPicker.jsx b/frontend/src/components/git/RepoPicker.jsx
index 3e491c61..8f8748d9 100644
--- a/frontend/src/components/git/RepoPicker.jsx
+++ b/frontend/src/components/git/RepoPicker.jsx
@@ -169,7 +169,7 @@ const RepoPicker = ({ provider, onPick }) => {
</div>
)}
{!reposLoading && repos.map((repo) => (
- <button
+ <Button variant="unstyled"
type="button"
key={repo.id}
className={`git-connect__gh-repo${selected?.id === repo.id ? ' is-active' : ''}`}
@@ -188,7 +188,7 @@ const RepoPicker = ({ provider, onPick }) => {
: t('git.picker.public', 'Public')}
</span>
{selected?.id === repo.id && <Check size={15} />}
- </button>
+ </Button>
))}
</div>
diff --git a/frontend/src/components/git/gitProviderData.js b/frontend/src/components/git/gitProviderData.js
new file mode 100644
index 00000000..f2af20ab
--- /dev/null
+++ b/frontend/src/components/git/gitProviderData.js
@@ -0,0 +1,26 @@
+import { SiGithub, SiGitlab, SiBitbucket, SiGitea } from 'react-icons/si';
+import { GitBranch } from 'lucide-react';
+
+// Ordered list rendered in the provider strip. `match` recognizes a clone URL's
+// host; the trailing "other" entry is the catch-all (self-hosted, SSH, anything
+// unrecognized).
+// `oauth` marks hosts that support a one-click connection (a backend OAuth app);
+// `placeholder` is the URL hint shown when that provider is chosen.
+export const GIT_PROVIDERS = [
+ { key: 'github', labelKey: 'app.gitProviders.github', label: 'GitHub', Icon: SiGithub, hintKey: 'app.gitProviders.oneClickOrUrl', hint: 'One-click or URL', match: /github\.com/i, oauth: true, placeholder: 'https://github.com/user/repo.git' },
+ { key: 'gitlab', labelKey: 'app.gitProviders.gitlab', label: 'GitLab', Icon: SiGitlab, hintKey: 'app.gitProviders.cloudOrSelfManaged', hint: 'Cloud or self-managed', match: /gitlab\./i, oauth: true, placeholder: 'https://gitlab.com/group/project.git' },
+ { key: 'bitbucket', labelKey: 'app.gitProviders.bitbucket', label: 'Bitbucket', Icon: SiBitbucket, hintKey: 'app.gitProviders.oneClickOrUrl', hint: 'One-click or URL', match: /bitbucket\.org/i, oauth: true, placeholder: 'https://bitbucket.org/user/repo.git' },
+ { key: 'gitea', labelKey: 'app.gitProviders.gitea', label: 'Gitea', Icon: SiGitea, hintKey: 'app.gitProviders.selfHosted', hint: 'Self-hosted', match: /gitea/i, local: true, placeholder: 'https://gitea.example.com/user/repo.git' },
+ { key: 'other', labelKey: 'app.gitProviders.sshOther', label: 'SSH / Other', Icon: GitBranch, hintKey: 'app.gitProviders.anyGitRemote', hint: 'Any Git remote', match: null, placeholder: 'git@host:user/repo.git' },
+];
+
+const OTHER_PROVIDER = GIT_PROVIDERS[GIT_PROVIDERS.length - 1];
+
+// Resolve a clone URL to a provider. Returns null for an empty field (so callers
+// can render a neutral, nothing-detected state) and the "other" catch-all when a
+// non-empty URL matches no known host.
+export function detectProvider(url) {
+ const trimmed = (url || '').trim();
+ if (!trimmed) return null;
+ return GIT_PROVIDERS.find((p) => p.match && p.match.test(trimmed)) || OTHER_PROVIDER;
+}
diff --git a/frontend/src/components/icons/DatabaseBrands.jsx b/frontend/src/components/icons/DatabaseBrands.jsx
index 80579142..6ed38593 100644
--- a/frontend/src/components/icons/DatabaseBrands.jsx
+++ b/frontend/src/components/icons/DatabaseBrands.jsx
@@ -5,25 +5,8 @@
//
// All Simple Icons render with `fill="currentColor"`, so the existing
// `.is-<engine>` SCSS tinting still controls the color with no inline styles.
-import {
- SiMysql, SiMariadb, SiPostgresql, SiSqlite, SiMongodb, SiRedis, SiDocker,
-} from 'react-icons/si';
import { Database } from 'lucide-react';
-
-// engine key -> brand icon component. Keys match ENGINE_META / node.engine.
-const ENGINE_ICONS = {
- mysql: SiMysql,
- mariadb: SiMariadb,
- postgresql: SiPostgresql,
- sqlite: SiSqlite,
- mongodb: SiMongodb,
- redis: SiRedis,
- docker: SiDocker,
-};
-
-export function hasBrandIcon(engine) {
- return Boolean(ENGINE_ICONS[engine]);
-}
+import { ENGINE_ICONS } from './databaseBrandData';
// Renders the brand icon for an engine, falling back to the generic lucide
// Database glyph for anything we don't have a brand for.
diff --git a/frontend/src/components/icons/ExtensionBrands.jsx b/frontend/src/components/icons/ExtensionBrands.jsx
index 77a31cd5..b5b68deb 100644
--- a/frontend/src/components/icons/ExtensionBrands.jsx
+++ b/frontend/src/components/icons/ExtensionBrands.jsx
@@ -5,34 +5,7 @@
//
// Slugs without a real brand icon return null so the caller can fall back to the
// manifest icon or the category lucide glyph.
-import {
- SiWordpress, SiCloudflare, SiGitea, SiGit, SiNvidia, SiWireguard,
-} from 'react-icons/si';
-
-// Strip the conventional `serverkit-` prefix and lowercase so keyword matching
-// works on both `serverkit-wordpress` and `wordpress`.
-const normalizeSlug = (slug) => String(slug || '').toLowerCase().replace(/^serverkit-/, '');
-
-// Ordered keyword rules — first match wins. Keep the most specific keys first
-// (gitea before the generic git fallback).
-const BRAND_RULES = [
- { keys: ['wordpress'], Icon: SiWordpress },
- { keys: ['cloudflare'], Icon: SiCloudflare },
- { keys: ['gitea', 'forgejo'], Icon: SiGitea },
- { keys: ['git'], Icon: SiGit },
- { keys: ['gpu', 'nvidia', 'cuda'], Icon: SiNvidia },
- { keys: ['wireguard', 'remote'], Icon: SiWireguard },
-];
-
-const resolveBrand = (slug) => {
- const normalized = normalizeSlug(slug);
- const rule = BRAND_RULES.find((item) => item.keys.some((key) => normalized.includes(key)));
- return rule ? rule.Icon : null;
-};
-
-export function hasBrandMark(slug) {
- return Boolean(resolveBrand(slug));
-}
+import { resolveBrand } from './extensionBrandData';
// Renders the brand mark for a known bundled slug, or null when we have no real
// brand icon (fallback handled by the caller). Simple Icons render with
@@ -43,18 +16,4 @@ export function ExtensionBrandMark({ slug, size = 34, className }) {
return <Icon size={size} className={className} aria-hidden="true" />;
}
-// Deterministic per-slug cover gradient. Hashes the slug to a hue so each
-// extension keeps a stable, distinct backdrop across renders. This is the one
-// data-derived inline style allowed on the marketplace surface.
-export function extensionCoverStyle(slug, category) {
- const seed = String(slug || category || 'extension');
- let hash = 0;
- for (const char of seed) hash = (hash * 31 + char.charCodeAt(0)) >>> 0;
- const hue = hash % 360;
- const hueShift = (hue + 28) % 360;
- return {
- background: `linear-gradient(135deg, hsl(${hue} 52% 42%), hsl(${hueShift} 58% 28%))`,
- };
-}
-
export default ExtensionBrandMark;
diff --git a/frontend/src/components/icons/databaseBrandData.js b/frontend/src/components/icons/databaseBrandData.js
new file mode 100644
index 00000000..48cfa20c
--- /dev/null
+++ b/frontend/src/components/icons/databaseBrandData.js
@@ -0,0 +1,18 @@
+import {
+ SiMysql, SiMariadb, SiPostgresql, SiSqlite, SiMongodb, SiRedis, SiDocker,
+} from 'react-icons/si';
+
+// engine key -> brand icon component. Keys match ENGINE_META / node.engine.
+export const ENGINE_ICONS = {
+ mysql: SiMysql,
+ mariadb: SiMariadb,
+ postgresql: SiPostgresql,
+ sqlite: SiSqlite,
+ mongodb: SiMongodb,
+ redis: SiRedis,
+ docker: SiDocker,
+};
+
+export function hasBrandIcon(engine) {
+ return Boolean(ENGINE_ICONS[engine]);
+}
diff --git a/frontend/src/components/icons/extensionBrandData.js b/frontend/src/components/icons/extensionBrandData.js
new file mode 100644
index 00000000..a84ee35d
--- /dev/null
+++ b/frontend/src/components/icons/extensionBrandData.js
@@ -0,0 +1,42 @@
+import {
+ SiWordpress, SiCloudflare, SiGitea, SiGit, SiNvidia, SiWireguard,
+} from 'react-icons/si';
+
+// Strip the conventional `serverkit-` prefix and lowercase so keyword matching
+// works on both `serverkit-wordpress` and `wordpress`.
+const normalizeSlug = (slug) => String(slug || '').toLowerCase().replace(/^serverkit-/, '');
+
+// Ordered keyword rules — first match wins. Keep the most specific keys first
+// (gitea before the generic git fallback).
+const BRAND_RULES = [
+ { keys: ['wordpress'], Icon: SiWordpress },
+ { keys: ['cloudflare'], Icon: SiCloudflare },
+ { keys: ['gitea', 'forgejo'], Icon: SiGitea },
+ { keys: ['git'], Icon: SiGit },
+ { keys: ['gpu', 'nvidia', 'cuda'], Icon: SiNvidia },
+ { keys: ['wireguard', 'remote'], Icon: SiWireguard },
+];
+
+export const resolveBrand = (slug) => {
+ const normalized = normalizeSlug(slug);
+ const rule = BRAND_RULES.find((item) => item.keys.some((key) => normalized.includes(key)));
+ return rule ? rule.Icon : null;
+};
+
+export function hasBrandMark(slug) {
+ return Boolean(resolveBrand(slug));
+}
+
+// Deterministic per-slug cover gradient. Hashes the slug to a hue so each
+// extension keeps a stable, distinct backdrop across renders. This is the one
+// data-derived inline style allowed on the marketplace surface.
+export function extensionCoverStyle(slug, category) {
+ const seed = String(slug || category || 'extension');
+ let hash = 0;
+ for (const char of seed) hash = (hash * 31 + char.charCodeAt(0)) >>> 0;
+ const hue = hash % 360;
+ const hueShift = (hue + 28) % 360;
+ return {
+ background: `linear-gradient(135deg, hsl(${hue} 52% 42%), hsl(${hueShift} 58% 28%))`,
+ };
+}
diff --git a/frontend/src/components/layouts/ResourceListPage.jsx b/frontend/src/components/layouts/ResourceListPage.jsx
index b9ccda1f..a2fd02a5 100644
--- a/frontend/src/components/layouts/ResourceListPage.jsx
+++ b/frontend/src/components/layouts/ResourceListPage.jsx
@@ -12,6 +12,7 @@ import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Shared chrome for resource list pages (Services, Servers, …): the status
// filter + search toolbar, sort & column menus, the DataTable with a standard
@@ -261,7 +262,7 @@ export default function ResourceListPage({
{renderCard && (
<div className="wp-list__viewswitch" role="group" aria-label={t('app.resourceListPage.layout', 'Layout')}>
{[['list', Rows3, 'List'], ['cards', LayoutGrid, 'Cards']].map(([key, Icon, label]) => (
- <button
+ <SharedButton variant="unstyled"
type="button"
key={key}
className={view === key ? 'is-active' : ''}
@@ -271,7 +272,7 @@ export default function ResourceListPage({
aria-pressed={view === key}
>
<Icon size={15} />
- </button>
+ </SharedButton>
))}
</div>
)}
diff --git a/frontend/src/components/log-viewer/LogFileList.jsx b/frontend/src/components/log-viewer/LogFileList.jsx
index c9b741f9..522616e0 100644
--- a/frontend/src/components/log-viewer/LogFileList.jsx
+++ b/frontend/src/components/log-viewer/LogFileList.jsx
@@ -2,6 +2,7 @@ import { useMemo, useState } from 'react';
import { Search, RefreshCw, ChevronDown, ChevronRight, FileText, AlertTriangle, Activity, Database, Globe, Mail, Shield, Server } from 'lucide-react';
import { LOG_GROUPS, categoriseLog, logKindFromPath, formatBytes, formatRelativeTime } from './logHelpers';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const GROUP_ICONS = {
web: Globe,
@@ -59,14 +60,14 @@ export default function LogFileList({ files, selectedPath, onSelect, onRefresh,
placeholder={t('app.logFileList.filterLogFiles', 'Filter log files…')}
/>
</div>
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className="lv-icon-btn"
onClick={onRefresh}
disabled={loading}
title={t('app.logFileList.reloadList', 'Reload list')}
>
<RefreshCw size={13} className={loading ? 'spinning' : ''} />
- </button>
+ </SharedButton>
</div>
<div className="lv-sidebar-body">
@@ -85,7 +86,7 @@ export default function LogFileList({ files, selectedPath, onSelect, onRefresh,
const isCollapsed = collapsed.has(group.id);
return (
<div key={group.id} className="lv-group">
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className="lv-group-header"
onClick={() => toggleGroup(group.id)}
>
@@ -93,14 +94,14 @@ export default function LogFileList({ files, selectedPath, onSelect, onRefresh,
<Icon size={13} className="lv-group-icon" />
<span>{group.label}</span>
<span className="lv-group-count">{group.files.length}</span>
- </button>
+ </SharedButton>
{!isCollapsed && (
<div className="lv-group-files">
{group.files.map((log) => {
const kind = logKindFromPath(log.path || log.name);
const isActive = selectedPath === log.path;
return (
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
key={log.path}
className={`lv-file ${isActive ? 'active' : ''}`}
onClick={() => onSelect(log)}
@@ -114,7 +115,7 @@ export default function LogFileList({ files, selectedPath, onSelect, onRefresh,
{formatRelativeTime(log.modified)}
</span>
)}
- </button>
+ </SharedButton>
);
})}
</div>
diff --git a/frontend/src/components/log-viewer/LogToolbar.jsx b/frontend/src/components/log-viewer/LogToolbar.jsx
index a15c86f0..c3b617c1 100644
--- a/frontend/src/components/log-viewer/LogToolbar.jsx
+++ b/frontend/src/components/log-viewer/LogToolbar.jsx
@@ -1,5 +1,6 @@
import { Search, RefreshCw, Download, Trash2, Maximize2, Minimize2, X, ArrowDownToLine, Hash, WrapText } from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
export default function LogToolbar({
searchPattern, onSearchChange, onSearchSubmit, onSearchClear,
@@ -25,9 +26,9 @@ export default function LogToolbar({
onKeyDown={(e) => e.key === 'Enter' && onSearchSubmit()}
/>
{searchPattern && (
- <button type="button" className="lv-search-field-clear" onClick={onSearchClear} title={t('common.actions.clear', 'Clear')}>
+ <SharedButton variant="unstyled" type="button" className="lv-search-field-clear" onClick={onSearchClear} title={t('common.actions.clear', 'Clear')}>
<X size={11} />
- </button>
+ </SharedButton>
)}
</div>
<select
@@ -43,7 +44,7 @@ export default function LogToolbar({
</div>
<div className="lv-toolbar-right">
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className={`lv-chip ${autoRefresh ? 'active' : ''}`}
onClick={onAutoRefreshToggle}
disabled={!canAct}
@@ -51,60 +52,60 @@ export default function LogToolbar({
>
<span className={`lv-pulse ${autoRefresh ? 'on' : ''}`} />
<span>{t('app.logToolbar.live', 'Live')}</span>
- </button>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button"
className={`lv-icon-btn ${showLineNumbers ? 'active' : ''}`}
onClick={onToggleLineNumbers}
title={t('app.logToolbar.toggleLineNumbers', 'Toggle line numbers')}
>
<Hash size={13} />
- </button>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button"
className={`lv-icon-btn ${wrapLines ? 'active' : ''}`}
onClick={onToggleWrap}
title={t('app.logToolbar.toggleWordWrap', 'Toggle word wrap')}
>
<WrapText size={13} />
- </button>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button"
className="lv-icon-btn"
onClick={onScrollToBottom}
disabled={!canAct}
title={t('app.logToolbar.jumpToEnd', 'Jump to end')}
>
<ArrowDownToLine size={13} />
- </button>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button"
className="lv-icon-btn"
onClick={onRefresh}
disabled={!canAct}
title={t('common.actions.refresh', 'Refresh')}
>
<RefreshCw size={13} />
- </button>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button"
className="lv-icon-btn"
onClick={onDownload}
disabled={!canAct}
title={t('common.actions.download', 'Download')}
>
<Download size={13} />
- </button>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button"
className="lv-icon-btn danger"
onClick={onClear}
disabled={!canAct}
title={t('app.logToolbar.truncateLogFile', 'Truncate log file')}
>
<Trash2 size={13} />
- </button>
- <button type="button"
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button"
className="lv-icon-btn"
onClick={onToggleFullscreen}
title={isFullscreen ? t('app.logToolbar.exitFullscreen', 'Exit fullscreen') : t('app.logToolbar.fullscreen', 'Fullscreen')}
>
{isFullscreen ? <Minimize2 size={13} /> : <Maximize2 size={13} />}
- </button>
+ </SharedButton>
</div>
</div>
);
diff --git a/frontend/src/components/marketplace/ManualInstallModal.jsx b/frontend/src/components/marketplace/ManualInstallModal.jsx
index 612ae56c..1899e959 100644
--- a/frontend/src/components/marketplace/ManualInstallModal.jsx
+++ b/frontend/src/components/marketplace/ManualInstallModal.jsx
@@ -10,7 +10,7 @@ import {
ShieldCheck,
} from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -278,7 +278,7 @@ const ManualInstallModal = ({ defaultSource = 'url', onClose, onInstalled }) =>
{INSTALL_SOURCES.map((source) => {
const SourceIcon = source.icon;
return (
- <button
+ <Button variant="unstyled"
key={source.id}
role="tab"
type="button"
@@ -288,7 +288,7 @@ const ManualInstallModal = ({ defaultSource = 'url', onClose, onInstalled }) =>
>
<SourceIcon aria-hidden="true" />
{source.label}
- </button>
+ </Button>
);
})}
</div>
diff --git a/frontend/src/components/monitoring/DiskReclaimModal.jsx b/frontend/src/components/monitoring/DiskReclaimModal.jsx
index e306fcc3..204b1f66 100644
--- a/frontend/src/components/monitoring/DiskReclaimModal.jsx
+++ b/frontend/src/components/monitoring/DiskReclaimModal.jsx
@@ -4,7 +4,7 @@ import { HardDrive } from 'lucide-react';
import api from '../../services/api';
import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
-import { useToast } from '@/contexts/ToastContext';
+import { useToast } from '@/contexts/useToast.js';
import { useOperations } from '@/contexts/OperationsContext';
import formatBytes from '@/utils/formatBytes';
diff --git a/frontend/src/components/monitoring/DoctorPanel.jsx b/frontend/src/components/monitoring/DoctorPanel.jsx
index 6bf8a899..49b46343 100644
--- a/frontend/src/components/monitoring/DoctorPanel.jsx
+++ b/frontend/src/components/monitoring/DoctorPanel.jsx
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import Modal from '@/components/Modal';
import { Pill, statusKind } from '@/components/ds';
diff --git a/frontend/src/components/monitoring/FleetCapacityPanel.jsx b/frontend/src/components/monitoring/FleetCapacityPanel.jsx
index 6a074b39..a19517f7 100644
--- a/frontend/src/components/monitoring/FleetCapacityPanel.jsx
+++ b/frontend/src/components/monitoring/FleetCapacityPanel.jsx
@@ -5,7 +5,7 @@ import {
CartesianGrid, Tooltip, ResponsiveContainer, Legend,
} from 'recharts';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { DataTable, DataTableFooter, Pill } from '@/components/ds';
import { CHART_COLORS, METRIC_LABELS } from './fleetMetrics';
diff --git a/frontend/src/components/monitoring/FleetThresholdsPanel.jsx b/frontend/src/components/monitoring/FleetThresholdsPanel.jsx
index b1b7afdf..1e2ac254 100644
--- a/frontend/src/components/monitoring/FleetThresholdsPanel.jsx
+++ b/frontend/src/components/monitoring/FleetThresholdsPanel.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react';
import { Plus, XCircle } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
diff --git a/frontend/src/components/monitoring/MonitoringOverview.jsx b/frontend/src/components/monitoring/MonitoringOverview.jsx
index 37eb107d..a2c6068c 100644
--- a/frontend/src/components/monitoring/MonitoringOverview.jsx
+++ b/frontend/src/components/monitoring/MonitoringOverview.jsx
@@ -96,7 +96,7 @@ export default function MonitoringOverview({
return () => { cancelled = true; };
}, [period, refreshKey]);
- const hostMetrics = status?.current_metrics || {};
+ const hostMetrics = useMemo(() => status?.current_metrics || {}, [status?.current_metrics]);
const scopeRow = !isHost ? fleet.find((r) => String(r.id) === String(scope)) : null;
// Current value per metric: the live reading for the panel host, the newest
@@ -104,10 +104,10 @@ export default function MonitoringOverview({
const current = useMemo(() => {
if (isHost) {
return {
- cpu: hostMetrics.cpu?.percent,
- memory: hostMetrics.memory?.percent,
- disk: hostMetrics.disk?.percent,
- load: hostMetrics.load_average?.['1min'],
+ cpu: hostMetrics?.cpu?.percent,
+ memory: hostMetrics?.memory?.percent,
+ disk: hostMetrics?.disk?.percent,
+ load: hostMetrics?.load_average?.['1min'],
containers: null,
};
}
@@ -437,7 +437,7 @@ function HostCard({ active, name, sub, status, cpu, memory, disk, spark, onClick
const kind = status === 'online' ? 'green' : status === 'offline' ? 'red' : 'gray';
const hot = typeof cpu === 'number' && cpu > 75;
return (
- <button
+ <Button variant="unstyled"
type="button"
className={`mon-host${active ? ' is-active' : ''}`}
onClick={onClick}
@@ -469,6 +469,6 @@ function HostCard({ active, name, sub, status, cpu, memory, disk, spark, onClick
<span>MEM <b>{memory == null ? '—' : `${fmt(memory, 0)}%`}</b></span>
<span>DSK <b>{disk == null ? '—' : `${fmt(disk, 0)}%`}</b></span>
</span>
- </button>
+ </Button>
);
}
diff --git a/frontend/src/components/monitoring/ServerScopePicker.jsx b/frontend/src/components/monitoring/ServerScopePicker.jsx
index 9b052312..000d5acb 100644
--- a/frontend/src/components/monitoring/ServerScopePicker.jsx
+++ b/frontend/src/components/monitoring/ServerScopePicker.jsx
@@ -3,6 +3,7 @@ import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover
import { useState } from 'react';
import { HOST_SCOPE } from './useMonitorScope';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Top-bar control that picks which host every Monitoring section describes.
// Hidden entirely when nothing is paired — with one machine there is no choice
@@ -17,16 +18,16 @@ export default function ServerScopePicker({ scope, servers, onChange, label }) {
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
- <button type="button" className="mon-scope" aria-label={t('app.serverScopePicker.chooseWhichServerToMonitor', 'Choose which server to monitor')}>
+ <SharedButton variant="unstyled" type="button" className="mon-scope" aria-label={t('app.serverScopePicker.chooseWhichServerToMonitor', 'Choose which server to monitor')}>
<span className="mon-scope__ico">
{scope === HOST_SCOPE ? <HardDrive size={14} /> : <ServerIcon size={14} />}
</span>
<span className="mon-scope__label">{label}</span>
<ChevronDown size={14} className="mon-scope__chev" />
- </button>
+ </SharedButton>
</PopoverTrigger>
<PopoverContent align="end" sideOffset={6} className="ui-popover-content mon-scope__menu">
- <button
+ <SharedButton variant="unstyled"
type="button"
className={`mon-scope__item${scope === HOST_SCOPE ? ' is-on' : ''}`}
onClick={() => pick(HOST_SCOPE)}
@@ -37,10 +38,10 @@ export default function ServerScopePicker({ scope, servers, onChange, label }) {
<small>{t('app.serverScopePicker.theMachineRunningThePanel', 'The machine running the panel')}</small>
</span>
{scope === HOST_SCOPE && <Check size={14} />}
- </button>
+ </SharedButton>
<div className="mon-scope__sep" />
{servers.map((s) => (
- <button
+ <SharedButton variant="unstyled"
key={s.id}
type="button"
className={`mon-scope__item${String(scope) === String(s.id) ? ' is-on' : ''}`}
@@ -52,7 +53,7 @@ export default function ServerScopePicker({ scope, servers, onChange, label }) {
<small>{s.hostname || s.ip_address || s.status || 'agent'}</small>
</span>
{String(scope) === String(s.id) && <Check size={14} />}
- </button>
+ </SharedButton>
))}
</PopoverContent>
</Popover>
diff --git a/frontend/src/components/monitoring/UptimeBars.jsx b/frontend/src/components/monitoring/UptimeBars.jsx
index 468e01e7..fc2b6b92 100644
--- a/frontend/src/components/monitoring/UptimeBars.jsx
+++ b/frontend/src/components/monitoring/UptimeBars.jsx
@@ -4,6 +4,7 @@
// green bar — "we weren't looking" and "it was fine" are different facts, and
// conflating them is how uptime widgets end up lying about their own history.
import { cn } from '@/lib/utils';
+import { Button as SharedButton } from '@/components/ui/button';
function tooltipFor(day) {
if (day.state === 'none') return `${day.date} — not monitored`;
@@ -21,8 +22,8 @@ export default function UptimeBars({ days = [], selected, onSelect, className })
// 6px sliver with no label or affordance of its own. Semantic
// <button> keeps it keyboard-reachable without dragging the
// full button styling into a data visualisation.
- // eslint-disable-next-line no-restricted-syntax
- <button
+
+ <SharedButton variant="unstyled"
key={day.date}
type="button"
className={cn(
diff --git a/frontend/src/components/previews/PreviewList.jsx b/frontend/src/components/previews/PreviewList.jsx
index c59823c8..0faa8234 100644
--- a/frontend/src/components/previews/PreviewList.jsx
+++ b/frontend/src/components/previews/PreviewList.jsx
@@ -3,7 +3,7 @@ import {
GitPullRequest, ExternalLink, RefreshCw, Trash2, RotateCcw,
} from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import EmptyState from '../EmptyState';
import { Pill, serviceStatusKind } from '../ds';
@@ -43,7 +43,7 @@ const PreviewList = ({ appId }) => {
} finally {
setLoading(false);
}
- }, [appId, toast]);
+ }, [appId, t, toast]);
useEffect(() => { load(); }, [load]);
diff --git a/frontend/src/components/processData.js b/frontend/src/components/processData.js
new file mode 100644
index 00000000..0640a85c
--- /dev/null
+++ b/frontend/src/components/processData.js
@@ -0,0 +1,2 @@
+// The process API uses both user and username across local/remote collectors.
+export const procUser = (p) => p.user || p.username || '';
diff --git a/frontend/src/components/proxy/ProxyStackPanel.jsx b/frontend/src/components/proxy/ProxyStackPanel.jsx
index 64dac746..20c9ff84 100644
--- a/frontend/src/components/proxy/ProxyStackPanel.jsx
+++ b/frontend/src/components/proxy/ProxyStackPanel.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback } from 'react';
import { Link } from 'react-router-dom';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Textarea } from '@/components/ui/textarea';
import { Pill, SegControl, serviceStatusKind } from '../ds';
diff --git a/frontend/src/components/security/AuditTab.jsx b/frontend/src/components/security/AuditTab.jsx
index c386a3ee..d3144f04 100644
--- a/frontend/src/components/security/AuditTab.jsx
+++ b/frontend/src/components/security/AuditTab.jsx
@@ -6,6 +6,7 @@ import EmptyState from '@/components/EmptyState';
import { Button } from '@/components/ui/button';
import { ScoreGauge } from '@/components/ds';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';
const scoreColor = (score) => {
@@ -36,14 +37,14 @@ const AuditTab = () => {
return (
<div className="audit-tab">
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.auditTab.securityAudit', 'Security Audit')}</h3>
<Button variant="default" onClick={runAudit} disabled={loading}>
{loading ? 'Running Audit...' : 'Run Audit'}
</Button>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
{error && <div className="alert alert-danger">{error}</div>}
{!audit && !loading && (
@@ -101,8 +102,8 @@ const AuditTab = () => {
)}
</div>
)}
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
</div>
);
};
diff --git a/frontend/src/components/security/EventsTab.jsx b/frontend/src/components/security/EventsTab.jsx
index f9fcd127..afcd881b 100644
--- a/frontend/src/components/security/EventsTab.jsx
+++ b/frontend/src/components/security/EventsTab.jsx
@@ -3,6 +3,7 @@ import api from '../../services/api';
import { Button } from '@/components/ui/button';
import { Feed, FeedItem } from '@/components/ds';
import { useTranslation } from 'react-i18next';
+import { CardHeader as SharedCardHeader, CardContent as SharedCardContent, Card as SharedCard } from '@/components/ui/card';
const EventsTab = () => {
const { t } = useTranslation();
@@ -55,11 +56,11 @@ const EventsTab = () => {
<div className="events-tab">
{failedLogins && (
<div className={`card ${failedLogins.alert_triggered ? 'card-warning' : ''}`}>
- <div className="card-header">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.eventsTab.failedLoginAttempts24h', 'Failed Login Attempts (24h)')}</h3>
<Button variant="outline" size="sm" onClick={loadFailedLogins}>{t('common.actions.refresh', 'Refresh')}</Button>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<div className="failed-login-summary">
<span className={`count ${failedLogins.alert_triggered ? 'danger' : ''}`}>
{failedLogins.failed_attempts}
@@ -72,16 +73,16 @@ const EventsTab = () => {
<pre>{failedLogins.recent_failures.join('\n')}</pre>
</details>
)}
- </div>
+ </SharedCardContent>
</div>
)}
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.eventsTab.securityEvents', 'Security Events')}</h3>
<Button variant="outline" size="sm" onClick={loadEvents}>{t('common.actions.refresh', 'Refresh')}</Button>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
{loading ? (
<div className="loading-sm">{t('common.loading', 'Loading…')}</div>
) : events.length === 0 ? (
@@ -100,8 +101,8 @@ const EventsTab = () => {
))}
</Feed>
)}
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
</div>
);
};
diff --git a/frontend/src/components/security/FirewallTab.jsx b/frontend/src/components/security/FirewallTab.jsx
index 74ac4239..a9f48fab 100644
--- a/frontend/src/components/security/FirewallTab.jsx
+++ b/frontend/src/components/security/FirewallTab.jsx
@@ -1,6 +1,6 @@
-import { useState, useEffect, useMemo } from 'react';
+import { useCallback, useState, useEffect, useMemo } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '@/hooks/useConfirm';
import EmptyState from '@/components/EmptyState';
import Modal from '../Modal';
@@ -18,6 +18,7 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { Ban, Shield } from 'lucide-react';
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';
const RULE_TYPE_TONES = {
port: 'accent',
@@ -119,56 +120,57 @@ const FirewallTab = () => {
{ port: 27017, name: 'MongoDB', protocol: 'tcp' },
];
- useEffect(() => {
- loadData();
- }, []);
-
- const loadData = async () => {
- setLoading(true);
- try {
- await Promise.all([loadStatus(), loadRules(), loadBlockedIPs(), loadGuard()]);
- } catch (error) {
- console.error('Failed to load firewall data:', error);
- } finally {
- setLoading(false);
- }
- };
-
- const loadStatus = async () => {
+ const loadStatus = useCallback(async () => {
try {
const data = await api.getFirewallStatus();
setStatus(data);
} catch (error) {
console.error('Failed to load status:', error);
}
- };
+ }, []);
- const loadRules = async () => {
+ const loadRules = useCallback(async () => {
try {
const data = await api.getFirewallRules();
setRules(data.rules || []);
} catch (error) {
console.error('Failed to load rules:', error);
}
- };
+ }, []);
- const loadBlockedIPs = async () => {
+ const loadBlockedIPs = useCallback(async () => {
try {
const data = await api.getBlockedIPs();
setBlockedIPs(data.blocked_ips || []);
} catch (error) {
console.error('Failed to load blocked IPs:', error);
}
- };
+ }, []);
- const loadGuard = async () => {
+ const loadGuard = useCallback(async () => {
try {
const data = await api.getMetadataGuard();
setGuard(data);
} catch (error) {
console.error('Failed to load metadata guard status:', error);
}
- };
+ }, []);
+
+ const loadData = useCallback(async () => {
+ setLoading(true);
+ try {
+ await Promise.all([loadStatus(), loadRules(), loadBlockedIPs(), loadGuard()]);
+ } catch (error) {
+ console.error('Failed to load firewall data:', error);
+ } finally {
+ setLoading(false);
+ }
+ }, [loadStatus, loadRules, loadBlockedIPs, loadGuard]);
+
+ useEffect(() => {
+ loadData();
+ }, [loadData]);
+
const handleGuardToggle = async (enabled) => {
setGuardLoading(true);
@@ -477,12 +479,12 @@ const FirewallTab = () => {
/>
{activeSubTab === 'status' && (
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.firewallTab.firewallInformation', 'Firewall Information')}</h3>
<Button variant="outline" size="sm" onClick={loadData}>{t('common.actions.refresh', 'Refresh')}</Button>
- </div>
- <div className="card-body">
+ </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>
@@ -501,8 +503,8 @@ const FirewallTab = () => {
</div>
)}
</div>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
)}
{activeSubTab === 'rules' && (
@@ -534,11 +536,11 @@ const FirewallTab = () => {
<GridChips {...chrome.chipProps} />
{rules.length === 0 ? (
- <div className="card">
+ <SharedCard variant="legacy" className="card">
<p className="text-muted">{t('app.firewallTab.noRulesConfigured', 'No rules configured')}</p>
- </div>
+ </SharedCard>
) : (
- <div className="card sec-flush">
+ <SharedCard variant="legacy" className="card sec-flush">
<DataTable
columns={chrome.columns}
data={rules}
@@ -554,21 +556,21 @@ const FirewallTab = () => {
/>
)}
/>
- </div>
+ </SharedCard>
)}
</>
)}
{activeSubTab === 'blocked' && (
- <div className="card sec-flush">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card sec-flush">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.firewallTab.blockedIpAddresses', 'Blocked IP Addresses')}</h3>
<Button variant="default" size="sm" onClick={() => setShowBlockIPModal(true)}>{t('app.firewallTab.blockIp', 'Block IP')}</Button>
- </div>
+ </SharedCardHeader>
{blockedIPs.length === 0 ? (
- <div className="card-body">
+ <SharedCardContent variant="legacy" className="card-body">
<EmptyState icon={Ban} title={t('app.firewallTab.noBlockedIps', 'No blocked IPs')} />
- </div>
+ </SharedCardContent>
) : (
<div className="blocked-list">
{blockedIPs.map((item, index) => (
@@ -583,15 +585,15 @@ const FirewallTab = () => {
))}
</div>
)}
- </div>
+ </SharedCard>
)}
{activeSubTab === 'quick' && (
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.firewallTab.quickPortAccess', 'Quick Port Access')}</h3>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<p className="sec-hint sec-hint--lead">{t('app.firewallTab.oneClickEnableDisableCommonService', 'One-click enable/disable common service ports')}</p>
<div className="quick-ports-grid">
{commonPorts.map(({ port, name, protocol }) => {
@@ -617,15 +619,15 @@ const FirewallTab = () => {
);
})}
</div>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
)}
</>
)}
{guard && (
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.firewallTab.cloudMetadataGuard2', 'Cloud Metadata Guard')}</h3>
{guard.supported ? (
<Pill kind={guard.active ? 'green' : 'gray'}>
@@ -634,8 +636,8 @@ const FirewallTab = () => {
) : (
<Pill kind="gray">{t('app.firewallTab.unsupportedOnThisHost', 'Unsupported on this host')}</Pill>
)}
- </div>
- <div className="card-body">
+ </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>
@@ -656,8 +658,8 @@ const FirewallTab = () => {
<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>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
)}
<GridFilterDrawer {...chrome.drawerProps} />
diff --git a/frontend/src/components/security/IPListsTab.jsx b/frontend/src/components/security/IPListsTab.jsx
index 0f201b5c..7792b5f1 100644
--- a/frontend/src/components/security/IPListsTab.jsx
+++ b/frontend/src/components/security/IPListsTab.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '@/hooks/useConfirm';
import Modal from '../Modal';
import { Button } from '@/components/ui/button';
@@ -15,6 +15,7 @@ import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useTranslation } from 'react-i18next';
import { t } from '../../i18n/t';
+import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';
// Both lists have the same columns; only the accent tone and the remove
// target differ, so one factory builds both. Two accessors per column on
@@ -246,8 +247,8 @@ const IPListsTab = () => {
// the table lying about what you are looking at.
const shown = applyFilters(items, chrome.cfg.filters, chrome.columns);
return (
- <div className="card sec-flush">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card sec-flush">
+ <SharedCardHeader variant="legacy" className="card-header">
{/* The view name IS the heading — there is no room for two
titles in a card this narrow. `label` keeps which list this
is inside that name, since the pair sits side by side and
@@ -271,12 +272,12 @@ const IPListsTab = () => {
{t('app.iPListsTab.addTo', 'Add to')} {listType}
</Button>
</div>
- </div>
+ </SharedCardHeader>
<GridChips {...chrome.chipProps} />
{items.length === 0 ? (
- <div className="card-body">
+ <SharedCardContent variant="legacy" className="card-body">
<p className="text-muted">{t('app.iPListsTab.noIpsIn', 'No IPs in')} {listType}.</p>
- </div>
+ </SharedCardContent>
) : (
<DataTable
columns={chrome.columns}
@@ -295,7 +296,7 @@ const IPListsTab = () => {
/>
)}
<GridFilterDrawer {...chrome.drawerProps} />
- </div>
+ </SharedCard>
);
};
diff --git a/frontend/src/components/security/IntegrityTab.jsx b/frontend/src/components/security/IntegrityTab.jsx
index e6b84a91..239ae3e3 100644
--- a/frontend/src/components/security/IntegrityTab.jsx
+++ b/frontend/src/components/security/IntegrityTab.jsx
@@ -10,6 +10,7 @@ import {
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';
// Scoped file-integrity monitoring: baseline-and-diff over the paths
// ServerKit manages (nginx configs, serverkit-owned systemd units, and
@@ -282,8 +283,8 @@ const IntegrityTab = () => {
// show never opens, even if it is the expanded one.
const isOpen = expanded === key && changeRows.length > 0;
return (
- <div className="card sec-flush" key={key}>
- <div className="card-header">
+ <SharedCard variant="legacy" className="card sec-flush" key={key}>
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>
{scopeLabel(scope)}{' '}
<span className="sec-count">
@@ -296,8 +297,8 @@ const IntegrityTab = () => {
{check && (changed
? <span className="sec-state sec-state--amber">{check.total_changes} changes</span>
: <span className="sec-state sec-state--green">clean</span>)}
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<p className="sec-hint--lead sec-hint">
{baseline
? `Baseline: ${baseline.file_count} files, ${formatAge(baseline.created_at) || 'unknown age'}`
@@ -365,7 +366,7 @@ const IntegrityTab = () => {
<GridChips {...chrome.chipProps} />
</>
)}
- </div>
+ </SharedCardContent>
{isOpen && (
<DataTable
columns={chrome.columns}
@@ -383,7 +384,7 @@ const IntegrityTab = () => {
)}
/>
)}
- </div>
+ </SharedCard>
);
}
@@ -405,11 +406,11 @@ const IntegrityTab = () => {
{managedScopes.map(renderScopeCard)}
{appScopes.map(renderScopeCard)}
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.integrityTab.applicationDocroots', 'Application docroots')} <span className="sec-count">{t('app.integrityTab.optIn', '· opt-in')}</span></h3>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<p className="sec-hint sec-hint--lead">
{t('app.integrityTab.watchingADocrootHashesEveryFile', 'Watching a docroot hashes every file outside upload/cache directories, so it is opt-in per application.')}
</p>
@@ -432,8 +433,8 @@ const IntegrityTab = () => {
))}
</div>
)}
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
<GridFilterDrawer {...chrome.drawerProps} />
</div>
diff --git a/frontend/src/components/security/OverviewTab.jsx b/frontend/src/components/security/OverviewTab.jsx
index 096dc9ea..1a192bc7 100644
--- a/frontend/src/components/security/OverviewTab.jsx
+++ b/frontend/src/components/security/OverviewTab.jsx
@@ -16,6 +16,7 @@ import {
Bug,
Radar,
} from 'lucide-react';
+import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';
// Status glyph per check state — paired with the label so state never relies on
// color alone (color-blind operators), per the product a11y bar.
@@ -121,14 +122,14 @@ const OverviewTab = ({ status, onRefresh, onNavigateTab }) => {
<div className="security-overview">
{error && <div className="alert alert-danger">{error}</div>}
- <div className="card sec-posture-card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card sec-posture-card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3><ShieldCheck size={13} /> {t('app.overviewTab.securityPosture', 'Security posture')}</h3>
<Button variant="outline" size="sm" onClick={() => runFix('recheck', async () => {})} disabled={busy}>
<RefreshCw size={13} className={busyKey === 'recheck' ? 'sec-spin' : undefined} /> {t('app.overviewTab.reCheck', 'Re-check')}
</Button>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<div className="sec-posture__top">
{score !== null ? (
<ScoreGauge value={score} size={104} stroke={9} color={scoreColor} label="posture" />
@@ -202,8 +203,8 @@ const OverviewTab = ({ status, onRefresh, onNavigateTab }) => {
)}
{t('app.overviewTab.addAlertDeliveryChannelsDiscordSlack', 'Add alert delivery channels (Discord, Slack, Telegram) in Settings → Notifications.')}
</p>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
</div>
);
};
diff --git a/frontend/src/components/security/SSHKeysTab.jsx b/frontend/src/components/security/SSHKeysTab.jsx
index d32de51d..1df69816 100644
--- a/frontend/src/components/security/SSHKeysTab.jsx
+++ b/frontend/src/components/security/SSHKeysTab.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useMemo } from 'react';
import { KeyRound } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '@/hooks/useConfirm';
import EmptyState from '@/components/EmptyState';
import Modal from '../Modal';
@@ -16,6 +16,7 @@ import {
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard } from '@/components/ui/card';
// What the Comment cell renders when a key carries none. It has to be a real
// value, not '': `ruleIsArmed` drops any rule whose value is empty, so
@@ -226,11 +227,11 @@ const SSHKeysTab = () => {
<GridChips {...chrome.chipProps} />
{loading ? (
- <div className="card">
+ <SharedCard variant="legacy" className="card">
<div className="loading-sm">{t('common.loading', 'Loading…')}</div>
- </div>
+ </SharedCard>
) : keys.length === 0 ? (
- <div className="card">
+ <SharedCard variant="legacy" className="card">
<EmptyState
icon={KeyRound}
title={t('app.sSHKeysTab.noSshKeysConfiguredForRoot', 'No SSH keys configured for root user.')}
@@ -240,9 +241,9 @@ const SSHKeysTab = () => {
</Button>
)}
/>
- </div>
+ </SharedCard>
) : (
- <div className="card sec-flush">
+ <SharedCard variant="legacy" className="card sec-flush">
<DataTable
columns={chrome.columns}
data={keys}
@@ -258,7 +259,7 @@ const SSHKeysTab = () => {
/>
)}
/>
- </div>
+ </SharedCard>
)}
<GridFilterDrawer {...chrome.drawerProps} />
diff --git a/frontend/src/components/security/SecurityConfigTab.jsx b/frontend/src/components/security/SecurityConfigTab.jsx
index df2742b6..10510739 100644
--- a/frontend/src/components/security/SecurityConfigTab.jsx
+++ b/frontend/src/components/security/SecurityConfigTab.jsx
@@ -5,6 +5,7 @@ import { Input } from '@/components/ui/input';
import { Switch } from '@/components/ui/switch';
import { Label } from '@/components/ui/label';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';
const SecurityConfigTab = () => {
const { t } = useTranslation();
@@ -63,11 +64,11 @@ const SecurityConfigTab = () => {
</div>
)}
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.securityConfigTab.clamavSettings', 'ClamAV Settings')}</h3>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<div className="form-group">
<div className="toggle-switch-label">
<Label htmlFor="clamav-enabled">{t('app.securityConfigTab.enableClamavScanning', 'Enable ClamAV scanning')}</Label>
@@ -98,14 +99,14 @@ const SecurityConfigTab = () => {
onChange={(e) => updateConfig('clamav', 'quarantine_path', e.target.value)}
/>
</div>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.securityConfigTab.fileIntegritySettings', 'File Integrity Settings')}</h3>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<div className="form-group">
<div className="toggle-switch-label">
<Label htmlFor="integrity-enabled">{t('app.securityConfigTab.enableFileIntegrityMonitoring', 'Enable file integrity monitoring')}</Label>
@@ -127,14 +128,14 @@ const SecurityConfigTab = () => {
/>
</div>
</div>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.securityConfigTab.notificationSettings', 'Notification Settings')}</h3>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<div className="form-group">
<div className="toggle-switch-label">
<Label htmlFor="notify-malware">{t('app.securityConfigTab.notifyOnMalwareDetection', 'Notify on malware detection')}</Label>
@@ -167,8 +168,8 @@ const SecurityConfigTab = () => {
/>
</div>
</div>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
<div className="form-actions">
<Button variant="default" onClick={handleSave} disabled={saving}>
diff --git a/frontend/src/components/server/OnboardingWizard.jsx b/frontend/src/components/server/OnboardingWizard.jsx
index 38654d25..497a5642 100644
--- a/frontend/src/components/server/OnboardingWizard.jsx
+++ b/frontend/src/components/server/OnboardingWizard.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Pill } from '../ds';
import { CheckCircle2, Loader2, Circle, XCircle, RotateCw, Clock, ChevronDown } from 'lucide-react';
@@ -322,7 +322,7 @@ const OnboardingWizard = ({ serverId, initialState, onStateChange }) => {
{progress.length > 0 && (
<div className="onboarding-wizard__trail">
- <button
+ <Button variant="unstyled"
type="button"
className="onboarding-wizard__trail-head"
aria-expanded={trailExpanded}
@@ -335,7 +335,7 @@ const OnboardingWizard = ({ serverId, initialState, onStateChange }) => {
/>
<span>{t('app.onboardingWizard.stepHistory', 'Step history')}</span>
<span className="onboarding-wizard__trail-count">{progress.length}</span>
- </button>
+ </Button>
{trailExpanded && (
<ul
ref={logTrailRef}
diff --git a/frontend/src/components/serverdetail/CloudflaredTab.jsx b/frontend/src/components/serverdetail/CloudflaredTab.jsx
index c55348ac..55ced9a5 100644
--- a/frontend/src/components/serverdetail/CloudflaredTab.jsx
+++ b/frontend/src/components/serverdetail/CloudflaredTab.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -347,13 +347,13 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {
>
{t('app.cloudflaredTab.routeSubdomain', 'Route subdomain')}
</Button>
- <button type="button"
+ <Button variant="unstyled" type="button"
className="btn-icon danger"
onClick={() => handleDelete(t)}
title={t('common.actions.delete', 'Delete')}
>
<TrashIcon />
- </button>
+ </Button>
</>
),
},
@@ -509,8 +509,8 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {
<p className="sk-modal__subtitle">
{t('app.cloudflaredTab.provisionsANewCloudflareTunnelOn', 'Provisions a new Cloudflare Tunnel on this server.')}
</p>
- <form onSubmit={handleCreate} className="space-y-4">
- <div className="space-y-1.5">
+ <form onSubmit={handleCreate} className="sk-form-stack">
+ <div className="sk-form-field">
<Label htmlFor="cf-name">{t('app.cloudflaredTab.tunnelName', 'Tunnel Name')}</Label>
<Input
id="cf-name"
@@ -520,7 +520,7 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {
required
autoFocus
/>
- <p className="text-xs text-muted-foreground">{t('app.cloudflaredTab.lettersNumbersDashesUnderscoresUpTo', 'Letters, numbers, dashes, underscores. Up to 32 chars.')}</p>
+ <p className="sk-form-hint">{t('app.cloudflaredTab.lettersNumbersDashesUnderscoresUpTo', 'Letters, numbers, dashes, underscores. Up to 32 chars.')}</p>
</div>
<div className="modal-actions">
<Button type="button" variant="outline" onClick={() => setShowCreateModal(false)} disabled={creating}>{t('common.actions.cancel', 'Cancel')}</Button>
@@ -537,8 +537,8 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {
<p className="sk-modal__subtitle">
{t('app.cloudflaredTab.aCnameForThisHostnameWill', 'A CNAME for this hostname will be created in Cloudflare DNS, pointing at the tunnel.')}
</p>
- <form onSubmit={handleRoute} className="space-y-4">
- <div className="space-y-1.5">
+ <form onSubmit={handleRoute} className="sk-form-stack">
+ <div className="sk-form-field">
<Label htmlFor="cf-host">{t('app.cloudflaredTab.hostname', 'Hostname')}</Label>
<Input
id="cf-host"
@@ -590,13 +590,13 @@ const CloudflaredLoginCard = ({ login, onCancel }) => {
>
{t('app.cloudflaredTab.openCloudflareLogin', 'Open Cloudflare login')}
</a>
- <button
+ <Button variant="unstyled"
type="button"
className="btn btn-outline"
onClick={() => copyToClipboard(login.authUrl)}
>
{t('app.cloudflaredTab.copyUrl', 'Copy URL')}
- </button>
+ </Button>
</div>
<p className="cloudflared-login-card__hint">
<strong>{t('app.cloudflaredTab.step22', 'Step 2 / 2:')}</strong> {t('app.cloudflaredTab.waitingForTheAgentToReceive', 'waiting for the agent to receive cert.pem from Cloudflare. This page will refresh automatically once authorisation completes.')}
diff --git a/frontend/src/components/serverdetail/CronTab.jsx b/frontend/src/components/serverdetail/CronTab.jsx
index a18706bf..ca7258aa 100644
--- a/frontend/src/components/serverdetail/CronTab.jsx
+++ b/frontend/src/components/serverdetail/CronTab.jsx
@@ -1,6 +1,7 @@
+import { PRESET_LABELS } from './serverDetailData';
import { useState, useEffect, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -25,7 +26,6 @@ import {
SelectValue,
} from '@/components/ui/select';
import {
- PRESET_LABELS,
OfflineIcon,
StopIcon,
PlayIcon,
@@ -256,20 +256,20 @@ const CronTab = ({ serverId, serverStatus }) => {
cellClassName: 'actions-cell',
render: (job) => (
<>
- <button type="button"
+ <Button variant="unstyled" type="button"
className="btn-icon"
onClick={() => handleToggle(job)}
title={job.enabled ? t('common.actions.disable', 'Disable') : t('common.actions.enable', 'Enable')}
>
{job.enabled ? <StopIcon /> : <PlayIcon />}
- </button>
- <button type="button"
+ </Button>
+ <Button variant="unstyled" type="button"
className="btn-icon danger"
onClick={() => handleRemove(job)}
title={t('common.actions.remove', 'Remove')}
>
<TrashIcon />
- </button>
+ </Button>
</>
),
},
@@ -394,8 +394,8 @@ const CronTab = ({ serverId, serverStatus }) => {
<p className="sk-modal__subtitle">
{t('app.cronTab.scheduleACommandOnTheHost', 'Schedule a command on the host crontab. Runs as the agent user.')}
</p>
- <form onSubmit={handleSubmit} className="space-y-4">
- <div className="space-y-1.5">
+ <form onSubmit={handleSubmit} className="sk-form-stack">
+ <div className="sk-form-field">
<Label htmlFor="cron-name">{t('app.cronTab.nameOptional', 'Name (optional)')}</Label>
<Input
id="cron-name"
@@ -404,7 +404,7 @@ const CronTab = ({ serverId, serverStatus }) => {
placeholder={t('app.cronTab.backupDatabase', 'Backup database')}
/>
</div>
- <div className="space-y-1.5">
+ <div className="sk-form-field">
<Label htmlFor="cron-schedule">{t('common.labels.schedule', 'Schedule')}</Label>
<Select
value={Object.keys(PRESET_LABELS).includes(form.schedule) ? form.schedule : 'custom'}
@@ -428,11 +428,10 @@ const CronTab = ({ serverId, serverStatus }) => {
value={form.schedule}
onChange={(e) => setForm({ ...form, schedule: e.target.value })}
placeholder="* * * * *"
- className="font-mono"
/>
- <p className="text-xs text-muted-foreground">{t('app.cronTab.5FieldsMinuteHourDayMonth', '5 fields: minute, hour, day, month, weekday.')}</p>
+ <p className="sk-form-hint">{t('app.cronTab.5FieldsMinuteHourDayMonth', '5 fields: minute, hour, day, month, weekday.')}</p>
</div>
- <div className="space-y-1.5">
+ <div className="sk-form-field">
<Label htmlFor="cron-command">{t('common.labels.command', 'Command')}</Label>
<Textarea
id="cron-command"
@@ -442,7 +441,7 @@ const CronTab = ({ serverId, serverStatus }) => {
placeholder="/usr/local/bin/my-script.sh"
required
/>
- <p className="text-xs text-muted-foreground">{t('app.cronTab.absolutePathShellOperatorsAreNot', 'Absolute path. Shell operators (;, &&, |, $(), >, <) are not allowed.')}</p>
+ <p className="sk-form-hint">{t('app.cronTab.absolutePathShellOperatorsAreNot', 'Absolute path. Shell operators (;, &&, |, $(), >, <) are not allowed.')}</p>
</div>
<div className="modal-actions">
<Button type="button" variant="outline" onClick={() => setShowAddModal(false)} disabled={submitting}>{t('common.actions.cancel', 'Cancel')}</Button>
diff --git a/frontend/src/components/serverdetail/PackagesTab.jsx b/frontend/src/components/serverdetail/PackagesTab.jsx
index 02c4f593..77e5351d 100644
--- a/frontend/src/components/serverdetail/PackagesTab.jsx
+++ b/frontend/src/components/serverdetail/PackagesTab.jsx
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useState } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -50,7 +50,7 @@ const PackagesTab = ({ serverId, serverStatus }) => {
} finally {
setLoadingInstalled(false);
}
- }, [serverId, toast]);
+ }, [serverId, t, toast]);
useEffect(() => {
if (serverStatus !== 'online') {
@@ -168,14 +168,14 @@ const PackagesTab = ({ serverId, serverStatus }) => {
<h3>{t('app.serverPackagesTab.quickInstall', 'Quick install')}</h3>
<div className="server-packages__chips">
{QUICK_PRESETS.map((p) => (
- <button
+ <Button variant="unstyled"
key={p.name}
type="button"
className="server-packages__chip"
onClick={() => handleInstall(p.name)}
>
{p.label}
- </button>
+ </Button>
))}
</div>
</section>
diff --git a/frontend/src/components/serverdetail/ServerDockerTab.jsx b/frontend/src/components/serverdetail/ServerDockerTab.jsx
index 9c566d44..fc1755a7 100644
--- a/frontend/src/components/serverdetail/ServerDockerTab.jsx
+++ b/frontend/src/components/serverdetail/ServerDockerTab.jsx
@@ -1,6 +1,6 @@
-import { useState, useEffect } from 'react';
+import { useCallback, useState, useEffect } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { Button } from '@/components/ui/button';
import { DataTable, DataTableFooter, Pill } from '../ds';
@@ -104,15 +104,7 @@ const ServerDockerTab = ({ serverId, serverStatus, server }) => {
const toast = useToast();
const { confirm: confirmDocker } = useConfirm();
- useEffect(() => {
- if (serverStatus === 'online') {
- loadDockerData();
- } else {
- setLoading(false);
- }
- }, [serverId, serverStatus]);
-
- async function loadDockerData() {
+ const loadDockerData = useCallback(async () => {
setLoading(true);
setLoadError(null);
try {
@@ -129,7 +121,16 @@ const ServerDockerTab = ({ serverId, serverStatus, server }) => {
} finally {
setLoading(false);
}
- }
+ }, [serverId]);
+
+ useEffect(() => {
+ if (serverStatus === 'online') {
+ loadDockerData();
+ } else {
+ setLoading(false);
+ }
+ }, [loadDockerData, serverStatus]);
+
// If the agent reports docker capability false (Docker daemon not
// reachable from the agent process — common on Windows when the
@@ -156,20 +157,19 @@ const ServerDockerTab = ({ serverId, serverStatus, server }) => {
async function handleContainerAction(containerId, action) {
try {
- let result;
if (action === 'start') {
- result = await api.startRemoteContainer(serverId, containerId);
+ await api.startRemoteContainer(serverId, containerId);
toast.success(t('app.serverDockerTab.containerStarted', 'Container started'));
} else if (action === 'stop') {
- result = await api.stopRemoteContainer(serverId, containerId);
+ await api.stopRemoteContainer(serverId, containerId);
toast.success(t('app.serverDockerTab.containerStopped', 'Container stopped'));
} else if (action === 'restart') {
- result = await api.restartRemoteContainer(serverId, containerId);
+ await api.restartRemoteContainer(serverId, containerId);
toast.success(t('app.serverDockerTab.containerRestarted', 'Container restarted'));
} else if (action === 'remove') {
const removeConfirmed = await confirmDocker({ titleKey: 'app.serverDockerTab.removeContainer', title: 'Remove Container', messageKey: 'app.serverDockerTab.removeThisContainer', message: 'Remove this container?' });
if (!removeConfirmed) return;
- result = await api.removeRemoteContainer(serverId, containerId, true);
+ await api.removeRemoteContainer(serverId, containerId, true);
toast.success(t('app.serverDockerTab.containerRemoved', 'Container removed'));
}
loadDockerData();
@@ -250,37 +250,37 @@ const ServerDockerTab = ({ serverId, serverStatus, server }) => {
const isRunning = container.state === 'running';
return isRunning ? (
<>
- <button type="button"
+ <Button variant="unstyled" type="button"
className="btn-icon"
onClick={() => handleContainerAction(container.id, 'restart')}
title={t('common.actions.restart', 'Restart')}
>
<RefreshIcon />
- </button>
- <button type="button"
+ </Button>
+ <Button variant="unstyled" type="button"
className="btn-icon danger"
onClick={() => handleContainerAction(container.id, 'stop')}
title={t('common.actions.stop', 'Stop')}
>
<StopIcon />
- </button>
+ </Button>
</>
) : (
<>
- <button type="button"
+ <Button variant="unstyled" type="button"
className="btn-icon success"
onClick={() => handleContainerAction(container.id, 'start')}
title={t('common.actions.start', 'Start')}
>
<PlayIcon />
- </button>
- <button type="button"
+ </Button>
+ <Button variant="unstyled" type="button"
className="btn-icon danger"
onClick={() => handleContainerAction(container.id, 'remove')}
title={t('common.actions.remove', 'Remove')}
>
<TrashIcon />
- </button>
+ </Button>
</>
);
},
@@ -296,18 +296,18 @@ const ServerDockerTab = ({ serverId, serverStatus, server }) => {
</div>
)}
<div className="docker-sub-tabs">
- <button type="button"
+ <Button variant="unstyled" type="button"
className={`sub-tab ${subTab === 'containers' ? 'active' : ''}`}
onClick={() => setSubTab('containers')}
>
{t('app.serverDockerTab.containers', 'Containers (')}{containers.length})
- </button>
- <button type="button"
+ </Button>
+ <Button variant="unstyled" type="button"
className={`sub-tab ${subTab === 'images' ? 'active' : ''}`}
onClick={() => setSubTab('images')}
>
{t('app.serverDockerTab.images', 'Images (')}{images.length})
- </button>
+ </Button>
</div>
{subTab === 'containers' && (
diff --git a/frontend/src/components/serverdetail/ServerOverviewTab.jsx b/frontend/src/components/serverdetail/ServerOverviewTab.jsx
index 5104151b..0bdd6044 100644
--- a/frontend/src/components/serverdetail/ServerOverviewTab.jsx
+++ b/frontend/src/components/serverdetail/ServerOverviewTab.jsx
@@ -1,10 +1,10 @@
+import { serverStatusKind } from './serverDetailData';
import { Pill, KpiBand } from '../ds';
import OnboardingWizard from '../server/OnboardingWizard';
import SystemStatusCard from './SystemStatusCard';
import { formatBytes } from '@/utils/formatBytes';
import { useTranslation } from 'react-i18next';
import {
- serverStatusKind,
InfoRow,
KpiTile,
KpiGauge,
diff --git a/frontend/src/components/serverdetail/ServerRestorePointsTab.jsx b/frontend/src/components/serverdetail/ServerRestorePointsTab.jsx
index 283cde02..748c8e8f 100644
--- a/frontend/src/components/serverdetail/ServerRestorePointsTab.jsx
+++ b/frontend/src/components/serverdetail/ServerRestorePointsTab.jsx
@@ -5,7 +5,7 @@ import Modal from '../Modal';
import FormField from '../FormField';
import DeploymentTimeline from '../deployments/DeploymentTimeline';
import { Button } from '../ui/button';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useTranslation } from 'react-i18next';
export default function ServerRestorePointsTab({ serverId }) {
diff --git a/frontend/src/components/serverdetail/ServerSettingsTab.jsx b/frontend/src/components/serverdetail/ServerSettingsTab.jsx
index 59c0e1e0..e7ffd67e 100644
--- a/frontend/src/components/serverdetail/ServerSettingsTab.jsx
+++ b/frontend/src/components/serverdetail/ServerSettingsTab.jsx
@@ -1,6 +1,7 @@
-import { useState, useEffect } from 'react';
+import { TOKEN_EXPIRY_OPTIONS } from './serverDetailData';
+import { useCallback, useState, useEffect } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { useClipboard } from '@/hooks/useClipboard';
import { DangerZone } from '../DangerZone';
@@ -20,7 +21,6 @@ import {
import TagsPanel from '../shared/TagsPanel';
import { useTranslation } from 'react-i18next';
import {
- TOKEN_EXPIRY_OPTIONS,
KeyIcon,
ServerIcon,
NetworkIcon,
@@ -75,10 +75,23 @@ const ServerSettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) =>
const [rotatingKey, setRotatingKey] = useState(false);
const toast = useToast();
+ const loadSecurityData = useCallback(async () => {
+ try {
+ const [ipsData, connData] = await Promise.all([
+ api.getAllowedIPs(server.id),
+ api.getConnectionInfo(server.id),
+ ]);
+ setAllowedIPs(ipsData.allowed_ips || []);
+ setConnectionInfo(connData);
+ } catch (err) {
+ console.error('Failed to load security data:', err);
+ }
+ }, [server.id]);
+
useEffect(() => {
loadGroups();
loadSecurityData();
- }, []);
+ }, [loadSecurityData]);
async function loadGroups() {
try {
@@ -89,18 +102,6 @@ const ServerSettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) =>
}
}
- async function loadSecurityData() {
- try {
- const [ipsData, connData] = await Promise.all([
- api.getAllowedIPs(server.id),
- api.getConnectionInfo(server.id),
- ]);
- setAllowedIPs(ipsData.allowed_ips || []);
- setConnectionInfo(connData);
- } catch (err) {
- console.error('Failed to load security data:', err);
- }
- }
async function handleAddIP() {
if (!newIP.trim()) return;
@@ -280,13 +281,13 @@ const ServerSettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) =>
{connectionInfo?.ip_address === ip && (
<Pill kind="green" dot={false}>{t('common.labels.current', 'Current')}</Pill>
)}
- <button type="button"
+ <Button variant="unstyled" type="button"
className="btn-icon danger"
onClick={() => handleRemoveIP(ip)}
title={t('common.actions.remove', 'Remove')}
>
<TrashIcon />
- </button>
+ </Button>
</div>
))
)}
diff --git a/frontend/src/components/serverdetail/ServicesTab.jsx b/frontend/src/components/serverdetail/ServicesTab.jsx
index 3c42f166..c870c8c4 100644
--- a/frontend/src/components/serverdetail/ServicesTab.jsx
+++ b/frontend/src/components/serverdetail/ServicesTab.jsx
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '@/hooks/useConfirm';
import { Button } from '@/components/ui/button';
import { Pill, Drawer, DataTable, DataTableFooter, ListToolbar, SearchField, serviceStatusKind } from '../ds';
@@ -154,7 +154,7 @@ const ServicesTab = ({ serverId = null, serverStatus = 'online' }) => {
} finally {
setLoading(false);
}
- }, [isLocal, serverId, toast]);
+ }, [isLocal, serverId, t, toast]);
useEffect(() => {
if (!isLocal && serverStatus !== 'online') {
@@ -503,21 +503,21 @@ const ServicesTab = ({ serverId = null, serverStatus = 'online' }) => {
</div>
<div className="preview-drawer-actions">
- <button type="button"
+ <Button variant="unstyled" type="button"
className="drawer-action-btn"
onClick={() => control(logsFor.unit, 'start')}
disabled={busyUnit === logsFor.unit}
- >{t('common.actions.start', 'Start')}</button>
- <button type="button"
+ >{t('common.actions.start', 'Start')}</Button>
+ <Button variant="unstyled" type="button"
className="drawer-action-btn"
onClick={() => control(logsFor.unit, 'stop')}
disabled={busyUnit === logsFor.unit}
- >{t('common.actions.stop', 'Stop')}</button>
- <button type="button"
+ >{t('common.actions.stop', 'Stop')}</Button>
+ <Button variant="unstyled" type="button"
className="drawer-action-btn"
onClick={() => control(logsFor.unit, 'restart')}
disabled={busyUnit === logsFor.unit}
- >{t('common.actions.restart', 'Restart')}</button>
+ >{t('common.actions.restart', 'Restart')}</Button>
</div>
<LogToolbar
diff --git a/frontend/src/components/serverdetail/SurveyTab.jsx b/frontend/src/components/serverdetail/SurveyTab.jsx
index 3123783f..f1d38990 100644
--- a/frontend/src/components/serverdetail/SurveyTab.jsx
+++ b/frontend/src/components/serverdetail/SurveyTab.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { DataTable, DataTableFooter, ListToolbar, Pill } from '../ds';
import EmptyState from '../EmptyState';
diff --git a/frontend/src/components/serverdetail/SystemStatusCard.jsx b/frontend/src/components/serverdetail/SystemStatusCard.jsx
index 41623b69..44486cc7 100644
--- a/frontend/src/components/serverdetail/SystemStatusCard.jsx
+++ b/frontend/src/components/serverdetail/SystemStatusCard.jsx
@@ -1,6 +1,6 @@
import { useState } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { useTranslation } from 'react-i18next';
diff --git a/frontend/src/components/serverdetail/serverDetailData.js b/frontend/src/components/serverdetail/serverDetailData.js
new file mode 100644
index 00000000..001912c5
--- /dev/null
+++ b/frontend/src/components/serverdetail/serverDetailData.js
@@ -0,0 +1,29 @@
+import { statusKind } from '../ds/status.js';
+
+// Server status → ds Pill tone (shared by the header pill and the
+// Overview "Status" row).
+// Server connection states ride the shared vocabulary (plan 77 D3).
+export const serverStatusKind = (status) => statusKind(status);
+
+export const PRESET_LABELS = {
+ '* * * * *': 'Every minute',
+ '*/5 * * * *': 'Every 5 minutes',
+ '*/15 * * * *': 'Every 15 minutes',
+ '*/30 * * * *': 'Every 30 minutes',
+ '0 * * * *': 'Hourly',
+ '0 0 * * *': 'Daily at midnight',
+ '0 12 * * *': 'Daily at noon',
+ '0 0 * * 0': 'Weekly (Sunday)',
+ '0 0 1 * *': 'Monthly (1st)',
+};
+
+// Token-lifetime presets shown in the regenerate modal. Mirrors the values
+// the Add Server modal uses (frontend/src/pages/Servers.jsx). Keep them in
+// sync if you tweak either list.
+export const TOKEN_EXPIRY_OPTIONS = [
+ { labelKey: 'app.serverDetailShared.1Hour', label: '1 hour', value: 60 * 60 },
+ { labelKey: 'app.serverDetailShared.24Hours', label: '24 hours', value: 24 * 60 * 60 },
+ { labelKey: 'app.serverDetailShared.7Days', label: '7 days', value: 7 * 24 * 60 * 60 },
+ { labelKey: 'app.serverDetailShared.30Days', label: '30 days', value: 30 * 24 * 60 * 60 },
+ { labelKey: 'app.serverDetailShared.never', label: 'Never', value: -1 },
+];
diff --git a/frontend/src/components/serverdetail/serverDetailShared.jsx b/frontend/src/components/serverdetail/serverDetailShared.jsx
index 50336588..7a2c3271 100644
--- a/frontend/src/components/serverdetail/serverDetailShared.jsx
+++ b/frontend/src/components/serverdetail/serverDetailShared.jsx
@@ -1,38 +1,9 @@
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Gauge } from '../ds';
import { copyToClipboard } from '@/utils/clipboard';
-import { statusKind } from '@/components/ds/status';
import { useTranslation } from 'react-i18next';
-// Server status → ds Pill tone (shared by the header pill and the
-// Overview "Status" row).
-// Server connection states ride the shared vocabulary (plan 77 D3).
-export const serverStatusKind = (status) => statusKind(status);
-
-export const PRESET_LABELS = {
- '* * * * *': 'Every minute',
- '*/5 * * * *': 'Every 5 minutes',
- '*/15 * * * *': 'Every 15 minutes',
- '*/30 * * * *': 'Every 30 minutes',
- '0 * * * *': 'Hourly',
- '0 0 * * *': 'Daily at midnight',
- '0 12 * * *': 'Daily at noon',
- '0 0 * * 0': 'Weekly (Sunday)',
- '0 0 1 * *': 'Monthly (1st)',
-};
-
-// Token-lifetime presets shown in the regenerate modal. Mirrors the values
-// the Add Server modal uses (frontend/src/pages/Servers.jsx). Keep them in
-// sync if you tweak either list.
-export const TOKEN_EXPIRY_OPTIONS = [
- { labelKey: 'app.serverDetailShared.1Hour', label: '1 hour', value: 60 * 60 },
- { labelKey: 'app.serverDetailShared.24Hours', label: '24 hours', value: 24 * 60 * 60 },
- { labelKey: 'app.serverDetailShared.7Days', label: '7 days', value: 7 * 24 * 60 * 60 },
- { labelKey: 'app.serverDetailShared.30Days', label: '30 days', value: 30 * 24 * 60 * 60 },
- { labelKey: 'app.serverDetailShared.never', label: 'Never', value: -1 },
-];
-
export const SecurityAlertItem = ({ alert, onAcknowledge, onResolve }) => {
const { t } = useTranslation();
const sev = (alert.severity || 'info').toLowerCase();
@@ -125,7 +96,7 @@ export const CopyChip = ({ label, value, title, mono }) => {
toast.success(`${label[0].toUpperCase()}${label.slice(1)} copied`);
};
return (
- <button
+ <Button variant="unstyled"
type="button"
className={`copy-chip${mono ? ' copy-chip--mono' : ''}`}
onClick={handleCopy}
@@ -134,7 +105,7 @@ export const CopyChip = ({ label, value, title, mono }) => {
<span className="copy-chip__label">{label}</span>
<code className="copy-chip__value">{value}</code>
<CopyIcon />
- </button>
+ </Button>
);
};
diff --git a/frontend/src/components/servers/LinkPanelForm.jsx b/frontend/src/components/servers/LinkPanelForm.jsx
index 042d35be..38f397c4 100644
--- a/frontend/src/components/servers/LinkPanelForm.jsx
+++ b/frontend/src/components/servers/LinkPanelForm.jsx
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import { Unlink } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { ConfirmDialog } from '../ConfirmDialog';
import StatusBadge from '../StatusBadge';
import { InfoList, InfoItem } from '../InfoList';
diff --git a/frontend/src/components/service-detail/CommandsTab.jsx b/frontend/src/components/service-detail/CommandsTab.jsx
index 962806cd..a00343e4 100644
--- a/frontend/src/components/service-detail/CommandsTab.jsx
+++ b/frontend/src/components/service-detail/CommandsTab.jsx
@@ -46,7 +46,7 @@ const CommandsTab = ({ appId, appType }) => {
<p className="hint">{t('app.commandsTab.commandsRunInTheAppS', 'Commands run in the app\'s virtual environment context.')}</p>
<div className="quick-commands">
- {quickCommands.map(({ label, cmd }) => (
+ {quickCommands.map(({ labelKey, label, cmd }) => (
<Button
key={cmd}
variant="outline"
@@ -54,7 +54,7 @@ const CommandsTab = ({ appId, appType }) => {
onClick={() => handleRun(cmd)}
disabled={running}
>
- {label}
+ {t(labelKey, { defaultValue: label })}
</Button>
))}
</div>
diff --git a/frontend/src/components/service-detail/EventsTab.jsx b/frontend/src/components/service-detail/EventsTab.jsx
index 63e48a71..9c750f79 100644
--- a/frontend/src/components/service-detail/EventsTab.jsx
+++ b/frontend/src/components/service-detail/EventsTab.jsx
@@ -10,7 +10,7 @@ import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { InfoList, InfoItem } from '../InfoList';
import api from '../../services/api';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import { useDeployments } from '../../hooks/useDeployments';
import { getDeployStatus, formatRelativeTime, formatDuration } from '../../utils/serviceTypes';
import EmptyState from '../EmptyState';
diff --git a/frontend/src/components/service-detail/GunicornTab.jsx b/frontend/src/components/service-detail/GunicornTab.jsx
index 001b4134..58dc331a 100644
--- a/frontend/src/components/service-detail/GunicornTab.jsx
+++ b/frontend/src/components/service-detail/GunicornTab.jsx
@@ -1,6 +1,6 @@
-import { useState, useEffect } from 'react';
+import { useState, useEffect, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Textarea } from '@/components/ui/textarea';
import EmptyState from '../EmptyState';
@@ -13,11 +13,7 @@ const GunicornTab = ({ appId }) => {
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
- useEffect(() => {
- loadConfig();
- }, [appId]);
-
- async function loadConfig() {
+ const loadConfig = useCallback(async () => {
try {
const data = await api.getGunicornConfig(appId);
setConfig(data.content || '');
@@ -26,14 +22,18 @@ const GunicornTab = ({ appId }) => {
} finally {
setLoading(false);
}
- }
+ }, [appId]);
+
+ useEffect(() => {
+ loadConfig();
+ }, [loadConfig]);
async function handleSave() {
setSaving(true);
try {
await api.updateGunicornConfig(appId, config);
toast.success(t('app.gunicornTab.configurationSavedRestartTheAppTo', 'Configuration saved. Restart the app to apply changes.'));
- } catch (err) {
+ } catch {
toast.error(t('app.gunicornTab.failedToSaveConfiguration', 'Failed to save configuration'));
} finally {
setSaving(false);
diff --git a/frontend/src/components/service-detail/LogsTab.jsx b/frontend/src/components/service-detail/LogsTab.jsx
index 632a07c4..a99caf90 100644
--- a/frontend/src/components/service-detail/LogsTab.jsx
+++ b/frontend/src/components/service-detail/LogsTab.jsx
@@ -1,8 +1,8 @@
-import { useState, useEffect, useRef, useMemo } from 'react';
+import { useCallback, useState, useEffect, useRef, useMemo } from 'react';
import { useSearchParams } from 'react-router-dom';
import { logsToText } from '@/utils/logText';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useLogsDrawer } from '../../contexts/LogsDrawerContext';
import DeploymentJobProgress from '../DeploymentJobProgress';
import { Button } from '@/components/ui/button';
@@ -41,9 +41,28 @@ const LogsTab = ({ app }) => {
const isDockerApp = app.app_type === 'docker';
const isPythonApp = ['flask', 'django'].includes(app.app_type);
+ const loadLogs = useCallback(async () => {
+ try {
+ let data;
+ if (isDockerApp) {
+ data = await api.getDockerAppLogs(app.id, lineCount);
+ } else if (isPythonApp) {
+ data = await api.getPythonAppLogs(app.id, lineCount);
+ } else {
+ data = { logs: 'Logs not available for this app type.' };
+ }
+ setRawLogs(logsToText(data) || 'No logs available');
+ } catch (err) {
+ console.error('Failed to load logs:', err);
+ setRawLogs('Failed to load logs');
+ } finally {
+ setLoading(false);
+ }
+ }, [app.id, lineCount, isDockerApp, isPythonApp]);
+
useEffect(() => {
loadLogs();
- }, [app.id, lineCount]);
+ }, [loadLogs]);
// No explicit ?deploy_job= param — check whether a deployment job is
// currently pending/running for this app so a mid-deploy visit to the
@@ -71,24 +90,6 @@ const LogsTab = ({ app }) => {
}
}, [rawLogs, autoScroll]);
- async function loadLogs() {
- try {
- let data;
- if (isDockerApp) {
- data = await api.getDockerAppLogs(app.id, lineCount);
- } else if (isPythonApp) {
- data = await api.getPythonAppLogs(app.id, lineCount);
- } else {
- data = { logs: 'Logs not available for this app type.' };
- }
- setRawLogs(logsToText(data) || 'No logs available');
- } catch (err) {
- console.error('Failed to load logs:', err);
- setRawLogs('Failed to load logs');
- } finally {
- setLoading(false);
- }
- }
function handleDeploySuccess() {
setDeployJobId(null);
diff --git a/frontend/src/components/service-detail/MetricsTab.jsx b/frontend/src/components/service-detail/MetricsTab.jsx
index 1630c3bf..1c3f5782 100644
--- a/frontend/src/components/service-detail/MetricsTab.jsx
+++ b/frontend/src/components/service-detail/MetricsTab.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect } from 'react';
+import { useCallback, useState, useEffect } from 'react';
import api from '../../services/api';
import { Gauge } from '@/components/ds';
import EmptyState from '../EmptyState';
@@ -19,10 +19,7 @@ const MetricsTab = ({ app }) => {
const isPython = ['flask', 'django'].includes(app.app_type);
// Load on mount and whenever the app changes; poll on top of that.
- useEffect(() => { loadMetrics(); }, [app.id]);
- usePolling(loadMetrics, METRICS_REFRESH_MS, { immediate: false });
-
- async function loadMetrics() {
+ const loadMetrics = useCallback(async () => {
try {
if (isDocker) {
const data = await api.getContainers(true);
@@ -44,7 +41,11 @@ const MetricsTab = ({ app }) => {
} finally {
setLoading(false);
}
- }
+ }, [app.id, app.name, isDocker, isPython]);
+
+ useEffect(() => { loadMetrics(); }, [loadMetrics]);
+ usePolling(loadMetrics, METRICS_REFRESH_MS, { immediate: false });
+
if (loading) {
return <EmptyState loading title={t('app.metricsTab.loadingMetrics', 'Loading metrics…')} />;
diff --git a/frontend/src/components/service-detail/OverviewTab.jsx b/frontend/src/components/service-detail/OverviewTab.jsx
index a90e6b32..9b1eb152 100644
--- a/frontend/src/components/service-detail/OverviewTab.jsx
+++ b/frontend/src/components/service-detail/OverviewTab.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect } from 'react';
+import { useCallback, useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { Activity, Rocket, CheckCircle2, XCircle, Globe, Database, ShieldCheck, ExternalLink } from 'lucide-react';
import { servicePortUrl } from '@/utils/serviceUrl';
@@ -36,31 +36,7 @@ const OverviewTab = ({ app, deployConfig }) => {
const isPython = ['flask', 'django'].includes(app.app_type);
// Load on mount and whenever the app changes; poll on top of that.
- useEffect(() => { loadMetrics(); }, [app.id]);
- usePolling(loadMetrics, METRICS_REFRESH_MS, { immediate: false });
-
- useEffect(() => {
- // Best-effort daily rollups; hide the card when there is no data.
- let cancelled = false;
- api.getAppBandwidth(app.id, 90)
- .then((data) => { if (!cancelled) setBandwidth(data); })
- .catch(() => {});
- return () => { cancelled = true; };
- }, [app.id]);
-
- useEffect(() => {
- // Related resources (domains, DBs, backups, deploys). Member-visible.
- let cancelled = false;
- api.getAppRelatedResources(app.id)
- .then((data) => { if (!cancelled) setRelated(data); })
- // Settle to an empty result rather than staying null: null is
- // the card's "still loading" state, so swallowing the error
- // left it spinning forever.
- .catch(() => { if (!cancelled) setRelated({}); });
- return () => { cancelled = true; };
- }, [app.id]);
-
- async function loadMetrics() {
+ const loadMetrics = useCallback(async () => {
try {
if (isDocker) {
const data = await api.getContainers(true);
@@ -107,7 +83,32 @@ const OverviewTab = ({ app, deployConfig }) => {
} finally {
setMetricsLoading(false);
}
- }
+ }, [app.id, app.name, isDocker, isPython]);
+
+ useEffect(() => { loadMetrics(); }, [loadMetrics]);
+ usePolling(loadMetrics, METRICS_REFRESH_MS, { immediate: false });
+
+ useEffect(() => {
+ // Best-effort daily rollups; hide the card when there is no data.
+ let cancelled = false;
+ api.getAppBandwidth(app.id, 90)
+ .then((data) => { if (!cancelled) setBandwidth(data); })
+ .catch(() => {});
+ return () => { cancelled = true; };
+ }, [app.id]);
+
+ useEffect(() => {
+ // Related resources (domains, DBs, backups, deploys). Member-visible.
+ let cancelled = false;
+ api.getAppRelatedResources(app.id)
+ .then((data) => { if (!cancelled) setRelated(data); })
+ // Settle to an empty result rather than staying null: null is
+ // the card's "still loading" state, so swallowing the error
+ // left it spinning forever.
+ .catch(() => { if (!cancelled) setRelated({}); });
+ return () => { cancelled = true; };
+ }, [app.id]);
+
// No link when a domain fronts it — the Domain row above is the one to follow.
const portUrl = app.domain ? null : servicePortUrl(app);
diff --git a/frontend/src/components/service-detail/PackagesTab.jsx b/frontend/src/components/service-detail/PackagesTab.jsx
index 76673598..338c6df3 100644
--- a/frontend/src/components/service-detail/PackagesTab.jsx
+++ b/frontend/src/components/service-detail/PackagesTab.jsx
@@ -1,6 +1,6 @@
-import { useState, useEffect } from 'react';
+import { useState, useEffect, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import EmptyState from '../EmptyState';
@@ -38,11 +38,7 @@ const PackagesTab = ({ appId }) => {
const [installing, setInstalling] = useState(false);
const [newPackage, setNewPackage] = useState('');
- useEffect(() => {
- loadPackages();
- }, [appId]);
-
- async function loadPackages() {
+ const loadPackages = useCallback(async () => {
try {
const data = await api.getPythonPackages(appId);
setPackages(data.packages || []);
@@ -51,7 +47,11 @@ const PackagesTab = ({ appId }) => {
} finally {
setLoading(false);
}
- }
+ }, [appId]);
+
+ useEffect(() => {
+ loadPackages();
+ }, [loadPackages]);
async function handleInstall(e) {
e.preventDefault();
@@ -73,7 +73,7 @@ const PackagesTab = ({ appId }) => {
try {
await api.freezePythonRequirements(appId);
toast.success(t('app.packagesTab.requirementsTxtUpdated', 'requirements.txt updated'));
- } catch (err) {
+ } catch {
toast.error(t('app.packagesTab.failedToFreezeRequirements', 'Failed to freeze requirements'));
}
}
diff --git a/frontend/src/components/service-detail/SettingsTab.jsx b/frontend/src/components/service-detail/SettingsTab.jsx
index 33e3628c..3a79853d 100644
--- a/frontend/src/components/service-detail/SettingsTab.jsx
+++ b/frontend/src/components/service-detail/SettingsTab.jsx
@@ -19,7 +19,7 @@ import {
Zap,
} from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '@/hooks/useConfirm';
import { DangerZone } from '../DangerZone';
import RepoConnectForm from '../git/RepoConnectForm';
@@ -38,6 +38,7 @@ import { Label } from '@/components/ui/label';
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
import { downloadBlob } from '@/utils/downloadBlob';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard } from '@/components/ui/card';
// Grouped left sub-nav for the service Settings tab — mirrors the WordPress
// detail page's settings layout: an uppercase mono group label per section with
@@ -124,7 +125,7 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =>
await api.updateAppEnvironment(app.id, newType);
setEnvironmentType(newType);
onUpdate();
- } catch (err) {
+ } catch {
toast.error(t('app.settingsTab.failedToUpdateEnvironmentType', 'Failed to update environment type'));
setEnvironmentType(app.environment_type || 'standalone');
} finally {
@@ -144,7 +145,7 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =>
try {
await api.unlinkApp(app.id);
onUpdate();
- } catch (err) {
+ } catch {
toast.error(t('app.settingsTab.failedToUnlinkApp', 'Failed to unlink app'));
} finally {
setUnlinking(false);
@@ -170,7 +171,7 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =>
await api.deleteApp(app.id);
toast.success(t('app.settingsTab.movedToTheRecycleBin', '“{{name}}” moved to the recycle bin', { name: app.name }));
navigate('/services');
- } catch (err) {
+ } catch {
toast.error(t('app.settingsTab.failedToDeleteService', 'Failed to delete service'));
setDeleting(false);
}
@@ -227,7 +228,7 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =>
<div className="svc-settings__group" key={g.label}>
<div className="svc-settings__grouplabel">{g.label}</div>
{g.items.map(s => (
- <button
+ <Button variant="unstyled"
type="button"
key={s.id}
className={`svc-settings__navitem ${section === s.id ? 'is-active' : ''}`}
@@ -235,7 +236,7 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =>
>
<s.icon size={15} />
{s.label}
- </button>
+ </Button>
))}
</div>
))}
@@ -246,7 +247,7 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =>
{section === 'environment' && (
<div className="svc-settings__section">
<h3 className="svc-settings__section-title">{t('app.settingsTab.environmentType', 'Environment Type')}</h3>
- <div className="card settings-section">
+ <SharedCard variant="legacy" className="card settings-section">
<div className="settings-row">
<div className="settings-label">
<span>{t('app.settingsTab.environmentType', 'Environment Type')}</span>
@@ -301,7 +302,7 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =>
</div>
</div>
)}
- </div>
+ </SharedCard>
</div>
)}
@@ -642,7 +643,7 @@ const DomainSslPanel = ({ app, domains, primaryDomain, onUpdate }) => {
);
return (
- <div className="card settings-section svc-domain-panel" data-walkthrough="service-domain-panel">
+ <SharedCard variant="legacy" className="card settings-section svc-domain-panel" data-walkthrough="service-domain-panel">
<div className="app-info-grid">
<div className="app-info-item">
<span className="app-info-label">{t('app.settingsTab.primaryDomain', 'Primary Domain')}</span>
@@ -824,7 +825,7 @@ const DomainSslPanel = ({ app, domains, primaryDomain, onUpdate }) => {
</>
)}
</Modal>
- </div>
+ </SharedCard>
);
};
@@ -852,7 +853,7 @@ const ManifestSection = ({ app }) => {
try {
const res = await api.getManifest(projectId);
if (!cancelled) setManifest(res?.manifest || null);
- } catch (err) {
+ } catch {
if (!cancelled) setManifest(null);
} finally {
if (!cancelled) setLoading(false);
@@ -927,14 +928,14 @@ const ManifestSection = ({ app }) => {
}
if (loading) {
- return <div className="card settings-section"><p className="hint">{t('app.settingsTab.loadingManifest', 'Loading manifest…')}</p></div>;
+ return <SharedCard variant="legacy" className="card settings-section"><p className="hint">{t('app.settingsTab.loadingManifest', 'Loading manifest…')}</p></SharedCard>;
}
const source = manifest?.source || {};
const shortCommit = source.commit ? String(source.commit).slice(0, 7) : null;
return (
- <div className="card settings-section svc-manifest">
+ <SharedCard variant="legacy" className="card settings-section svc-manifest">
{manifest ? (
<div className="svc-manifest__status">
<span className="svc-manifest__badge">
@@ -1033,7 +1034,7 @@ const ManifestSection = ({ app }) => {
)}
</div>
)}
- </div>
+ </SharedCard>
);
};
diff --git a/frontend/src/components/service-detail/ShellTab.jsx b/frontend/src/components/service-detail/ShellTab.jsx
index 5a51ab5b..616d7fe7 100644
--- a/frontend/src/components/service-detail/ShellTab.jsx
+++ b/frontend/src/components/service-detail/ShellTab.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect, useRef } from 'react';
+import { useCallback, useState, useEffect, useRef } from 'react';
import api from '../../services/api';
import { Input } from '@/components/ui/input';
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
@@ -15,17 +15,7 @@ const ShellTab = ({ appId, appName }) => {
const [loading, setLoading] = useState(true);
const terminalRef = useRef(null);
- useEffect(() => {
- loadContainers();
- }, [appId]);
-
- useEffect(() => {
- if (terminalRef.current) {
- terminalRef.current.scrollTop = terminalRef.current.scrollHeight;
- }
- }, [history]);
-
- async function loadContainers() {
+ const loadContainers = useCallback(async () => {
try {
const data = await api.getContainers(true);
const appContainers = (data.containers || []).filter(c =>
@@ -33,15 +23,26 @@ const ShellTab = ({ appId, appName }) => {
c.Labels?.['com.docker.compose.project'] === appName
);
setContainers(appContainers);
- if (appContainers.length > 0 && !selectedContainer) {
- setSelectedContainer(appContainers[0].Id);
+ if (appContainers.length > 0) {
+ setSelectedContainer(current => current || appContainers[0].Id);
}
} catch (err) {
console.error('Failed to load containers:', err);
} finally {
setLoading(false);
}
- }
+ }, [appName]);
+
+ useEffect(() => {
+ loadContainers();
+ }, [appId, loadContainers]);
+
+ useEffect(() => {
+ if (terminalRef.current) {
+ terminalRef.current.scrollTop = terminalRef.current.scrollHeight;
+ }
+ }, [history]);
+
async function handleExec(e) {
e.preventDefault();
@@ -90,7 +91,7 @@ const ShellTab = ({ appId, appName }) => {
value={selectedContainer || ''}
onValueChange={setSelectedContainer}
>
- <SelectTrigger style={{ fontSize: '12px' }}>
+ <SelectTrigger className="shell-tab__container-select">
<SelectValue />
</SelectTrigger>
<SelectContent>
diff --git a/frontend/src/components/settings/AISettingsTab.jsx b/frontend/src/components/settings/AISettingsTab.jsx
index 9cb8b011..bff0de80 100644
--- a/frontend/src/components/settings/AISettingsTab.jsx
+++ b/frontend/src/components/settings/AISettingsTab.jsx
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import api from '../../services/api';
import useSettingFocus from '../../hooks/useSettingFocus';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import { Switch } from '@/components/ui/switch';
import { Label } from '@/components/ui/label';
import { Button } from '@/components/ui/button';
diff --git a/frontend/src/components/settings/AboutTab.jsx b/frontend/src/components/settings/AboutTab.jsx
index 1a9e6f1b..4943eef2 100644
--- a/frontend/src/components/settings/AboutTab.jsx
+++ b/frontend/src/components/settings/AboutTab.jsx
@@ -36,7 +36,7 @@ const AboutTab = () => {
try {
const data = await api.getVersion();
setVersion(data.version || '1.0.0');
- } catch (error) {
+ } catch {
setVersion('1.0.0');
}
};
@@ -61,7 +61,7 @@ const AboutTab = () => {
setUpdateStatus(null);
}
}
- } catch (error) {
+ } catch {
setUpdateInfo({ error: 'Failed to check for updates' });
}
setCheckingUpdate(false);
@@ -157,7 +157,7 @@ const AboutTab = () => {
) : updateInfo.error ? (
<div className="update-status error">
<span>{updateInfo.error}</span>
- <button type="button" className="btn-link" onClick={checkForUpdate}>{t('common.actions.retry', 'Retry')}</button>
+ <Button variant="unstyled" type="button" className="btn-link" onClick={checkForUpdate}>{t('common.actions.retry', 'Retry')}</Button>
</div>
) : updateInfo.update_available ? (
updatePhase === null || updatePhase === 'confirm' ? (
@@ -245,9 +245,9 @@ const AboutTab = () => {
{showStarPrompt && (
<div className="star-prompt-card">
- <button type="button" className="dismiss-btn" onClick={dismissStarPrompt} title={t('common.actions.dismiss', 'Dismiss')}>
+ <Button variant="unstyled" type="button" className="dismiss-btn" onClick={dismissStarPrompt} title={t('common.actions.dismiss', 'Dismiss')}>
<X size={16} />
- </button>
+ </Button>
<div className="star-icon">
<Star size={24} />
</div>
diff --git a/frontend/src/components/settings/ActivityTab.jsx b/frontend/src/components/settings/ActivityTab.jsx
index 8c6d9922..4d1cad57 100644
--- a/frontend/src/components/settings/ActivityTab.jsx
+++ b/frontend/src/components/settings/ActivityTab.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect } from 'react';
+import { useCallback, useState, useEffect } from 'react';
import api from '../../services/api';
import ContributionGraph from './ContributionGraph';
import EmptyState from '../EmptyState';
@@ -29,22 +29,7 @@ const ActivityTab = () => {
loadActions();
}, []);
- useEffect(() => {
- loadLogs();
- }, [pagination.page, filters]);
-
- async function loadSummary() {
- try {
- const data = await api.getActivitySummary();
- setSummary(data);
- } catch {
- // Silently handle
- } finally {
- setLoading(false);
- }
- }
-
- async function loadLogs() {
+ const loadLogs = useCallback(async () => {
try {
setFeedLoading(true);
const params = {
@@ -66,8 +51,24 @@ const ActivityTab = () => {
} finally {
setFeedLoading(false);
}
+ }, [pagination.page, pagination.perPage, filters.action, filters.user_id]);
+
+ useEffect(() => {
+ loadLogs();
+ }, [loadLogs]);
+
+ async function loadSummary() {
+ try {
+ const data = await api.getActivitySummary();
+ setSummary(data);
+ } catch {
+ // Silently handle
+ } finally {
+ setLoading(false);
+ }
}
+
async function loadUsers() {
try {
const data = await api.getUsers();
diff --git a/frontend/src/components/settings/ApiKeyModal.jsx b/frontend/src/components/settings/ApiKeyModal.jsx
index ff9c2208..82d4b96d 100644
--- a/frontend/src/components/settings/ApiKeyModal.jsx
+++ b/frontend/src/components/settings/ApiKeyModal.jsx
@@ -87,7 +87,7 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
<Label>{t('app.apiKeyModal.tier', 'Tier')}</Label>
<div className="api-key-modal__tiers">
{TIER_OPTIONS.map(t => (
- <button
+ <Button variant="unstyled"
key={t.value}
type="button"
className={`api-key-modal__tier-btn ${tier === t.value ? 'active' : ''}`}
@@ -95,7 +95,7 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
>
<span className="api-key-modal__tier-label">{t.label}</span>
<span className="api-key-modal__tier-desc">{t.desc}</span>
- </button>
+ </Button>
))}
</div>
</div>
diff --git a/frontend/src/components/settings/ApiSettingsTab.jsx b/frontend/src/components/settings/ApiSettingsTab.jsx
index 14f516c3..f6bdf585 100644
--- a/frontend/src/components/settings/ApiSettingsTab.jsx
+++ b/frontend/src/components/settings/ApiSettingsTab.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect, useCallback } from 'react';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import api from '../../services/api';
import useSettingFocus from '../../hooks/useSettingFocus';
import ApiKeyModal from './ApiKeyModal';
diff --git a/frontend/src/components/settings/AppearanceTab.jsx b/frontend/src/components/settings/AppearanceTab.jsx
index f21ecb49..98313ed5 100644
--- a/frontend/src/components/settings/AppearanceTab.jsx
+++ b/frontend/src/components/settings/AppearanceTab.jsx
@@ -1,11 +1,11 @@
import { useRef, useState } from 'react';
-import { useTheme } from '../../contexts/ThemeContext';
-import { useAuth } from '../../contexts/AuthContext';
-import { useToast } from '../../contexts/ToastContext';
+import { useTheme } from '../../contexts/useTheme.js';
+import { useAuth } from '../../contexts/useAuth.js';
+import { useToast } from '../../contexts/useToast.js';
import { Link } from 'react-router-dom';
import { RotateCcw, Upload, Store, Sparkles, LayoutGrid } from 'lucide-react';
import { Button } from '@/components/ui/button';
-import { Switch } from '@/components/ui/switch';
+
import useSettingFocus from '../../hooks/useSettingFocus';
import LanguageSelector from './LanguageSelector';
import ThemeGallery from './ThemeGallery';
@@ -66,7 +66,7 @@ const AppearanceTab = () => {
<h3>{t('app.appearanceTab.theme', 'Theme')}</h3>
<p>{t('app.appearanceTab.selectYourPreferredColorScheme', 'Select your preferred color scheme')}</p>
<div className="theme-options">
- <button type="button"
+ <Button variant="unstyled" type="button"
className={`theme-option ${theme === 'dark' ? 'active' : ''}`}
onClick={() => setTheme('dark')}
>
@@ -78,8 +78,8 @@ const AppearanceTab = () => {
</div>
</div>
<span>{t('app.appearanceTab.dark', 'Dark')}</span>
- </button>
- <button type="button"
+ </Button>
+ <Button variant="unstyled" type="button"
className={`theme-option ${theme === 'light' ? 'active' : ''}`}
onClick={() => setTheme('light')}
>
@@ -91,8 +91,8 @@ const AppearanceTab = () => {
</div>
</div>
<span>{t('app.appearanceTab.light', 'Light')}</span>
- </button>
- <button type="button"
+ </Button>
+ <Button variant="unstyled" type="button"
className={`theme-option ${theme === 'system' ? 'active' : ''}`}
onClick={() => setTheme('system')}
>
@@ -104,7 +104,7 @@ const AppearanceTab = () => {
</div>
</div>
<span>{t('common.labels.system', 'System')}</span>
- </button>
+ </Button>
</div>
</div>
@@ -150,14 +150,14 @@ const AppearanceTab = () => {
<p>{t('app.appearanceTab.chooseThePrimaryAccentColorUsed', 'Choose the primary accent color used across the interface')}</p>
<div className="accent-presets">
{ACCENT_PRESETS.map(({ label, color }) => (
- <button type="button"
+ <Button variant="unstyled" type="button"
key={color}
className={`accent-preset${accentColor === color ? ' active' : ''}`}
onClick={() => setAccentColor(color)}
>
<span className="accent-swatch" style={{ background: color }} />
<span className="accent-label">{label}</span>
- </button>
+ </Button>
))}
</div>
<div className="accent-custom">
@@ -171,14 +171,14 @@ const AppearanceTab = () => {
/>
<span className="accent-custom-hex">{accentColor.toUpperCase()}</span>
{hasCustomAccent && (
- <button
+ <Button variant="unstyled"
type="button"
className="accent-custom-reset"
onClick={resetAccentColor}
title={t('app.appearanceTab.useTheThemeSAccent', 'Use the theme\'s accent')}
>
<RotateCcw size={13} /> {t('app.appearanceTab.useThemeAccent', 'Use theme accent')}
- </button>
+ </Button>
)}
</div>
</div>
diff --git a/frontend/src/components/settings/IconReferenceTab.jsx b/frontend/src/components/settings/IconReferenceTab.jsx
index 6f096edc..107964cf 100644
--- a/frontend/src/components/settings/IconReferenceTab.jsx
+++ b/frontend/src/components/settings/IconReferenceTab.jsx
@@ -14,6 +14,7 @@ import {
import { Input } from '@/components/ui/input';
import { copyToClipboard } from '@/utils/clipboard';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const ICON_CATALOG = {
'General': {
@@ -106,7 +107,7 @@ const IconReferenceTab = () => {
<h3>{group}</h3>
<div className="icon-reference-grid">
{Object.entries(icons).map(([name, IconComp]) => (
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
key={name}
className={`icon-reference-item ${copiedIcon === name ? 'copied' : ''}`}
onClick={() => handleCopyImport(name)}
@@ -116,7 +117,7 @@ const IconReferenceTab = () => {
<span className="icon-reference-name">
{copiedIcon === name ? 'Copied!' : name}
</span>
- </button>
+ </SharedButton>
))}
</div>
</div>
diff --git a/frontend/src/components/settings/LanguageSelector.jsx b/frontend/src/components/settings/LanguageSelector.jsx
index e0fe2127..3a101ba8 100644
--- a/frontend/src/components/settings/LanguageSelector.jsx
+++ b/frontend/src/components/settings/LanguageSelector.jsx
@@ -3,7 +3,7 @@ import { Languages } from 'lucide-react';
import {
Select, SelectContent, SelectItem, SelectTrigger, SelectValue,
} from '@/components/ui/select';
-import { useLocale } from '../../contexts/LocaleContext';
+import { useLocale } from '../../contexts/useLocale.js';
import useSettingFocus from '../../hooks/useSettingFocus';
/**
diff --git a/frontend/src/components/settings/MigrationHistoryTab.jsx b/frontend/src/components/settings/MigrationHistoryTab.jsx
index f6618c9e..d2e14c0c 100644
--- a/frontend/src/components/settings/MigrationHistoryTab.jsx
+++ b/frontend/src/components/settings/MigrationHistoryTab.jsx
@@ -10,10 +10,11 @@ import {
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import EmptyState from '../EmptyState';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import useSettingFocus from '../../hooks/useSettingFocus';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Revisions in this project are short descriptive slugs (e.g. 016_resource_grants),
// so show them in full rather than truncating mid-word.
@@ -265,7 +266,7 @@ const MigrationHistoryTab = () => {
)}
</p>
<div className="migration-pending-actions">
- <button
+ <SharedButton variant="primary"
type="button"
className="btn btn-primary btn-sm"
onClick={runMigrations}
@@ -278,7 +279,7 @@ const MigrationHistoryTab = () => {
) : (
<><Database size={14} /> {t('app.migrationHistoryTab.apply', 'Apply')} {count} migration{plural}</>
)}
- </button>
+ </SharedButton>
<label className="migration-backup-toggle">
<input
type="checkbox"
diff --git a/frontend/src/components/settings/ModulesTab.jsx b/frontend/src/components/settings/ModulesTab.jsx
index 4e5e1b01..fc79cf57 100644
--- a/frontend/src/components/settings/ModulesTab.jsx
+++ b/frontend/src/components/settings/ModulesTab.jsx
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { Layers, CheckCircle, XCircle } from 'lucide-react';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import useModules from '../../hooks/useModules';
import api from '../../services/api';
import { Label } from '@/components/ui/label';
diff --git a/frontend/src/components/settings/NotificationsTab.jsx b/frontend/src/components/settings/NotificationsTab.jsx
index 06bb532c..50f449d0 100644
--- a/frontend/src/components/settings/NotificationsTab.jsx
+++ b/frontend/src/components/settings/NotificationsTab.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import api from '../../services/api';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -149,7 +149,7 @@ const NotificationsTab = () => {
<div className="user-notification-prefs">
<div {...register('notifications-enable', 'settings-card')}>
<div className="form-group">
- <div className="flex items-center gap-3">
+ <div className="settings-notification-option">
<Switch
checked={userPrefs.enabled}
onCheckedChange={(checked) => setUserPrefs({...userPrefs, enabled: checked})}
@@ -277,7 +277,7 @@ const NotificationsTab = () => {
<h3>{t('app.notificationsTab.quietHours', 'Quiet Hours')}</h3>
<p>{t('app.notificationsTab.pauseNonCriticalNotificationsDuringThese', 'Pause non-critical notifications during these hours')}</p>
<div className="form-group">
- <div className="flex items-center gap-3">
+ <div className="settings-notification-option">
<Switch
checked={userPrefs.quiet_hours?.enabled}
onCheckedChange={(checked) => setUserPrefs({
@@ -379,7 +379,7 @@ const NotificationsTab = () => {
)}
<div className="notification-tabs">
- <button type="button"
+ <Button variant="unstyled" type="button"
className={`notification-tab ${activeSection === 'personal' ? 'active' : ''}`}
onClick={() => setActiveSection('personal')}
>
@@ -388,9 +388,9 @@ const NotificationsTab = () => {
<circle cx="12" cy="7" r="4"/>
</svg>
{t('app.notificationsTab.myPreferences', 'My Preferences')}
- </button>
+ </Button>
{isAdmin && (
- <button type="button"
+ <Button variant="unstyled" type="button"
className={`notification-tab ${activeSection === 'admin' ? 'active' : ''}`}
onClick={() => setActiveSection('admin')}
>
@@ -399,7 +399,7 @@ const NotificationsTab = () => {
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
</svg>
{t('app.notificationsTab.systemWebhooks', 'System Webhooks')}
- </button>
+ </Button>
)}
</div>
@@ -436,7 +436,7 @@ const NotificationsTab = () => {
{expandedChannel === channel.id && (
<div className="channel-config">
<div className="form-group">
- <div className="flex items-center gap-3">
+ <div className="settings-notification-option">
<Switch
checked={config[channel.id]?.enabled || false}
onCheckedChange={(checked) => updateChannelConfig(channel.id, 'enabled', checked)}
@@ -612,7 +612,7 @@ const NotificationsTab = () => {
/>
</div>
<div className="form-group">
- <div className="flex items-center gap-3">
+ <div className="settings-notification-option">
<Switch
checked={config.email.smtp_tls !== false}
onCheckedChange={(checked) => updateChannelConfig('email', 'smtp_tls', checked)}
diff --git a/frontend/src/components/settings/ProfileTab.jsx b/frontend/src/components/settings/ProfileTab.jsx
index 3841ad12..410da796 100644
--- a/frontend/src/components/settings/ProfileTab.jsx
+++ b/frontend/src/components/settings/ProfileTab.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
diff --git a/frontend/src/components/settings/RecycleBinTab.jsx b/frontend/src/components/settings/RecycleBinTab.jsx
index d606b732..4420648b 100644
--- a/frontend/src/components/settings/RecycleBinTab.jsx
+++ b/frontend/src/components/settings/RecycleBinTab.jsx
@@ -1,8 +1,8 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { Trash2, Undo2 } from 'lucide-react';
import api from '@/services/api';
-import { useToast } from '@/contexts/ToastContext';
-import { useAuth } from '@/contexts/AuthContext';
+import { useToast } from '@/contexts/useToast.js';
+import { useAuth } from '@/contexts/useAuth.js';
import { Button } from '@/components/ui/button';
import EmptyState from '@/components/EmptyState';
import { Pill, DataTable, DataTableFooter } from '@/components/ds';
@@ -85,7 +85,7 @@ export default function RecycleBinTab() {
} finally {
setLoading(false);
}
- }, [toast]);
+ }, [t, toast]);
useEffect(() => { load(); }, []); // eslint-disable-line react-hooks/exhaustive-deps
diff --git a/frontend/src/components/settings/SSOConfigTab.jsx b/frontend/src/components/settings/SSOConfigTab.jsx
index 38e7df25..689f89ab 100644
--- a/frontend/src/components/settings/SSOConfigTab.jsx
+++ b/frontend/src/components/settings/SSOConfigTab.jsx
@@ -71,7 +71,7 @@ const SSOConfigTab = () => {
setForceSso(data.config?.sso_force_sso ?? false);
const domains = data.config?.sso_allowed_domains || [];
setAllowedDomains(Array.isArray(domains) ? domains.join(', ') : '');
- } catch (err) {
+ } catch {
setMessage({ type: 'error', text: 'Failed to load SSO config' });
} finally {
setLoading(false);
diff --git a/frontend/src/components/settings/SecuritySettingsTab.jsx b/frontend/src/components/settings/SecuritySettingsTab.jsx
index 26837bbe..737bdb55 100644
--- a/frontend/src/components/settings/SecuritySettingsTab.jsx
+++ b/frontend/src/components/settings/SecuritySettingsTab.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import api from '../../services/api';
import useSettingFocus from '../../hooks/useSettingFocus';
import TwoFactorPolicyCard from './TwoFactorPolicyCard';
@@ -30,7 +30,7 @@ const LinkedAccounts = ({ register }) => {
try {
const data = await api.getSSOIdentities();
setIdentities(data.identities || []);
- } catch (err) {
+ } catch {
// SSO may not be configured; silently handle
} finally {
setLoading(false);
diff --git a/frontend/src/components/settings/SidebarSettings.jsx b/frontend/src/components/settings/SidebarSettings.jsx
index 6b395c82..5d051ac2 100644
--- a/frontend/src/components/settings/SidebarSettings.jsx
+++ b/frontend/src/components/settings/SidebarSettings.jsx
@@ -1,5 +1,5 @@
import { useState, useMemo } from 'react';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import api from '../../services/api';
import { Check, RotateCcw } from 'lucide-react';
import { sanitizeSvgInner } from '../../utils/sanitizeSvg';
@@ -106,7 +106,7 @@ const SidebarSettings = () => {
<div className="sidebar-presets">
{Object.entries(SIDEBAR_PRESETS).map(([key, profile]) => (
- <button type="button"
+ <Button variant="unstyled" type="button"
key={key}
className={`sidebar-preset-card ${preset === key ? 'active' : ''}`}
onClick={() => handlePresetChange(key)}
@@ -123,9 +123,9 @@ const SidebarSettings = () => {
<Check size={16} />
</div>
)}
- </button>
+ </Button>
))}
- <button type="button"
+ <Button variant="unstyled" type="button"
className={`sidebar-preset-card ${preset === 'custom' ? 'active' : ''}`}
onClick={() => handlePresetChange('custom')}
>
@@ -143,7 +143,7 @@ const SidebarSettings = () => {
<Check size={16} />
</div>
)}
- </button>
+ </Button>
</div>
</div>
diff --git a/frontend/src/components/settings/SiteSettingsTab.jsx b/frontend/src/components/settings/SiteSettingsTab.jsx
index 7efd15c5..a17e29b1 100644
--- a/frontend/src/components/settings/SiteSettingsTab.jsx
+++ b/frontend/src/components/settings/SiteSettingsTab.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect } from 'react';
+import { useCallback, useState, useEffect } from 'react';
import api from '../../services/api';
import { Switch } from '@/components/ui/switch';
import { Label } from '@/components/ui/label';
@@ -6,7 +6,7 @@ import { Input } from '@/components/ui/input';
import { Button } from '@/components/ui/button';
import { Pill } from '@/components/ds';
import useSettingFocus from '../../hooks/useSettingFocus';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import { useTranslation } from 'react-i18next';
const SiteSettingsTab = ({ onDevModeChange }) => {
@@ -38,11 +38,17 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
const [addingDomain, setAddingDomain] = useState(false);
const [rowBusy, setRowBusy] = useState(''); // domain currently being mutated
- useEffect(() => {
- loadSettings();
+ const loadHttps = useCallback(async () => {
+ try {
+ const h = await api.getSitesHttpsStatus();
+ setHttps(h);
+ setBaseDomain(h.base_domain || '');
+ setServerIp(h.server_ip || '');
+ if (h.providers?.length) setProviderId(current => current || String(h.providers[0].id));
+ } catch { /* non-admin or endpoint unavailable */ }
}, []);
- async function loadSettings() {
+ const loadSettings = useCallback(async () => {
try {
const data = await api.getSystemSettings();
setSettings({
@@ -59,17 +65,12 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
} finally {
setLoading(false);
}
- }
+ }, [loadHttps]);
+
+ useEffect(() => {
+ loadSettings();
+ }, [loadSettings]);
- async function loadHttps() {
- try {
- const h = await api.getSitesHttpsStatus();
- setHttps(h);
- setBaseDomain(h.base_domain || '');
- setServerIp(h.server_ip || '');
- if (h.providers?.length && !providerId) setProviderId(String(h.providers[0].id));
- } catch { /* non-admin or endpoint unavailable */ }
- }
// The bases to show: the registry when populated, else a synthetic row for
// the single legacy base (editable in place) so single-domain installs and
@@ -314,7 +315,6 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
value={publicTitle}
onChange={(e) => setPublicTitle(e.target.value)}
placeholder={t('app.siteSettingsTab.controlPanel', 'Control Panel')}
- className="w-56"
/>
</div>
</div>
@@ -333,7 +333,6 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
value={panelTitle}
onChange={(e) => setPanelTitle(e.target.value)}
placeholder={t('common.labels.serverKit', 'ServerKit')}
- className="w-56"
/>
</div>
</div>
@@ -404,7 +403,6 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
value={basePort}
onChange={(e) => setBasePort(e.target.value)}
disabled={savingPort}
- className="w-32"
/>
<Button onClick={handleSaveBasePort} disabled={savingPort}>
{savingPort ? 'Saving…' : 'Save'}
@@ -433,7 +431,6 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
placeholder="203.0.113.10"
value={serverIp}
onChange={(e) => setServerIp(e.target.value)}
- className="w-56"
/>
<Button onClick={handleSaveServerIp} disabled={savingDomain}>
{savingDomain ? 'Saving…' : 'Save'}
@@ -470,13 +467,13 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
{b._legacy ? (
<div className="settings-control">
<Input type="text" placeholder="apps.example.com" value={baseDomain}
- onChange={(e) => setBaseDomain(e.target.value)} className="w-56" />
+ onChange={(e) => setBaseDomain(e.target.value)} />
<Button onClick={handleSaveDomain} disabled={savingDomain}>
{savingDomain ? 'Saving…' : 'Save'}
</Button>
</div>
) : (
- <span className="flex items-center gap-2">
+ <span className="settings-site-action-label">
<code>{b.domain}</code>
{b.is_default && <Pill kind="blue" dot={false}>{t('common.labels.default', 'Default')}</Pill>}
<Pill kind={b.https_enabled ? 'green' : 'gray'} dot={false}>
@@ -522,7 +519,7 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
<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)} className="w-56" />
+ 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>
diff --git a/frontend/src/components/settings/SystemTab.jsx b/frontend/src/components/settings/SystemTab.jsx
index b2ee5f6b..8cbf4d1f 100644
--- a/frontend/src/components/settings/SystemTab.jsx
+++ b/frontend/src/components/settings/SystemTab.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react';
-import { useAuth } from '../../contexts/AuthContext';
-import { useTheme } from '../../contexts/ThemeContext';
+import { useAuth } from '../../contexts/useAuth.js';
+import { useTheme } from '../../contexts/useTheme.js';
import api from '../../services/api';
import useSettingFocus from '../../hooks/useSettingFocus';
import { InfoList, InfoItem } from '../InfoList';
diff --git a/frontend/src/components/settings/ThemeBrowseModal.jsx b/frontend/src/components/settings/ThemeBrowseModal.jsx
index a8d108a1..3fa1b123 100644
--- a/frontend/src/components/settings/ThemeBrowseModal.jsx
+++ b/frontend/src/components/settings/ThemeBrowseModal.jsx
@@ -3,10 +3,11 @@ import { Check, Download, Loader2 } from 'lucide-react';
import {
Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription,
} from '@/components/ui/dialog';
-import { useTheme } from '../../contexts/ThemeContext';
-import { useToast } from '../../contexts/ToastContext';
+import { useTheme } from '../../contexts/useTheme.js';
+import { useToast } from '../../contexts/useToast.js';
import api from '../../services/api';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Browse & install community themes from the registry (plan 60, Phase 3).
// Offline-tolerant: if the registry is unreachable the panel falls back to the
@@ -93,7 +94,7 @@ const ThemeBrowseModal = ({ open, onOpenChange }) => {
{themeEntry.installed ? (
<span className="theme-browse__installed"><Check size={13} /> {t('app.themeBrowseModal.installed', 'Installed')}</span>
) : (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="theme-browse__install"
disabled={installing === themeEntry.slug}
@@ -103,7 +104,7 @@ const ThemeBrowseModal = ({ open, onOpenChange }) => {
? <Loader2 className="spin" size={13} />
: <Download size={13} />}
{t('app.themeBrowseModal.install', 'Install')}
- </button>
+ </SharedButton>
)}
</div>
);
diff --git a/frontend/src/components/settings/ThemeGallery.jsx b/frontend/src/components/settings/ThemeGallery.jsx
index 4db9403c..88fce183 100644
--- a/frontend/src/components/settings/ThemeGallery.jsx
+++ b/frontend/src/components/settings/ThemeGallery.jsx
@@ -1,11 +1,12 @@
import { useState } from 'react';
import { Check, Star, Trash2 } from 'lucide-react';
-import { useTheme } from '../../contexts/ThemeContext';
-import { useAuth } from '../../contexts/AuthContext';
-import { useToast } from '../../contexts/ToastContext';
+import { useTheme } from '../../contexts/useTheme.js';
+import { useAuth } from '../../contexts/useAuth.js';
+import { useToast } from '../../contexts/useToast.js';
import { DEFAULT_THEME_SLUG } from '../../data/bundledThemes';
import api from '../../services/api';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Theme Gallery — cards for every selectable skin (bundled seeds + installed).
// Apply is instant (tokens are already local); hovering previews live and
@@ -104,24 +105,24 @@ const ThemeGallery = () => {
{isAdmin && (
<div className="theme-card__admin">
{!isPanelDefault && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="theme-card__admin-btn"
disabled={busy === themeEntry.slug}
onClick={(e) => { e.stopPropagation(); setDefault(themeEntry.slug); }}
>
<Star size={12} /> {t('app.themeGallery.setDefault', 'Set default')}
- </button>
+ </SharedButton>
)}
{removable && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="theme-card__admin-btn theme-card__admin-btn--danger"
disabled={busy === themeEntry.slug}
onClick={(e) => { e.stopPropagation(); removeTheme(themeEntry.slug); }}
>
<Trash2 size={12} /> {t('common.actions.remove', 'Remove')}
- </button>
+ </SharedButton>
)}
</div>
)}
diff --git a/frontend/src/components/settings/ThemeStudioModal.jsx b/frontend/src/components/settings/ThemeStudioModal.jsx
index b10f9a80..1321a2ae 100644
--- a/frontend/src/components/settings/ThemeStudioModal.jsx
+++ b/frontend/src/components/settings/ThemeStudioModal.jsx
@@ -4,9 +4,9 @@ import {
Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription,
} from '@/components/ui/dialog';
import { Button } from '@/components/ui/button';
-import { useTheme } from '../../contexts/ThemeContext';
-import { useAuth } from '../../contexts/AuthContext';
-import { useToast } from '../../contexts/ToastContext';
+import { useTheme } from '../../contexts/useTheme.js';
+import { useAuth } from '../../contexts/useAuth.js';
+import { useToast } from '../../contexts/useToast.js';
import { TOKEN_GROUPS, GROUP_LABELS, TOKEN_TYPE, sanitizeTokens } from '../../data/themeTokens';
import { DEFAULT_THEME_SLUG, BUNDLED_THEME_MAP } from '../../data/bundledThemes';
import api from '../../services/api';
@@ -170,16 +170,16 @@ const ThemeStudioModal = ({ open, onOpenChange }) => {
<input type="color" value={accent} onChange={(e) => setAccent(e.target.value)} />
</div>
<div className="theme-studio__modes">
- <button
+ <Button variant="unstyled"
type="button"
className={editMode === 'dark' ? 'active' : ''}
onClick={() => setEditMode('dark')}
- >{t('app.themeStudioModal.darkTokens', 'Dark tokens')}</button>
- <button
+ >{t('app.themeStudioModal.darkTokens', 'Dark tokens')}</Button>
+ <Button variant="unstyled"
type="button"
className={editMode === 'light' ? 'active' : ''}
onClick={() => setEditMode('light')}
- >{t('app.themeStudioModal.lightTokens', 'Light tokens')}</button>
+ >{t('app.themeStudioModal.lightTokens', 'Light tokens')}</Button>
</div>
</div>
diff --git a/frontend/src/components/settings/UserModal.jsx b/frontend/src/components/settings/UserModal.jsx
index d4186cc3..e3950139 100644
--- a/frontend/src/components/settings/UserModal.jsx
+++ b/frontend/src/components/settings/UserModal.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import api from '../../services/api';
import PermissionEditor from './PermissionEditor';
import Modal from '../Modal';
diff --git a/frontend/src/components/settings/UsersTab.jsx b/frontend/src/components/settings/UsersTab.jsx
index 0c2c5030..a04d5f39 100644
--- a/frontend/src/components/settings/UsersTab.jsx
+++ b/frontend/src/components/settings/UsersTab.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback, useRef } from 'react';
import api from '../../services/api';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import UserModal from './UserModal';
import InvitationsTab from './InvitationsTab';
import LoginLinksSection from './LoginLinksSection';
diff --git a/frontend/src/components/settings/WebhooksTab.jsx b/frontend/src/components/settings/WebhooksTab.jsx
index a8aaf46d..c63e1b0b 100644
--- a/frontend/src/components/settings/WebhooksTab.jsx
+++ b/frontend/src/components/settings/WebhooksTab.jsx
@@ -1,4 +1,4 @@
-import { useEffect, useMemo, useState } from 'react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
import api from '../../services/api';
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
@@ -9,7 +9,7 @@ import { Badge } from '@/components/ui/badge';
import Modal from '@/components/Modal';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useConfirm } from '../../hooks/useConfirm';
import { Plus, MoreVertical, Copy, RefreshCw, ArrowRightLeft } from 'lucide-react';
import EmptyState from '../EmptyState';
@@ -29,6 +29,7 @@ const formatDate = (d) => (d ? new Date(d).toLocaleString() : '—');
export default function WebhooksTab() {
const { t } = useTranslation();
const toast = useToast();
+ const toastError = toast.error;
const { confirm } = useConfirm();
const [endpoints, setEndpoints] = useState([]);
@@ -39,21 +40,22 @@ export default function WebhooksTab() {
const [deliveries, setDeliveries] = useState([]);
const [regeneratedSecret, setRegeneratedSecret] = useState(null);
- useEffect(() => {
- loadAll();
- }, []);
-
- async function loadAll() {
+ const loadAll = useCallback(async () => {
setLoading(true);
try {
const e = await api.listWebhookEndpoints();
setEndpoints(e.endpoints || []);
} catch (err) {
- toast.error(t('app.webhooksTab.loadFailed', 'Load failed: {{message}}', { message: err.message }));
+ toastError(t('app.webhooksTab.loadFailed', 'Load failed: {{message}}', { message: err.message }));
} finally {
setLoading(false);
}
- }
+ }, [t, toastError]);
+
+ useEffect(() => {
+ loadAll();
+ }, [loadAll]);
+
async function createEndpoint(e) {
e.preventDefault();
@@ -163,25 +165,25 @@ export default function WebhooksTab() {
<TableHead>{t('app.webhooksTab.slug', 'Slug')}</TableHead>
<TableHead>{t('app.webhooksTab.forwardUrl', 'Forward URL')}</TableHead>
<TableHead>{t('common.labels.status', 'Status')}</TableHead>
- <TableHead className="text-right">{t('common.labels.actions', 'Actions')}</TableHead>
+ <TableHead>{t('common.labels.actions', 'Actions')}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{endpoints.map(ep => (
- <TableRow key={ep.id} className="cursor-pointer" onClick={() => openEndpoint(ep.id)}>
- <TableCell className="font-medium">{ep.name}</TableCell>
+ <TableRow key={ep.id} className="settings-webhook-row" onClick={() => openEndpoint(ep.id)}>
+ <TableCell className="settings-webhook-name">{ep.name}</TableCell>
<TableCell>{ep.slug}</TableCell>
<TableCell>{ep.forward_url || '—'}</TableCell>
<TableCell><Badge variant={ep.is_active ? 'default' : 'secondary'}>{ep.is_active ? 'Active' : 'Inactive'}</Badge></TableCell>
- <TableCell className="text-right">
+ <TableCell className="settings-webhook-actions">
<DropdownMenu>
<DropdownMenuTrigger asChild onClick={(e) => e.stopPropagation()}>
<Button variant="ghost" size="icon"><MoreVertical size={14} /></Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => openEndpoint(ep.id)}>{t('app.webhooksTab.viewDeliveries', 'View deliveries')}</DropdownMenuItem>
- <DropdownMenuItem onClick={() => regenerateSecret(ep.id)}><RefreshCw size={12} className="mr-2" /> {t('app.webhooksTab.regenerateSecret', 'Regenerate secret')}</DropdownMenuItem>
- <DropdownMenuItem className="text-destructive" onClick={() => deleteEndpoint(ep.id)}>{t('common.actions.delete', 'Delete')}</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => regenerateSecret(ep.id)}><RefreshCw size={12} className="settings-webhook-action-icon" /> {t('app.webhooksTab.regenerateSecret', 'Regenerate secret')}</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => deleteEndpoint(ep.id)}>{t('common.actions.delete', 'Delete')}</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</TableCell>
@@ -198,7 +200,7 @@ export default function WebhooksTab() {
<div className="secrets__header">
<div>
<Button variant="ghost" size="sm" onClick={() => setSelectedEndpoint(null)}>{t('app.webhooksTab.back', '← Back')}</Button>
- <CardTitle className="mt-2">{selectedEndpoint.name}</CardTitle>
+ <CardTitle>{selectedEndpoint.name}</CardTitle>
<CardDescription>
{t('app.webhooksTab.postTo', 'POST to')} <code className="secrets__code">{receiverUrl}</code>
</CardDescription>
@@ -219,17 +221,17 @@ export default function WebhooksTab() {
<TableHead>{t('common.labels.status', 'Status')}</TableHead>
<TableHead>{t('app.webhooksTab.signature', 'Signature')}</TableHead>
<TableHead>{t('app.webhooksTab.received', 'Received')}</TableHead>
- <TableHead className="text-right">{t('common.labels.actions', 'Actions')}</TableHead>
+ <TableHead>{t('common.labels.actions', 'Actions')}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{deliveries.map(d => (
<TableRow key={d.id}>
- <TableCell className="font-mono text-xs max-w-[200px] truncate">{d.event_id}</TableCell>
+ <TableCell className="settings-webhook-event-id">{d.event_id}</TableCell>
<TableCell><WebhookStatusBadge status={d.status} /></TableCell>
<TableCell>{d.signature_valid === true ? 'Valid' : d.signature_valid === false ? 'Invalid' : '—'}</TableCell>
<TableCell>{formatDate(d.received_at)}</TableCell>
- <TableCell className="text-right">
+ <TableCell className="settings-webhook-actions">
<Button variant="ghost" size="icon" onClick={() => replayDelivery(d.id)} title={t('app.webhooksTab.replay', 'Replay')}>
<ArrowRightLeft size={14} />
</Button>
@@ -245,7 +247,7 @@ export default function WebhooksTab() {
<Modal open={endpointForm.open} onClose={() => setEndpointForm({ ...endpointForm, open: false })} title={t('app.webhooksTab.newWebhookEndpoint', 'New Webhook Endpoint')}>
<p className="sk-modal__subtitle">{t('app.webhooksTab.createASlugSecretAndOptional', 'Create a slug, secret, and optional forward URL.')}</p>
- <form onSubmit={createEndpoint} className="space-y-4">
+ <form onSubmit={createEndpoint} className="settings-webhook-form">
<div>
<Label htmlFor="epName">{t('common.labels.name', 'Name')}</Label>
<Input id="epName" value={endpointForm.name} onChange={(e) => setEndpointForm({ ...endpointForm, name: e.target.value })} required />
@@ -277,11 +279,11 @@ export default function WebhooksTab() {
)}
>
<p className="sk-modal__subtitle">{t('app.webhooksTab.copyThisSecretNowItWill', 'Copy this secret now. It will not be shown again.')}</p>
- <div className="space-y-2">
+ <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="flex gap-2">
+ <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} />
diff --git a/frontend/src/components/settings/WhiteLabelTab.jsx b/frontend/src/components/settings/WhiteLabelTab.jsx
index 893e9891..ca54c5d3 100644
--- a/frontend/src/components/settings/WhiteLabelTab.jsx
+++ b/frontend/src/components/settings/WhiteLabelTab.jsx
@@ -1,5 +1,5 @@
import { useRef } from 'react';
-import { useTheme } from '../../contexts/ThemeContext';
+import { useTheme } from '../../contexts/useTheme.js';
import { Star, X, Layers, Image, Type, Upload } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -48,7 +48,7 @@ const WhiteLabelTab = () => {
<>
<div className="whitelabel-modes">
{WHITELABEL_MODES.map(({ id, label, icon: Icon, desc }) => (
- <button type="button"
+ <Button variant="unstyled" type="button"
key={id}
className={`whitelabel-mode${whiteLabel.mode === id ? ' active' : ''}`}
onClick={() => setWhiteLabel({ mode: id })}
@@ -56,7 +56,7 @@ const WhiteLabelTab = () => {
<Icon size={20} />
<span className="whitelabel-mode__label">{label}</span>
<span className="whitelabel-mode__desc">{desc}</span>
- </button>
+ </Button>
))}
</div>
diff --git a/frontend/src/components/settings/connections/ConnectProviderModal.jsx b/frontend/src/components/settings/connections/ConnectProviderModal.jsx
index 34a4e01d..1f4462cc 100644
--- a/frontend/src/components/settings/connections/ConnectProviderModal.jsx
+++ b/frontend/src/components/settings/connections/ConnectProviderModal.jsx
@@ -193,7 +193,7 @@ function SourceBody({ provider, status, config, isAdmin, onConnect, onDisconnect
{isAdmin && (
<div className="conn-advanced">
{isGithub && (
- <button
+ <Button variant="unstyled"
type="button"
className="conn-advanced__toggle"
onClick={() => setAdvancedOpen((o) => !o)}
@@ -201,7 +201,7 @@ function SourceBody({ provider, status, config, isAdmin, onConnect, onDisconnect
>
<span><KeyRound size={14} /> {t('app.connectProviderModal.advancedUseYourOwnOauthApp', 'Advanced: use your own OAuth app')}</span>
<ChevronDown size={15} className={advancedOpen ? 'conn-list__chev is-open' : 'conn-list__chev'} />
- </button>
+ </Button>
)}
{advancedOpen && (
<form className="conn-form" onSubmit={save}>
@@ -317,14 +317,14 @@ function DnsBody({ provider, isAdmin, connections, onAdd, onRemove, onTest }) {
{isCloudflare && (
<div className="conn-scope" role="radiogroup" aria-label={t('app.connectProviderModal.accessLevel', 'Access level')}>
- <button type="button" className={`conn-scope__opt${cfMode === 'scoped' ? ' is-active' : ''}`} onClick={() => setCfMode('scoped')} role="radio" aria-checked={cfMode === 'scoped'}>
+ <Button variant="unstyled" type="button" className={`conn-scope__opt${cfMode === 'scoped' ? ' is-active' : ''}`} onClick={() => setCfMode('scoped')} role="radio" aria-checked={cfMode === 'scoped'}>
<span className="conn-scope__head"><ShieldCheck size={16} /> {t('app.connectProviderModal.scopedToken', 'Scoped token')} <span className="conn-scope__rec">{t('app.connectProviderModal.recommended', 'Recommended')}</span></span>
<span className="conn-scope__desc">{t('app.connectProviderModal.aCloudflareTokenLimitedToDns', 'A Cloudflare token limited to DNS:Edit on the zones you choose. ServerKit can only touch DNS.')}</span>
- </button>
- <button type="button" className={`conn-scope__opt${cfMode === 'global' ? ' is-active' : ''}`} onClick={() => setCfMode('global')} role="radio" aria-checked={cfMode === 'global'}>
+ </Button>
+ <Button variant="unstyled" type="button" className={`conn-scope__opt${cfMode === 'global' ? ' is-active' : ''}`} onClick={() => setCfMode('global')} role="radio" aria-checked={cfMode === 'global'}>
<span className="conn-scope__head"><ShieldAlert size={16} /> {t('app.connectProviderModal.globalApiKey', 'Global API key')}</span>
<span className="conn-scope__desc">{t('app.connectProviderModal.yourAccountEmailGlobalKeySimplest', 'Your account email + global key. Simplest to set up, but grants full account access.')}</span>
- </button>
+ </Button>
</div>
)}
@@ -706,7 +706,7 @@ function RegistryBody({ isAdmin, registries, onAdd, onRemove, onTest }) {
<div className="conn-presets" role="radiogroup" aria-label={t('app.connectProviderModal.registryProvider', 'Registry provider')}>
{REGISTRY_PROVIDERS.map((p) => (
- <button
+ <Button variant="unstyled"
type="button"
key={p.id}
className={`conn-presets__opt${providerId === p.id ? ' is-active' : ''}`}
@@ -715,7 +715,7 @@ function RegistryBody({ isAdmin, registries, onAdd, onRemove, onTest }) {
aria-checked={providerId === p.id}
>
{p.name}
- </button>
+ </Button>
))}
</div>
@@ -815,7 +815,7 @@ function EmailBody({ isAdmin, relayConfig, onSave, onTest, onDisable }) {
<div className="conn-presets" role="radiogroup" aria-label={t('app.connectProviderModal.providerPreset', 'Provider preset')}>
{SMTP_PRESETS.map((p) => (
- <button
+ <Button variant="unstyled"
type="button"
key={p.id}
className={`conn-presets__opt${form.provider_hint === p.id ? ' is-active' : ''}`}
@@ -824,7 +824,7 @@ function EmailBody({ isAdmin, relayConfig, onSave, onTest, onDisable }) {
aria-checked={form.provider_hint === p.id}
>
{p.name}
- </button>
+ </Button>
))}
</div>
diff --git a/frontend/src/components/settings/connections/ConnectionsHub.jsx b/frontend/src/components/settings/connections/ConnectionsHub.jsx
index fde18895..30a50aff 100644
--- a/frontend/src/components/settings/connections/ConnectionsHub.jsx
+++ b/frontend/src/components/settings/connections/ConnectionsHub.jsx
@@ -14,8 +14,8 @@ import { ShieldAlert } from 'lucide-react';
import api from '../../../services/api';
import useSettingFocus from '../../../hooks/useSettingFocus';
import { useConfirm } from '../../../hooks/useConfirm';
-import { useAuth } from '../../../contexts/AuthContext';
-import { useToast } from '../../../contexts/ToastContext';
+import { useAuth } from '../../../contexts/useAuth.js';
+import { useToast } from '../../../contexts/useToast.js';
import {
CONNECTION_CATEGORIES, CONNECTION_PROVIDERS, deriveScope, dedupeScopes,
} from './providerCatalog';
@@ -112,7 +112,7 @@ export default function ConnectionsHub() {
} catch (err) {
toast.error(err.message || t('app.connectionsHub.failedToStartConnection', 'Failed to start {{name}} connection', { name: provider.name }));
}
- }, [toast]);
+ }, [t, toast]);
const onDisconnectSource = useCallback(async (provider) => {
try {
@@ -123,7 +123,7 @@ export default function ConnectionsHub() {
} catch (err) {
toast.error(err.message || t('app.connectionsHub.failedToDisconnect', 'Failed to disconnect'));
}
- }, [toast, loadData]);
+ }, [toast, loadData, t]);
// One-click GitHub App setup: fetch the manifest, then POST it to github.com
// via an auto-submitted form (GitHub only accepts the manifest as a form
@@ -147,7 +147,7 @@ export default function ConnectionsHub() {
} catch (err) {
toast.error(err.message || t('app.connectionsHub.failedToStartGithubAppSetup', 'Failed to start GitHub App setup'));
}
- }, [toast]);
+ }, [t, toast]);
const onSaveSourceConfig = useCallback(async (provider, config) => {
try {
@@ -161,7 +161,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToSaveOauthApp', 'Failed to save OAuth app'));
return false;
}
- }, [toast, loadData]);
+ }, [toast, t, loadData]);
// ── DNS ──
const onAddDns = useCallback(async (payload) => {
@@ -175,7 +175,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToAddConnection', 'Failed to add connection'));
return false;
}
- }, [toast, loadData]);
+ }, [toast, loadData, t]);
const onRemoveDns = useCallback(async (record) => {
const confirmed = await confirm({
@@ -194,7 +194,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToRemoveConnection', 'Failed to remove connection'));
return false;
}
- }, [confirm, toast, loadData]);
+ }, [confirm, t, toast, loadData]);
const onTestDns = useCallback(async (id) => {
try {
@@ -206,7 +206,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));
return null;
}
- }, [toast]);
+ }, [t, toast]);
// ── Cloud (server provisioning) ──
const onAddCloud = useCallback(async (payload) => {
@@ -219,7 +219,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToConnectProvider', 'Failed to connect provider'));
return false;
}
- }, [toast, loadData]);
+ }, [toast, t, loadData]);
const onRemoveCloud = useCallback(async (id) => {
const confirmed = await confirm({
@@ -238,7 +238,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToDisconnect', 'Failed to disconnect'));
return false;
}
- }, [confirm, toast, loadData]);
+ }, [confirm, t, toast, loadData]);
// ── Storage ──
const onSaveStorage = useCallback(async (config) => {
@@ -252,7 +252,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToSaveStorage', 'Failed to save storage'));
return false;
}
- }, [toast, loadData]);
+ }, [toast, t, loadData]);
const onTestStorage = useCallback(async (config) => {
try {
@@ -264,7 +264,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));
return null;
}
- }, [toast]);
+ }, [t, toast]);
// ── Email relay ──
const onSaveRelay = useCallback(async (payload) => {
@@ -277,7 +277,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToSaveRelay', 'Failed to save relay'));
return false;
}
- }, [toast, loadData]);
+ }, [toast, t, loadData]);
const onTestRelay = useCallback(async (payload) => {
try {
@@ -289,7 +289,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));
return null;
}
- }, [toast]);
+ }, [t, toast]);
const onDisableRelay = useCallback(async () => {
try {
@@ -301,7 +301,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToDisableRelay', 'Failed to disable relay'));
return false;
}
- }, [toast, loadData]);
+ }, [toast, t, loadData]);
// ── Registrar ──
const onAddRegistrar = useCallback(async (payload) => {
@@ -314,7 +314,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToConnectRegistrar', 'Failed to connect registrar'));
return false;
}
- }, [toast, loadData]);
+ }, [toast, t, loadData]);
const onRemoveRegistrar = useCallback(async (id) => {
const confirmed = await confirm({
@@ -333,7 +333,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToDisconnect', 'Failed to disconnect'));
return false;
}
- }, [confirm, toast, loadData]);
+ }, [confirm, t, toast, loadData]);
const onTestRegistrar = useCallback(async (id) => {
try {
@@ -345,7 +345,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));
return null;
}
- }, [toast]);
+ }, [t, toast]);
// ── Container registries ──
const onAddRegistry = useCallback(async (payload) => {
@@ -358,7 +358,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToAddRegistry', 'Failed to add registry'));
return false;
}
- }, [toast, loadData]);
+ }, [toast, t, loadData]);
const onRemoveRegistry = useCallback(async (id) => {
const confirmed = await confirm({
@@ -377,7 +377,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.failedToRemoveRegistry', 'Failed to remove registry'));
return false;
}
- }, [confirm, toast, loadData]);
+ }, [confirm, t, toast, loadData]);
const onTestRegistry = useCallback(async (id) => {
try {
@@ -389,7 +389,7 @@ export default function ConnectionsHub() {
toast.error(err.message || t('app.connectionsHub.loginFailed', 'Login failed'));
return null;
}
- }, [toast]);
+ }, [t, toast]);
// ── Per-provider card summaries ──
const summaries = useMemo(() => {
diff --git a/frontend/src/components/setup/SetupStepAccount.jsx b/frontend/src/components/setup/SetupStepAccount.jsx
index 538dff21..32818364 100644
--- a/frontend/src/components/setup/SetupStepAccount.jsx
+++ b/frontend/src/components/setup/SetupStepAccount.jsx
@@ -1,10 +1,11 @@
import { useState } from 'react';
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import { Info } from 'lucide-react';
-import { Button } from '@/components/ui/button';
+
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const SetupStepAccount = ({ onComplete }) => {
const { t } = useTranslation();
@@ -103,13 +104,13 @@ const SetupStepAccount = ({ onComplete }) => {
/>
</div>
- <button
+ <SharedButton variant="unstyled"
type="submit"
className="btn-wizard-next btn-wizard-next--block"
disabled={loading}
>
{loading ? 'Signing in...' : 'Sign In & Continue'}
- </button>
+ </SharedButton>
</form>
</div>
);
@@ -181,13 +182,13 @@ const SetupStepAccount = ({ onComplete }) => {
/>
</div>
- <button
+ <SharedButton variant="unstyled"
type="submit"
className="btn-wizard-next btn-wizard-next--block"
disabled={loading}
>
{loading ? 'Creating account...' : 'Continue'}
- </button>
+ </SharedButton>
</form>
</div>
);
diff --git a/frontend/src/components/setup/SetupStepCapacity.jsx b/frontend/src/components/setup/SetupStepCapacity.jsx
index a4f13538..fb572b84 100644
--- a/frontend/src/components/setup/SetupStepCapacity.jsx
+++ b/frontend/src/components/setup/SetupStepCapacity.jsx
@@ -1,8 +1,9 @@
import { useState } from 'react';
-import { useResourceTier } from '../../contexts/ResourceTierContext';
+import { useResourceTier } from '../../contexts/useResourceTier.js';
import { Check, X, AlertTriangle, Loader, Cpu, MemoryStick, HardDrive } from 'lucide-react';
import api from '../../services/api';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Display order. The card bodies themselves come from the backend so the
// installer and the panel can never disagree about what a profile contains.
@@ -134,7 +135,7 @@ const SetupStepCapacity = ({ useCases, onComplete }) => {
const isRecommended = recommendedProfile === id;
return (
- <button
+ <SharedButton variant="unstyled"
type="button"
key={id}
className={`tier-card tier-card--selectable${isActive ? ' detected' : ''}`}
@@ -171,7 +172,7 @@ const SetupStepCapacity = ({ useCases, onComplete }) => {
</div>
))}
</div>
- </button>
+ </SharedButton>
);
})}
</div>
@@ -197,14 +198,14 @@ const SetupStepCapacity = ({ useCases, onComplete }) => {
)}
<div className="wizard-nav wizard-nav--flush">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="btn-wizard-next"
onClick={handleContinue}
disabled={saving}
>
{saving ? 'Saving...' : 'Continue'}
- </button>
+ </SharedButton>
</div>
</div>
);
diff --git a/frontend/src/components/setup/SetupStepIntent.jsx b/frontend/src/components/setup/SetupStepIntent.jsx
index 3f4b0b22..8f729f70 100644
--- a/frontend/src/components/setup/SetupStepIntent.jsx
+++ b/frontend/src/components/setup/SetupStepIntent.jsx
@@ -1,7 +1,8 @@
import { useState } from 'react';
import { Globe, Code, Server, GitBranch, Check } from 'lucide-react';
-import { Button } from '@/components/ui/button';
+
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const USE_CASE_OPTIONS = [
{
@@ -81,9 +82,9 @@ const SetupStepIntent = ({ selections, onComplete }) => {
</div>
<div className="wizard-nav wizard-nav--flush">
- <button type="button" className="btn-wizard-next" onClick={handleContinue}>
+ <SharedButton variant="unstyled" type="button" className="btn-wizard-next" onClick={handleContinue}>
{t('common.actions.continue', 'Continue')}
- </button>
+ </SharedButton>
</div>
</div>
);
diff --git a/frontend/src/components/setup/SetupStepSecurity.jsx b/frontend/src/components/setup/SetupStepSecurity.jsx
index baa29871..fc50beb4 100644
--- a/frontend/src/components/setup/SetupStepSecurity.jsx
+++ b/frontend/src/components/setup/SetupStepSecurity.jsx
@@ -118,13 +118,13 @@ const SetupStepSecurity = ({ onComplete }) => {
</div>
<div className="wizard-nav wizard-nav--flush">
- <button
+ <Button variant="unstyled"
type="button"
className="btn-wizard-next"
onClick={() => onComplete(true)}
>
{t('common.actions.continue', 'Continue')}
- </button>
+ </Button>
</div>
</div>
);
@@ -163,14 +163,14 @@ const SetupStepSecurity = ({ onComplete }) => {
<Button variant="ghost" onClick={() => onComplete(false)} disabled={busy}>
{t('app.setupStepSecurity.skipForNow', 'Skip for now')}
</Button>
- <button
+ <Button variant="unstyled"
type="button"
className="btn-wizard-next"
onClick={handleEnable}
disabled={busy}
>
{busy ? 'Starting...' : 'Enable two-factor'}
- </button>
+ </Button>
</div>
</div>
);
@@ -233,14 +233,14 @@ const SetupStepSecurity = ({ onComplete }) => {
<Button variant="ghost" onClick={() => onComplete(false)} disabled={busy}>
{t('app.setupStepSecurity.skipForNow', 'Skip for now')}
</Button>
- <button
+ <Button variant="unstyled"
type="button"
className="btn-wizard-next"
onClick={handleConfirm}
disabled={busy || code.length !== CODE_LENGTH}
>
{busy ? 'Verifying...' : 'Verify and enable'}
- </button>
+ </Button>
</div>
</div>
);
@@ -280,13 +280,13 @@ const SetupStepSecurity = ({ onComplete }) => {
</div>
<div className="wizard-nav wizard-nav--flush">
- <button
+ <Button variant="unstyled"
type="button"
className="btn-wizard-next"
onClick={() => onComplete(true)}
>
{savedCodes ? 'Continue' : 'I have saved these'}
- </button>
+ </Button>
</div>
</div>
);
diff --git a/frontend/src/components/setup/SetupStepSummary.jsx b/frontend/src/components/setup/SetupStepSummary.jsx
index e4556bb2..0f19ff5f 100644
--- a/frontend/src/components/setup/SetupStepSummary.jsx
+++ b/frontend/src/components/setup/SetupStepSummary.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
-import { useResourceTier } from '../../contexts/ResourceTierContext';
+import { useResourceTier } from '../../contexts/useResourceTier.js';
import { Sparkles, Check, Loader, AlertTriangle } from 'lucide-react';
import { Badge } from '@/components/ui/badge';
import api from '../../services/api';
@@ -10,6 +10,7 @@ import {
presetForUseCases,
visibleCountForPreset,
} from '../sidebarItems';
+import { Button as SharedButton } from '@/components/ui/button';
const USE_CASE_LABELS = {
wordpress: 'WordPress Sites',
@@ -227,7 +228,7 @@ const SetupStepSummary = ({ accountInfo, useCases, twoFactorEnabled, onFinish })
].map((level) => {
const exts = postures[level.key] || [];
return (
- <button
+ <SharedButton variant="unstyled"
type="button"
key={level.key}
className={`summary-preset-card${securityPosture === level.key ? ' active' : ''}`}
@@ -248,7 +249,7 @@ const SetupStepSummary = ({ accountInfo, useCases, twoFactorEnabled, onFinish })
<> {t('app.setupStepSummary.postureNotYetAvailable', '— not yet available from the extension registry; pick it later from the Marketplace.')}</>
)}
</span>
- </button>
+ </SharedButton>
);
})}
</div>
@@ -263,14 +264,14 @@ const SetupStepSummary = ({ accountInfo, useCases, twoFactorEnabled, onFinish })
<span className="summary-value-note">
{visibleCountForPreset(sidebarPreset)} of {SIDEBAR_ITEMS.length} items
</span>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="summary-change-btn"
onClick={() => setPresetOpen((open) => !open)}
aria-expanded={presetOpen}
>
{presetOpen ? 'Done' : 'Change'}
- </button>
+ </SharedButton>
</span>
</div>
@@ -281,7 +282,7 @@ const SetupStepSummary = ({ accountInfo, useCases, twoFactorEnabled, onFinish })
</p>
<div className="summary-preset-list">
{Object.entries(SIDEBAR_PRESETS).map(([key, profile]) => (
- <button
+ <SharedButton variant="unstyled"
type="button"
key={key}
className={`summary-preset-card${sidebarPreset === key ? ' active' : ''}`}
@@ -297,7 +298,7 @@ const SetupStepSummary = ({ accountInfo, useCases, twoFactorEnabled, onFinish })
<span className="summary-preset-card__desc">
{profile.description}
</span>
- </button>
+ </SharedButton>
))}
</div>
</div>
@@ -355,14 +356,14 @@ const SetupStepSummary = ({ accountInfo, useCases, twoFactorEnabled, onFinish })
</div>
<div className="wizard-nav wizard-nav--flush">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="btn-wizard-next"
onClick={handleFinish}
disabled={installing}
>
{installing ? 'Setting up...' : 'Go to Dashboard'}
- </button>
+ </SharedButton>
</div>
</div>
);
diff --git a/frontend/src/components/shared/EnvironmentVariablesPanel.jsx b/frontend/src/components/shared/EnvironmentVariablesPanel.jsx
index 112bac53..8179600d 100644
--- a/frontend/src/components/shared/EnvironmentVariablesPanel.jsx
+++ b/frontend/src/components/shared/EnvironmentVariablesPanel.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { useTranslation } from 'react-i18next';
/**
@@ -108,7 +108,7 @@ const EnvironmentVariablesPanel = ({ resourceType, resourceId }) => {
setLocalKeys(keys);
setHierarchical(isHierarchical);
setLoading(false);
- }, [resourceType, resourceId, toast]);
+ }, [resourceType, resourceId, toast, t]);
useEffect(() => { load(); }, [load]);
diff --git a/frontend/src/components/shared/SharedVariableGroups.jsx b/frontend/src/components/shared/SharedVariableGroups.jsx
index f094fdc5..caaafb13 100644
--- a/frontend/src/components/shared/SharedVariableGroups.jsx
+++ b/frontend/src/components/shared/SharedVariableGroups.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback, useMemo } from 'react';
import { ArrowLeft, Boxes, Plus, Trash2 } from 'lucide-react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
@@ -80,7 +80,7 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })
} finally {
setLoading(false);
}
- }, [scopeType, scopeId, toast]);
+ }, [scopeType, scopeId, toast, t]);
const loadDetail = useCallback(async (groupId) => {
if (!groupId) { setDetail(null); return; }
@@ -90,7 +90,7 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })
} catch {
toast.error(t('app.sharedVariableGroups.failedToLoadGroup', 'Failed to load group'));
}
- }, [toast]);
+ }, [t, toast]);
useEffect(() => { loadGroups(); }, [loadGroups]);
useEffect(() => { loadDetail(selectedId); }, [selectedId, loadDetail]);
@@ -487,7 +487,7 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })
<span className="shared-groups__attachment-label">
{a.resource_type}:{a.resource_id}
</span>
- <button
+ <Button variant="unstyled"
type="button"
className="shared-tag__remove"
onClick={() => handleDetach(a)}
@@ -495,7 +495,7 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })
aria-label={t('app.sharedVariableGroups.detachGroup', 'Detach group')}
>
&times;
- </button>
+ </Button>
</li>
))}
</ul>
diff --git a/frontend/src/components/shared/TagsPanel.jsx b/frontend/src/components/shared/TagsPanel.jsx
index 6ae55be1..f0a21941 100644
--- a/frontend/src/components/shared/TagsPanel.jsx
+++ b/frontend/src/components/shared/TagsPanel.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from 'react';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { useTranslation } from 'react-i18next';
@@ -73,7 +73,7 @@ const TagsPanel = ({ resourceType, resourceId, readOnly = false }) => {
<span key={t.id} className="shared-tag">
<span className="shared-tag__label">{t.tag}</span>
{!readOnly && (
- <button
+ <Button variant="unstyled"
type="button"
className="shared-tag__remove"
onClick={() => handleRemove(t.tag)}
@@ -81,7 +81,7 @@ const TagsPanel = ({ resourceType, resourceId, readOnly = false }) => {
title={t('app.tagsPanel.removeTag2', 'Remove tag')}
>
&times;
- </button>
+ </Button>
)}
</span>
))
diff --git a/frontend/src/components/ui/alert-dialog.jsx b/frontend/src/components/ui/alert-dialog.jsx
index 38fedf7f..65871b3f 100644
--- a/frontend/src/components/ui/alert-dialog.jsx
+++ b/frontend/src/components/ui/alert-dialog.jsx
@@ -1,7 +1,7 @@
import * as React from 'react';
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
import { cn } from '@/lib/utils';
-import { buttonVariants } from '@/components/ui/button';
+import { buttonVariants } from './buttonVariants';
const AlertDialog = AlertDialogPrimitive.Root;
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
diff --git a/frontend/src/components/ui/badge.jsx b/frontend/src/components/ui/badge.jsx
index 7d4fdbb9..6bd9b1b6 100644
--- a/frontend/src/components/ui/badge.jsx
+++ b/frontend/src/components/ui/badge.jsx
@@ -1,4 +1,3 @@
-import * as React from 'react';
import { cn } from '@/lib/utils';
// Styling lives in styles/components/_badges.scss via the
diff --git a/frontend/src/components/ui/button.jsx b/frontend/src/components/ui/button.jsx
index d2b5ea44..0d8e0488 100644
--- a/frontend/src/components/ui/button.jsx
+++ b/frontend/src/components/ui/button.jsx
@@ -1,36 +1,6 @@
import * as React from 'react';
import { Slot } from '@radix-ui/react-slot';
-import { cn } from '@/lib/utils';
-
-// Map shadcn-style `variant` prop to our SCSS .btn-* classes.
-// SCSS owns all geometry, color and hover state — see styles/components/_buttons.scss
-const VARIANT_CLASS = {
- default: 'btn-primary',
- primary: 'btn-primary',
- destructive: 'btn-danger',
- danger: 'btn-danger',
- outline: 'btn-secondary',
- secondary: 'btn-soft',
- ghost: 'btn-ghost',
- link: 'btn-link',
-};
-
-const SIZE_CLASS = {
- default: '',
- md: '',
- sm: 'btn-sm',
- lg: 'btn-lg',
- icon: 'btn-icon',
-};
-
-function buttonVariants({ variant = 'default', size = 'default', className } = {}) {
- return cn(
- 'btn',
- VARIANT_CLASS[variant] ?? VARIANT_CLASS.default,
- SIZE_CLASS[size] ?? '',
- className,
- );
-}
+import { buttonVariants } from './buttonVariants';
// forwardRef is load-bearing, not ceremony: every Radix trigger used as
// `<PopoverTrigger asChild><Button/></PopoverTrigger>` hands the button a ref
@@ -52,5 +22,4 @@ const Button = React.forwardRef(({ className, variant, size, asChild = false, ..
});
Button.displayName = 'Button';
-export { Button, buttonVariants };
-
+export { Button };
diff --git a/frontend/src/components/ui/buttonVariants.js b/frontend/src/components/ui/buttonVariants.js
new file mode 100644
index 00000000..2f35c1bc
--- /dev/null
+++ b/frontend/src/components/ui/buttonVariants.js
@@ -0,0 +1,35 @@
+import { cn } from '../../lib/utils.js';
+
+// Map shadcn-style `variant` prop to our SCSS .btn-* classes.
+// SCSS owns all geometry, color and hover state — see styles/components/_buttons.scss
+const VARIANT_CLASS = {
+ default: 'btn-primary',
+ primary: 'btn-primary',
+ destructive: 'btn-danger',
+ danger: 'btn-danger',
+ outline: 'btn-secondary',
+ secondary: 'btn-soft',
+ ghost: 'btn-ghost',
+ link: 'btn-link',
+};
+
+const SIZE_CLASS = {
+ default: '',
+ md: '',
+ sm: 'btn-sm',
+ lg: 'btn-lg',
+ icon: 'btn-icon',
+};
+
+export function buttonVariants({ variant = 'default', size = 'default', className } = {}) {
+ // Custom controls (table headers, palette items, shell actions) already have
+ // component-owned SCSS. Reuse the ref/Slot/DOM contract without adding the
+ // geometry and colors of a standalone .btn.
+ if (variant === 'unstyled') return cn(className);
+ return cn(
+ 'btn',
+ VARIANT_CLASS[variant] ?? VARIANT_CLASS.default,
+ SIZE_CLASS[size] ?? '',
+ className,
+ );
+}
diff --git a/frontend/src/components/ui/card.jsx b/frontend/src/components/ui/card.jsx
index 06db6c5e..941cb8da 100644
--- a/frontend/src/components/ui/card.jsx
+++ b/frontend/src/components/ui/card.jsx
@@ -1,12 +1,14 @@
-import * as React from 'react';
import { cn } from '@/lib/utils';
-function Card({ className, ...props }) {
- return <div data-slot="card" className={cn('ui-card', className)} {...props} />;
+// The legacy skin keeps existing .card layouts intact while callers migrate
+// to these shared components. Both skins are owned by the SCSS design system.
+function Card({ className, variant, ...props }) {
+ return <div data-slot="card" className={cn(variant === 'legacy' ? 'card' : 'ui-card', className)} {...props} />;
}
-function CardHeader({ className, ...props }) {
- return <div data-slot="card-header" className={cn('ui-card-header', className)} {...props} />;
+function CardHeader({ className, variant, ...props }) {
+ const base = variant === 'legacy-row' ? 'card-header-row' : variant === 'legacy' ? 'card-header' : 'ui-card-header';
+ return <div data-slot="card-header" className={cn(base, className)} {...props} />;
}
function CardTitle({ className, ...props }) {
@@ -17,12 +19,12 @@ function CardDescription({ className, ...props }) {
return <div data-slot="card-description" className={cn('ui-card-description', className)} {...props} />;
}
-function CardContent({ className, ...props }) {
- return <div data-slot="card-content" className={cn('ui-card-content', className)} {...props} />;
+function CardContent({ className, variant, ...props }) {
+ return <div data-slot="card-content" className={cn(variant === 'legacy' ? 'card-body' : 'ui-card-content', className)} {...props} />;
}
-function CardFooter({ className, ...props }) {
- return <div data-slot="card-footer" className={cn('ui-card-footer', className)} {...props} />;
+function CardFooter({ className, variant, ...props }) {
+ return <div data-slot="card-footer" className={cn(variant === 'legacy' ? 'card-actions' : 'ui-card-footer', className)} {...props} />;
}
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
diff --git a/frontend/src/components/ui/input.jsx b/frontend/src/components/ui/input.jsx
index b7d8fd3e..ecd4dddc 100644
--- a/frontend/src/components/ui/input.jsx
+++ b/frontend/src/components/ui/input.jsx
@@ -1,4 +1,3 @@
-import * as React from 'react';
import { cn } from '@/lib/utils';
function Input({ className, type, ...props }) {
diff --git a/frontend/src/components/ui/label.jsx b/frontend/src/components/ui/label.jsx
index 5b9bca96..73f70f09 100644
--- a/frontend/src/components/ui/label.jsx
+++ b/frontend/src/components/ui/label.jsx
@@ -1,4 +1,3 @@
-import * as React from 'react';
import * as LabelPrimitive from '@radix-ui/react-label';
import { cn } from '@/lib/utils';
diff --git a/frontend/src/components/ui/tabs.jsx b/frontend/src/components/ui/tabs.jsx
index fd945ec9..89b3c6d9 100644
--- a/frontend/src/components/ui/tabs.jsx
+++ b/frontend/src/components/ui/tabs.jsx
@@ -5,6 +5,7 @@ import { Popover, PopoverTrigger, PopoverContent } from './popover';
import { cn } from '@/lib/utils';
import { useOverflowItems } from '@/hooks/useOverflowItems';
import { t } from '../../i18n/t';
+import { Button as SharedButton } from '@/components/ui/button';
const Tabs = TabsPrimitive.Root;
@@ -75,14 +76,14 @@ const TabsList = React.forwardRef(({ className, children, ...props }, ref) => {
{hiddenIndices.length > 0 && (
<Popover open={popoverOpen} onOpenChange={setPopoverOpen}>
<PopoverTrigger asChild>
- <button
+ <SharedButton variant="unstyled"
ref={moreBtnRef}
type="button"
className="tab tabs-overflow-trigger"
aria-label={t('app.tabs.moreTabs', 'More tabs')}
>
<MoreHorizontal size={16} />
- </button>
+ </SharedButton>
</PopoverTrigger>
<PopoverContent
align="end"
diff --git a/frontend/src/components/ui/textarea.jsx b/frontend/src/components/ui/textarea.jsx
index 6f9d4a19..92b74b03 100644
--- a/frontend/src/components/ui/textarea.jsx
+++ b/frontend/src/components/ui/textarea.jsx
@@ -1,4 +1,3 @@
-import * as React from 'react';
import { cn } from '@/lib/utils';
function Textarea({ className, ...props }) {
diff --git a/frontend/src/components/workspaces/WorkspaceApplicationsTab.jsx b/frontend/src/components/workspaces/WorkspaceApplicationsTab.jsx
new file mode 100644
index 00000000..0e4fcd64
--- /dev/null
+++ b/frontend/src/components/workspaces/WorkspaceApplicationsTab.jsx
@@ -0,0 +1,186 @@
+import { useNavigate } from 'react-router-dom';
+import { Box, Globe, Plus } from 'lucide-react';
+import { ServiceTile, Pill, DataTable, DataTableFooter, serviceStatusKind } from '@/components/ds';
+import {
+ useTableChrome, GridViewPicker, GridChips, GridFilterButton,
+ GridToolsMenu, GridFilterDrawer,
+} from '@/components/ds/grid';
+import { useTableSort } from '@/hooks/useTableSort';
+import { useColumnVisibility } from '@/hooks/useColumnVisibility';
+import { Button } from '@/components/ui/button';
+import EmptyState from '../EmptyState';
+import { useTranslation } from 'react-i18next';
+
+// What the Status cell shows when the row carries none. A real word, not '':
+// `ruleIsArmed` drops any rule whose value is empty.
+const UNKNOWN = 'unknown';
+
+const NO_RULES = { match: 'all', rules: [] };
+const BY_NAME = [{ key: 'name', direction: 'asc' }];
+
+const CONFIG = {
+ services: { noun: 'service', icon: Box, ruleId: 'wsv1', allView: 'All services' },
+ sites: { noun: 'site', icon: Globe, ruleId: 'wsi1', allView: 'All sites' },
+};
+const BUILTIN_VIEWS = Object.fromEntries(Object.entries(CONFIG).map(([kind, config]) => [kind, [
+ { name: config.allView, state: { sorts: BY_NAME, hiddenKeys: [], columnFilters: NO_RULES } },
+ {
+ name: 'Not running',
+ state: {
+ sorts: BY_NAME, hiddenKeys: [],
+ columnFilters: {
+ match: 'all',
+ rules: [{ id: config.ruleId, field: 'status', op: 'none', value: ['running'] }],
+ },
+ },
+ },
+]]));
+
+const WorkspaceApplicationsTab = ({ kind, wsId, rows, appsOut, onMoveApp, onShare }) => {
+ const { t } = useTranslation();
+ const config = CONFIG[kind];
+ const labels = kind === 'sites' ? {
+ header: t('app.workspaceSitesTab.site', 'Site'),
+ empty: t('app.workspaceSitesTab.noSitesInThisWorkspaceYet', 'No sites in this workspace yet'),
+ moveBelow: t('app.workspaceSitesTab.moveOneInBelow', 'Move one in below.'),
+ move: t('app.workspaceSitesTab.moveASiteIntoThisWorkspace', 'Move a site into this workspace'),
+ } : {
+ header: t('common.labels.service', 'Service'),
+ empty: t('app.workspaceServicesTab.noServicesInThisWorkspaceYet', 'No services in this workspace yet'),
+ moveBelow: t('app.workspaceServicesTab.moveOneInBelow', 'Move one in below.'),
+ move: t('app.workspaceServicesTab.moveAnApplicationIntoThisWorkspace', 'Move an application into this workspace'),
+ };
+ const navigate = useNavigate();
+ const { sorts, setSorts } = useTableSort({ storageKey: `serverkit-table-ws-${kind}-sort` });
+ const { hiddenKeys, setHiddenKeys } = useColumnVisibility({ storageKey: `serverkit-table-ws-${kind}-cols` });
+
+ // DataTable columns. Cell markup and classNames are unchanged, so the
+ // shared .sk-cell-name / .sk-cell-sub rules keep applying.
+ const columns = [
+ {
+ key: 'name',
+ header: labels.header,
+ sortable: true,
+ hideable: false,
+ type: 'text',
+ value: (a) => a.name || '',
+ sortValue: (a) => a.name || '',
+ render: (a) => (
+ <div className="sk-cell-name">
+ <ServiceTile name={a.name} size={30} />
+ <div>
+ <div>{a.name}</div>
+ <div className="sk-cell-sub">{a.app_type}{a.domain ? ` · ${a.domain}` : ''}</div>
+ </div>
+ </div>
+ ),
+ },
+ {
+ key: 'status',
+ headerKey: 'common.labels.status', header: 'Status',
+ sortable: true,
+ // Declared, not inferred: a workspace holding two services of two
+ // statuses fails the enum cardinality test and would fall back to
+ // text, turning the pick-list into a typed fragment and the view
+ // above into a no-op. No `enumOrder` — the options come from the
+ // data, which is the only source that agrees with itself here.
+ type: 'enum',
+ value: (a) => a.status || UNKNOWN,
+ sortValue: (a) => a.status || UNKNOWN,
+ render: (a) => <Pill kind={serviceStatusKind(a.status)}>{a.status || UNKNOWN}</Pill>,
+ },
+ {
+ key: 'actions',
+ header: '',
+ width: 220,
+ sortable: false,
+ hideable: false,
+ render: (a) => (
+ <div className="ws-detail__rowactions" onClick={e => e.stopPropagation()}>
+ <Button size="sm" variant="outline" onClick={() => onShare(a)}>{t('app.workspaceServicesTab.share', 'Share')}</Button>
+ <Button size="sm" variant="destructive" onClick={() => onMoveApp(a.id, null)}>{t('common.actions.remove', 'Remove')}</Button>
+ </div>
+ ),
+ },
+ ];
+
+ // One ROUTE renders four of these tabs, so each carries its own view
+ // namespace and its own `urlScope` — without the scope they would all write
+ // `?view=`/`?sort=` and a link saved on Services would reopen on Sites.
+ const chrome = useTableChrome({
+ columns,
+ rows,
+ viewPageKey: `workspace-${kind}`,
+ builtinViews: BUILTIN_VIEWS[kind],
+ noun: kind,
+ sorts,
+ setSorts,
+ hiddenKeys,
+ setHiddenKeys,
+ urlScope: kind,
+ });
+
+ return (
+ <>
+ {/* Inline chrome, not hoisted: this is a tab inside a detail page
+ that already owns the top bar, so hoisting would hijack it. */}
+ <GridViewPicker
+ views={chrome.views}
+ label={kind}
+ onCreate={chrome.createView}
+ actions={(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...chrome.toolsProps} />
+ </>
+ )}
+ />
+
+ <GridChips {...chrome.chipProps} />
+
+ <DataTable
+ columns={chrome.columns}
+ data={rows}
+ keyField="id"
+ sorts={sorts}
+ onSortsChange={setSorts}
+ {...chrome.tableProps}
+ onRowClick={(a) => navigate(`/services/${a.id}`)}
+ className="ws-detail__tablecard"
+ emptyState={(
+ <EmptyState icon={config.icon} title={labels.empty} description={labels.moveBelow} />
+ )}
+ footer={(
+ <DataTableFooter
+ shown={chrome.shownCount}
+ total={rows.length}
+ noun={config.noun}
+ />
+ )}
+ />
+
+ <GridFilterDrawer {...chrome.drawerProps} />
+
+ {appsOut.length > 0 && (
+ <>
+ <div className="ws-pick-label">{labels.move}</div>
+ <div className="ws-pick">
+ {appsOut.map(a => (
+ <div key={a.id} className="ws-pick__item" onClick={() => onMoveApp(a.id, wsId)}>
+ <ServiceTile name={a.name} size={28} className="ws-pick__tile" />
+ <span className="ws-pick__name">{a.name}</span>
+ <span className="sk-tag">{a.app_type}</span>
+ <Plus size={16} className="ws-pick__plus" />
+ </div>
+ ))}
+ </div>
+ </>
+ )}
+ </>
+ );
+};
+
+export default WorkspaceApplicationsTab;
diff --git a/frontend/src/components/workspaces/WorkspaceMembersTab.jsx b/frontend/src/components/workspaces/WorkspaceMembersTab.jsx
index 51f6b360..dcb4188e 100644
--- a/frontend/src/components/workspaces/WorkspaceMembersTab.jsx
+++ b/frontend/src/components/workspaces/WorkspaceMembersTab.jsx
@@ -32,7 +32,7 @@ const WORKSPACE_MEMBER_VIEWS = [
},
];
-const WorkspaceMembersTab = ({ wsId, members, allUsers, onAddMember, onRemoveMember }) => {
+const WorkspaceMembersTab = ({ members, allUsers, onAddMember, onRemoveMember }) => {
const { t } = useTranslation();
const { sorts, setSorts } = useTableSort({ storageKey: 'serverkit-table-ws-members-sort' });
const {
diff --git a/frontend/src/components/workspaces/WorkspaceServicesTab.jsx b/frontend/src/components/workspaces/WorkspaceServicesTab.jsx
index c7ad3d8d..4b442d7c 100644
--- a/frontend/src/components/workspaces/WorkspaceServicesTab.jsx
+++ b/frontend/src/components/workspaces/WorkspaceServicesTab.jsx
@@ -1,180 +1,5 @@
-import { useNavigate } from 'react-router-dom';
-import { Box, Plus } from 'lucide-react';
-import { ServiceTile, Pill, DataTable, DataTableFooter, serviceStatusKind } from '@/components/ds';
-import {
- useTableChrome, GridViewPicker, GridChips, GridFilterButton,
- GridToolsMenu, GridFilterDrawer,
-} from '@/components/ds/grid';
-import { useTableSort } from '@/hooks/useTableSort';
-import { useColumnVisibility } from '@/hooks/useColumnVisibility';
-import { Button } from '@/components/ui/button';
-import EmptyState from '../EmptyState';
-import { useTranslation } from 'react-i18next';
+import WorkspaceApplicationsTab from './WorkspaceApplicationsTab';
-// What the Status cell shows when the row carries none. A real word, not '':
-// `ruleIsArmed` drops any rule whose value is empty.
-const UNKNOWN = 'unknown';
-
-const NO_RULES = { match: 'all', rules: [] };
-const BY_NAME = [{ key: 'name', direction: 'asc' }];
-
-// Built-in saved views. Membership is already the tab's job, so what is left
-// worth slicing is whether the container is actually up.
-const WORKSPACE_SERVICE_VIEWS = [
- {
- name: 'All services',
- state: { sorts: BY_NAME, hiddenKeys: [], columnFilters: NO_RULES },
- },
- {
- // Stated as "not running" rather than as a list of bad statuses, so
- // 'error', 'deploying' and anything new all land here.
- name: 'Not running',
- state: {
- sorts: BY_NAME,
- hiddenKeys: [],
- columnFilters: {
- match: 'all',
- rules: [{ id: 'wsv1', field: 'status', op: 'none', value: ['running'] }],
- },
- },
- },
-];
-
-const WorkspaceServicesTab = ({ wsId, services, appsOut, onMoveApp, onShare }) => {
- const { t } = useTranslation();
- const navigate = useNavigate();
- const { sorts, setSorts } = useTableSort({ storageKey: 'serverkit-table-ws-services-sort' });
- const {
- hiddenKeys, setHiddenKeys,
- } = useColumnVisibility({ storageKey: 'serverkit-table-ws-services-cols' });
-
- // DataTable columns. Cell markup and classNames are unchanged, so the
- // shared .sk-cell-name / .sk-cell-sub rules keep applying.
- const columns = [
- {
- key: 'name',
- headerKey: 'common.labels.service', header: 'Service',
- sortable: true,
- hideable: false,
- type: 'text',
- value: (a) => a.name || '',
- sortValue: (a) => a.name || '',
- render: (a) => (
- <div className="sk-cell-name">
- <ServiceTile name={a.name} size={30} />
- <div>
- <div>{a.name}</div>
- <div className="sk-cell-sub">{a.app_type}{a.domain ? ` · ${a.domain}` : ''}</div>
- </div>
- </div>
- ),
- },
- {
- key: 'status',
- headerKey: 'common.labels.status', header: 'Status',
- sortable: true,
- // Declared, not inferred: a workspace holding two services of two
- // statuses fails the enum cardinality test and would fall back to
- // text, turning the pick-list into a typed fragment and the view
- // above into a no-op. No `enumOrder` — the options come from the
- // data, which is the only source that agrees with itself here.
- type: 'enum',
- value: (a) => a.status || UNKNOWN,
- sortValue: (a) => a.status || UNKNOWN,
- render: (a) => <Pill kind={serviceStatusKind(a.status)}>{a.status || UNKNOWN}</Pill>,
- },
- {
- key: 'actions',
- header: '',
- width: 220,
- sortable: false,
- hideable: false,
- render: (a) => (
- <div className="ws-detail__rowactions" onClick={e => e.stopPropagation()}>
- <Button size="sm" variant="outline" onClick={() => onShare(a)}>{t('app.workspaceServicesTab.share', 'Share')}</Button>
- <Button size="sm" variant="destructive" onClick={() => onMoveApp(a.id, null)}>{t('common.actions.remove', 'Remove')}</Button>
- </div>
- ),
- },
- ];
-
- // One ROUTE renders four of these tabs, so each carries its own view
- // namespace and its own `urlScope` — without the scope they would all write
- // `?view=`/`?sort=` and a link saved on Services would reopen on Sites.
- const chrome = useTableChrome({
- columns,
- rows: services,
- viewPageKey: 'workspace-services',
- builtinViews: WORKSPACE_SERVICE_VIEWS,
- noun: 'services',
- sorts,
- setSorts,
- hiddenKeys,
- setHiddenKeys,
- urlScope: 'services',
- });
-
- return (
- <>
- {/* Inline chrome, not hoisted: this is a tab inside a detail page
- that already owns the top bar, so hoisting would hijack it. */}
- <GridViewPicker
- views={chrome.views}
- label="services"
- onCreate={chrome.createView}
- actions={(
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} />
- </>
- )}
- />
-
- <GridChips {...chrome.chipProps} />
-
- <DataTable
- columns={chrome.columns}
- data={services}
- keyField="id"
- sorts={sorts}
- onSortsChange={setSorts}
- {...chrome.tableProps}
- onRowClick={(a) => navigate(`/services/${a.id}`)}
- className="ws-detail__tablecard"
- emptyState={(
- <EmptyState icon={Box} title={t('app.workspaceServicesTab.noServicesInThisWorkspaceYet', 'No services in this workspace yet')} description={t('app.workspaceServicesTab.moveOneInBelow', 'Move one in below.')} />
- )}
- footer={(
- <DataTableFooter
- shown={chrome.shownCount}
- total={services.length}
- noun="service"
- />
- )}
- />
-
- <GridFilterDrawer {...chrome.drawerProps} />
-
- {appsOut.length > 0 && (
- <>
- <div className="ws-pick-label">{t('app.workspaceServicesTab.moveAnApplicationIntoThisWorkspace', 'Move an application into this workspace')}</div>
- <div className="ws-pick">
- {appsOut.map(a => (
- <div key={a.id} className="ws-pick__item" onClick={() => onMoveApp(a.id, wsId)}>
- <ServiceTile name={a.name} size={28} className="ws-pick__tile" />
- <span className="ws-pick__name">{a.name}</span>
- <span className="sk-tag">{a.app_type}</span>
- <Plus size={16} className="ws-pick__plus" />
- </div>
- ))}
- </div>
- </>
- )}
- </>
- );
-};
-
-export default WorkspaceServicesTab;
+export default function WorkspaceServicesTab({ services, ...props }) {
+ return <WorkspaceApplicationsTab {...props} kind="services" rows={services} />;
+}
diff --git a/frontend/src/components/workspaces/WorkspaceSettingsTab.jsx b/frontend/src/components/workspaces/WorkspaceSettingsTab.jsx
index d60c0ce3..0d14099f 100644
--- a/frontend/src/components/workspaces/WorkspaceSettingsTab.jsx
+++ b/frontend/src/components/workspaces/WorkspaceSettingsTab.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { Settings, PanelLeft, Check, Archive, ArchiveRestore, Trash2 } from 'lucide-react';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
@@ -9,6 +9,7 @@ import { Checkbox } from '@/components/ui/checkbox';
import { SIDEBAR_ITEMS } from '../sidebarItems';
import api from '../../services/api';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard } from '@/components/ui/card';
const SETTINGS_GROUPS = [
{
@@ -38,7 +39,7 @@ const GeneralSection = ({ form, setForm }) => {
return (
<div className="ws-settings__section">
<h3 className="ws-settings__section-title">{t('app.workspaceSettingsTab.general', 'General')}</h3>
- <div className="card settings-section">
+ <SharedCard variant="legacy" className="card settings-section">
<div className="form-group">
<label>{t('common.labels.name', 'Name')}</label>
<Input
@@ -84,7 +85,7 @@ const GeneralSection = ({ form, setForm }) => {
/>
<span className="form-hint">{t('app.workspaceSettingsTab.recolorsThePanelForAnyoneViewing', 'Recolors the panel for anyone viewing this workspace.')}</span>
</div>
- </div>
+ </SharedCard>
</div>
);
};
@@ -94,7 +95,7 @@ const ManagementSection = ({ ws, isCurrent, onSetActive, onArchive, onRestore, o
return (
<div className="ws-settings__section">
<h3 className="ws-settings__section-title">{t('app.workspaceSettingsTab.workspaceManagement', 'Workspace management')}</h3>
- <div className="card settings-section ws-settings__management">
+ <SharedCard variant="legacy" className="card settings-section ws-settings__management">
<p className="form-hint">{t('app.workspaceSettingsTab.theseActionsTakeEffectImmediatelyAnd', 'These actions take effect immediately and cannot be undone from this screen.')}</p>
<div className="ws-settings__actions-grid">
{!isCurrent && ws.status === 'active' && (
@@ -118,7 +119,7 @@ const ManagementSection = ({ ws, isCurrent, onSetActive, onArchive, onRestore, o
</Button>
)}
</div>
- </div>
+ </SharedCard>
</div>
);
};
@@ -129,7 +130,7 @@ const NavigationPermissionsSection = ({ form, setForm }) => {
return (
<div className="ws-settings__section">
<h3 className="ws-settings__section-title">{t('app.workspaceSettingsTab.navigationPermissions', 'Navigation Permissions')}</h3>
- <div className="card settings-section">
+ <SharedCard variant="legacy" className="card settings-section">
<p className="form-hint">{t('app.workspaceSettingsTab.limitWhichSidebarItemsEachWorkspace', 'Limit which sidebar items each workspace role can see. Empty = no restrictions.')}</p>
{roles.map((role) => (
<div key={role} className="ws-nav-role">
@@ -155,7 +156,7 @@ const NavigationPermissionsSection = ({ form, setForm }) => {
</div>
</div>
))}
- </div>
+ </SharedCard>
</div>
);
};
@@ -213,7 +214,7 @@ const WorkspaceSettingsTab = ({ wsId, ws, onUpdate, user, isCurrent, onSetActive
<div className="ws-settings__group" key={g.label}>
<div className="ws-settings__grouplabel">{g.label}</div>
{g.items.map((s) => (
- <button
+ <Button variant="unstyled"
type="button"
key={s.id}
className={`ws-settings__navitem ${section === s.id ? 'is-active' : ''}`}
@@ -221,7 +222,7 @@ const WorkspaceSettingsTab = ({ wsId, ws, onUpdate, user, isCurrent, onSetActive
>
<s.icon size={15} />
{s.label}
- </button>
+ </Button>
))}
</div>
))}
diff --git a/frontend/src/components/workspaces/WorkspaceSitesTab.jsx b/frontend/src/components/workspaces/WorkspaceSitesTab.jsx
index 1619070f..2e5fb573 100644
--- a/frontend/src/components/workspaces/WorkspaceSitesTab.jsx
+++ b/frontend/src/components/workspaces/WorkspaceSitesTab.jsx
@@ -1,180 +1,5 @@
-import { useNavigate } from 'react-router-dom';
-import { Globe, Plus } from 'lucide-react';
-import { ServiceTile, Pill, DataTable, DataTableFooter, serviceStatusKind } from '@/components/ds';
-import {
- useTableChrome, GridViewPicker, GridChips, GridFilterButton,
- GridToolsMenu, GridFilterDrawer,
-} from '@/components/ds/grid';
-import { useTableSort } from '@/hooks/useTableSort';
-import { useColumnVisibility } from '@/hooks/useColumnVisibility';
-import { Button } from '@/components/ui/button';
-import EmptyState from '../EmptyState';
-import { useTranslation } from 'react-i18next';
+import WorkspaceApplicationsTab from './WorkspaceApplicationsTab';
-// What the Status cell shows when the row carries none. A real word, not '':
-// `ruleIsArmed` drops any rule whose value is empty.
-const UNKNOWN = 'unknown';
-
-const NO_RULES = { match: 'all', rules: [] };
-const BY_NAME = [{ key: 'name', direction: 'asc' }];
-
-// Built-in saved views. Every row here is already a WordPress app, so the axis
-// left is whether the site is actually serving.
-const WORKSPACE_SITE_VIEWS = [
- {
- name: 'All sites',
- state: { sorts: BY_NAME, hiddenKeys: [], columnFilters: NO_RULES },
- },
- {
- // Stated as "not running" rather than as a list of bad statuses, so
- // 'error', 'deploying' and anything new all land here.
- name: 'Not running',
- state: {
- sorts: BY_NAME,
- hiddenKeys: [],
- columnFilters: {
- match: 'all',
- rules: [{ id: 'wsi1', field: 'status', op: 'none', value: ['running'] }],
- },
- },
- },
-];
-
-const WorkspaceSitesTab = ({ wsId, sites, appsOut, onMoveApp, onShare }) => {
- const { t } = useTranslation();
- const navigate = useNavigate();
- const { sorts, setSorts } = useTableSort({ storageKey: 'serverkit-table-ws-sites-sort' });
- const {
- hiddenKeys, setHiddenKeys,
- } = useColumnVisibility({ storageKey: 'serverkit-table-ws-sites-cols' });
-
- // DataTable columns. Cell markup and classNames are unchanged, so the
- // shared .sk-cell-name / .sk-cell-sub rules keep applying.
- const columns = [
- {
- key: 'name',
- headerKey: 'app.workspaceSitesTab.site', header: 'Site',
- sortable: true,
- hideable: false,
- type: 'text',
- value: (a) => a.name || '',
- sortValue: (a) => a.name || '',
- render: (a) => (
- <div className="sk-cell-name">
- <ServiceTile name={a.name} size={30} />
- <div>
- <div>{a.name}</div>
- <div className="sk-cell-sub">{a.app_type}{a.domain ? ` · ${a.domain}` : ''}</div>
- </div>
- </div>
- ),
- },
- {
- key: 'status',
- headerKey: 'common.labels.status', header: 'Status',
- sortable: true,
- // Declared, not inferred: a workspace holding two sites of two
- // statuses fails the enum cardinality test and would fall back to
- // text, turning the pick-list into a typed fragment and the view
- // above into a no-op. No `enumOrder` — the options come from the
- // data, which is the only source that agrees with itself here.
- type: 'enum',
- value: (a) => a.status || UNKNOWN,
- sortValue: (a) => a.status || UNKNOWN,
- render: (a) => <Pill kind={serviceStatusKind(a.status)}>{a.status || UNKNOWN}</Pill>,
- },
- {
- key: 'actions',
- header: '',
- width: 220,
- sortable: false,
- hideable: false,
- render: (a) => (
- <div className="ws-detail__rowactions" onClick={e => e.stopPropagation()}>
- <Button size="sm" variant="outline" onClick={() => onShare(a)}>{t('app.workspaceSitesTab.share', 'Share')}</Button>
- <Button size="sm" variant="destructive" onClick={() => onMoveApp(a.id, null)}>{t('common.actions.remove', 'Remove')}</Button>
- </div>
- ),
- },
- ];
-
- // One ROUTE renders four of these tabs, so each carries its own view
- // namespace and its own `urlScope` — without the scope they would all write
- // `?view=`/`?sort=` and a link saved on Sites would reopen on Services.
- const chrome = useTableChrome({
- columns,
- rows: sites,
- viewPageKey: 'workspace-sites',
- builtinViews: WORKSPACE_SITE_VIEWS,
- noun: 'sites',
- sorts,
- setSorts,
- hiddenKeys,
- setHiddenKeys,
- urlScope: 'sites',
- });
-
- return (
- <>
- {/* Inline chrome, not hoisted: this is a tab inside a detail page
- that already owns the top bar, so hoisting would hijack it. */}
- <GridViewPicker
- views={chrome.views}
- label="sites"
- onCreate={chrome.createView}
- actions={(
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} />
- </>
- )}
- />
-
- <GridChips {...chrome.chipProps} />
-
- <DataTable
- columns={chrome.columns}
- data={sites}
- keyField="id"
- sorts={sorts}
- onSortsChange={setSorts}
- {...chrome.tableProps}
- onRowClick={(a) => navigate(`/services/${a.id}`)}
- className="ws-detail__tablecard"
- emptyState={(
- <EmptyState icon={Globe} title={t('app.workspaceSitesTab.noSitesInThisWorkspaceYet', 'No sites in this workspace yet')} description={t('app.workspaceSitesTab.moveOneInBelow', 'Move one in below.')} />
- )}
- footer={(
- <DataTableFooter
- shown={chrome.shownCount}
- total={sites.length}
- noun="site"
- />
- )}
- />
-
- <GridFilterDrawer {...chrome.drawerProps} />
-
- {appsOut.length > 0 && (
- <>
- <div className="ws-pick-label">{t('app.workspaceSitesTab.moveASiteIntoThisWorkspace', 'Move a site into this workspace')}</div>
- <div className="ws-pick">
- {appsOut.map(a => (
- <div key={a.id} className="ws-pick__item" onClick={() => onMoveApp(a.id, wsId)}>
- <ServiceTile name={a.name} size={28} className="ws-pick__tile" />
- <span className="ws-pick__name">{a.name}</span>
- <span className="sk-tag">{a.app_type}</span>
- <Plus size={16} className="ws-pick__plus" />
- </div>
- ))}
- </div>
- </>
- )}
- </>
- );
-};
-
-export default WorkspaceSitesTab;
+export default function WorkspaceSitesTab({ sites, ...props }) {
+ return <WorkspaceApplicationsTab {...props} kind="sites" rows={sites} />;
+}
diff --git a/frontend/src/contexts/AIContext.jsx b/frontend/src/contexts/AIContext.jsx
index 4b6cddb7..22c5bc31 100644
--- a/frontend/src/contexts/AIContext.jsx
+++ b/frontend/src/contexts/AIContext.jsx
@@ -1,6 +1,4 @@
-import {
- createContext, useCallback, useContext, useEffect, useMemo, useReducer, useRef,
-} from 'react';
+import { useCallback, useEffect, useMemo, useReducer, useRef } from 'react';
import api from '../services/api';
import usePageContext from '../hooks/ai/usePageContext';
import {
@@ -13,7 +11,7 @@ import {
toAttachmentPayload,
} from '../lib/ai/attachments';
-const AIContext = createContext(null);
+import { AIContext } from './useServerkitAI.js';
const AI_CONFIG_CHANGED_EVENT = 'serverkit:ai-config-changed';
@@ -431,11 +429,3 @@ function matchRoute(pattern, route) {
if (pattern.endsWith('*')) return route.startsWith(pattern.slice(0, -1));
return route === pattern || route.startsWith(`${pattern}/`);
}
-
-export function useServerkitAI() {
- const ctx = useContext(AIContext);
- if (!ctx) throw new Error('useServerkitAI must be used within AIProvider');
- return ctx;
-}
-
-export { AIContext };
diff --git a/frontend/src/contexts/AuthContext.jsx b/frontend/src/contexts/AuthContext.jsx
index b3777b41..1d46508a 100644
--- a/frontend/src/contexts/AuthContext.jsx
+++ b/frontend/src/contexts/AuthContext.jsx
@@ -1,8 +1,8 @@
-import { createContext, useContext, useState, useEffect } from 'react';
+import { useCallback, useState, useEffect } from 'react';
import api from '../services/api';
import { presetForUseCases } from '../components/sidebarItems';
-const AuthContext = createContext(null);
+import { AuthContext } from './useAuth.js';
export function AuthProvider({ children }) {
const [user, setUser] = useState(null);
@@ -26,17 +26,23 @@ export function AuthProvider({ children }) {
checked: false
});
- useEffect(() => {
- checkSetupStatus();
- }, []);
-
- useEffect(() => {
- const handleAuthExpired = () => setUser(null);
- window.addEventListener('serverkit:auth-expired', handleAuthExpired);
- return () => window.removeEventListener('serverkit:auth-expired', handleAuthExpired);
+ const checkAuth = useCallback(async () => {
+ const token = localStorage.getItem('access_token');
+ if (token) {
+ try {
+ const data = await api.getCurrentUser();
+ setUser(data.user);
+ } catch (error) {
+ if (error.status !== 401) {
+ console.error('Auth check failed:', error);
+ }
+ api.clearTokens();
+ }
+ }
+ setLoading(false);
}, []);
- async function checkSetupStatus(retries = 3) {
+ const checkSetupStatus = useCallback(async function checkSetupStatus(retries = 3) {
try {
const status = await api.getSetupStatus();
setSetupStatus({
@@ -71,23 +77,18 @@ export function AuthProvider({ children }) {
}));
await checkAuth();
}
- }
+ }, [checkAuth]);
+
+ useEffect(() => {
+ checkSetupStatus();
+ }, [checkSetupStatus]);
+
+ useEffect(() => {
+ const handleAuthExpired = () => setUser(null);
+ window.addEventListener('serverkit:auth-expired', handleAuthExpired);
+ return () => window.removeEventListener('serverkit:auth-expired', handleAuthExpired);
+ }, []);
- async function checkAuth() {
- const token = localStorage.getItem('access_token');
- if (token) {
- try {
- const data = await api.getCurrentUser();
- setUser(data.user);
- } catch (error) {
- if (error.status !== 401) {
- console.error('Auth check failed:', error);
- }
- api.clearTokens();
- }
- }
- setLoading(false);
- }
async function refreshSetupStatus() {
try {
@@ -208,11 +209,3 @@ export function AuthProvider({ children }) {
</AuthContext.Provider>
);
}
-
-export function useAuth() {
- const context = useContext(AuthContext);
- if (!context) {
- throw new Error('useAuth must be used within an AuthProvider');
- }
- return context;
-}
diff --git a/frontend/src/contexts/ConfirmContext.jsx b/frontend/src/contexts/ConfirmContext.jsx
index 93ae1606..36e17ae6 100644
--- a/frontend/src/contexts/ConfirmContext.jsx
+++ b/frontend/src/contexts/ConfirmContext.jsx
@@ -1,4 +1,4 @@
-import { createContext, useContext, useCallback, useRef, useState } from 'react';
+import { useCallback, useRef, useState } from 'react';
import ConfirmDialog from '../components/ConfirmDialog';
// App-level confirm dialog. One <ConfirmDialog> is rendered here; pages call
@@ -6,7 +6,7 @@ import ConfirmDialog from '../components/ConfirmDialog';
// each rendering their own dialog. See useConfirm for the back-compat shim that
// lets un-migrated pages keep working.
-const ConfirmContext = createContext(null);
+import { ConfirmContext } from './useConfirmContext.js';
export function ConfirmProvider({ children }) {
const [state, setState] = useState({ isOpen: false });
@@ -46,9 +46,3 @@ export function ConfirmProvider({ children }) {
</ConfirmContext.Provider>
);
}
-
-export function useConfirmContext() {
- return useContext(ConfirmContext);
-}
-
-export default ConfirmContext;
diff --git a/frontend/src/contexts/LayoutContext.jsx b/frontend/src/contexts/LayoutContext.jsx
index 92047be9..b2ea849f 100644
--- a/frontend/src/contexts/LayoutContext.jsx
+++ b/frontend/src/contexts/LayoutContext.jsx
@@ -1,6 +1,6 @@
-import { createContext, useContext, useState, useEffect, useCallback } from 'react';
+import { useState, useEffect, useCallback } from 'react';
-const LayoutContext = createContext(null);
+import { LayoutContext } from './useLayout.js';
// Shell geometry options, kept in sync with the switcher in Sidebar and the
// [data-layout="..."] rules in styles/layout/_sidebar.scss. 'topbar' is reserved
@@ -31,13 +31,3 @@ export function LayoutProvider({ children }) {
</LayoutContext.Provider>
);
}
-
-export function useLayout() {
- const context = useContext(LayoutContext);
- if (!context) {
- throw new Error('useLayout must be used within a LayoutProvider');
- }
- return context;
-}
-
-export default LayoutContext;
diff --git a/frontend/src/contexts/LocaleContext.jsx b/frontend/src/contexts/LocaleContext.jsx
index 4a5e7ba6..be636bda 100644
--- a/frontend/src/contexts/LocaleContext.jsx
+++ b/frontend/src/contexts/LocaleContext.jsx
@@ -1,6 +1,4 @@
-import {
- createContext, useCallback, useContext, useEffect, useMemo, useRef, useState,
-} from 'react';
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { activateLocale } from '../i18n';
import { setFormatLocale } from '../utils/intl';
import {
@@ -8,7 +6,7 @@ import {
directionFor, languageInfo, matchSupported, navigatorLanguages, resolveLocale,
} from '../i18n/resolveLocale';
-const LocaleContext = createContext(null);
+import { LocaleContext } from './useLocale.js';
/**
* Owns the active locale (plan 79 §B1).
@@ -113,11 +111,7 @@ export function LocaleProvider({ children }) {
return <LocaleContext.Provider value={value}>{children}</LocaleContext.Provider>;
}
-export function useLocale() {
- const context = useContext(LocaleContext);
- if (!context) throw new Error('useLocale must be used within a LocaleProvider');
- return context;
-}
+
function readStored() {
try {
diff --git a/frontend/src/contexts/NotificationsContext.jsx b/frontend/src/contexts/NotificationsContext.jsx
index 98b71fe0..b3f130bd 100644
--- a/frontend/src/contexts/NotificationsContext.jsx
+++ b/frontend/src/contexts/NotificationsContext.jsx
@@ -1,7 +1,7 @@
-import { createContext, useContext, useState, useEffect, useCallback } from 'react';
+import { useState, useEffect, useCallback } from 'react';
import api from '../services/api';
import socketService from '../services/socket';
-import { useAuth } from './AuthContext';
+import { useAuth } from './useAuth.js';
import { getDismissedNotices, addDismissedNotice, noticeToItem } from '../utils/dismissedNotices';
// Global in-app notification state: the bell's unread badge + recent list, kept
@@ -11,14 +11,12 @@ import { getDismissedNotices, addDismissedNotice, noticeToItem } from '../utils/
// It also folds in live "system notices" (admin misconfiguration hints from
// /system/notices) so they surface in the notification center instead of stacking
// as banners at the top of the dashboard — only genuinely urgent ones get a banner.
-const NotificationsContext = createContext(null);
+import { NotificationsContext } from './useNotifications.js';
const RECENT_LIMIT = 12;
const MAX_BUFFERED = 30;
-export function useNotifications() {
- return useContext(NotificationsContext);
-}
+
export function NotificationsProvider({ children }) {
const { isAuthenticated, isAdmin } = useAuth();
@@ -104,5 +102,3 @@ export function NotificationsProvider({ children }) {
</NotificationsContext.Provider>
);
}
-
-export default NotificationsContext;
diff --git a/frontend/src/contexts/OperationsContext.jsx b/frontend/src/contexts/OperationsContext.jsx
index 13d95ab3..9804c71f 100644
--- a/frontend/src/contexts/OperationsContext.jsx
+++ b/frontend/src/contexts/OperationsContext.jsx
@@ -22,7 +22,7 @@ import {
reconcileOperationStatus,
} from '../services/operations';
import socketService from '../services/socket';
-import { useAuth } from './AuthContext';
+import { useAuth } from './useAuth.js';
const OperationsContext = createContext(null);
const REFRESH_MS = 6000;
diff --git a/frontend/src/contexts/ResourceTierContext.jsx b/frontend/src/contexts/ResourceTierContext.jsx
index 266a5954..eca5ec36 100644
--- a/frontend/src/contexts/ResourceTierContext.jsx
+++ b/frontend/src/contexts/ResourceTierContext.jsx
@@ -1,8 +1,8 @@
-import { createContext, useContext, useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import api from '../services/api';
-import { useAuth } from './AuthContext';
+import { useAuth } from './useAuth.js';
-const ResourceTierContext = createContext(null);
+import { ResourceTierContext } from './useResourceTier.js';
export function ResourceTierProvider({ children }) {
const { isAuthenticated, isAdmin } = useAuth();
@@ -76,11 +76,3 @@ export function ResourceTierProvider({ children }) {
</ResourceTierContext.Provider>
);
}
-
-export function useResourceTier() {
- const context = useContext(ResourceTierContext);
- if (!context) {
- throw new Error('useResourceTier must be used within a ResourceTierProvider');
- }
- return context;
-}
diff --git a/frontend/src/contexts/ShellDockContext.jsx b/frontend/src/contexts/ShellDockContext.jsx
index 16d53fe1..87fdf91a 100644
--- a/frontend/src/contexts/ShellDockContext.jsx
+++ b/frontend/src/contexts/ShellDockContext.jsx
@@ -1,9 +1,7 @@
-import {
- createContext, useCallback, useContext, useEffect, useMemo, useState,
-} from 'react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
import { useOperations } from './OperationsContext';
-import { useServerkitAI } from './AIContext';
+import { useServerkitAI } from './useServerkitAI.js';
import { useWalkthroughs } from './walkthroughContextValue';
// One console, four tabs (Operations · Alerts · Recipes · Assistant), exactly
@@ -13,7 +11,7 @@ import { useWalkthroughs } from './walkthroughContextValue';
// provider doesn't own their state: it derives the active tab and flips the
// underlying contexts in concert. Priority on conflicting opens: assistant >
// recipes > operations — closing the winner reveals the panel underneath.
-const ShellDockContext = createContext(null);
+import { ShellDockContext } from './useShellDock.js';
export function ShellDockProvider({ children }) {
const { collapsed, setCollapsed } = useOperations();
@@ -73,9 +71,3 @@ export function ShellDockProvider({ children }) {
return <ShellDockContext.Provider value={value}>{children}</ShellDockContext.Provider>;
}
-
-export function useShellDock() {
- const context = useContext(ShellDockContext);
- if (!context) throw new Error('useShellDock must be used within ShellDockProvider');
- return context;
-}
diff --git a/frontend/src/contexts/ThemeContext.jsx b/frontend/src/contexts/ThemeContext.jsx
index fd6a9433..03572f52 100644
--- a/frontend/src/contexts/ThemeContext.jsx
+++ b/frontend/src/contexts/ThemeContext.jsx
@@ -1,10 +1,10 @@
-import { createContext, useContext, useState, useEffect, useCallback, useMemo } from 'react';
+import { useState, useEffect, useCallback, useMemo } from 'react';
import { BUNDLED_THEMES, BUNDLED_THEME_MAP, DEFAULT_THEME_SLUG } from '../data/bundledThemes';
import { applySkin } from '../utils/applySkin';
import api from '../services/api';
-import { useWorkspace } from './WorkspaceContext';
+import { useWorkspace } from './useWorkspace.js';
-const ThemeContext = createContext(null);
+import { ThemeContext } from './useTheme.js';
const DEFAULT_ACCENT = '#6d7cff';
@@ -325,13 +325,3 @@ export function ThemeProvider({ children }) {
</ThemeContext.Provider>
);
}
-
-export function useTheme() {
- const context = useContext(ThemeContext);
- if (!context) {
- throw new Error('useTheme must be used within a ThemeProvider');
- }
- return context;
-}
-
-export default ThemeContext;
diff --git a/frontend/src/contexts/ToastContext.jsx b/frontend/src/contexts/ToastContext.jsx
index be780918..7562cf2f 100644
--- a/frontend/src/contexts/ToastContext.jsx
+++ b/frontend/src/contexts/ToastContext.jsx
@@ -1,13 +1,9 @@
-import { createContext, useContext, useCallback } from 'react';
+import { useCallback } from 'react';
import { toast as sonner } from 'sonner';
-const ToastContext = createContext(null);
+import { ToastContext } from './useToast.js';
+
-export function useToast() {
- const context = useContext(ToastContext);
- if (!context) throw new Error('useToast must be used within a ToastProvider');
- return context;
-}
// Callers pass either a numeric duration (`toast.info(msg, 4000)`) or a full sonner
// options object (`toast.info(msg, { duration: 4000 })`). Normalize both so an
@@ -30,5 +26,3 @@ export function ToastProvider({ children }) {
</ToastContext.Provider>
);
}
-
-export default ToastContext;
diff --git a/frontend/src/contexts/WalkthroughContext.jsx b/frontend/src/contexts/WalkthroughContext.jsx
index a6bc0e7a..b0e78e3a 100644
--- a/frontend/src/contexts/WalkthroughContext.jsx
+++ b/frontend/src/contexts/WalkthroughContext.jsx
@@ -25,7 +25,7 @@ import {
WALKTHROUGH_LIBRARY_EVENT,
WALKTHROUGH_SIGNAL_EVENT,
} from '../services/walkthroughRegistry';
-import { useAuth } from './AuthContext';
+import { useAuth } from './useAuth.js';
import usePolling from '../hooks/usePolling';
import { WalkthroughContext } from './walkthroughContextValue';
diff --git a/frontend/src/contexts/WorkspaceContext.jsx b/frontend/src/contexts/WorkspaceContext.jsx
index 6b39900d..d351b151 100644
--- a/frontend/src/contexts/WorkspaceContext.jsx
+++ b/frontend/src/contexts/WorkspaceContext.jsx
@@ -1,7 +1,7 @@
-import { createContext, useCallback, useContext, useMemo, useSyncExternalStore } from 'react';
+import { useCallback, useMemo, useSyncExternalStore } from 'react';
import { workspaceStore } from '../services/workspaceStore';
-const WorkspaceContext = createContext(null);
+import { WorkspaceContext } from './useWorkspace.js';
export function WorkspaceProvider({ children }) {
const snapshot = useSyncExternalStore(
@@ -36,12 +36,3 @@ export function WorkspaceProvider({ children }) {
</WorkspaceContext.Provider>
);
}
-
-export function useWorkspace() {
- const context = useContext(WorkspaceContext);
- if (!context) {
- throw new Error('useWorkspace must be used within a WorkspaceProvider');
- }
- return context;
-}
-
diff --git a/frontend/src/contexts/useAuth.js b/frontend/src/contexts/useAuth.js
new file mode 100644
index 00000000..30c582e5
--- /dev/null
+++ b/frontend/src/contexts/useAuth.js
@@ -0,0 +1,11 @@
+import { createContext, useContext } from 'react';
+
+export const AuthContext = createContext(null);
+
+export function useAuth() {
+ const context = useContext(AuthContext);
+ if (!context) {
+ throw new Error('useAuth must be used within an AuthProvider');
+ }
+ return context;
+}
diff --git a/frontend/src/contexts/useConfirmContext.js b/frontend/src/contexts/useConfirmContext.js
new file mode 100644
index 00000000..4dc76ab8
--- /dev/null
+++ b/frontend/src/contexts/useConfirmContext.js
@@ -0,0 +1,9 @@
+import { createContext, useContext } from 'react';
+
+export const ConfirmContext = createContext(null);
+
+export function useConfirmContext() {
+ return useContext(ConfirmContext);
+}
+
+export default ConfirmContext;
diff --git a/frontend/src/contexts/useLayout.js b/frontend/src/contexts/useLayout.js
new file mode 100644
index 00000000..c64dc535
--- /dev/null
+++ b/frontend/src/contexts/useLayout.js
@@ -0,0 +1,13 @@
+import { createContext, useContext } from 'react';
+
+export const LayoutContext = createContext(null);
+
+export function useLayout() {
+ const context = useContext(LayoutContext);
+ if (!context) {
+ throw new Error('useLayout must be used within a LayoutProvider');
+ }
+ return context;
+}
+
+export default LayoutContext;
diff --git a/frontend/src/contexts/useLocale.js b/frontend/src/contexts/useLocale.js
new file mode 100644
index 00000000..18b45d8c
--- /dev/null
+++ b/frontend/src/contexts/useLocale.js
@@ -0,0 +1,9 @@
+import { createContext, useContext } from 'react';
+
+export const LocaleContext = createContext(null);
+
+export function useLocale() {
+ const context = useContext(LocaleContext);
+ if (!context) throw new Error('useLocale must be used within a LocaleProvider');
+ return context;
+}
diff --git a/frontend/src/contexts/useNotifications.js b/frontend/src/contexts/useNotifications.js
new file mode 100644
index 00000000..7e4b42cc
--- /dev/null
+++ b/frontend/src/contexts/useNotifications.js
@@ -0,0 +1,9 @@
+import { createContext, useContext } from 'react';
+
+export const NotificationsContext = createContext(null);
+
+export function useNotifications() {
+ return useContext(NotificationsContext);
+}
+
+export default NotificationsContext;
diff --git a/frontend/src/contexts/useResourceTier.js b/frontend/src/contexts/useResourceTier.js
new file mode 100644
index 00000000..6f17017d
--- /dev/null
+++ b/frontend/src/contexts/useResourceTier.js
@@ -0,0 +1,11 @@
+import { createContext, useContext } from 'react';
+
+export const ResourceTierContext = createContext(null);
+
+export function useResourceTier() {
+ const context = useContext(ResourceTierContext);
+ if (!context) {
+ throw new Error('useResourceTier must be used within a ResourceTierProvider');
+ }
+ return context;
+}
diff --git a/frontend/src/contexts/useServerkitAI.js b/frontend/src/contexts/useServerkitAI.js
new file mode 100644
index 00000000..5504ca3c
--- /dev/null
+++ b/frontend/src/contexts/useServerkitAI.js
@@ -0,0 +1,9 @@
+import { createContext, useContext } from 'react';
+
+export const AIContext = createContext(null);
+
+export function useServerkitAI() {
+ const ctx = useContext(AIContext);
+ if (!ctx) throw new Error('useServerkitAI must be used within AIProvider');
+ return ctx;
+}
diff --git a/frontend/src/contexts/useShellDock.js b/frontend/src/contexts/useShellDock.js
new file mode 100644
index 00000000..62c88a15
--- /dev/null
+++ b/frontend/src/contexts/useShellDock.js
@@ -0,0 +1,9 @@
+import { createContext, useContext } from 'react';
+
+export const ShellDockContext = createContext(null);
+
+export function useShellDock() {
+ const context = useContext(ShellDockContext);
+ if (!context) throw new Error('useShellDock must be used within ShellDockProvider');
+ return context;
+}
diff --git a/frontend/src/contexts/useTheme.js b/frontend/src/contexts/useTheme.js
new file mode 100644
index 00000000..894c9e79
--- /dev/null
+++ b/frontend/src/contexts/useTheme.js
@@ -0,0 +1,13 @@
+import { createContext, useContext } from 'react';
+
+export const ThemeContext = createContext(null);
+
+export function useTheme() {
+ const context = useContext(ThemeContext);
+ if (!context) {
+ throw new Error('useTheme must be used within a ThemeProvider');
+ }
+ return context;
+}
+
+export default ThemeContext;
diff --git a/frontend/src/contexts/useToast.js b/frontend/src/contexts/useToast.js
new file mode 100644
index 00000000..6fe0a614
--- /dev/null
+++ b/frontend/src/contexts/useToast.js
@@ -0,0 +1,11 @@
+import { createContext, useContext } from 'react';
+
+export const ToastContext = createContext(null);
+
+export function useToast() {
+ const context = useContext(ToastContext);
+ if (!context) throw new Error('useToast must be used within a ToastProvider');
+ return context;
+}
+
+export default ToastContext;
diff --git a/frontend/src/contexts/useWorkspace.js b/frontend/src/contexts/useWorkspace.js
new file mode 100644
index 00000000..5fcd7b84
--- /dev/null
+++ b/frontend/src/contexts/useWorkspace.js
@@ -0,0 +1,11 @@
+import { createContext, useContext } from 'react';
+
+export const WorkspaceContext = createContext(null);
+
+export function useWorkspace() {
+ const context = useContext(WorkspaceContext);
+ if (!context) {
+ throw new Error('useWorkspace must be used within a WorkspaceProvider');
+ }
+ return context;
+}
diff --git a/frontend/src/hooks/ai/useFocusTrap.js b/frontend/src/hooks/ai/useFocusTrap.js
index eb9b58c0..ba81c52f 100644
--- a/frontend/src/hooks/ai/useFocusTrap.js
+++ b/frontend/src/hooks/ai/useFocusTrap.js
@@ -13,6 +13,7 @@ export default function useFocusTrap(ref, { active, onEscape, restoreFocusRef }
if (!active || !ref.current) return undefined;
const node = ref.current;
const previouslyFocused = document.activeElement;
+ const restoreTo = restoreFocusRef?.current || previouslyFocused;
const focusFirst = () => {
const focusable = node.querySelectorAll(FOCUSABLE);
@@ -44,7 +45,6 @@ export default function useFocusTrap(ref, { active, onEscape, restoreFocusRef }
node.addEventListener('keydown', onKeyDown);
return () => {
node.removeEventListener('keydown', onKeyDown);
- const restoreTo = restoreFocusRef?.current || previouslyFocused;
restoreTo?.focus?.();
};
}, [active, ref, onEscape, restoreFocusRef]);
diff --git a/frontend/src/hooks/useClipboard.js b/frontend/src/hooks/useClipboard.js
index 2fedc5e6..b1ab1038 100644
--- a/frontend/src/hooks/useClipboard.js
+++ b/frontend/src/hooks/useClipboard.js
@@ -1,5 +1,5 @@
import { useCallback, useRef, useState } from 'react';
-import { useToast } from '@/contexts/ToastContext';
+import { useToast } from '@/contexts/useToast.js';
import { copyToClipboard } from '@/utils/clipboard';
// Copy-to-clipboard hook with toast feedback and a transient `copied` flag.
diff --git a/frontend/src/hooks/useConfirm.js b/frontend/src/hooks/useConfirm.js
index ba60b3a7..f95f712c 100644
--- a/frontend/src/hooks/useConfirm.js
+++ b/frontend/src/hooks/useConfirm.js
@@ -1,5 +1,5 @@
import { useState, useCallback } from 'react';
-import { useConfirmContext } from '../contexts/ConfirmContext';
+import { useConfirmContext } from '../contexts/useConfirmContext.js';
// Confirm-dialog hook.
//
diff --git a/frontend/src/hooks/useDevMode.js b/frontend/src/hooks/useDevMode.js
index a1d98d9c..cab0770d 100644
--- a/frontend/src/hooks/useDevMode.js
+++ b/frontend/src/hooks/useDevMode.js
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react';
import api from '../services/api';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
// Shared, app-wide "developer mode" flag — the gate for developer-only surfaces
// (currently the Test Sandbox). True when either:
diff --git a/frontend/src/hooks/useFormat.js b/frontend/src/hooks/useFormat.js
index 3c732356..44e312e9 100644
--- a/frontend/src/hooks/useFormat.js
+++ b/frontend/src/hooks/useFormat.js
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
-import { useLocale } from '../contexts/LocaleContext';
+import { useLocale } from '../contexts/useLocale.js';
import * as intl from '../utils/intl';
/**
@@ -27,6 +27,6 @@ export default function useFormat() {
formatPercent: intl.formatPercent,
formatList: intl.formatList,
locale: language,
- // eslint-disable-next-line react-hooks/exhaustive-deps
+
}), [language]);
}
diff --git a/frontend/src/hooks/useMetrics.js b/frontend/src/hooks/useMetrics.js
index f8b76989..32b2d2d7 100644
--- a/frontend/src/hooks/useMetrics.js
+++ b/frontend/src/hooks/useMetrics.js
@@ -1,98 +1,59 @@
import { useState, useEffect, useCallback, useRef } from 'react';
import socketService from '../services/socket';
import api from '../services/api';
+import { usePolling } from './usePolling';
+import { subscribeToMetrics } from '../utils/metricsSubscription';
-// Default polling interval in ms (10 seconds)
const DEFAULT_POLL_INTERVAL = 10000;
-export function useMetrics(useWebSocket = true, pollInterval = DEFAULT_POLL_INTERVAL) {
+// `enabled` selects the local host; `autoRefresh` also controls the live stream.
+// Manual refresh and the initial snapshot remain available with auto-refresh off.
+export function useMetrics(useWebSocket = true, pollInterval = DEFAULT_POLL_INTERVAL, options = {}) {
+ const { enabled = true, autoRefresh = true } = options;
const [metrics, setMetrics] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [connected, setConnected] = useState(false);
- const pollIntervalRef = useRef(null);
-
- const fetchMetrics = useCallback(async () => {
- try {
- const data = await api.getSystemMetrics();
- setMetrics(data);
- setError(null);
- } catch (err) {
- setError(err.message);
- } finally {
- setLoading(false);
- }
- }, []);
-
- // Start polling when not connected via WebSocket
- const startPolling = useCallback(() => {
- if (pollIntervalRef.current) return; // Already polling
- if (pollInterval <= 0) return; // Polling disabled
-
- pollIntervalRef.current = setInterval(fetchMetrics, pollInterval);
- }, [fetchMetrics, pollInterval]);
-
- // Stop polling
- const stopPolling = useCallback(() => {
- if (pollIntervalRef.current) {
- clearInterval(pollIntervalRef.current);
- pollIntervalRef.current = null;
- }
+ const inFlight = useRef(null);
+ const active = useRef(false);
+
+ const fetchMetrics = useCallback(() => {
+ // Mount, manual refresh, and restarted pollers share this guard, even
+ // when a slow request spans a socket reconnect.
+ if (inFlight.current) return inFlight.current;
+ const request = Promise.resolve().then(() => api.getSystemMetrics())
+ .then((data) => {
+ if (active.current) { setMetrics(data); setError(null); }
+ }).catch((err) => {
+ if (active.current) setError(err.message);
+ }).finally(() => {
+ inFlight.current = null;
+ if (active.current) setLoading(false);
+ });
+ inFlight.current = request;
+ return request;
}, []);
useEffect(() => {
- // Initial fetch
- fetchMetrics();
-
- if (useWebSocket) {
- // Connect WebSocket
- socketService.connect();
-
- // Set up listeners
- const unsubConnect = socketService.on('connected', () => {
- setConnected(true);
- stopPolling(); // Stop polling when WS connects
- socketService.subscribeMetrics();
- });
+ active.current = enabled;
+ if (enabled) fetchMetrics();
+ return () => { active.current = false; };
+ }, [enabled, fetchMetrics]);
- const unsubDisconnect = socketService.on('disconnected', () => {
- setConnected(false);
- startPolling(); // Start polling when WS disconnects
- });
-
- const unsubMetrics = socketService.on('metrics', (data) => {
- setMetrics(data);
- setLoading(false);
- });
-
- const unsubError = socketService.on('error', (err) => {
- setError(err.message || 'WebSocket error');
- startPolling(); // Start polling on error
- });
+ useEffect(() => {
+ setConnected(false);
+ if (!enabled || !autoRefresh || !useWebSocket) return undefined;
+ return subscribeToMetrics(socketService, {
+ onConnected: setConnected,
+ onMetrics: (data) => { setMetrics(data); setLoading(false); setError(null); },
+ onError: (err) => setError(err?.message || 'WebSocket error'),
+ });
+ }, [enabled, autoRefresh, useWebSocket]);
- // Start polling initially (will stop if WS connects)
- // Give WebSocket 3 seconds to connect before starting poll
- const pollTimeout = setTimeout(() => {
- if (!socketService.socket?.connected) {
- startPolling();
- }
- }, 3000);
-
- return () => {
- clearTimeout(pollTimeout);
- unsubConnect();
- unsubDisconnect();
- unsubMetrics();
- unsubError();
- socketService.unsubscribeMetrics();
- stopPolling();
- };
- } else {
- // Polling only mode
- startPolling();
- return () => stopPolling();
- }
- }, [useWebSocket, fetchMetrics, startPolling, stopPolling]);
+ usePolling(fetchMetrics, pollInterval, {
+ enabled: enabled && autoRefresh && pollInterval > 0 && !connected,
+ immediate: false,
+ });
return { metrics, loading, error, connected, refresh: fetchMetrics };
}
diff --git a/frontend/src/hooks/useOverflowItems.js b/frontend/src/hooks/useOverflowItems.js
index 1b37eef7..932fbd83 100644
--- a/frontend/src/hooks/useOverflowItems.js
+++ b/frontend/src/hooks/useOverflowItems.js
@@ -1,5 +1,7 @@
import { useState, useRef, useEffect, useCallback } from 'react';
+const NO_ACTIVE_ITEM = () => -1;
+
function arraysEqual(a, b) {
if (a.length !== b.length) return false;
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
@@ -77,11 +79,12 @@ export function sanitizeOverflowIndices(indices, count) {
* recompute: () => void
* }}
*/
-export function useOverflowItems({ count, itemRefs: externalItemRefs, gap = 8, moreWidth = 36, getActiveIndex = () => -1, deps = [] }) {
+export function useOverflowItems({ count, itemRefs: externalItemRefs, gap = 8, moreWidth = 36, getActiveIndex = NO_ACTIVE_ITEM, deps = [] }) {
const containerRef = useRef(null);
const internalItemRefs = useRef([]);
const moreBtnRef = useRef(null);
const [hiddenIndices, setHiddenIndices] = useState([]);
+ const measurementInputs = useRef(null);
const itemRefs = externalItemRefs || internalItemRefs;
itemRefs.current.length = count;
@@ -141,12 +144,20 @@ export function useOverflowItems({ count, itemRefs: externalItemRefs, gap = 8, m
if (!visibleSetObj.has(i)) hidden.push(i);
}
setHiddenIndices((prev) => (arraysEqual(prev, hidden) ? prev : hidden));
- }, [count, gap, moreWidth, getActiveIndex, ...deps]);
+ }, [gap, moreWidth, getActiveIndex, itemRefs]);
- // Initial measurement after first paint.
+ // Consumers may supply an arbitrary dependency list. Compare its values
+ // after each commit, using React's Object.is semantics, without putting a
+ // variable-length spread into a hook dependency array or measuring again
+ // just because the caller created a fresh array.
useEffect(() => {
+ const inputs = [recompute, count, ...deps];
+ const previous = measurementInputs.current;
+ if (previous && previous.length === inputs.length
+ && inputs.every((value, index) => Object.is(value, previous[index]))) return;
+ measurementInputs.current = inputs;
recompute();
- }, [recompute, count]);
+ });
// Re-fit on container resize.
useEffect(() => {
diff --git a/frontend/src/hooks/usePageTitle.js b/frontend/src/hooks/usePageTitle.js
index af4847c7..fe9d2c6f 100644
--- a/frontend/src/hooks/usePageTitle.js
+++ b/frontend/src/hooks/usePageTitle.js
@@ -1,5 +1,5 @@
import { useEffect } from 'react';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
/**
* Hook to set the page title (suffixed with " | <panel title>")
diff --git a/frontend/src/hooks/usePaletteAuthz.js b/frontend/src/hooks/usePaletteAuthz.js
index 903da531..34e4d852 100644
--- a/frontend/src/hooks/usePaletteAuthz.js
+++ b/frontend/src/hooks/usePaletteAuthz.js
@@ -1,7 +1,7 @@
import { useMemo } from 'react';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
import { SIDEBAR_ITEMS } from '../components/sidebarItems';
-import { useWorkspace } from '../contexts/WorkspaceContext';
+import { useWorkspace } from '../contexts/useWorkspace.js';
// Sidebar items that can never be hidden (Dashboard, Marketplace) — the palette
// mirrors the sidebar's `alwaysVisible` so a workspace nav map can't hide them.
diff --git a/frontend/src/hooks/useRecipeCatalog.js b/frontend/src/hooks/useRecipeCatalog.js
index bfe9af6d..ae575257 100644
--- a/frontend/src/hooks/useRecipeCatalog.js
+++ b/frontend/src/hooks/useRecipeCatalog.js
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next';
import { api } from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useServerMutation, useServerQuery } from './useServerQuery';
// Data door for the Recipe catalog (serverkit-recipes registry). Pages render
diff --git a/frontend/src/hooks/useResourceOptions.js b/frontend/src/hooks/useResourceOptions.js
index db6593cf..f4f825ce 100644
--- a/frontend/src/hooks/useResourceOptions.js
+++ b/frontend/src/hooks/useResourceOptions.js
@@ -1,6 +1,6 @@
import { useCallback, useMemo, useState } from 'react';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
import { useServerQuery } from './useServerQuery';
import api from '../services/api';
import { getFavorites } from '../utils/recents';
diff --git a/frontend/src/hooks/useServerQuery.js b/frontend/src/hooks/useServerQuery.js
index ef6c660f..d3e27582 100644
--- a/frontend/src/hooks/useServerQuery.js
+++ b/frontend/src/hooks/useServerQuery.js
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
-import { useWorkspace } from '../contexts/WorkspaceContext';
+import { useWorkspace } from '../contexts/useWorkspace.js';
import { queryClient, serializeQueryKey } from '../services/queryClient';
import { usePolling } from './usePolling';
diff --git a/frontend/src/i18n/locales/ar.json b/frontend/src/i18n/locales/ar.json
index 65b880de..570c68c7 100644
--- a/frontend/src/i18n/locales/ar.json
+++ b/frontend/src/i18n/locales/ar.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 سطر",
"200Lines": "200 سطر",
"500Lines": "500 سطر",
- "applicationLogs": "سجلات التطبيق",
- "autoRefresh": "التحديث التلقائي",
"autoScroll": "التمرير التلقائي",
"copyLogs": "نسخ السجلات",
"deployingThisService": "نشر هذه الخدمة",
"deploymentFailed": "فشل النشر:",
"deploymentFinishedSuccessfully": "انتهى النشر بنجاح",
- "dockerComposeLogs": "سجلات Docker Compose",
"downloadLogs": "تحميل السجلات",
- "gunicornSystemdLogs": "سجلات Gunicorn/systemd",
"live": "يعيش",
"loadingLogs": "جارٍ تحميل السجلات...",
"pinToDrawer": "دبوس إلى الدرج",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "أضف قنوات توصيل التنبيهات (Discord وSlack وTelegram) في الإعدادات → الإشعارات.",
"alerts24h": "التنبيهات · 24 ساعة",
- "applicationInfo": "معلومات التطبيق",
- "areYouSureYouWantTo": "هل أنت متأكد أنك تريد إلغاء ربط هذه التطبيقات؟ ستبقى بيانات اعتماد قاعدة البيانات دون تغيير.",
"bandwidth": "عرض النطاق الترددي",
- "clickRunDiagnosticsToCheckRouting": "انقر فوق \"تشغيل التشخيص\" للتحقق من تكوين التوجيه وتحديد المشكلات.",
"computing": "الحوسبة…",
- "cpuLoad": "تحميل وحدة المعالجة المركزية",
"deployments": "عمليات النشر",
"enableAlerts": "تمكين التنبيهات",
"enableMonitoring": "تمكين المراقبة",
"environment": "بيئة",
- "environmentLinking": "الربط البيئي",
"fileIntegrityMonitoringEnabled": "تم تمكين مراقبة سلامة الملف",
"initializeBaseline": "تهيئة خط الأساس",
"integrityBaselineInitialized": "تمت تهيئة خط الأساس للنزاهة",
"integrityChanges": "السلامة · 24 ساعة",
"last90Days": "آخر 90 يومًا",
- "linkThisAppToAnotherTo": "اربط هذا التطبيق بآخر لإنشاء زوج إنتاج/تطوير. يمكن للتطبيقات المرتبطة مشاركة بيانات اعتماد قاعدة البيانات.",
- "liveResources": "الموارد الحية",
"loadingMetrics": "جارٍ تحميل المقاييس...",
"malware": "البرامج الضارة",
"marketplaceLink": "المتجر",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "لا توجد تغييرات في التكامل (24 ساعة)",
"noRelatedResourcesYet": "لا توجد موارد ذات صلة حتى الآن.",
"open": "افتح {{portUrl}}",
- "phpVersion": "الإصدار PHP",
- "processStatus": "حالة العملية",
"processes": "العمليات",
- "pythonVersion": "الإصدار Python",
- "ramUsage": "استخدام ذاكرة الوصول العشوائي",
"reCheck": "أعد الفحص",
"recentDeployments": "عمليات النشر الأخيرة",
"relatedResources": "الموارد ذات الصلة",
"repository": "مستودع",
"resourceUsage": "استخدام الموارد",
"reviewChanges": "مراجعة التغييرات",
- "rootPath": "مسار الجذر",
- "routingDiagnostics": "تشخيص التوجيه",
"securityAlertsConfigured": "تم تكوين التنبيهات الأمنية",
"securityPosture": "الموقف الأمني",
"serviceInfo": "معلومات الخدمة",
- "startTheContainerToSeeLive": "ابدأ الحاوية لرؤية الموارد الحية.",
"successful": "ناجح",
- "tags": "العلامات",
"thisMonth": "هذا الشهر",
"totalDeploys": "إجمالي عمليات النشر",
- "unlinkApps": "إلغاء ربط التطبيقات",
"workers": "العمال"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "إنشاء قالب",
"deleteTemplate": "حذف القالب",
"deleteThisCannotBeUndone": "هل تريد حذف \"{{name}}\"؟ لا يمكن التراجع عن هذا.",
- "driftCheckInitiated": "بدأ فحص الانجراف",
"failedToLoadTemplates": "فشل تحميل القوالب",
"firewall": "جدار الحماية",
"firewallRules": "قواعد جدار الحماية",
@@ -4644,7 +4623,6 @@
"packages": "الحزم",
"packagesOnePerLine": "الحزم (واحدة لكل سطر)",
"remediation": "العلاج",
- "remediationInitiated": "بدأت المعالجة",
"selectAServerToApplyThis": "حدد خادمًا لتطبيق هذا القالب:",
"startFromAReadyMadeLibrary": "ابدأ من قالب مكتبة جاهز، أو أنشئ واحدًا من البداية.",
"template": "نموذج",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "انقل موقعًا إلى مساحة العمل هذه",
"moveOneInBelow": "نقل واحد في الأسفل.",
"noSitesInThisWorkspaceYet": "لا توجد مواقع في مساحة العمل هذه حتى الآن",
- "share": "يشارك",
"site": "موقع"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/bn.json b/frontend/src/i18n/locales/bn.json
index 348fc94f..7f880046 100644
--- a/frontend/src/i18n/locales/bn.json
+++ b/frontend/src/i18n/locales/bn.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 লাইন",
"200Lines": "200 লাইন",
"500Lines": "500 লাইন",
- "applicationLogs": "অ্যাপ্লিকেশন লগ",
- "autoRefresh": "স্বয়ংক্রিয় রিফ্রেশ",
"autoScroll": "অটো-স্ক্রোল",
"copyLogs": "লগ কপি করুন",
"deployingThisService": "এই পরিষেবা স্থাপন করা হচ্ছে",
"deploymentFailed": "স্থাপনা ব্যর্থ হয়েছে:",
"deploymentFinishedSuccessfully": "স্থাপন সফলভাবে সমাপ্ত",
- "dockerComposeLogs": "Docker Compose লগ",
"downloadLogs": "লগ ডাউনলোড করুন",
- "gunicornSystemdLogs": "Gunicorn/systemd লগ",
"live": "লাইভ",
"loadingLogs": "লগ লোড হচ্ছে...",
"pinToDrawer": "ড্রয়ারে পিন করুন",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "সেটিংস → বিজ্ঞপ্তিতে সতর্কতা বিতরণ চ্যানেল (ডিসকর্ড, স্ল্যাক, টেলিগ্রাম) যোগ করুন।",
"alerts24h": "সতর্কতা · ২৪ ঘন্টা",
- "applicationInfo": "আবেদনের তথ্য",
- "areYouSureYouWantTo": "আপনি কি এই অ্যাপ্লিকেশানগুলি লিঙ্কমুক্ত করার বিষয়ে নিশ্চিত? ডাটাবেস শংসাপত্র অপরিবর্তিত থাকবে।",
"bandwidth": "ব্যান্ডউইথ",
- "clickRunDiagnosticsToCheckRouting": "রাউটিং কনফিগারেশন পরীক্ষা করতে এবং সমস্যা চিহ্নিত করতে \"রান ডায়াগনস্টিকস\" এ ক্লিক করুন।",
"computing": "কম্পিউটিং...",
- "cpuLoad": "CPU লোড",
"deployments": "স্থাপনা",
"enableAlerts": "সতর্কতা সক্ষম করুন",
"enableMonitoring": "পর্যবেক্ষণ সক্ষম করুন",
"environment": "পরিবেশ",
- "environmentLinking": "এনভায়রনমেন্ট লিঙ্কিং",
"fileIntegrityMonitoringEnabled": "ফাইল অখণ্ডতা পর্যবেক্ষণ সক্ষম",
"initializeBaseline": "বেসলাইন শুরু করুন",
"integrityBaselineInitialized": "ইন্টিগ্রিটি বেসলাইন আরম্ভ করা হয়েছে",
"integrityChanges": "ইন্টেগ্রিটি · 24h",
"last90Days": "গত 90 দিন",
- "linkThisAppToAnotherTo": "একটি প্রোডাকশন/ডেভেলপমেন্ট পেয়ার তৈরি করতে এই অ্যাপটিকে অন্যের সাথে লিঙ্ক করুন। লিঙ্ক করা অ্যাপগুলি ডাটাবেস শংসাপত্র শেয়ার করতে পারে।",
- "liveResources": "লাইভ সম্পদ",
"loadingMetrics": "মেট্রিক্স লোড হচ্ছে...",
"malware": "ম্যালওয়্যার",
"marketplaceLink": "মার্কেটপ্লেস",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "কোন অখণ্ডতা পরিবর্তন নেই (24 ঘন্টা)",
"noRelatedResourcesYet": "এখনও কোন সম্পর্কিত সম্পদ.",
"open": "{{portUrl}} খুলুন",
- "phpVersion": "PHP সংস্করণ",
- "processStatus": "প্রক্রিয়া অবস্থা",
"processes": "প্রসেস",
- "pythonVersion": "Python সংস্করণ",
- "ramUsage": "RAM ব্যবহার",
"reCheck": "পুনরায় চেক করুন",
"recentDeployments": "সাম্প্রতিক স্থাপনা",
"relatedResources": "সম্পর্কিত সম্পদ",
"repository": "ভান্ডার",
"resourceUsage": "সম্পদ ব্যবহার",
"reviewChanges": "পরিবর্তনগুলি পর্যালোচনা করুন",
- "rootPath": "রুট পাথ",
- "routingDiagnostics": "রাউটিং ডায়াগনস্টিকস",
"securityAlertsConfigured": "নিরাপত্তা সতর্কতা কনফিগার করা হয়েছে",
"securityPosture": "নিরাপত্তা ভঙ্গি",
"serviceInfo": "পরিষেবা তথ্য",
- "startTheContainerToSeeLive": "লাইভ সম্পদ দেখতে কন্টেইনার শুরু করুন.",
"successful": "সফল",
- "tags": "ট্যাগ",
"thisMonth": "এই মাসে",
"totalDeploys": "মোট স্থাপনা",
- "unlinkApps": "অ্যাপস লিঙ্কমুক্ত করুন",
"workers": "শ্রমিকরা"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "টেমপ্লেট তৈরি করুন",
"deleteTemplate": "টেমপ্লেট মুছুন",
"deleteThisCannotBeUndone": "\"{{name}}\" মুছবেন? এটি পূর্বাবস্থায় ফেরানো যাবে না।",
- "driftCheckInitiated": "ড্রিফ্ট চেক শুরু হয়েছে",
"failedToLoadTemplates": "টেমপ্লেট লোড করতে ব্যর্থ হয়েছে",
"firewall": "ফায়ারওয়াল",
"firewallRules": "ফায়ারওয়াল নিয়ম",
@@ -4644,7 +4623,6 @@
"packages": "প্যাকেজ",
"packagesOnePerLine": "প্যাকেজ (প্রতি লাইনে একটি)",
"remediation": "প্রতিকার",
- "remediationInitiated": "প্রতিকার শুরু হয়েছে",
"selectAServerToApplyThis": "এই টেমপ্লেটটি প্রয়োগ করতে একটি সার্ভার নির্বাচন করুন:",
"startFromAReadyMadeLibrary": "একটি রেডিমেড লাইব্রেরি টেমপ্লেট থেকে শুরু করুন, অথবা স্ক্র্যাচ থেকে একটি তৈরি করুন৷",
"template": "টেমপ্লেট",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "এই কর্মক্ষেত্রে একটি সাইট সরান",
"moveOneInBelow": "নীচে একটি সরান.",
"noSitesInThisWorkspaceYet": "এই কর্মক্ষেত্রে এখনো কোনো সাইট নেই",
- "share": "শেয়ার করুন",
"site": "সাইট"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/de.json b/frontend/src/i18n/locales/de.json
index 2282bd8d..c06b1d3c 100644
--- a/frontend/src/i18n/locales/de.json
+++ b/frontend/src/i18n/locales/de.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 Zeilen",
"200Lines": "200 Zeilen",
"500Lines": "500 Zeilen",
- "applicationLogs": "Anwendungsprotokolle",
- "autoRefresh": "Automatische Aktualisierung",
"autoScroll": "Automatisches Scrollen",
"copyLogs": "Protokolle kopieren",
"deployingThisService": "Bereitstellung dieses Dienstes",
"deploymentFailed": "Bereitstellung fehlgeschlagen:",
"deploymentFinishedSuccessfully": "Die Bereitstellung wurde erfolgreich abgeschlossen",
- "dockerComposeLogs": "Docker-Protokolle erstellen",
"downloadLogs": "Protokolle herunterladen",
- "gunicornSystemdLogs": "Gunicorn/systemd-Protokolle",
"live": "Lebe",
"loadingLogs": "Protokolle werden geladen...",
"pinToDrawer": "An die Schublade heften",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Fügen Sie unter Einstellungen → Benachrichtigungen Kanäle für die Zustellung von Benachrichtigungen hinzu (Discord, Slack, Telegram).",
"alerts24h": "Benachrichtigungen · 24h",
- "applicationInfo": "Bewerbungsinfo",
- "areYouSureYouWantTo": "Möchten Sie die Verknüpfung dieser Apps wirklich aufheben? Die Datenbankanmeldeinformationen bleiben unverändert.",
"bandwidth": "Bandbreite",
- "clickRunDiagnosticsToCheckRouting": "Klicken Sie auf „Diagnose ausführen“, um die Routing-Konfiguration zu überprüfen und Probleme zu identifizieren.",
"computing": "Computer…",
- "cpuLoad": "CPU-Last",
"deployments": "Bereitstellungen",
"enableAlerts": "Aktivieren Sie Benachrichtigungen",
"enableMonitoring": "Überwachung aktivieren",
"environment": "Umwelt",
- "environmentLinking": "Umgebungsverknüpfung",
"fileIntegrityMonitoringEnabled": "Überwachung der Dateiintegrität aktiviert",
"initializeBaseline": "Grundlinie initialisieren",
"integrityBaselineInitialized": "Integritätsbasislinie initialisiert",
"integrityChanges": "Integrität · 24h",
"last90Days": "Letzte 90 Tage",
- "linkThisAppToAnotherTo": "Verknüpfen Sie diese App mit einer anderen, um ein Produktions-/Entwicklungspaar zu erstellen. Verknüpfte Apps können Datenbankanmeldeinformationen teilen.",
- "liveResources": "Live-Ressourcen",
"loadingMetrics": "Messwerte werden geladen...",
"malware": "Schadsoftware",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "Keine Integritätsänderungen (24 Stunden)",
"noRelatedResourcesYet": "Noch keine entsprechenden Ressourcen.",
"open": "Öffnen Sie {{portUrl}}",
- "phpVersion": "PHP-Version",
- "processStatus": "Prozessstatus",
"processes": "Prozesse",
- "pythonVersion": "Python-Version",
- "ramUsage": "RAM-Nutzung",
"reCheck": "Überprüfen Sie es noch einmal",
"recentDeployments": "Aktuelle Bereitstellungen",
"relatedResources": "Verwandte Ressourcen",
"repository": "Repository",
"resourceUsage": "Ressourcennutzung",
"reviewChanges": "Überprüfen Sie die Änderungen",
- "rootPath": "Root-Pfad",
- "routingDiagnostics": "Routing-Diagnose",
"securityAlertsConfigured": "Sicherheitswarnungen konfiguriert",
"securityPosture": "Sicherheitslage",
"serviceInfo": "Service-Info",
- "startTheContainerToSeeLive": "Starten Sie den Container, um Live-Ressourcen anzuzeigen.",
"successful": "Erfolgreich",
- "tags": "Schlagworte",
"thisMonth": "diesen Monat",
"totalDeploys": "Gesamtzahl der Bereitstellungen",
- "unlinkApps": "Verknüpfung von Apps aufheben",
"workers": "Arbeiter"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "Vorlage erstellen",
"deleteTemplate": "Vorlage löschen",
"deleteThisCannotBeUndone": "„{{name}}“ löschen? Dies kann nicht rückgängig gemacht werden.",
- "driftCheckInitiated": "Driftprüfung eingeleitet",
"failedToLoadTemplates": "Vorlagen konnten nicht geladen werden",
"firewall": "Firewall",
"firewallRules": "Firewall-Regeln",
@@ -4644,7 +4623,6 @@
"packages": "Pakete",
"packagesOnePerLine": "Pakete (eins pro Zeile)",
"remediation": "Sanierung",
- "remediationInitiated": "Sanierung eingeleitet",
"selectAServerToApplyThis": "Wählen Sie einen Server aus, um diese Vorlage anzuwenden:",
"startFromAReadyMadeLibrary": "Beginnen Sie mit einer vorgefertigten Bibliotheksvorlage oder erstellen Sie eine von Grund auf.",
"template": "Vorlage",
@@ -5768,7 +5746,7 @@
"textarea": "Textbereich",
"theOld": "Das Alte",
"theQuickBrownFox": "— Der schnelle Braunfuchs",
- "theQuickBrownFoxJumpsOver": "Der schnelle Braunfuchs springt über den faulen Hund – Inter",
+ "theQuickBrownFoxJumpsOver": "Der schnelle Braunfuchs springt über den faulen Hund – IBM Plex Sans",
"theQuickBrownFoxJumpsOver2": "— Der schnelle Braunfuchs springt über den faulen Hund",
"theyPublishActionsThrough": "— Sie veröffentlichen Aktionen durch",
"thisIsAFullWidthError": "Dies ist ein Fehlerbanner in voller Breite.",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "Verschieben Sie eine Site in diesen Arbeitsbereich",
"moveOneInBelow": "Schieben Sie eins nach unten.",
"noSitesInThisWorkspaceYet": "Noch keine Websites in diesem Arbeitsbereich",
- "share": "Teilen",
"site": "Website"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json
index 39a2f44a..f2c3c1dc 100644
--- a/frontend/src/i18n/locales/en.json
+++ b/frontend/src/i18n/locales/en.json
@@ -2840,16 +2840,12 @@
"100Lines": "100 lines",
"200Lines": "200 lines",
"500Lines": "500 lines",
- "applicationLogs": "Application Logs",
- "autoRefresh": "Auto-refresh",
"autoScroll": "Auto-scroll",
"copyLogs": "Copy logs",
"deployingThisService": "Deploying this service",
"deploymentFailed": "Deployment failed:",
"deploymentFinishedSuccessfully": "Deployment finished successfully",
- "dockerComposeLogs": "Docker Compose Logs",
"downloadLogs": "Download logs",
- "gunicornSystemdLogs": "Gunicorn/systemd Logs",
"live": "Live",
"loadingLogs": "Loading logs…",
"pinToDrawer": "Open in Operations dock",
@@ -3469,24 +3465,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Add alert delivery channels (Discord, Slack, Telegram) in Settings → Notifications.",
"alerts24h": "Alerts · 24h",
- "applicationInfo": "Application Info",
- "areYouSureYouWantTo": "Are you sure you want to unlink these apps? Database credentials will remain unchanged.",
"bandwidth": "Bandwidth",
- "clickRunDiagnosticsToCheckRouting": "Click \"Run Diagnostics\" to check routing configuration and identify issues.",
"computing": "Computing…",
- "cpuLoad": "CPU Load",
"deployments": "Deployments",
"enableAlerts": "Enable alerts",
"enableMonitoring": "Enable monitoring",
"environment": "Environment",
- "environmentLinking": "Environment Linking",
"fileIntegrityMonitoringEnabled": "File integrity monitoring enabled",
"initializeBaseline": "Initialize baseline",
"integrityBaselineInitialized": "Integrity baseline initialized",
"integrityChanges": "Integrity · 24h",
"last90Days": "Last 90 days",
- "linkThisAppToAnotherTo": "Link this app to another to create a production/development pair. Linked apps can share database credentials.",
- "liveResources": "Live Resources",
"loadingMetrics": "Loading metrics…",
"malware": "Malware",
"marketplaceLink": "Marketplace",
@@ -3496,28 +3485,19 @@
"noIntegrityChanges24h": "No integrity changes (24h)",
"noRelatedResourcesYet": "No related resources yet.",
"open": "Open {{portUrl}}",
- "phpVersion": "PHP Version",
- "processStatus": "Process Status",
"processes": "Processes",
- "pythonVersion": "Python Version",
- "ramUsage": "RAM Usage",
"reCheck": "Re-check",
"recentDeployments": "Recent Deployments",
"relatedResources": "Related Resources",
"repository": "Repository",
"resourceUsage": "Resource Usage",
"reviewChanges": "Review changes",
- "rootPath": "Root Path",
- "routingDiagnostics": "Routing Diagnostics",
"securityAlertsConfigured": "Security alerts configured",
"securityPosture": "Security posture",
"serviceInfo": "Service Info",
- "startTheContainerToSeeLive": "Start the container to see live resources.",
"successful": "Successful",
- "tags": "Tags",
"thisMonth": "this month",
"totalDeploys": "Total Deploys",
- "unlinkApps": "Unlink Apps",
"workers": "Workers"
},
"packagesTab": {
@@ -4639,7 +4619,6 @@
"createTemplate": "Create Template",
"deleteTemplate": "Delete Template",
"deleteThisCannotBeUndone": "Delete \"{{name}}\"? This cannot be undone.",
- "driftCheckInitiated": "Drift check initiated",
"failedToLoadTemplates": "Failed to load templates",
"firewall": "Firewall",
"firewallRules": "firewall rules",
@@ -4649,7 +4628,6 @@
"packages": "Packages",
"packagesOnePerLine": "Packages (one per line)",
"remediation": "Remediation",
- "remediationInitiated": "Remediation initiated",
"selectAServerToApplyThis": "Select a server to apply this template:",
"startFromAReadyMadeLibrary": "Start from a ready-made library template, or create one from scratch.",
"template": "Template",
@@ -5591,7 +5569,7 @@
"fingerprint": "Fingerprint",
"firewallRules": "Firewall Rules",
"firstName": "First Name",
- "flexUtilities": "Flex Utilities",
+ "flexUtilities": "Flex Layouts",
"fontFamilies": "Font Families",
"fontSizes": "Font Sizes",
"fontWeights": "Font Weights",
@@ -5609,7 +5587,7 @@
"globalBottomPinnedDrawerForStreaming": "Global bottom-pinned drawer for streaming logs. Opens via the LogsDrawer context.",
"glow": "Glow",
"gridOfServiceCardsWithStatus": "Grid of service cards with status dot, metadata, and action buttons.",
- "gridUtilities": "Grid Utilities",
+ "gridUtilities": "Grid Layouts",
"h1PageTitle": "h1 — Page Title",
"h2SectionTitle": "h2 — Section Title",
"h3CardTitle": "h3 — Card Title",
@@ -5773,7 +5751,7 @@
"textarea": "Textarea",
"theOld": "The old",
"theQuickBrownFox": "— The quick brown fox",
- "theQuickBrownFoxJumpsOver": "The quick brown fox jumps over the lazy dog — Inter",
+ "theQuickBrownFoxJumpsOver": "The quick brown fox jumps over the lazy dog — IBM Plex Sans",
"theQuickBrownFoxJumpsOver2": "— The quick brown fox jumps over the lazy dog",
"theyPublishActionsThrough": "— they publish actions through",
"thisIsAFullWidthError": "This is a full-width error banner.",
@@ -6673,7 +6651,6 @@
"moveASiteIntoThisWorkspace": "Move a site into this workspace",
"moveOneInBelow": "Move one in below.",
"noSitesInThisWorkspaceYet": "No sites in this workspace yet",
- "share": "Share",
"site": "Site"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.json
index ac4f4e1c..49e8845a 100644
--- a/frontend/src/i18n/locales/es.json
+++ b/frontend/src/i18n/locales/es.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 líneas",
"200Lines": "200 líneas",
"500Lines": "500 líneas",
- "applicationLogs": "Registros de la aplicación",
- "autoRefresh": "Actualización automática",
"autoScroll": "Desplazamiento automático",
"copyLogs": "Copiar registros",
"deployingThisService": "Desplegando este servicio",
"deploymentFailed": "El despliegue falló:",
"deploymentFinishedSuccessfully": "El despliegue terminó correctamente",
- "dockerComposeLogs": "Registros de Docker Compose",
"downloadLogs": "Descargar registros",
- "gunicornSystemdLogs": "Registros de Gunicorn/systemd",
"live": "En vivo",
"loadingLogs": "Cargando registros...",
"pinToDrawer": "Fijar al panel lateral",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Añade canales de entrega de alertas (Discord, Slack, Telegram) en Configuración → Notificaciones.",
"alerts24h": "Alertas · 24 h",
- "applicationInfo": "Información de la aplicación",
- "areYouSureYouWantTo": "¿Seguro que quieres desvincular estas aplicaciones? Las credenciales de la base de datos no cambiarán.",
"bandwidth": "Ancho de banda",
- "clickRunDiagnosticsToCheckRouting": "Haz clic en \"Ejecutar diagnóstico\" para comprobar la configuración de enrutamiento e identificar problemas.",
"computing": "Calculando…",
- "cpuLoad": "Carga de CPU",
"deployments": "Despliegues",
"enableAlerts": "Activar alertas",
"enableMonitoring": "Activar monitorización",
"environment": "Entorno",
- "environmentLinking": "Vinculación de entornos",
"fileIntegrityMonitoringEnabled": "Monitorización de integridad de archivos activada",
"initializeBaseline": "Inicializar línea base",
"integrityBaselineInitialized": "Línea base de integridad inicializada",
"integrityChanges": "Integridad · 24 h",
"last90Days": "Últimos 90 días",
- "linkThisAppToAnotherTo": "Vincula esta aplicación con otra para crear un par de producción/desarrollo. Las aplicaciones vinculadas pueden compartir credenciales de base de datos.",
- "liveResources": "Recursos en vivo",
"loadingMetrics": "Cargando métricas...",
"malware": "Malware",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "Sin cambios de integridad (24 h)",
"noRelatedResourcesYet": "Aún no hay recursos relacionados.",
"open": "Abrir {{portUrl}}",
- "phpVersion": "Versión de PHP",
- "processStatus": "Estado del proceso",
"processes": "Procesos",
- "pythonVersion": "Versión de Python",
- "ramUsage": "Uso de RAM",
"reCheck": "Volver a comprobar",
"recentDeployments": "Despliegues recientes",
"relatedResources": "Recursos relacionados",
"repository": "Repositorio",
"resourceUsage": "Uso de recursos",
"reviewChanges": "Revisar cambios",
- "rootPath": "Ruta raíz",
- "routingDiagnostics": "Diagnóstico de enrutamiento",
"securityAlertsConfigured": "Alertas de seguridad configuradas",
"securityPosture": "Postura de seguridad",
"serviceInfo": "Información del servicio",
- "startTheContainerToSeeLive": "Inicia el contenedor para ver los recursos en vivo.",
"successful": "Exitosos",
- "tags": "Etiquetas",
"thisMonth": "este mes",
"totalDeploys": "Despliegues totales",
- "unlinkApps": "Desvincular aplicaciones",
"workers": "Workers"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "Crear plantilla",
"deleteTemplate": "Eliminar plantilla",
"deleteThisCannotBeUndone": "¿Eliminar \"{{name}}\"? Esta acción no se puede deshacer.",
- "driftCheckInitiated": "Comprobación de deriva iniciada",
"failedToLoadTemplates": "No se pudieron cargar las plantillas",
"firewall": "Firewall",
"firewallRules": "reglas de firewall",
@@ -4644,7 +4623,6 @@
"packages": "Paquetes",
"packagesOnePerLine": "Paquetes (uno por línea)",
"remediation": "Corrección",
- "remediationInitiated": "Corrección iniciada",
"selectAServerToApplyThis": "Selecciona un servidor para aplicar esta plantilla:",
"startFromAReadyMadeLibrary": "Empieza desde una plantilla de la biblioteca ya lista, o crea una desde cero.",
"template": "Plantilla",
@@ -5768,7 +5746,7 @@
"textarea": "Textarea",
"theOld": "El antiguo",
"theQuickBrownFox": "— El veloz murciélago hindú comía feliz cardillo y kiwi",
- "theQuickBrownFoxJumpsOver": "El veloz murciélago hindú comía feliz cardillo y kiwi — Inter",
+ "theQuickBrownFoxJumpsOver": "El veloz murciélago hindú comía feliz cardillo y kiwi — IBM Plex Sans",
"theQuickBrownFoxJumpsOver2": "— El veloz murciélago hindú comía feliz cardillo y kiwi",
"theyPublishActionsThrough": "— publican acciones a través de",
"thisIsAFullWidthError": "Este es un banner de error de ancho completo.",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "Mover un sitio a este espacio de trabajo",
"moveOneInBelow": "Mueve uno abajo.",
"noSitesInThisWorkspaceYet": "Aún no hay sitios en este espacio de trabajo",
- "share": "Compartir",
"site": "Sitio"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/fr.json b/frontend/src/i18n/locales/fr.json
index 34718f5f..bffa7117 100644
--- a/frontend/src/i18n/locales/fr.json
+++ b/frontend/src/i18n/locales/fr.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 lignes",
"200Lines": "200 lignes",
"500Lines": "500 lignes",
- "applicationLogs": "Journaux d'applications",
- "autoRefresh": "Actualisation automatique",
"autoScroll": "Défilement automatique",
"copyLogs": "Copier les journaux",
"deployingThisService": "Déployer ce service",
"deploymentFailed": "Le déploiement a échoué :",
"deploymentFinishedSuccessfully": "Le déploiement s'est terminé avec succès",
- "dockerComposeLogs": "Journaux Docker Compose",
"downloadLogs": "Télécharger les journaux",
- "gunicornSystemdLogs": "Journaux Gunicorn/systemd",
"live": "En direct",
"loadingLogs": "Chargement des journaux...",
"pinToDrawer": "Épingler au tiroir",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Ajoutez des canaux de diffusion d'alertes (Discord, Slack, Telegram) dans Paramètres → Notifications.",
"alerts24h": "Alertes · 24h",
- "applicationInfo": "Informations sur la candidature",
- "areYouSureYouWantTo": "Êtes-vous sûr de vouloir dissocier ces applications ? Les informations d'identification de la base de données resteront inchangées.",
"bandwidth": "Bande passante",
- "clickRunDiagnosticsToCheckRouting": "Cliquez sur \"Exécuter les diagnostics\" pour vérifier la configuration du routage et identifier les problèmes.",
"computing": "Informatique…",
- "cpuLoad": "Charge du processeur",
"deployments": "Déploiements",
"enableAlerts": "Activer les alertes",
"enableMonitoring": "Activer la surveillance",
"environment": "Environnement",
- "environmentLinking": "Liaison avec l'environnement",
"fileIntegrityMonitoringEnabled": "Surveillance de l'intégrité des fichiers activée",
"initializeBaseline": "Initialiser la ligne de base",
"integrityBaselineInitialized": "Base de référence d'intégrité initialisée",
"integrityChanges": "Intégrité · 24 h",
"last90Days": "90 derniers jours",
- "linkThisAppToAnotherTo": "Liez cette application à une autre pour créer un couple production/développement. Les applications liées peuvent partager les informations d'identification de la base de données.",
- "liveResources": "Ressources en direct",
"loadingMetrics": "Chargement des métriques...",
"malware": "Logiciel malveillant",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "Aucun changement d'intégrité (24h)",
"noRelatedResourcesYet": "Aucune ressource associée pour l'instant.",
"open": "Ouvrir {{portUrl}}",
- "phpVersion": "Version PHP",
- "processStatus": "Statut du processus",
"processes": "Processus",
- "pythonVersion": "Version Python",
- "ramUsage": "Utilisation de la RAM",
"reCheck": "Revérifier",
"recentDeployments": "Déploiements récents",
"relatedResources": "Ressources connexes",
"repository": "Dépôt",
"resourceUsage": "Utilisation des ressources",
"reviewChanges": "Examiner les modifications",
- "rootPath": "Chemin racine",
- "routingDiagnostics": "Diagnostic de routage",
"securityAlertsConfigured": "Alertes de sécurité configurées",
"securityPosture": "Posture de sécurité",
"serviceInfo": "Informations sur les services",
- "startTheContainerToSeeLive": "Démarrez le conteneur pour voir les ressources en direct.",
"successful": "Réussi",
- "tags": "Balises",
"thisMonth": "ce mois-ci",
"totalDeploys": "Total des déploiements",
- "unlinkApps": "Dissocier les applications",
"workers": "Ouvriers"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "Créer un modèle",
"deleteTemplate": "Supprimer le modèle",
"deleteThisCannotBeUndone": "Supprimer « {{name}} » ? Cela ne peut pas être annulé.",
- "driftCheckInitiated": "Vérification de la dérive lancée",
"failedToLoadTemplates": "Échec du chargement des modèles",
"firewall": "Pare-feu",
"firewallRules": "règles de pare-feu",
@@ -4644,7 +4623,6 @@
"packages": "Forfaits",
"packagesOnePerLine": "Forfaits (un par ligne)",
"remediation": "Assainissement",
- "remediationInitiated": "Correction lancée",
"selectAServerToApplyThis": "Sélectionnez un serveur pour appliquer ce modèle :",
"startFromAReadyMadeLibrary": "Commencez à partir d’un modèle de bibliothèque prêt à l’emploi ou créez-en un à partir de zéro.",
"template": "Modèle",
@@ -5768,7 +5746,7 @@
"textarea": "Zone de texte",
"theOld": "Le vieux",
"theQuickBrownFox": "— Le renard brun rapide",
- "theQuickBrownFoxJumpsOver": "Le rapide renard brun saute par-dessus le chien paresseux — Inter",
+ "theQuickBrownFoxJumpsOver": "Le rapide renard brun saute par-dessus le chien paresseux — IBM Plex Sans",
"theQuickBrownFoxJumpsOver2": "— Le rapide renard brun saute par-dessus le chien paresseux",
"theyPublishActionsThrough": "— ils publient des actions via",
"thisIsAFullWidthError": "Il s'agit d'une bannière d'erreur pleine largeur.",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "Déplacer un site dans cet espace de travail",
"moveOneInBelow": "Déplacez-en un ci-dessous.",
"noSitesInThisWorkspaceYet": "Aucun site dans cet espace de travail pour l'instant",
- "share": "Partager",
"site": "Site"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/id.json b/frontend/src/i18n/locales/id.json
index c61aebac..8249ec24 100644
--- a/frontend/src/i18n/locales/id.json
+++ b/frontend/src/i18n/locales/id.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 baris",
"200Lines": "200 baris",
"500Lines": "500 baris",
- "applicationLogs": "Log Aplikasi",
- "autoRefresh": "Segarkan otomatis",
"autoScroll": "Gulir otomatis",
"copyLogs": "Salin log",
"deployingThisService": "Menyebarkan layanan ini",
"deploymentFailed": "Penerapan gagal:",
"deploymentFinishedSuccessfully": "Penerapan selesai dengan sukses",
- "dockerComposeLogs": "Log Docker Compose",
"downloadLogs": "Unduh log",
- "gunicornSystemdLogs": "Log Gunicorn/systemd",
"live": "Hidup",
"loadingLogs": "Memuat log...",
"pinToDrawer": "Sematkan ke laci",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Tambahkan saluran pengiriman peringatan (Discord, Slack, Telegram) di Pengaturan → Pemberitahuan.",
"alerts24h": "Peringatan · 24 jam",
- "applicationInfo": "Informasi Aplikasi",
- "areYouSureYouWantTo": "Apakah Anda yakin ingin membatalkan tautan aplikasi ini? Kredensial basis data tidak akan berubah.",
"bandwidth": "Bandwidth",
- "clickRunDiagnosticsToCheckRouting": "Klik \"Jalankan Diagnostik\" untuk memeriksa konfigurasi perutean dan mengidentifikasi masalah.",
"computing": "Menghitung…",
- "cpuLoad": "Beban CPU",
"deployments": "Penerapan",
"enableAlerts": "Aktifkan peringatan",
"enableMonitoring": "Aktifkan pemantauan",
"environment": "Lingkungan",
- "environmentLinking": "Tautan Lingkungan",
"fileIntegrityMonitoringEnabled": "Pemantauan integritas file diaktifkan",
"initializeBaseline": "Inisialisasi garis dasar",
"integrityBaselineInitialized": "Garis dasar integritas diinisialisasi",
"integrityChanges": "Integritas · 24 jam",
"last90Days": "90 hari terakhir",
- "linkThisAppToAnotherTo": "Tautkan aplikasi ini ke aplikasi lain untuk membuat pasangan produksi/pengembangan. Aplikasi tertaut dapat berbagi kredensial database.",
- "liveResources": "Sumber Daya Langsung",
"loadingMetrics": "Memuat metrik...",
"malware": "perangkat lunak perusak",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "Tidak ada perubahan integritas (24 jam)",
"noRelatedResourcesYet": "Belum ada sumber daya terkait.",
"open": "Buka {{portUrl}}",
- "phpVersion": "Versi PHP",
- "processStatus": "Status Proses",
"processes": "Proses",
- "pythonVersion": "Versi Python",
- "ramUsage": "Penggunaan RAM",
"reCheck": "Periksa kembali",
"recentDeployments": "Penerapan Terbaru",
"relatedResources": "Sumber Daya Terkait",
"repository": "Gudang",
"resourceUsage": "Penggunaan Sumber Daya",
"reviewChanges": "Tinjau perubahan",
- "rootPath": "Jalur Akar",
- "routingDiagnostics": "Diagnostik Perutean",
"securityAlertsConfigured": "Peringatan keamanan dikonfigurasi",
"securityPosture": "Postur keamanan",
"serviceInfo": "Informasi Layanan",
- "startTheContainerToSeeLive": "Mulai penampung untuk melihat sumber daya langsung.",
"successful": "Berhasil",
- "tags": "Tag",
"thisMonth": "bulan ini",
"totalDeploys": "Total Penerapan",
- "unlinkApps": "Putuskan tautan Aplikasi",
"workers": "Pekerja"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "Buat Templat",
"deleteTemplate": "Hapus Templat",
"deleteThisCannotBeUndone": "Hapus \"{{name}}\"? Hal ini tidak dapat dibatalkan.",
- "driftCheckInitiated": "Pemeriksaan drift dimulai",
"failedToLoadTemplates": "Gagal memuat template",
"firewall": "tembok api",
"firewallRules": "aturan firewall",
@@ -4644,7 +4623,6 @@
"packages": "Paket",
"packagesOnePerLine": "Paket (satu per baris)",
"remediation": "Remediasi",
- "remediationInitiated": "Remediasi dimulai",
"selectAServerToApplyThis": "Pilih server untuk menerapkan templat ini:",
"startFromAReadyMadeLibrary": "Mulai dari templat perpustakaan yang sudah jadi, atau buat dari awal.",
"template": "Templat",
@@ -5768,7 +5746,7 @@
"textarea": "Area teks",
"theOld": "Yang lama",
"theQuickBrownFox": "— Rubah coklat yang gesit",
- "theQuickBrownFoxJumpsOver": "Rubah coklat yang gesit melompati anjing pemalas — Inter",
+ "theQuickBrownFoxJumpsOver": "Rubah coklat yang gesit melompati anjing pemalas — IBM Plex Sans",
"theQuickBrownFoxJumpsOver2": "— Rubah coklat yang gesit melompati anjing pemalas",
"theyPublishActionsThrough": "— mereka mempublikasikan tindakan melalui",
"thisIsAFullWidthError": "Ini adalah spanduk kesalahan dengan lebar penuh.",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "Pindahkan situs ke ruang kerja ini",
"moveOneInBelow": "Pindahkan satu ke bawah.",
"noSitesInThisWorkspaceYet": "Belum ada situs di ruang kerja ini",
- "share": "Membagikan",
"site": "Lokasi"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/it.json b/frontend/src/i18n/locales/it.json
index d4d143e2..b18859f6 100644
--- a/frontend/src/i18n/locales/it.json
+++ b/frontend/src/i18n/locales/it.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 righe",
"200Lines": "200 righe",
"500Lines": "500 righe",
- "applicationLogs": "Registri dell'applicazione",
- "autoRefresh": "Aggiornamento automatico",
"autoScroll": "Scorrimento automatico",
"copyLogs": "Copia i log",
"deployingThisService": "Distribuzione di questo servizio",
"deploymentFailed": "Distribuzione non riuscita:",
"deploymentFinishedSuccessfully": "La distribuzione è stata completata correttamente",
- "dockerComposeLogs": "Docker Compose Tronchi",
"downloadLogs": "Scarica i registri",
- "gunicornSystemdLogs": "Tronchi Gunicorn/systemd",
"live": "Vivere",
"loadingLogs": "Caricamento registri...",
"pinToDrawer": "Appunta al cassetto",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Aggiungi canali di consegna degli avvisi (Discord, Slack, Telegram) in Impostazioni → Notifiche.",
"alerts24h": "Avvisi · 24 ore su 24",
- "applicationInfo": "Informazioni sull'applicazione",
- "areYouSureYouWantTo": "Sei sicuro di voler scollegare queste app? Le credenziali del database rimarranno invariate.",
"bandwidth": "Larghezza di banda",
- "clickRunDiagnosticsToCheckRouting": "Fai clic su \"Esegui diagnostica\" per verificare la configurazione del routing e identificare i problemi.",
"computing": "Informatica…",
- "cpuLoad": "Carico della CPU",
"deployments": "Distribuzioni",
"enableAlerts": "Abilita avvisi",
"enableMonitoring": "Abilita il monitoraggio",
"environment": "Ambiente",
- "environmentLinking": "Collegamento all'ambiente",
"fileIntegrityMonitoringEnabled": "Monitoraggio dell'integrità dei file abilitato",
"initializeBaseline": "Inizializza la linea di base",
"integrityBaselineInitialized": "Base di integrità inizializzata",
"integrityChanges": "Integrità · 24h",
"last90Days": "Ultimi 90 giorni",
- "linkThisAppToAnotherTo": "Collega questa app a un'altra per creare una coppia produzione/sviluppo. Le app collegate possono condividere le credenziali del database.",
- "liveResources": "Risorse in tempo reale",
"loadingMetrics": "Caricamento metriche...",
"malware": "Malware",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "Nessuna modifica all'integrità (24 ore)",
"noRelatedResourcesYet": "Nessuna risorsa correlata ancora.",
"open": "Apri {{portUrl}}",
- "phpVersion": "Versione PHP",
- "processStatus": "Stato del processo",
"processes": "Processi",
- "pythonVersion": "Versione Python",
- "ramUsage": "Utilizzo della RAM",
"reCheck": "Ricontrolla",
"recentDeployments": "Distribuzioni recenti",
"relatedResources": "Risorse correlate",
"repository": "Deposito",
"resourceUsage": "Utilizzo delle risorse",
"reviewChanges": "Esaminare le modifiche",
- "rootPath": "Percorso radice",
- "routingDiagnostics": "Diagnostica del percorso",
"securityAlertsConfigured": "Avvisi di sicurezza configurati",
"securityPosture": "Atteggiamento di sicurezza",
"serviceInfo": "Informazioni sul servizio",
- "startTheContainerToSeeLive": "Avvia il contenitore per vedere le risorse live.",
"successful": "Riuscito",
- "tags": "Tag",
"thisMonth": "questo mese",
"totalDeploys": "Distribuzioni totali",
- "unlinkApps": "Scollega app",
"workers": "Lavoratori"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "Crea modello",
"deleteTemplate": "Elimina modello",
"deleteThisCannotBeUndone": "Eliminare \"{{name}}\"? Questa operazione non può essere annullata.",
- "driftCheckInitiated": "Controllo della deriva avviato",
"failedToLoadTemplates": "Impossibile caricare i modelli",
"firewall": "Firewall",
"firewallRules": "regole del firewall",
@@ -4644,7 +4623,6 @@
"packages": "Pacchetti",
"packagesOnePerLine": "Pacchetti (uno per riga)",
"remediation": "Bonifica",
- "remediationInitiated": "Avviata la bonifica",
"selectAServerToApplyThis": "Seleziona un server a cui applicare questo modello:",
"startFromAReadyMadeLibrary": "Inizia da un modello di libreria già pronto o creane uno da zero.",
"template": "Modello",
@@ -5768,7 +5746,7 @@
"textarea": "Area di testo",
"theOld": "Il vecchio",
"theQuickBrownFox": "- La veloce volpe marrone",
- "theQuickBrownFoxJumpsOver": "La veloce volpe marrone salta sopra il cane pigro - Inter",
+ "theQuickBrownFoxJumpsOver": "La veloce volpe marrone salta sopra il cane pigro - IBM Plex Sans",
"theQuickBrownFoxJumpsOver2": "— La veloce volpe marrone salta sopra il cane pigro",
"theyPublishActionsThrough": "- pubblicano azioni attraverso",
"thisIsAFullWidthError": "Questo è un banner di errore a larghezza intera.",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "Sposta un sito in quest'area di lavoro",
"moveOneInBelow": "Spostane uno qui sotto.",
"noSitesInThisWorkspaceYet": "Nessun sito ancora in quest'area di lavoro",
- "share": "Condividere",
"site": "Sito"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/ko.json b/frontend/src/i18n/locales/ko.json
index 1f2e3291..6e3be60f 100644
--- a/frontend/src/i18n/locales/ko.json
+++ b/frontend/src/i18n/locales/ko.json
@@ -2835,16 +2835,12 @@
"100Lines": "100줄",
"200Lines": "200줄",
"500Lines": "500줄",
- "applicationLogs": "애플리케이션 로그",
- "autoRefresh": "자동 새로고침",
"autoScroll": "자동 스크롤",
"copyLogs": "로그 복사",
"deployingThisService": "이 서비스 배포",
"deploymentFailed": "배포 실패:",
"deploymentFinishedSuccessfully": "배포가 성공적으로 완료되었습니다.",
- "dockerComposeLogs": "Docker Compose 로그",
"downloadLogs": "로그 다운로드",
- "gunicornSystemdLogs": "Gunicorn/systemd 로그",
"live": "라이브",
"loadingLogs": "로그 로드 중...",
"pinToDrawer": "서랍에 고정",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "설정 → 알림에서 알림 전달 채널(Discord, Slack, Telegram)을 추가하세요.",
"alerts24h": "알림 · 24시간",
- "applicationInfo": "신청정보",
- "areYouSureYouWantTo": "이 앱의 연결을 해제하시겠습니까? 데이터베이스 자격 증명은 변경되지 않습니다.",
"bandwidth": "대역폭",
- "clickRunDiagnosticsToCheckRouting": "라우팅 구성을 확인하고 문제를 식별하려면 \"진단 실행\"을 클릭하십시오.",
"computing": "컴퓨팅 중…",
- "cpuLoad": "CPU 부하",
"deployments": "배포",
"enableAlerts": "알림 활성화",
"enableMonitoring": "모니터링 활성화",
"environment": "환경",
- "environmentLinking": "환경 연결",
"fileIntegrityMonitoringEnabled": "파일 무결성 모니터링 활성화됨",
"initializeBaseline": "기준선 초기화",
"integrityBaselineInitialized": "무결성 기준이 초기화되었습니다.",
"integrityChanges": "무결성 · 24시간",
"last90Days": "지난 90일",
- "linkThisAppToAnotherTo": "이 앱을 다른 앱에 연결하여 프로덕션/개발 쌍을 만드세요. 연결된 앱은 데이터베이스 자격 증명을 공유할 수 있습니다.",
- "liveResources": "라이브 리소스",
"loadingMetrics": "측정항목 로드 중...",
"malware": "악성 코드",
"marketplaceLink": "마켓플레이스",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "무결성 변경 없음(24시간)",
"noRelatedResourcesYet": "아직 관련 자료가 없습니다.",
"open": "{{portUrl}} 열기",
- "phpVersion": "PHP 버전",
- "processStatus": "프로세스 상태",
"processes": "프로세스",
- "pythonVersion": "파이썬 버전",
- "ramUsage": "RAM 사용량",
"reCheck": "재확인",
"recentDeployments": "최근 배포",
"relatedResources": "관련 자료",
"repository": "저장소",
"resourceUsage": "자원 사용량",
"reviewChanges": "변경사항 검토",
- "rootPath": "루트 경로",
- "routingDiagnostics": "라우팅 진단",
"securityAlertsConfigured": "보안 경고가 구성되었습니다.",
"securityPosture": "보안 태세",
"serviceInfo": "서비스 정보",
- "startTheContainerToSeeLive": "라이브 리소스를 보려면 컨테이너를 시작하세요.",
"successful": "성공",
- "tags": "태그",
"thisMonth": "이번 달",
"totalDeploys": "총 배포",
- "unlinkApps": "앱 연결 해제",
"workers": "노동자"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "템플릿 생성",
"deleteTemplate": "템플릿 삭제",
"deleteThisCannotBeUndone": "\"{{name}}\"을(를) 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.",
- "driftCheckInitiated": "드리프트 체크 시작",
"failedToLoadTemplates": "템플릿을 로드하지 못했습니다.",
"firewall": "방화벽",
"firewallRules": "방화벽 규칙",
@@ -4644,7 +4623,6 @@
"packages": "패키지",
"packagesOnePerLine": "패키지(한 줄에 하나씩)",
"remediation": "교정",
- "remediationInitiated": "해결이 시작되었습니다.",
"selectAServerToApplyThis": "이 템플릿을 적용할 서버를 선택하세요.",
"startFromAReadyMadeLibrary": "미리 만들어진 라이브러리 템플릿에서 시작하거나 처음부터 새로 만듭니다.",
"template": "템플릿",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "사이트를 이 작업공간으로 이동",
"moveOneInBelow": "아래로 하나 이동하세요.",
"noSitesInThisWorkspaceYet": "이 작업공간에는 아직 사이트가 없습니다.",
- "share": "공유",
"site": "사이트"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/pl.json b/frontend/src/i18n/locales/pl.json
index 4f8a1852..4ceb2a56 100644
--- a/frontend/src/i18n/locales/pl.json
+++ b/frontend/src/i18n/locales/pl.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 linii",
"200Lines": "200 linii",
"500Lines": "500 linii",
- "applicationLogs": "Dzienniki aplikacji",
- "autoRefresh": "Automatyczne odświeżanie",
"autoScroll": "Automatyczne przewijanie",
"copyLogs": "Skopiuj logi",
"deployingThisService": "Wdrożenie tej usługi",
"deploymentFailed": "Wdrożenie nie powiodło się:",
"deploymentFinishedSuccessfully": "Wdrożenie zakończyło się pomyślnie",
- "dockerComposeLogs": "Dzienniki Docker Compose",
"downloadLogs": "Pobierz logi",
- "gunicornSystemdLogs": "Dzienniki Gunicorn/systemd",
"live": "Na żywo",
"loadingLogs": "Ładowanie dzienników...",
"pinToDrawer": "Przypnij do szuflady",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Dodaj kanały dostarczania alertów (Discord, Slack, Telegram) w Ustawieniach → Powiadomienia.",
"alerts24h": "Alerty · 24h",
- "applicationInfo": "Informacje o aplikacji",
- "areYouSureYouWantTo": "Czy na pewno chcesz odłączyć te aplikacje? Poświadczenia bazy danych pozostaną niezmienione.",
"bandwidth": "Przepustowość łącza",
- "clickRunDiagnosticsToCheckRouting": "Kliknij „Uruchom diagnostykę”, aby sprawdzić konfigurację routingu i zidentyfikować problemy.",
"computing": "Obliczanie…",
- "cpuLoad": "Obciążenie procesora",
"deployments": "Wdrożenia",
"enableAlerts": "Włącz alerty",
"enableMonitoring": "Włącz monitorowanie",
"environment": "Środowisko",
- "environmentLinking": "Łączenie środowiska",
"fileIntegrityMonitoringEnabled": "Włączono monitorowanie integralności plików",
"initializeBaseline": "Zainicjuj linię bazową",
"integrityBaselineInitialized": "Zainicjowano linię bazową integralności",
"integrityChanges": "Integralność · 24h",
"last90Days": "Ostatnie 90 dni",
- "linkThisAppToAnotherTo": "Połącz tę aplikację z inną, aby utworzyć parę produkcja/rozwój. Połączone aplikacje mogą udostępniać dane uwierzytelniające bazy danych.",
- "liveResources": "Zasoby na żywo",
"loadingMetrics": "Ładowanie danych...",
"malware": "Złośliwe oprogramowanie",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "Brak zmian integralności (24h)",
"noRelatedResourcesYet": "Nie ma jeszcze powiązanych zasobów.",
"open": "Otwórz {{portUrl}}",
- "phpVersion": "Wersja PHP",
- "processStatus": "Stan procesu",
"processes": "Procesy",
- "pythonVersion": "Wersja Python",
- "ramUsage": "Użycie pamięci RAM",
"reCheck": "Sprawdź ponownie",
"recentDeployments": "Ostatnie wdrożenia",
"relatedResources": "Powiązane zasoby",
"repository": "Magazyn",
"resourceUsage": "Wykorzystanie zasobów",
"reviewChanges": "Przejrzyj zmiany",
- "rootPath": "Ścieżka korzenia",
- "routingDiagnostics": "Diagnostyka routingu",
"securityAlertsConfigured": "Skonfigurowano alerty zabezpieczeń",
"securityPosture": "Postawa bezpieczeństwa",
"serviceInfo": "Informacje serwisowe",
- "startTheContainerToSeeLive": "Uruchom kontener, aby zobaczyć aktywne zasoby.",
"successful": "Udany",
- "tags": "Tagi",
"thisMonth": "w tym miesiącu",
"totalDeploys": "Łączna liczba wdrożeń",
- "unlinkApps": "Odłącz aplikacje",
"workers": "Pracownicy"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "Utwórz szablon",
"deleteTemplate": "Usuń szablon",
"deleteThisCannotBeUndone": "Usunąć „{{name}}”? Tego nie można cofnąć.",
- "driftCheckInitiated": "Rozpoczęto kontrolę dryfu",
"failedToLoadTemplates": "Nie udało się załadować szablonów",
"firewall": "Zapora sieciowa",
"firewallRules": "reguły zapory sieciowej",
@@ -4644,7 +4623,6 @@
"packages": "Pakiety",
"packagesOnePerLine": "Pakiety (po jednym w wierszu)",
"remediation": "Remediacja",
- "remediationInitiated": "Rozpoczęto naprawę",
"selectAServerToApplyThis": "Wybierz serwer, aby zastosować ten szablon:",
"startFromAReadyMadeLibrary": "Zacznij od gotowego szablonu biblioteki lub utwórz go od podstaw.",
"template": "Szablon",
@@ -5768,7 +5746,7 @@
"textarea": "Obszar tekstowy",
"theOld": "Stary",
"theQuickBrownFox": "— Szybki brązowy lis",
- "theQuickBrownFoxJumpsOver": "Szybki brązowy lis przeskakuje leniwego psa – Inter",
+ "theQuickBrownFoxJumpsOver": "Szybki brązowy lis przeskakuje leniwego psa – IBM Plex Sans",
"theQuickBrownFoxJumpsOver2": "— Szybki brązowy lis przeskakuje leniwego psa",
"theyPublishActionsThrough": "— publikują działania poprzez",
"thisIsAFullWidthError": "To jest baner błędu o pełnej szerokości.",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "Przenieś witrynę do tego obszaru roboczego",
"moveOneInBelow": "Przenieś jeden poniżej.",
"noSitesInThisWorkspaceYet": "Brak witryn w tym obszarze roboczym",
- "share": "Udział",
"site": "Strona"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/pt.json b/frontend/src/i18n/locales/pt.json
index 4288da5f..aef1cb92 100644
--- a/frontend/src/i18n/locales/pt.json
+++ b/frontend/src/i18n/locales/pt.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 linhas",
"200Lines": "200 linhas",
"500Lines": "500 linhas",
- "applicationLogs": "Registros de aplicativos",
- "autoRefresh": "Atualização automática",
"autoScroll": "Rolagem automática",
"copyLogs": "Copiar registros",
"deployingThisService": "Implantando este serviço",
"deploymentFailed": "Falha na implantação:",
"deploymentFinishedSuccessfully": "A implantação foi concluída com sucesso",
- "dockerComposeLogs": "Logs do Docker Compose",
"downloadLogs": "Baixar registros",
- "gunicornSystemdLogs": "Registros do Gunicorn/systemd",
"live": "Ao vivo",
"loadingLogs": "Carregando registros...",
"pinToDrawer": "Fixar na gaveta",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Adicione canais de entrega de alertas (Discord, Slack, Telegram) em Configurações → Notificações.",
"alerts24h": "Alertas · 24h",
- "applicationInfo": "Informações do aplicativo",
- "areYouSureYouWantTo": "Tem certeza de que deseja desvincular esses aplicativos? As credenciais do banco de dados permanecerão inalteradas.",
"bandwidth": "Largura de banda",
- "clickRunDiagnosticsToCheckRouting": "Clique em “Executar diagnóstico” para verificar a configuração de roteamento e identificar problemas.",
"computing": "Computação…",
- "cpuLoad": "Carga da CPU",
"deployments": "Implantações",
"enableAlerts": "Habilitar alertas",
"enableMonitoring": "Habilitar monitoramento",
"environment": "Meio Ambiente",
- "environmentLinking": "Vinculação de ambiente",
"fileIntegrityMonitoringEnabled": "Monitoramento de integridade de arquivos ativado",
"initializeBaseline": "Inicializar linha de base",
"integrityBaselineInitialized": "Linha de base de integridade inicializada",
"integrityChanges": "Integridade · 24h",
"last90Days": "Últimos 90 dias",
- "linkThisAppToAnotherTo": "Vincule este aplicativo a outro para criar um par produção/desenvolvimento. Os aplicativos vinculados podem compartilhar credenciais de banco de dados.",
- "liveResources": "Recursos ativos",
"loadingMetrics": "Carregando métricas...",
"malware": "Programas maliciosos",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "Sem alterações de integridade (24h)",
"noRelatedResourcesYet": "Ainda não há recursos relacionados.",
"open": "Abra {{portUrl}}",
- "phpVersion": "Versão PHP",
- "processStatus": "Status do Processo",
"processes": "Processos",
- "pythonVersion": "Versão Python",
- "ramUsage": "Uso de RAM",
"reCheck": "Verifique novamente",
"recentDeployments": "Implantações recentes",
"relatedResources": "Recursos relacionados",
"repository": "Repositório",
"resourceUsage": "Uso de recursos",
"reviewChanges": "Revise as alterações",
- "rootPath": "Caminho raiz",
- "routingDiagnostics": "Diagnóstico de roteamento",
"securityAlertsConfigured": "Alertas de segurança configurados",
"securityPosture": "Postura de segurança",
"serviceInfo": "Informações de serviço",
- "startTheContainerToSeeLive": "Inicie o contêiner para ver os recursos ativos.",
"successful": "Bem sucedido",
- "tags": "Etiquetas",
"thisMonth": "este mês",
"totalDeploys": "Total de implantações",
- "unlinkApps": "Desvincular aplicativos",
"workers": "Trabalhadores"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "Criar modelo",
"deleteTemplate": "Excluir modelo",
"deleteThisCannotBeUndone": "Excluir \"{{name}}\"? Isto não pode ser desfeito.",
- "driftCheckInitiated": "Verificação de desvio iniciada",
"failedToLoadTemplates": "Falha ao carregar modelos",
"firewall": "Firewall",
"firewallRules": "regras de firewall",
@@ -4644,7 +4623,6 @@
"packages": "Pacotes",
"packagesOnePerLine": "Pacotes (um por linha)",
"remediation": "Correção",
- "remediationInitiated": "Correção iniciada",
"selectAServerToApplyThis": "Selecione um servidor para aplicar este modelo:",
"startFromAReadyMadeLibrary": "Comece com um modelo de biblioteca pronto ou crie um do zero.",
"template": "Modelo",
@@ -5768,7 +5746,7 @@
"textarea": "Área de texto",
"theOld": "O velho",
"theQuickBrownFox": "— A rápida raposa marrom",
- "theQuickBrownFoxJumpsOver": "A rápida raposa marrom salta sobre o cachorro preguiçoso – Inter",
+ "theQuickBrownFoxJumpsOver": "A rápida raposa marrom salta sobre o cachorro preguiçoso – IBM Plex Sans",
"theQuickBrownFoxJumpsOver2": "— A rápida raposa marrom salta sobre o cachorro preguiçoso",
"theyPublishActionsThrough": "— eles publicam ações através",
"thisIsAFullWidthError": "Este é um banner de erro de largura total.",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "Mover um site para este espaço de trabalho",
"moveOneInBelow": "Mova um abaixo.",
"noSitesInThisWorkspaceYet": "Ainda não há sites neste espaço de trabalho",
- "share": "Compartilhar",
"site": "Local"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/ru.json b/frontend/src/i18n/locales/ru.json
index 1a85d6fa..6ef007ea 100644
--- a/frontend/src/i18n/locales/ru.json
+++ b/frontend/src/i18n/locales/ru.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 строк",
"200Lines": "200 строк",
"500Lines": "500 строк",
- "applicationLogs": "Журналы приложений",
- "autoRefresh": "Автообновление",
"autoScroll": "Автопрокрутка",
"copyLogs": "Копировать журналы",
"deployingThisService": "Развертывание этой службы",
"deploymentFailed": "Развертывание не удалось:",
"deploymentFinishedSuccessfully": "Развертывание завершено успешно",
- "dockerComposeLogs": "Docker Compose Logs",
"downloadLogs": "Скачать журналы",
- "gunicornSystemdLogs": "Журналы Gunicorn/systemd",
"live": "Работает",
"loadingLogs": "Загрузка журналов...",
"pinToDrawer": "Прикрепить к ящику",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Добавьте каналы доставки оповещений (Discord, Slack, Telegram) в «Настройки» → «Уведомления».",
"alerts24h": "Оповещения · 24 часа",
- "applicationInfo": "Информация о приложении",
- "areYouSureYouWantTo": "Вы уверены, что хотите отменить связь этих приложений? Учетные данные базы данных останутся неизменными.",
"bandwidth": "Пропускная способность",
- "clickRunDiagnosticsToCheckRouting": "Нажмите «Запустить диагностику», чтобы проверить конфигурацию маршрутизации и выявить проблемы.",
"computing": "Вычисление…",
- "cpuLoad": "Загрузка процессора",
"deployments": "Развертывания",
"enableAlerts": "Включить оповещения",
"enableMonitoring": "Включить мониторинг",
"environment": "Среда",
- "environmentLinking": "Связь с окружающей средой",
"fileIntegrityMonitoringEnabled": "Мониторинг целостности файлов включен",
"initializeBaseline": "Инициализировать базовый уровень",
"integrityBaselineInitialized": "Базовый уровень целостности инициализирован",
"integrityChanges": "Целостность · 24 ч",
"last90Days": "Последние 90 дней",
- "linkThisAppToAnotherTo": "Свяжите это приложение с другим, чтобы создать пару «производство/разработка». Связанные приложения могут совместно использовать учетные данные базы данных.",
- "liveResources": "Живые ресурсы",
"loadingMetrics": "Загрузка показателей...",
"malware": "Вредоносное ПО",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "Никаких изменений целостности (24 часа)",
"noRelatedResourcesYet": "Соответствующих ресурсов пока нет.",
"open": "Открыть {{portUrl}}",
- "phpVersion": "PHP-версия",
- "processStatus": "Статус процесса",
"processes": "Процессы",
- "pythonVersion": "Версия Python",
- "ramUsage": "Использование оперативной памяти",
"reCheck": "Перепроверить",
"recentDeployments": "Недавние развертывания",
"relatedResources": "Связанные ресурсы",
"repository": "Репозиторий",
"resourceUsage": "Использование ресурсов",
"reviewChanges": "Просмотрите изменения",
- "rootPath": "Корневой путь",
- "routingDiagnostics": "Диагностика маршрутизации",
"securityAlertsConfigured": "Оповещения безопасности настроены",
"securityPosture": "Положение безопасности",
"serviceInfo": "Информация об услуге",
- "startTheContainerToSeeLive": "Запустите контейнер, чтобы увидеть живые ресурсы.",
"successful": "Успешный",
- "tags": "Теги",
"thisMonth": "в этом месяце",
"totalDeploys": "Всего развертываний",
- "unlinkApps": "Отключить приложения",
"workers": "Рабочие процессы"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "Создать шаблон",
"deleteTemplate": "Удалить шаблон",
"deleteThisCannotBeUndone": "Удалить \"{{name}}\"? Это невозможно отменить.",
- "driftCheckInitiated": "Начата проверка дрейфа",
"failedToLoadTemplates": "Не удалось загрузить шаблоны.",
"firewall": "Брандмауэр",
"firewallRules": "правила брандмауэра",
@@ -4644,7 +4623,6 @@
"packages": "Пакеты",
"packagesOnePerLine": "Пакеты (по одному на строку)",
"remediation": "Исправление",
- "remediationInitiated": "Исправление начато",
"selectAServerToApplyThis": "Выберите сервер для применения этого шаблона:",
"startFromAReadyMadeLibrary": "Начните с готового шаблона библиотеки или создайте его с нуля.",
"template": "Шаблон",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "Переместить сайт в это рабочее пространство",
"moveOneInBelow": "Переместите один ниже.",
"noSitesInThisWorkspaceYet": "В этой рабочей области пока нет сайтов",
- "share": "Делиться",
"site": "Сайт"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/th.json b/frontend/src/i18n/locales/th.json
index 7a61680b..fc7eba44 100644
--- a/frontend/src/i18n/locales/th.json
+++ b/frontend/src/i18n/locales/th.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 เส้น",
"200Lines": "200 เส้น",
"500Lines": "500 เส้น",
- "applicationLogs": "บันทึกการใช้งาน",
- "autoRefresh": "รีเฟรชอัตโนมัติ",
"autoScroll": "เลื่อนอัตโนมัติ",
"copyLogs": "คัดลอกบันทึก",
"deployingThisService": "การปรับใช้บริการนี้",
"deploymentFailed": "การปรับใช้ล้มเหลว:",
"deploymentFinishedSuccessfully": "การปรับใช้เสร็จสิ้นเรียบร้อยแล้ว",
- "dockerComposeLogs": "บันทึก Docker Compose",
"downloadLogs": "ดาวน์โหลดบันทึก",
- "gunicornSystemdLogs": "บันทึก Gunicorn/systemd",
"live": "สด",
"loadingLogs": "กำลังโหลดบันทึก...",
"pinToDrawer": "ปักหมุดไว้ที่ลิ้นชัก",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "เพิ่มช่องทางการส่งการแจ้งเตือน (Discord, Slack, Telegram) ในการตั้งค่า → การแจ้งเตือน",
"alerts24h": "การแจ้งเตือน · 24 ชม",
- "applicationInfo": "ข้อมูลการสมัคร",
- "areYouSureYouWantTo": "คุณแน่ใจหรือไม่ว่าต้องการยกเลิกการเชื่อมโยงแอปเหล่านี้ ข้อมูลรับรองฐานข้อมูลจะยังคงไม่เปลี่ยนแปลง",
"bandwidth": "แบนด์วิธ",
- "clickRunDiagnosticsToCheckRouting": "คลิก \"เรียกใช้การวินิจฉัย\" เพื่อตรวจสอบการกำหนดค่าเส้นทางและระบุปัญหา",
"computing": "คอมพิวเตอร์...",
- "cpuLoad": "โหลดซีพียู",
"deployments": "การปรับใช้",
"enableAlerts": "เปิดใช้งานการแจ้งเตือน",
"enableMonitoring": "เปิดใช้งานการตรวจสอบ",
"environment": "สิ่งแวดล้อม",
- "environmentLinking": "การเชื่อมโยงสิ่งแวดล้อม",
"fileIntegrityMonitoringEnabled": "เปิดใช้งานการตรวจสอบความสมบูรณ์ของไฟล์แล้ว",
"initializeBaseline": "เริ่มต้นพื้นฐาน",
"integrityBaselineInitialized": "เริ่มต้นข้อมูลพื้นฐานด้านความสมบูรณ์แล้ว",
"integrityChanges": "ความสมบูรณ์ · 24 ชม.",
"last90Days": "90 วันที่ผ่านมา",
- "linkThisAppToAnotherTo": "เชื่อมโยงแอปนี้กับแอปอื่นเพื่อสร้างคู่การผลิต/การพัฒนา แอพที่เชื่อมโยงสามารถแชร์ข้อมูลรับรองฐานข้อมูลได้",
- "liveResources": "ทรัพยากรสด",
"loadingMetrics": "กำลังโหลดเมตริก...",
"malware": "มัลแวร์",
"marketplaceLink": "มาร์เก็ตเพลส",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "ไม่มีการเปลี่ยนแปลงความสมบูรณ์ (24 ชม.)",
"noRelatedResourcesYet": "ยังไม่มีทรัพยากรที่เกี่ยวข้อง",
"open": "เปิด {{portUrl}}",
- "phpVersion": "เวอร์ชัน PHP",
- "processStatus": "สถานะกระบวนการ",
"processes": "กระบวนการ",
- "pythonVersion": "เวอร์ชัน Python",
- "ramUsage": "การใช้แรม",
"reCheck": "ตรวจสอบอีกครั้ง",
"recentDeployments": "การปรับใช้ล่าสุด",
"relatedResources": "แหล่งข้อมูลที่เกี่ยวข้อง",
"repository": "พื้นที่เก็บข้อมูล",
"resourceUsage": "การใช้ทรัพยากร",
"reviewChanges": "ตรวจสอบการเปลี่ยนแปลง",
- "rootPath": "เส้นทางราก",
- "routingDiagnostics": "การวินิจฉัยเส้นทาง",
"securityAlertsConfigured": "กำหนดค่าการแจ้งเตือนความปลอดภัยแล้ว",
"securityPosture": "ท่าทางการรักษาความปลอดภัย",
"serviceInfo": "ข้อมูลการบริการ",
- "startTheContainerToSeeLive": "เริ่มคอนเทนเนอร์เพื่อดูทรัพยากรที่ใช้งานอยู่",
"successful": "ประสบความสำเร็จ",
- "tags": "แท็ก",
"thisMonth": "เดือนนี้",
"totalDeploys": "การปรับใช้ทั้งหมด",
- "unlinkApps": "ยกเลิกการเชื่อมโยงแอป",
"workers": "คนงาน"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "สร้างเทมเพลต",
"deleteTemplate": "ลบเทมเพลต",
"deleteThisCannotBeUndone": "ลบ \"{{name}}\" หรือไม่ สิ่งนี้ไม่สามารถยกเลิกได้",
- "driftCheckInitiated": "เริ่มต้นการตรวจสอบดริฟท์แล้ว",
"failedToLoadTemplates": "โหลดเทมเพลตไม่สำเร็จ",
"firewall": "ไฟร์วอลล์",
"firewallRules": "กฎไฟร์วอลล์",
@@ -4644,7 +4623,6 @@
"packages": "แพ็คเกจ",
"packagesOnePerLine": "แพ็คเกจ (หนึ่งรายการต่อบรรทัด)",
"remediation": "การแก้ไข",
- "remediationInitiated": "เริ่มการแก้ไขแล้ว",
"selectAServerToApplyThis": "เลือกเซิร์ฟเวอร์เพื่อใช้เทมเพลตนี้:",
"startFromAReadyMadeLibrary": "เริ่มจากเทมเพลตไลบรารีสำเร็จรูป หรือสร้างใหม่ตั้งแต่ต้น",
"template": "แม่แบบ",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "ย้ายไซต์ไปยังพื้นที่ทำงานนี้",
"moveOneInBelow": "ย้ายอันหนึ่งไปไว้ด้านล่าง",
"noSitesInThisWorkspaceYet": "ยังไม่มีไซต์ในพื้นที่ทำงานนี้",
- "share": "แบ่งปัน",
"site": "เว็บไซต์"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/tr.json b/frontend/src/i18n/locales/tr.json
index d140fee8..cc372ec2 100644
--- a/frontend/src/i18n/locales/tr.json
+++ b/frontend/src/i18n/locales/tr.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 satır",
"200Lines": "200 satır",
"500Lines": "500 satır",
- "applicationLogs": "Uygulama Günlükleri",
- "autoRefresh": "Otomatik yenileme",
"autoScroll": "Otomatik kaydırma",
"copyLogs": "Günlükleri kopyala",
"deployingThisService": "Bu hizmeti dağıtma",
"deploymentFailed": "Dağıtım başarısız oldu:",
"deploymentFinishedSuccessfully": "Dağıtım başarıyla tamamlandı",
- "dockerComposeLogs": "Docker Compose Günlükler",
"downloadLogs": "Günlükleri indir",
- "gunicornSystemdLogs": "Gunicorn/systemd Günlükler",
"live": "Canlı",
"loadingLogs": "Günlükler yükleniyor...",
"pinToDrawer": "Çekmeceye sabitle",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Ayarlar → Bildirimler'e uyarı dağıtım kanalları (Discord, Slack, Telegram) ekleyin.",
"alerts24h": "Uyarılar · 24 saat",
- "applicationInfo": "Başvuru Bilgileri",
- "areYouSureYouWantTo": "Bu uygulamaların bağlantısını kaldırmak istediğinizden emin misiniz? Veritabanı kimlik bilgileri değişmeden kalacaktır.",
"bandwidth": "Bant genişliği",
- "clickRunDiagnosticsToCheckRouting": "Yönlendirme yapılandırmasını kontrol etmek ve sorunları tanımlamak için \"Tanılamayı Çalıştır\"ı tıklayın.",
"computing": "Bilgisayar…",
- "cpuLoad": "CPU Yükü",
"deployments": "Dağıtımlar",
"enableAlerts": "Uyarıları etkinleştir",
"enableMonitoring": "İzlemeyi etkinleştir",
"environment": "Çevre",
- "environmentLinking": "Çevre Bağlantısı",
"fileIntegrityMonitoringEnabled": "Dosya bütünlüğü izleme etkin",
"initializeBaseline": "Taban çizgisini başlat",
"integrityBaselineInitialized": "Bütünlük temel çizgisi başlatıldı",
"integrityChanges": "Bütünlük · 24 sa",
"last90Days": "Son 90 gün",
- "linkThisAppToAnotherTo": "Bir üretim/geliştirme çifti oluşturmak için bu uygulamayı diğerine bağlayın. Bağlantılı uygulamalar veritabanı kimlik bilgilerini paylaşabilir.",
- "liveResources": "Canlı Kaynaklar",
"loadingMetrics": "Metrikler yükleniyor...",
"malware": "Kötü amaçlı yazılım",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "Bütünlük değişikliği yok (24 saat)",
"noRelatedResourcesYet": "Henüz ilgili kaynak yok.",
"open": "{{portUrl}}'yi açın",
- "phpVersion": "PHP Sürümü",
- "processStatus": "Süreç Durumu",
"processes": "Süreçler",
- "pythonVersion": "Python Sürümü",
- "ramUsage": "RAM Kullanımı",
"reCheck": "Tekrar kontrol et",
"recentDeployments": "Son Dağıtımlar",
"relatedResources": "İlgili Kaynaklar",
"repository": "Depo",
"resourceUsage": "Kaynak Kullanımı",
"reviewChanges": "Değişiklikleri inceleyin",
- "rootPath": "Kök Yolu",
- "routingDiagnostics": "Yönlendirme Teşhisi",
"securityAlertsConfigured": "Güvenlik uyarıları yapılandırıldı",
"securityPosture": "Güvenlik duruşu",
"serviceInfo": "Servis Bilgisi",
- "startTheContainerToSeeLive": "Canlı kaynakları görmek için kapsayıcıyı başlatın.",
"successful": "Başarılı",
- "tags": "Etiketler",
"thisMonth": "bu ay",
"totalDeploys": "Toplam Dağıtımlar",
- "unlinkApps": "Uygulamaların Bağlantısını Kaldır",
"workers": "İşçiler"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "Şablon Oluştur",
"deleteTemplate": "Şablonu Sil",
"deleteThisCannotBeUndone": "\"{{name}}\" silinsin mi? Bu geri alınamaz.",
- "driftCheckInitiated": "Drift kontrolü başlatıldı",
"failedToLoadTemplates": "Şablonlar yüklenemedi",
"firewall": "Güvenlik duvarı",
"firewallRules": "güvenlik duvarı kuralları",
@@ -4644,7 +4623,6 @@
"packages": "Paketler",
"packagesOnePerLine": "Paketler (satır başına bir tane)",
"remediation": "İyileştirme",
- "remediationInitiated": "Düzeltme başlatıldı",
"selectAServerToApplyThis": "Bu şablonu uygulamak için bir sunucu seçin:",
"startFromAReadyMadeLibrary": "Hazır bir kitaplık şablonundan başlayın veya sıfırdan bir şablon oluşturun.",
"template": "Şablon",
@@ -5768,7 +5746,7 @@
"textarea": "Metin alanı",
"theOld": "Eski",
"theQuickBrownFox": "— Hızlı kahverengi tilki",
- "theQuickBrownFoxJumpsOver": "Hızlı kahverengi tilki tembel köpeğin üzerinden atlıyor - Inter",
+ "theQuickBrownFoxJumpsOver": "Hızlı kahverengi tilki tembel köpeğin üzerinden atlıyor - IBM Plex Sans",
"theQuickBrownFoxJumpsOver2": "— Hızlı kahverengi tilki tembel köpeğin üzerinden atlıyor",
"theyPublishActionsThrough": "— eylemleri aracılığıyla yayınlıyorlar",
"thisIsAFullWidthError": "Bu tam genişlikte bir hata başlığıdır.",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "Bir siteyi bu çalışma alanına taşıyın",
"moveOneInBelow": "Birini aşağıya taşıyın.",
"noSitesInThisWorkspaceYet": "Bu çalışma alanında henüz site yok",
- "share": "Paylaşmak",
"site": "Alan"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/vi.json b/frontend/src/i18n/locales/vi.json
index 3c2f0cc8..e900a454 100644
--- a/frontend/src/i18n/locales/vi.json
+++ b/frontend/src/i18n/locales/vi.json
@@ -2835,16 +2835,12 @@
"100Lines": "100 dòng",
"200Lines": "200 dòng",
"500Lines": "500 dòng",
- "applicationLogs": "Nhật ký ứng dụng",
- "autoRefresh": "Tự động làm mới",
"autoScroll": "Tự động cuộn",
"copyLogs": "Sao chép nhật ký",
"deployingThisService": "Triển khai dịch vụ này",
"deploymentFailed": "Triển khai không thành công:",
"deploymentFinishedSuccessfully": "Triển khai đã kết thúc thành công",
- "dockerComposeLogs": "Nhật ký Docker Compose",
"downloadLogs": "Tải xuống nhật ký",
- "gunicornSystemdLogs": "Nhật ký Gunicorn/systemd",
"live": "Sống",
"loadingLogs": "Đang tải nhật ký...",
"pinToDrawer": "Ghim vào ngăn kéo",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "Thêm các kênh gửi cảnh báo (Discord, Slack, Telegram) trong Cài đặt → Thông báo.",
"alerts24h": "Cảnh báo · 24h",
- "applicationInfo": "Thông tin ứng dụng",
- "areYouSureYouWantTo": "Bạn có chắc chắn muốn hủy liên kết các ứng dụng này không? Thông tin xác thực cơ sở dữ liệu sẽ không thay đổi.",
"bandwidth": "Băng thông",
- "clickRunDiagnosticsToCheckRouting": "Nhấp vào \"Chạy chẩn đoán\" để kiểm tra cấu hình định tuyến và xác định sự cố.",
"computing": "Máy tính…",
- "cpuLoad": "Tải CPU",
"deployments": "Triển khai",
"enableAlerts": "Bật cảnh báo",
"enableMonitoring": "Bật giám sát",
"environment": "Môi trường",
- "environmentLinking": "Liên kết môi trường",
"fileIntegrityMonitoringEnabled": "Đã bật tính năng giám sát tính toàn vẹn của tệp",
"initializeBaseline": "Khởi tạo đường cơ sở",
"integrityBaselineInitialized": "Đã khởi tạo đường cơ sở về tính toàn vẹn",
"integrityChanges": "Toàn vẹn · 24h",
"last90Days": "90 ngày qua",
- "linkThisAppToAnotherTo": "Liên kết ứng dụng này với ứng dụng khác để tạo cặp sản xuất/phát triển. Các ứng dụng được liên kết có thể chia sẻ thông tin xác thực cơ sở dữ liệu.",
- "liveResources": "Tài nguyên trực tiếp",
"loadingMetrics": "Đang tải số liệu...",
"malware": "Phần mềm độc hại",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "Không có thay đổi về tính toàn vẹn (24h)",
"noRelatedResourcesYet": "Chưa có tài nguyên liên quan.",
"open": "Mở {{portUrl}}",
- "phpVersion": "Phiên bản PHP",
- "processStatus": "Trạng thái quy trình",
"processes": "Quy trình",
- "pythonVersion": "Phiên bản Python",
- "ramUsage": "Sử dụng RAM",
"reCheck": "Kiểm tra lại",
"recentDeployments": "Triển khai gần đây",
"relatedResources": "Tài nguyên liên quan",
"repository": "Kho lưu trữ",
"resourceUsage": "Sử dụng tài nguyên",
"reviewChanges": "Xem lại các thay đổi",
- "rootPath": "Đường dẫn gốc",
- "routingDiagnostics": "Chẩn đoán định tuyến",
"securityAlertsConfigured": "Cảnh báo bảo mật được định cấu hình",
"securityPosture": "Tư thế an ninh",
"serviceInfo": "Thông tin dịch vụ",
- "startTheContainerToSeeLive": "Khởi động vùng chứa để xem tài nguyên trực tiếp.",
"successful": "Thành công",
- "tags": "Thẻ",
"thisMonth": "tháng này",
"totalDeploys": "Tổng số lần triển khai",
- "unlinkApps": "Hủy liên kết ứng dụng",
"workers": "Công nhân"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "Tạo mẫu",
"deleteTemplate": "Xóa mẫu",
"deleteThisCannotBeUndone": "Xóa \"{{name}}\"? Điều này không thể hoàn tác được.",
- "driftCheckInitiated": "Đã bắt đầu kiểm tra trôi dạt",
"failedToLoadTemplates": "Không tải được mẫu",
"firewall": "Tường lửa",
"firewallRules": "quy tắc tường lửa",
@@ -4644,7 +4623,6 @@
"packages": "Gói",
"packagesOnePerLine": "Các gói (một trên mỗi dòng)",
"remediation": "Cách khắc phục",
- "remediationInitiated": "Đã bắt đầu khắc phục",
"selectAServerToApplyThis": "Chọn một máy chủ để áp dụng mẫu này:",
"startFromAReadyMadeLibrary": "Bắt đầu từ mẫu thư viện có sẵn hoặc tạo mẫu từ đầu.",
"template": "Bản mẫu",
@@ -5768,7 +5746,7 @@
"textarea": "Vùng văn bản",
"theOld": "cái cũ",
"theQuickBrownFox": "- Con cáo nâu nhanh nhẹn",
- "theQuickBrownFoxJumpsOver": "Cáo nâu nhanh nhẹn nhảy qua chó lười - Inter",
+ "theQuickBrownFoxJumpsOver": "Cáo nâu nhanh nhẹn nhảy qua chó lười - IBM Plex Sans",
"theQuickBrownFoxJumpsOver2": "— Cáo nâu nhanh nhẹn nhảy qua chó lười",
"theyPublishActionsThrough": "— họ công bố các hành động thông qua",
"thisIsAFullWidthError": "Đây là biểu ngữ lỗi có chiều rộng đầy đủ.",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "Di chuyển một trang web vào không gian làm việc này",
"moveOneInBelow": "Di chuyển một cái vào bên dưới.",
"noSitesInThisWorkspaceYet": "Chưa có trang web nào trong không gian làm việc này",
- "share": "Chia sẻ",
"site": "Địa điểm"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/zh-Hans.json b/frontend/src/i18n/locales/zh-Hans.json
index c00ae91a..589e3eb8 100644
--- a/frontend/src/i18n/locales/zh-Hans.json
+++ b/frontend/src/i18n/locales/zh-Hans.json
@@ -2835,16 +2835,12 @@
"100Lines": "100行",
"200Lines": "200行",
"500Lines": "500行",
- "applicationLogs": "应用程序日志",
- "autoRefresh": "自动刷新",
"autoScroll": "自动滚动",
"copyLogs": "复制日志",
"deployingThisService": "部署此服务",
"deploymentFailed": "部署失败:",
"deploymentFinishedSuccessfully": "部署成功完成",
- "dockerComposeLogs": "Docker 撰写日志",
"downloadLogs": "下载日志",
- "gunicornSystemdLogs": "Gunicorn/systemd 日志",
"live": "实时",
"loadingLogs": "正在加载日志...",
"pinToDrawer": "用别针固定在抽屉上",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "在“设置”→“通知”中添加警报传递渠道(Discord、Slack、Telegram)。",
"alerts24h": "警报 · 24 小时",
- "applicationInfo": "应用信息",
- "areYouSureYouWantTo": "您确定要取消这些应用程序的链接吗?数据库凭据将保持不变。",
"bandwidth": "带宽",
- "clickRunDiagnosticsToCheckRouting": "单击“运行诊断”以检查路由配置并识别问题。",
"computing": "计算...",
- "cpuLoad": "CPU负载",
"deployments": "部署",
"enableAlerts": "启用警报",
"enableMonitoring": "启用监控",
"environment": "环境",
- "environmentLinking": "环境链接",
"fileIntegrityMonitoringEnabled": "启用文件完整性监控",
"initializeBaseline": "初始化基线",
"integrityBaselineInitialized": "完整性基线已初始化",
"integrityChanges": "完整性 · 24 小时",
"last90Days": "过去 90 天",
- "linkThisAppToAnotherTo": "将此应用程序链接到另一个应用程序以创建生产/开发对。链接的应用程序可以共享数据库凭据。",
- "liveResources": "实时资源",
"loadingMetrics": "正在加载指标...",
"malware": "恶意软件",
"marketplaceLink": "应用市场",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "完整性无变化(24小时)",
"noRelatedResourcesYet": "还没有相关资源。",
"open": "打开 {{portUrl}}",
- "phpVersion": "PHP版本",
- "processStatus": "进程状态",
"processes": "进程",
- "pythonVersion": "Python版本",
- "ramUsage": "内存使用情况",
"reCheck": "重新检查",
"recentDeployments": "最近的部署",
"relatedResources": "相关资源",
"repository": "仓库",
"resourceUsage": "资源使用情况",
"reviewChanges": "审查变更",
- "rootPath": "根路径",
- "routingDiagnostics": "路由诊断",
"securityAlertsConfigured": "已配置安全警报",
"securityPosture": "安全态势",
"serviceInfo": "服务信息",
- "startTheContainerToSeeLive": "启动容器以查看实时资源。",
"successful": "成功的",
- "tags": "标签",
"thisMonth": "本月",
"totalDeploys": "部署总数",
- "unlinkApps": "取消链接应用程序",
"workers": "工作进程"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "创建模板",
"deleteTemplate": "删除模板",
"deleteThisCannotBeUndone": "删除“{{name}}”?此操作无法撤消。",
- "driftCheckInitiated": "漂移检查已启动",
"failedToLoadTemplates": "加载模板失败",
"firewall": "防火墙",
"firewallRules": "防火墙规则",
@@ -4644,7 +4623,6 @@
"packages": "套餐",
"packagesOnePerLine": "套餐(每行一个)",
"remediation": "补救措施",
- "remediationInitiated": "已启动修复",
"selectAServerToApplyThis": "选择一个服务器来应用此模板:",
"startFromAReadyMadeLibrary": "从现成的库模板开始,或从头开始创建一个。",
"template": "模板",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "将站点移至此工作区",
"moveOneInBelow": "把一个移到下面。",
"noSitesInThisWorkspaceYet": "此工作区中还没有网站",
- "share": "分享",
"site": "地点"
},
"workspaceSwitcher": {
diff --git a/frontend/src/i18n/locales/zh-Hant.json b/frontend/src/i18n/locales/zh-Hant.json
index 7b08226e..ba4f64f2 100644
--- a/frontend/src/i18n/locales/zh-Hant.json
+++ b/frontend/src/i18n/locales/zh-Hant.json
@@ -2835,16 +2835,12 @@
"100Lines": "100行",
"200Lines": "200行",
"500Lines": "500行",
- "applicationLogs": "應用程式日誌",
- "autoRefresh": "自動重新整理",
"autoScroll": "自動捲動",
"copyLogs": "複製日誌",
"deployingThisService": "部署此服務",
"deploymentFailed": "部署失敗:",
"deploymentFinishedSuccessfully": "部署成功完成",
- "dockerComposeLogs": "Docker Compose 日誌",
"downloadLogs": "下載日誌",
- "gunicornSystemdLogs": "Gunicorn/systemd 日誌",
"live": "居住",
"loadingLogs": "正在載入日誌...",
"pinToDrawer": "用別針固定在抽屜上",
@@ -3464,24 +3460,17 @@
"overviewTab": {
"addAlertDeliveryChannelsDiscordSlack": "在「設定」→「通知」中新增警報傳遞管道(Discord、Slack、Telegram)。",
"alerts24h": "警報 · 24 小時",
- "applicationInfo": "應用程式資訊",
- "areYouSureYouWantTo": "您確定要取消這些應用程式的連結嗎?資料庫憑證將保持不變。",
"bandwidth": "頻寬",
- "clickRunDiagnosticsToCheckRouting": "按一下“運行診斷”以檢查路由配置並識別問題。",
"computing": "計算...",
- "cpuLoad": "CPU負載",
"deployments": "部署",
"enableAlerts": "啟用警報",
"enableMonitoring": "啟用監控",
"environment": "環境",
- "environmentLinking": "環境連結",
"fileIntegrityMonitoringEnabled": "啟用檔案完整性監控",
"initializeBaseline": "初始化基線",
"integrityBaselineInitialized": "完整性基線已初始化",
"integrityChanges": "完整性 · 24 小時",
"last90Days": "過去 90 天",
- "linkThisAppToAnotherTo": "將此應用程式連結到另一個應用程式以建立生產/開發對。連結的應用程式可以共享資料庫憑證。",
- "liveResources": "即時資源",
"loadingMetrics": "正在加載指標...",
"malware": "惡意軟體",
"marketplaceLink": "Marketplace",
@@ -3491,28 +3480,19 @@
"noIntegrityChanges24h": "完整性無變化(24小時)",
"noRelatedResourcesYet": "還沒有相關資源。",
"open": "開啟{{portUrl}}",
- "phpVersion": "PHP版本",
- "processStatus": "行程狀態",
"processes": "流程",
- "pythonVersion": "Python版本",
- "ramUsage": "記憶體使用情況",
"reCheck": "重新檢查",
"recentDeployments": "最近的部署",
"relatedResources": "相關資源",
"repository": "儲存庫",
"resourceUsage": "資源使用情況",
"reviewChanges": "審查變更",
- "rootPath": "根路徑",
- "routingDiagnostics": "路由診斷",
"securityAlertsConfigured": "已配置安全警報",
"securityPosture": "安全態勢",
"serviceInfo": "服務資訊",
- "startTheContainerToSeeLive": "啟動容器以查看即時資源。",
"successful": "成功的",
- "tags": "標籤",
"thisMonth": "本月",
"totalDeploys": "部署總數",
- "unlinkApps": "取消連結應用程式",
"workers": "勞工"
},
"packagesTab": {
@@ -4634,7 +4614,6 @@
"createTemplate": "建立模板",
"deleteTemplate": "刪除模板",
"deleteThisCannotBeUndone": "刪除“{{name}}”?此操作無法撤銷。",
- "driftCheckInitiated": "漂移檢查已啟動",
"failedToLoadTemplates": "載入模板失敗",
"firewall": "防火牆",
"firewallRules": "防火牆規則",
@@ -4644,7 +4623,6 @@
"packages": "套餐",
"packagesOnePerLine": "套餐(每行一個)",
"remediation": "補救措施",
- "remediationInitiated": "已啟動修復",
"selectAServerToApplyThis": "選擇一個伺服器來應用此模板:",
"startFromAReadyMadeLibrary": "從現成的庫模板開始,或從頭開始建立一個。",
"template": "範本",
@@ -6653,7 +6631,6 @@
"moveASiteIntoThisWorkspace": "將站點移至此工作區",
"moveOneInBelow": "把一個移到下面。",
"noSitesInThisWorkspaceYet": "此工作區中還沒有網站",
- "share": "分享",
"site": "地點"
},
"workspaceSwitcher": {
diff --git a/frontend/src/pages/AgentFleet.jsx b/frontend/src/pages/AgentFleet.jsx
index d8267b43..61d458c3 100644
--- a/frontend/src/pages/AgentFleet.jsx
+++ b/frontend/src/pages/AgentFleet.jsx
@@ -1,36 +1,31 @@
-import { useState, useEffect, useCallback } from 'react';
+import { useCallback, useState, useEffect } from 'react';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import {
Shield,
Activity,
- Download,
RefreshCw,
CheckCircle,
AlertCircle,
Clock,
Zap,
Search,
- ChevronRight,
Server,
- Layers,
Package,
Play,
- Pause,
XCircle,
Wifi,
WifiOff,
- RotateCcw,
- Info
+ RotateCcw
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
-import { useAuth } from '../contexts/AuthContext';
+import { useToast } from '../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Badge } from '@/components/ui/badge';
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { MetricCard, KpiBand, Pill, Gauge, DataTable, DataTableFooter, statusKind } from '@/components/ds';
import { useTranslation } from 'react-i18next';
+import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';
const AgentFleet = () => {
const { t } = useTranslation();
@@ -43,30 +38,16 @@ const AgentFleet = () => {
const [rollouts, setRollouts] = useState([]);
const [queuedCommands, setQueuedCommands] = useState([]);
const [diagnostics, setDiagnostics] = useState(null);
- const [diagnosticsServerId, setDiagnosticsServerId] = useState('');
const [isScanning, setIsScanning] = useState(false);
const [selectedVersion, setSelectedVersion] = useState('');
const [rolloutStrategy, setRolloutStrategy] = useState('all');
const [rolloutBatchSize, setRolloutBatchSize] = useState(5);
const [rolloutDelay, setRolloutDelay] = useState(10);
const toast = useToast();
- const { user } = useAuth();
+ const toastError = toast.error;
- useEffect(() => {
- fetchData();
- }, [activeTab]);
-
- // Publish the Refresh button to the shared tab-group top bar; re-registers
- // on `loading` so the spinner/disabled state stays in sync.
- useTopbarActions(() =>
- <Button size="sm" onClick={fetchData} disabled={loading}>
- <RefreshCw size={18} className={loading ? 'animate-spin' : ''} />
- {t('common.actions.refresh', 'Refresh')}
- </Button>,
- [loading]
- );
- const fetchData = async () => {
+ const fetchData = useCallback(async () => {
setLoading(true);
try {
if (activeTab === 'dashboard') {
@@ -82,8 +63,8 @@ const AgentFleet = () => {
]);
setRollouts(rolloutData);
setVersions(versionData);
- if (versionData.length > 0 && !selectedVersion) {
- setSelectedVersion(versionData[0].id);
+ if (versionData.length > 0) {
+ setSelectedVersion(current => current || versionData[0].id);
}
} else if (activeTab === 'discovery') {
const data = await api.getDiscoveredAgents();
@@ -97,11 +78,26 @@ const AgentFleet = () => {
}
} catch (error) {
console.error('Error fetching fleet data:', error);
- toast.error(t('app.agentFleet.failedToFetchFleetData', 'Failed to fetch fleet data'));
+ toastError(t('app.agentFleet.failedToFetchFleetData', 'Failed to fetch fleet data'));
} finally {
setLoading(false);
}
- };
+ }, [activeTab, t, toastError]);
+
+ useEffect(() => {
+ fetchData();
+ }, [fetchData]);
+
+ // Publish the Refresh button to the shared tab-group top bar; re-registers
+ // on `loading` so the spinner/disabled state stays in sync.
+ useTopbarActions(() =>
+ <Button size="sm" onClick={fetchData} disabled={loading}>
+ <RefreshCw size={18} className={loading ? 'fleet-refresh-spinner' : ''} />
+ {t('common.actions.refresh', 'Refresh')}
+ </Button>,
+ [loading]
+ );
+
const startDiscovery = async () => {
setIsScanning(true);
@@ -111,7 +107,7 @@ const AgentFleet = () => {
const data = await api.getDiscoveredAgents();
setDiscoveredAgents(data);
toast.success(t('app.agentFleet.discoveredAgents', 'Discovered {{length}} agents', { length: data.length }));
- } catch (error) {
+ } catch {
toast.error(t('app.agentFleet.discoveryScanFailed', 'Discovery scan failed'));
} finally {
setIsScanning(false);
@@ -123,7 +119,7 @@ const AgentFleet = () => {
await api.approveRegistration(serverId);
toast.success(t('app.agentFleet.agentRegistrationApproved', 'Agent registration approved'));
fetchData();
- } catch (error) {
+ } catch {
toast.error(t('app.agentFleet.failedToApproveAgent', 'Failed to approve agent'));
}
};
@@ -133,7 +129,7 @@ const AgentFleet = () => {
await api.rejectRegistration(serverId);
toast.success(t('app.agentFleet.agentRegistrationRejected', 'Agent registration rejected'));
fetchData();
- } catch (error) {
+ } catch {
toast.error(t('app.agentFleet.failedToRejectAgent', 'Failed to reject agent'));
}
};
@@ -159,7 +155,7 @@ const AgentFleet = () => {
toast.success(t('app.agentFleet.stagedRolloutStarted', 'Staged rollout started'));
}
fetchData();
- } catch (error) {
+ } catch {
toast.error(t('app.agentFleet.failedToTriggerUpgrade', 'Failed to trigger upgrade'));
}
};
@@ -169,7 +165,7 @@ const AgentFleet = () => {
await api.cancelRollout(rolloutId);
toast.success(t('app.agentFleet.rolloutCancelled', 'Rollout cancelled'));
fetchData();
- } catch (error) {
+ } catch {
toast.error(t('app.agentFleet.failedToCancelRollout', 'Failed to cancel rollout'));
}
};
@@ -179,7 +175,7 @@ const AgentFleet = () => {
await api.retryCommand(commandId);
toast.success(t('app.agentFleet.commandRetryTriggered', 'Command retry triggered'));
fetchData();
- } catch (error) {
+ } catch {
toast.error(t('app.agentFleet.failedToRetryCommand', 'Failed to retry command'));
}
};
@@ -188,8 +184,7 @@ const AgentFleet = () => {
try {
const data = await api.getServerDiagnostics(serverId);
setDiagnostics(data);
- setDiagnosticsServerId(serverId);
- } catch (error) {
+ } catch {
toast.error(t('app.agentFleet.failedToLoadDiagnostics', 'Failed to load diagnostics'));
}
};
@@ -205,7 +200,7 @@ const AgentFleet = () => {
sortable: true,
hideable: false,
sortValue: (v) => v.version || '',
- cellClassName: 'font-semibold',
+ cellClassName: 'fleet-value',
render: (v) => `v${v.version}`,
},
{
@@ -249,7 +244,7 @@ const AgentFleet = () => {
sortable: true,
hideable: false,
sortValue: (r) => r.version || '',
- cellClassName: 'font-semibold',
+ cellClassName: 'fleet-value',
render: (r) => `v${r.version}`,
},
{
@@ -265,16 +260,16 @@ const AgentFleet = () => {
sortable: true,
sortValue: (r) => (r.total_servers > 0 ? (r.processed_servers / r.total_servers * 100) : 0),
render: (r) => (
- <div className="flex items-center gap-3">
+ <div className="fleet-rollout-progress">
<Gauge
- className="w-24"
+ className="fleet-rollout-progress__gauge"
value={r.total_servers > 0 ? (r.processed_servers / r.total_servers * 100) : 0}
color={r.status === 'failed' ? 'var(--red)' : r.status === 'completed' ? 'var(--green)' : 'var(--accent-bright)'}
/>
- <span className="text-sm text-gray-500">
+ <span className="fleet-caption">
{r.processed_servers}/{r.total_servers}
{r.failed_servers > 0 && (
- <span className="text-red-500 ml-1">({r.failed_servers} failed)</span>
+ <span className="fleet-rollout-failure">({r.failed_servers} failed)</span>
)}
</span>
</div>
@@ -294,7 +289,7 @@ const AgentFleet = () => {
headerKey: 'app.agentFleet.started', header: 'Started',
sortable: true,
sortValue: (r) => (r.started_at ? new Date(r.started_at).getTime() : null),
- cellClassName: 'text-sm',
+ cellClassName: 'fleet-queued-description',
render: (r) => (r.started_at ? new Date(r.started_at).toLocaleString() : '-'),
},
{
@@ -309,7 +304,6 @@ const AgentFleet = () => {
<Button
variant="ghost"
size="sm"
- className="text-red-600"
onClick={() => cancelRollout(r.id)}
title={t('app.agentFleet.cancelRollout', 'Cancel Rollout')}
>
@@ -317,7 +311,7 @@ const AgentFleet = () => {
</Button>
)}
{r.error && (
- <span className="text-xs text-red-500" title={r.error}>
+ <span className="fleet-command-error" title={r.error}>
<AlertCircle size={14} />
</span>
)}
@@ -340,7 +334,7 @@ const AgentFleet = () => {
headerKey: 'common.labels.command', header: 'Command',
sortable: true,
sortValue: (cmd) => cmd.command_type || '',
- cellClassName: 'font-mono text-sm',
+ cellClassName: 'fleet-command-type',
render: (cmd) => cmd.command_type,
},
{
@@ -349,7 +343,7 @@ const AgentFleet = () => {
sortable: true,
sortValue: (cmd) => cmd.retry_count ?? null,
render: (cmd) => (
- <span className={cmd.retry_count > 0 ? 'text-yellow-600' : ''}>
+ <span className={cmd.retry_count > 0 ? 'fleet-command-retry' : ''}>
{cmd.retry_count}/{cmd.max_retries}
</span>
),
@@ -359,7 +353,7 @@ const AgentFleet = () => {
headerKey: 'app.agentFleet.queuedAt', header: 'Queued At',
sortable: true,
sortValue: (cmd) => (cmd.created_at ? new Date(cmd.created_at).getTime() : null),
- cellClassName: 'text-sm',
+ cellClassName: 'fleet-queued-description',
render: (cmd) => new Date(cmd.created_at).toLocaleString(),
},
{
@@ -388,7 +382,7 @@ const AgentFleet = () => {
sortable: true,
hideable: false,
sortValue: (server) => server.name || '',
- cellClassName: 'font-semibold',
+ cellClassName: 'fleet-value',
render: (server) => server.name,
},
{
@@ -422,7 +416,6 @@ const AgentFleet = () => {
<>
<Button
size="sm"
- className="flex items-center gap-1"
onClick={() => approveAgent(server.id)}
>
<CheckCircle size={14} /> {t('app.agentFleet.approve', 'Approve')}
@@ -430,7 +423,6 @@ const AgentFleet = () => {
<Button
variant="ghost"
size="sm"
- className="text-red-600"
onClick={() => rejectAgent(server.id)}
>
<XCircle size={14} /> {t('app.agentFleet.reject', 'Reject')}
@@ -456,20 +448,20 @@ const AgentFleet = () => {
<tab.icon size={18} />
{tab.label}
{tab.key === 'approvals' && pendingServers.length > 0 && (
- <Badge variant="destructive" className="ml-2">{pendingServers.length}</Badge>
+ <Badge variant="destructive" className="fleet-tab-count">{pendingServers.length}</Badge>
)}
{tab.key === 'queue' && queuedCommands.length > 0 && (
- <Badge variant="warning" className="ml-2">{queuedCommands.length}</Badge>
+ <Badge variant="warning" className="fleet-tab-count">{queuedCommands.length}</Badge>
)}
</TabsTrigger>
))}
</TabsList>
</Tabs>
- <div className="tab-content mt-6">
+ <div className="tab-content fleet-tab-content">
{/* ==================== Dashboard ==================== */}
{activeTab === 'dashboard' && health && (
- <div className="space-y-6">
+ <div className="fleet-section-stack">
<KpiBand>
<MetricCard icon={<Server size={16} />} tone="accent" label={t('app.agentFleet.totalAgents', 'Total Agents')} value={health.total_servers} />
<MetricCard icon={<CheckCircle size={16} />} tone="green" label={t('app.agentFleet.online', 'Online')} value={health.online_servers} />
@@ -477,76 +469,76 @@ const AgentFleet = () => {
<MetricCard icon={<Zap size={16} />} tone="cyan" label={t('app.agentFleet.successRate', 'Success Rate')} value={`${health.command_success_rate}%`} />
</KpiBand>
- <div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
- <div className="card">
- <div className="card-header">
+ <div className="fleet-health-grid">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h2>{t('app.agentFleet.fleetHealthSummary', 'Fleet Health Summary')}</h2>
- </div>
- <div className="card-body">
- <div className="space-y-4">
- <div className="flex justify-between items-center">
- <span className="text-gray-600">{t('app.agentFleet.overallUptime', 'Overall Uptime')}</span>
- <span className="font-semibold text-green-600">{health.uptime_percentage?.toFixed(2)}%</span>
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
+ <div className="fleet-metric-stack">
+ <div className="fleet-summary-row">
+ <span className="fleet-metric-label">{t('app.agentFleet.overallUptime', 'Overall Uptime')}</span>
+ <span className="fleet-uptime-value">{health.uptime_percentage?.toFixed(2)}%</span>
</div>
<Gauge value={health.uptime_percentage} color="var(--green)" />
- <div className="flex justify-between items-center mt-6">
- <span className="text-gray-600">{t('app.agentFleet.avgHeartbeatLatency', 'Avg Heartbeat Latency')}</span>
- <span className="font-semibold">{health.avg_heartbeat_latency} ms</span>
+ <div className="fleet-summary-row fleet-summary-row--latency">
+ <span className="fleet-metric-label">{t('app.agentFleet.avgHeartbeatLatency', 'Avg Heartbeat Latency')}</span>
+ <span className="fleet-value">{health.avg_heartbeat_latency} ms</span>
</div>
<Gauge value={Math.min(100, health.avg_heartbeat_latency / 2)} color="var(--cyan)" />
{health.queued_commands > 0 && (
- <div className="fleet-warnrow mt-4">
- <span className="flex items-center gap-2">
+ <div className="fleet-warnrow fleet-warnrow--spaced">
+ <span className="fleet-inline-label">
<Clock size={16} /> {t('app.agentFleet.queuedCommands', 'Queued Commands')}
</span>
- <span className="font-semibold">{health.queued_commands}</span>
+ <span className="fleet-value">{health.queued_commands}</span>
</div>
)}
</div>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h2>{t('app.agentFleet.versionDistribution', 'Version Distribution')}</h2>
- </div>
- <div className="card-body">
- <div className="space-y-4">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
+ <div className="fleet-metric-stack">
{Object.entries(health.version_distribution || {}).map(([version, count]) => (
- <div key={version} className="space-y-1">
- <div className="flex justify-between text-sm">
+ <div key={version} className="fleet-version-distribution">
+ <div className="fleet-version-distribution__label">
<span>v{version}</span>
- <span className="text-gray-500">{count} {t('app.agentFleet.agents', 'agents (')}{(count / health.total_servers * 100).toFixed(0)}%)</span>
+ <span className="fleet-note">{count} {t('app.agentFleet.agents', 'agents (')}{(count / health.total_servers * 100).toFixed(0)}%)</span>
</div>
<Gauge value={count / health.total_servers * 100} color="var(--accent-bright)" />
</div>
))}
{Object.keys(health.version_distribution || {}).length === 0 && (
- <p className="text-gray-500 text-center py-4">{t('app.agentFleet.noAgentsRegisteredYet', 'No agents registered yet.')}</p>
+ <p className="fleet-version-empty">{t('app.agentFleet.noAgentsRegisteredYet', 'No agents registered yet.')}</p>
)}
</div>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
</div>
</div>
)}
{/* ==================== Versions ==================== */}
{activeTab === 'versions' && (
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h2>{t('app.agentFleet.agentVersions', 'Agent Versions')}</h2>
- </div>
+ </SharedCardHeader>
<DataTable
columns={versionColumns}
data={versions}
keyField="id"
storageKey="serverkit-table-fleet-versions"
- className="overflow-x-auto"
+ className="fleet-table-scroll"
emptyState={(
- <div className="text-center py-8 text-gray-500">
+ <div className="fleet-table-empty">
{t('app.agentFleet.noAgentVersionsRegisteredInDatabase', 'No agent versions registered in database.')}
</div>
)}
@@ -559,30 +551,30 @@ const AgentFleet = () => {
)}
/>
{versions.length > 0 && versions[0].release_notes && (
- <div className="card-body border-t">
- <h3 className="text-sm font-semibold mb-2">{t('app.agentFleet.latestReleaseNotesV', 'Latest Release Notes (v')}{versions[0].version})</h3>
- <p className="text-sm text-gray-600 whitespace-pre-wrap">{versions[0].release_notes}</p>
- </div>
+ <SharedCardContent variant="legacy" className="card-body fleet-release-notes">
+ <h3 className="fleet-release-notes__title">{t('app.agentFleet.latestReleaseNotesV', 'Latest Release Notes (v')}{versions[0].version})</h3>
+ <p className="fleet-release-notes__text">{versions[0].release_notes}</p>
+ </SharedCardContent>
)}
- </div>
+ </SharedCard>
)}
{/* ==================== Rollouts ==================== */}
{activeTab === 'rollouts' && (
- <div className="space-y-6">
- <div className="card">
- <div className="card-header">
+ <div className="fleet-section-stack">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h2>{t('app.agentFleet.triggerFleetUpgrade', 'Trigger Fleet Upgrade')}</h2>
- </div>
- <div className="card-body">
- <p className="text-gray-600 mb-4">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
+ <p className="fleet-rollout-description">
{t('app.agentFleet.pushASpecificAgentVersionTo', 'Push a specific agent version to multiple servers at once.')}
</p>
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
+ <div className="fleet-rollout-fields">
<div className="form-group">
<label>{t('app.agentFleet.targetVersion', 'Target Version')}</label>
<select
- className="form-select w-full"
+ className="form-select fleet-rollout-select"
value={selectedVersion}
onChange={e => setSelectedVersion(e.target.value)}
>
@@ -595,7 +587,7 @@ const AgentFleet = () => {
<div className="form-group">
<label>{t('app.agentFleet.rolloutStrategy', 'Rollout Strategy')}</label>
<select
- className="form-select w-full"
+ className="form-select fleet-rollout-select"
value={rolloutStrategy}
onChange={e => setRolloutStrategy(e.target.value)}
>
@@ -627,25 +619,25 @@ const AgentFleet = () => {
</>
)}
</div>
- <div className="mt-6 flex justify-end">
+ <div className="fleet-rollout-actions">
<Button onClick={triggerUpgrade} disabled={!selectedVersion}>
<Play size={18} /> {t('app.agentFleet.startRollout', 'Start Rollout')}
</Button>
</div>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h2>{t('app.agentFleet.rolloutHistory', 'Rollout History')}</h2>
- </div>
+ </SharedCardHeader>
{rollouts.length > 0 ? (
<DataTable
columns={rolloutColumns}
data={rollouts}
keyField="id"
storageKey="serverkit-table-fleet-rollouts"
- className="overflow-x-auto"
+ className="fleet-table-scroll"
footer={(
<DataTableFooter
shown={rollouts.length}
@@ -655,29 +647,29 @@ const AgentFleet = () => {
)}
/>
) : (
- <div className="card-body py-12 text-center text-gray-500">
- <Zap size={48} className="mx-auto text-gray-300 mb-4" />
+ <SharedCardContent variant="legacy" className="card-body fleet-card-empty">
+ <Zap size={48} className="fleet-empty-icon" />
<p>{t('app.agentFleet.noRolloutsHaveBeenStartedYet', 'No rollouts have been started yet.')}</p>
- </div>
+ </SharedCardContent>
)}
- </div>
+ </SharedCard>
</div>
)}
{/* ==================== Command Queue ==================== */}
{activeTab === 'queue' && (
- <div className="card">
- <div className="card-header flex justify-between items-center">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header fleet-card-heading">
<h2>{t('app.agentFleet.queuedCommands', 'Queued Commands')}</h2>
- <p className="text-sm text-gray-500">{t('app.agentFleet.commandsWaitingToBeDeliveredWhen', 'Commands waiting to be delivered when agents reconnect')}</p>
- </div>
+ <p className="fleet-caption">{t('app.agentFleet.commandsWaitingToBeDeliveredWhen', 'Commands waiting to be delivered when agents reconnect')}</p>
+ </SharedCardHeader>
{queuedCommands.length > 0 ? (
<DataTable
columns={queueColumns}
data={queuedCommands}
keyField="id"
storageKey="serverkit-table-fleet-queue"
- className="overflow-x-auto"
+ className="fleet-table-scroll"
footer={(
<DataTableFooter
shown={queuedCommands.length}
@@ -687,30 +679,30 @@ const AgentFleet = () => {
)}
/>
) : (
- <div className="card-body py-12 text-center text-gray-500">
- <CheckCircle size={48} className="mx-auto text-gray-300 mb-4" />
+ <SharedCardContent variant="legacy" className="card-body fleet-card-empty">
+ <CheckCircle size={48} className="fleet-empty-icon" />
<p>{t('app.agentFleet.noQueuedCommandsAllAgentsAre', 'No queued commands. All agents are up to date.')}</p>
- </div>
+ </SharedCardContent>
)}
- </div>
+ </SharedCard>
)}
{/* ==================== Discovery ==================== */}
{activeTab === 'discovery' && (
- <div className="space-y-6">
- <div className="flex justify-between items-center">
+ <div className="fleet-section-stack">
+ <div className="fleet-summary-row">
<h2>{t('app.agentFleet.networkDiscovery', 'Network Discovery')}</h2>
<Button onClick={startDiscovery} disabled={isScanning}>
- {isScanning ? <RefreshCw size={18} className="animate-spin" /> : <Search size={18} />}
+ {isScanning ? <RefreshCw size={18} className="fleet-refresh-spinner" /> : <Search size={18} />}
{isScanning ? 'Scanning...' : 'Start Scan'}
</Button>
</div>
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
+ <div className="fleet-discovery-grid">
{discoveredAgents.map(agent => (
- <div key={agent.agent_id} className="card p-4 flex flex-col justify-between">
+ <SharedCard variant="legacy" key={agent.agent_id} className="card fleet-discovered-agent">
<div>
- <div className="flex justify-between items-start mb-2">
+ <div className="fleet-discovered-agent__heading">
<div className="fleet-ico">
<Server size={20} />
</div>
@@ -720,25 +712,25 @@ const AgentFleet = () => {
<Pill kind="amber">{t('app.agentFleet.new', 'New')}</Pill>
)}
</div>
- <h3 className="font-bold">{agent.hostname}</h3>
- <p className="text-sm text-gray-500">{agent.ip_address}</p>
- <div className="mt-4 space-y-2 text-sm">
- <div className="flex justify-between">
- <span className="text-gray-500">{t('app.agentFleet.os', 'OS:')}</span>
+ <h3 className="fleet-agent-name">{agent.hostname}</h3>
+ <p className="fleet-caption">{agent.ip_address}</p>
+ <div className="fleet-agent-facts">
+ <div className="fleet-agent-fact">
+ <span className="fleet-note">{t('app.agentFleet.os', 'OS:')}</span>
<span>{agent.os} ({agent.arch})</span>
</div>
- <div className="flex justify-between">
- <span className="text-gray-500">{t('app.agentFleet.agentVersion2', 'Agent Version:')}</span>
+ <div className="fleet-agent-fact">
+ <span className="fleet-note">{t('app.agentFleet.agentVersion2', 'Agent Version:')}</span>
<span>v{agent.agent_version}</span>
</div>
</div>
</div>
- <div className="mt-4 pt-4 border-t">
+ <div className="fleet-agent-actions">
{agent.is_registered ? (
<Button
variant="ghost"
size="sm"
- className="w-full"
+ className="fleet-agent-action"
onClick={() => {
setActiveTab('dashboard');
loadDiagnostics(agent.server_id);
@@ -747,16 +739,16 @@ const AgentFleet = () => {
{t('app.agentFleet.viewDetails', 'View Details')}
</Button>
) : (
- <Button size="sm" className="w-full">{t('app.agentFleet.addToFleet', 'Add to Fleet')}</Button>
+ <Button size="sm" className="fleet-agent-action">{t('app.agentFleet.addToFleet', 'Add to Fleet')}</Button>
)}
</div>
- </div>
+ </SharedCard>
))}
{discoveredAgents.length === 0 && !isScanning && (
- <div className="col-span-full py-12 text-center card">
- <Search size={48} className="mx-auto text-gray-300 mb-4" />
- <p className="text-gray-500">{t('app.agentFleet.noAgentsDiscoveredYetStartA', 'No agents discovered yet. Start a scan to find agents on your local network.')}</p>
- </div>
+ <SharedCard variant="legacy" className="card fleet-discovery-empty">
+ <Search size={48} className="fleet-empty-icon" />
+ <p className="fleet-note">{t('app.agentFleet.noAgentsDiscoveredYetStartA', 'No agents discovered yet. Start a scan to find agents on your local network.')}</p>
+ </SharedCard>
)}
</div>
</div>
@@ -764,18 +756,18 @@ const AgentFleet = () => {
{/* ==================== Approvals ==================== */}
{activeTab === 'approvals' && (
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h2>{t('app.agentFleet.pendingRegistrations', 'Pending Registrations')}</h2>
- </div>
+ </SharedCardHeader>
<DataTable
columns={approvalColumns}
data={pendingServers}
keyField="id"
storageKey="serverkit-table-fleet-approvals"
- className="overflow-x-auto"
+ className="fleet-table-scroll"
emptyState={(
- <div className="text-center py-8 text-gray-500">
+ <div className="fleet-table-empty">
{t('app.agentFleet.noPendingAgentRegistrations', 'No pending agent registrations.')}
</div>
)}
@@ -787,60 +779,60 @@ const AgentFleet = () => {
/>
)}
/>
- </div>
+ </SharedCard>
)}
{/* ==================== Diagnostics Modal ==================== */}
{diagnostics && (
- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60" onClick={() => setDiagnostics(null)}>
- <div className="fleet-modal w-full max-w-2xl max-h-[80vh] overflow-y-auto m-4" onClick={e => e.stopPropagation()}>
- <div className="p-6 border-b flex justify-between items-center">
- <h2 className="text-lg font-semibold">
+ <div className="fleet-diagnostics-overlay" onClick={() => setDiagnostics(null)}>
+ <div className="fleet-modal fleet-diagnostics-dialog" onClick={e => e.stopPropagation()}>
+ <div className="fleet-diagnostics-heading">
+ <h2 className="fleet-diagnostics-title">
{t('app.agentFleet.agentDiagnostics', 'Agent Diagnostics -')} {diagnostics.server_name}
</h2>
<Button variant="ghost" size="sm" onClick={() => setDiagnostics(null)}>
<XCircle size={18} />
</Button>
</div>
- <div className="p-6 space-y-6">
- <div className="grid grid-cols-2 gap-4">
+ <div className="fleet-diagnostics-body">
+ <div className="fleet-diagnostics-facts">
<div>
- <label className="text-sm text-gray-500">{t('common.labels.status', 'Status')}</label>
- <p className="font-semibold flex items-center gap-2">
+ <label className="fleet-caption">{t('common.labels.status', 'Status')}</label>
+ <p className="fleet-connection-value">
{diagnostics.connection.is_connected ? (
- <><Wifi size={16} className="text-green-500" /> {t('app.agentFleet.connected', 'Connected')}</>
+ <><Wifi size={16} className="fleet-connected-icon" /> {t('app.agentFleet.connected', 'Connected')}</>
) : (
- <><WifiOff size={16} className="text-red-500" /> {t('app.agentFleet.disconnected', 'Disconnected')}</>
+ <><WifiOff size={16} className="fleet-disconnected-icon" /> {t('app.agentFleet.disconnected', 'Disconnected')}</>
)}
</p>
</div>
<div>
- <label className="text-sm text-gray-500">{t('app.agentFleet.agentVersion', 'Agent Version')}</label>
- <p className="font-semibold">v{diagnostics.agent_version || 'Unknown'}</p>
+ <label className="fleet-caption">{t('app.agentFleet.agentVersion', 'Agent Version')}</label>
+ <p className="fleet-value">v{diagnostics.agent_version || 'Unknown'}</p>
</div>
<div>
- <label className="text-sm text-gray-500">{t('app.agentFleet.currentLatency', 'Current Latency')}</label>
- <p className="font-semibold">
+ <label className="fleet-caption">{t('app.agentFleet.currentLatency', 'Current Latency')}</label>
+ <p className="fleet-value">
{diagnostics.connection.current_latency_ms != null
? `${diagnostics.connection.current_latency_ms.toFixed(1)} ms`
: 'N/A'}
</p>
</div>
<div>
- <label className="text-sm text-gray-500">{t('app.agentFleet.avgLatency', 'Avg Latency')}</label>
- <p className="font-semibold">
+ <label className="fleet-caption">{t('app.agentFleet.avgLatency', 'Avg Latency')}</label>
+ <p className="fleet-value">
{diagnostics.connection.avg_latency_ms != null
? `${diagnostics.connection.avg_latency_ms.toFixed(1)} ms`
: 'N/A'}
</p>
</div>
<div>
- <label className="text-sm text-gray-500">{t('common.labels.ipAddress', 'IP Address')}</label>
- <p className="font-semibold">{diagnostics.connection.ip_address || 'N/A'}</p>
+ <label className="fleet-caption">{t('common.labels.ipAddress', 'IP Address')}</label>
+ <p className="fleet-value">{diagnostics.connection.ip_address || 'N/A'}</p>
</div>
<div>
- <label className="text-sm text-gray-500">{t('app.agentFleet.connectedSince', 'Connected Since')}</label>
- <p className="font-semibold">
+ <label className="fleet-caption">{t('app.agentFleet.connectedSince', 'Connected Since')}</label>
+ <p className="fleet-value">
{diagnostics.connection.connected_since
? new Date(diagnostics.connection.connected_since).toLocaleString()
: 'N/A'}
@@ -849,53 +841,53 @@ const AgentFleet = () => {
</div>
<div>
- <h3 className="font-semibold mb-3">{t('app.agentFleet.commandStats24h', 'Command Stats (24h)')}</h3>
- <div className="grid grid-cols-4 gap-3">
+ <h3 className="fleet-diagnostics-section-title">{t('app.agentFleet.commandStats24h', 'Command Stats (24h)')}</h3>
+ <div className="fleet-command-statistics">
<div className="fleet-statbox">
- <div className="text-lg font-bold">{diagnostics.commands_24h.total}</div>
- <div className="text-xs text-gray-500">{t('app.agentFleet.total', 'Total')}</div>
+ <div className="fleet-command-total">{diagnostics.commands_24h.total}</div>
+ <div className="fleet-command-statistic-label">{t('app.agentFleet.total', 'Total')}</div>
</div>
<div className="fleet-statbox is-green">
- <div className="text-lg font-bold text-green-600">{diagnostics.commands_24h.success}</div>
- <div className="text-xs text-gray-500">{t('app.agentFleet.success', 'Success')}</div>
+ <div className="fleet-command-success">{diagnostics.commands_24h.success}</div>
+ <div className="fleet-command-statistic-label">{t('app.agentFleet.success', 'Success')}</div>
</div>
<div className="fleet-statbox is-red">
- <div className="text-lg font-bold text-red-600">{diagnostics.commands_24h.failed}</div>
- <div className="text-xs text-gray-500">{t('common.state.failed', 'Failed')}</div>
+ <div className="fleet-command-failed">{diagnostics.commands_24h.failed}</div>
+ <div className="fleet-command-statistic-label">{t('common.state.failed', 'Failed')}</div>
</div>
<div className="fleet-statbox is-amber">
- <div className="text-lg font-bold text-yellow-600">{diagnostics.commands_24h.timeout}</div>
- <div className="text-xs text-gray-500">{t('app.agentFleet.timeout', 'Timeout')}</div>
+ <div className="fleet-command-timeout">{diagnostics.commands_24h.timeout}</div>
+ <div className="fleet-command-statistic-label">{t('app.agentFleet.timeout', 'Timeout')}</div>
</div>
</div>
</div>
{diagnostics.queued_commands > 0 && (
<div className="fleet-warnrow">
- <span className="flex items-center gap-2">
+ <span className="fleet-inline-label">
<Clock size={16} />
- <span className="text-sm">{diagnostics.queued_commands} {t('app.agentFleet.commandsQueuedForDelivery', 'commands queued for delivery')}</span>
+ <span className="fleet-queued-description">{diagnostics.queued_commands} {t('app.agentFleet.commandsQueuedForDelivery', 'commands queued for delivery')}</span>
</span>
</div>
)}
<div>
- <h3 className="font-semibold mb-3">{t('app.agentFleet.recentSessions', 'Recent Sessions')}</h3>
- <div className="space-y-2 max-h-48 overflow-y-auto">
+ <h3 className="fleet-diagnostics-section-title">{t('app.agentFleet.recentSessions', 'Recent Sessions')}</h3>
+ <div className="fleet-session-list">
{diagnostics.recent_sessions.map(session => (
- <div key={session.id} className="fleet-statrow flex justify-between items-center text-sm p-2 rounded">
- <div className="flex items-center gap-2">
+ <div key={session.id} className="fleet-statrow fleet-session-row">
+ <div className="fleet-inline-label">
{session.is_active ? (
- <Wifi size={14} className="text-green-500" />
+ <Wifi size={14} className="fleet-connected-icon" />
) : (
- <WifiOff size={14} className="text-gray-400" />
+ <WifiOff size={14} className="fleet-session-offline" />
)}
<span>{session.ip_address}</span>
</div>
- <div className="text-gray-500">
+ <div className="fleet-note">
{new Date(session.connected_at).toLocaleString()}
{session.disconnect_reason && (
- <span className="ml-2 text-red-500">({session.disconnect_reason})</span>
+ <span className="fleet-session-disconnect-reason">({session.disconnect_reason})</span>
)}
</div>
</div>
diff --git a/frontend/src/pages/AppMap.jsx b/frontend/src/pages/AppMap.jsx
index a2708cd8..52fdfe6b 100644
--- a/frontend/src/pages/AppMap.jsx
+++ b/frontend/src/pages/AppMap.jsx
@@ -15,6 +15,7 @@ import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
import PageLayout from '../layouts/PageLayout';
import useTabParam from '../hooks/useTabParam';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const VIEWS = [
{
@@ -301,13 +302,13 @@ export default function AppMap() {
<div className="app-map__viewmeta">
<Info size={14} />
<span>{view.description}</span>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="app-map__legend-toggle"
onClick={() => setShowLegend(s => !s)}
>
{showLegend ? 'Hide legend' : 'Show legend'}
- </button>
+ </SharedButton>
</div>
{showLegend && (
diff --git a/frontend/src/pages/Backups.jsx b/frontend/src/pages/Backups.jsx
index 3a6ed989..c6688291 100644
--- a/frontend/src/pages/Backups.jsx
+++ b/frontend/src/pages/Backups.jsx
@@ -4,7 +4,7 @@ import { Upload, Check, AlertTriangle, Archive, Clock, Database, Package, Folder
import api from '../services/api';
import { formatBytes } from '@/utils/formatBytes';
import { scrollBehavior } from '@/utils/reducedMotion';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import EmptyState from '../components/EmptyState';
import Modal from '@/components/Modal';
@@ -27,6 +27,7 @@ import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useTranslation } from 'react-i18next';
import useFocusParam from '../hooks/useFocusParam';
+import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';
// `backups` is kept as an alias so old /backups/backups links still resolve to
// the archive, which now answers to `snapshots`.
@@ -638,7 +639,7 @@ const Backups = () => {
render: (backup) => (
<div className="bk-actions">
{backup.type !== 'files' && (
- <button
+ <Button variant="unstyled"
type="button"
className="bk-iconbtn"
onClick={() => {
@@ -649,10 +650,10 @@ const Backups = () => {
aria-label={t('app.backups.restore', 'Restore {{name}}', { name: backup.name })}
>
<History size={15} />
- </button>
+ </Button>
)}
{storageConfig?.provider !== 'local' && backup.remote_status !== 'synced' && (
- <button
+ <Button variant="unstyled"
type="button"
className="bk-iconbtn"
onClick={() => handleUploadToRemote(backup)}
@@ -663,9 +664,9 @@ const Backups = () => {
{uploadingBackup === backup.path
? <RefreshCw size={15} className="spinning" />
: <Upload size={15} />}
- </button>
+ </Button>
)}
- <button
+ <Button variant="unstyled"
type="button"
className="bk-iconbtn bk-iconbtn--danger"
onClick={() => handleDeleteBackup(backup.path)}
@@ -673,7 +674,7 @@ const Backups = () => {
aria-label={t('app.backups.delete', 'Delete {{name}}', { name: backup.name })}
>
<Trash2 size={15} />
- </button>
+ </Button>
</div>
),
},
@@ -768,7 +769,7 @@ const Backups = () => {
{error && (
<div className="alert alert-danger">
{error}
- <button type="button" onClick={() => setError(null)} className="alert-close">&times;</button>
+ <Button variant="unstyled" type="button" onClick={() => setError(null)} className="alert-close">&times;</Button>
</div>
)}
@@ -878,11 +879,11 @@ const Backups = () => {
}}
/>
- <div className="card" id="bk-storage-form">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card" id="bk-storage-form">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.backups.configureDestination', 'Configure destination')}</h3>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
{/* While ServerKit Cloud owns this
destination the form here is read-only, and says
where the setting comes from and how to take it
@@ -1081,18 +1082,18 @@ const Backups = () => {
</div>
</form>
</fieldset>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
</>
)}
{activeTab === 'settings' && (
<>
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.backups.backupSettings', 'Backup Settings')}</h3>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<form onSubmit={handleSaveConfig}>
<FormField>
<label className="checkbox-label">
@@ -1124,14 +1125,14 @@ const Backups = () => {
</Button>
</div>
</form>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
- <div className="card">
- <div className="card-header">
+ <SharedCard variant="legacy" className="card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.backups.storageCostRates', 'Storage cost rates')}</h3>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<p className="form-help">
{t('app.backups.serverkitIsFreeTheseAreYour', 'ServerKit is free — these are your own storage costs. Local is your server disk (leave at 0 if you don\'t track it). S3/B2 are your cloud provider\'s $/GB/month.')}
</p>
@@ -1178,8 +1179,8 @@ const Backups = () => {
</Button>
</div>
</form>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
</>
)}
diff --git a/frontend/src/pages/CloudProvision.jsx b/frontend/src/pages/CloudProvision.jsx
index 04baf268..39f6e85c 100644
--- a/frontend/src/pages/CloudProvision.jsx
+++ b/frontend/src/pages/CloudProvision.jsx
@@ -1,8 +1,9 @@
+import { Card as SharedCard } from '@/components/ui/card';
import { useState, useEffect, useCallback } from 'react';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
-import { useAuth } from '../contexts/AuthContext';
+import { useToast } from '../contexts/useToast.js';
+import { useAuth } from '../contexts/useAuth.js';
import PageLoader from '../components/PageLoader';
import ConfirmDialog from '../components/ConfirmDialog';
import EmptyState from '../components/EmptyState';
@@ -40,12 +41,12 @@ const CloudProvision = () => {
setProviders(pData.providers || []);
setServers(sData.servers || []);
setCosts(cData);
- } catch (err) {
+ } catch {
toast.error(t('app.cloudProvision.failedToLoadCloudData', 'Failed to load cloud data'));
} finally {
setLoading(false);
}
- }, [toast]);
+ }, [t, toast]);
useEffect(() => { loadData(); }, [loadData]);
@@ -118,7 +119,7 @@ const CloudProvision = () => {
<TabsContent value="servers">
<div className="cloud-servers-grid">
{servers.map(srv => (
- <div key={srv.id} className="cloud-server-card card">
+ <SharedCard variant="legacy" key={srv.id} className="cloud-server-card card">
<div className="cloud-server-card__header">
<h3>{srv.name}</h3>
<Badge variant={serverStatusVariant(srv.status)}>{srv.status}</Badge>
@@ -138,7 +139,7 @@ const CloudProvision = () => {
<Button size="sm" variant="destructive" onClick={() => setDeleteConfirm(srv)}>{t('app.cloudProvision.destroy', 'Destroy')}</Button>
)}
</div>
- </div>
+ </SharedCard>
))}
{servers.length === 0 && (
<EmptyState
@@ -155,11 +156,11 @@ const CloudProvision = () => {
<TabsContent value="providers">
<div className="providers-list">
{providers.map(p => (
- <div key={p.id} className="provider-row card">
+ <SharedCard variant="legacy" key={p.id} className="provider-row card">
<strong>{p.name}</strong>
<Badge variant="outline">{providerTypes[p.provider_type] || p.provider_type}</Badge>
<span>{p.server_count} servers</span>
- </div>
+ </SharedCard>
))}
{providers.length === 0 && (
<EmptyState
@@ -175,7 +176,7 @@ const CloudProvision = () => {
<TabsContent value="costs">
{costs && (
- <div className="costs-panel card">
+ <SharedCard variant="legacy" className="costs-panel card">
<h3>{t('app.cloudProvision.monthlyCostSummary', 'Monthly Cost Summary')}</h3>
<div className="cost-total">${costs.total_monthly}/mo across {costs.server_count} servers</div>
<div className="cost-breakdown">
@@ -187,7 +188,7 @@ const CloudProvision = () => {
</div>
))}
</div>
- </div>
+ </SharedCard>
)}
</TabsContent>
</Tabs>
diff --git a/frontend/src/pages/CronJobs.jsx b/frontend/src/pages/CronJobs.jsx
index 0aaadcd1..2b3121f8 100644
--- a/frontend/src/pages/CronJobs.jsx
+++ b/frontend/src/pages/CronJobs.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback, useMemo } from 'react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
-import { useAuth } from '../contexts/AuthContext';
+import { useToast } from '../contexts/useToast.js';
+import { useAuth } from '../contexts/useAuth.js';
import { useConfirm } from '../hooks/useConfirm';
import useFocusParam from '@/hooks/useFocusParam';
import EmptyState from '../components/EmptyState';
@@ -154,7 +154,7 @@ const CronJobs = () => {
// Table sort + column visibility (persisted, mirrored by the toolbar menus)
const { sorts, setSorts } = useTableSort({ storageKey: 'serverkit-table-cronjobs-sort' });
- const { hiddenKeys, setHiddenKeys, toggleColumn, showAllColumns } = useColumnVisibility({
+ const { hiddenKeys, setHiddenKeys } = useColumnVisibility({
storageKey: 'serverkit-table-cronjobs-cols',
});
@@ -278,9 +278,6 @@ const CronJobs = () => {
}
};
- const enabledCount = jobs.filter(j => j.enabled).length;
- const failedCount = jobs.filter(j => j.enabled && j.last_status === 'failure').length;
- const pausedCount = jobs.length - enabledCount;
const q = search.trim().toLowerCase();
const shown = jobs.filter((job) => !q
@@ -441,14 +438,14 @@ const CronJobs = () => {
{error && (
<div className="error-banner">
{error}
- <button
+ <Button variant="unstyled"
type="button"
className="error-banner__close"
onClick={() => setError(null)}
aria-label={t('app.cronJobs.dismissError', 'Dismiss error')}
>
×
- </button>
+ </Button>
</div>
)}
diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx
index 8c153775..ceea7c05 100644
--- a/frontend/src/pages/Dashboard.jsx
+++ b/frontend/src/pages/Dashboard.jsx
@@ -4,8 +4,8 @@ import {
RefreshCw, SlidersHorizontal, X,
} from 'lucide-react';
import api from '../services/api';
-import { useAuth } from '../contexts/AuthContext';
-import { useToast } from '../contexts/ToastContext';
+import { useAuth } from '../contexts/useAuth.js';
+import { useToast } from '../contexts/useToast.js';
import { useMetrics } from '../hooks/useMetrics';
import useDashboardBoards from '../hooks/useDashboardBoards';
import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover';
@@ -77,7 +77,6 @@ const Dashboard = () => {
});
// ---- host identity strip ----------------------------------------------
- const { metrics: localMetrics, loading: metricsLoading, connected, refresh: refreshMetrics } = useMetrics(true);
const [systemInfo, setSystemInfo] = useState(null);
const [servers, setServers] = useState([]);
const [selectedServer, setSelectedServer] = useState({ id: 'local', name: 'Local (this server)' });
@@ -85,6 +84,10 @@ const Dashboard = () => {
const [remoteMetrics, setRemoteMetrics] = useState(null);
const [remoteSystemInfo, setRemoteSystemInfo] = useState(null);
const isRemote = selectedServer.id !== 'local';
+ const { metrics: localMetrics, loading: metricsLoading, refresh: refreshMetrics } = useMetrics(true, refreshInterval * 1000, {
+ enabled: !isRemote,
+ autoRefresh: refreshInterval > 0,
+ });
const metrics = isRemote ? remoteMetrics : localMetrics;
// Uptime and clock tick locally between server samples so they don't freeze
@@ -197,16 +200,9 @@ const Dashboard = () => {
immediate: false,
});
- // Board-wide refresh pulse: every widget watches ctx.tick.
- useEffect(() => {
- if (!refreshInterval) return undefined;
- const id = setInterval(() => setTick((k) => k + 1), refreshInterval * 1000);
- return () => clearInterval(id);
- }, [refreshInterval]);
-
- // HTTP polling fallback for live metrics when the socket is down.
- usePolling(refreshMetrics, refreshInterval * 1000, {
- enabled: Boolean(refreshInterval) && !connected && !isRemote,
+ // Shared scheduler pauses widget refreshes in hidden tabs.
+ usePolling(() => setTick((k) => k + 1), refreshInterval * 1000, {
+ enabled: refreshInterval > 0,
immediate: false,
});
@@ -469,9 +465,9 @@ const Dashboard = () => {
{selectedServer.name} · {range} {t('app.dashboard.refresh', '· refresh')} {refreshInterval ? `${refreshInterval}s` : 'off'}
</span>
<span className="skw-tv__clock mono">{displayTime}</span>
- <button type="button" className="btn btn-outline btn-sm" onClick={() => setTvMode(false)}>
+ <Button variant="unstyled" type="button" className="btn btn-outline btn-sm" onClick={() => setTvMode(false)}>
<X size={14} /> {t('app.dashboard.exit', 'Exit')}
- </button>
+ </Button>
</div>
<div className="skw-tv__body">{grid}</div>
</div>
@@ -527,18 +523,18 @@ const Dashboard = () => {
{board.id === activeBoardId && edit ? widgets.length : (board.widgets || []).length}
</span>
{edit && boards.length > 1 && board.id === activeBoardId && (
- <button
+ <Button variant="unstyled"
type="button"
className="skw-iconbtn skw-iconbtn--bare"
aria-label={t('app.dashboard.delete', 'Delete {{name}}', { name: board.name })}
onClick={(e) => { e.stopPropagation(); handleRemoveBoard(board.id); }}
>
<X size={12} />
- </button>
+ </Button>
)}
</div>
))}
- <button
+ <Button variant="unstyled"
type="button"
className="skw-tab skw-tab--add"
onClick={handleCreateBoard}
@@ -546,7 +542,7 @@ const Dashboard = () => {
title={t('app.dashboard.newDashboard', 'New dashboard')}
>
<Plus size={14} />
- </button>
+ </Button>
</div>
<div className="skw-bar__ctl">
@@ -561,7 +557,7 @@ const Dashboard = () => {
) : (
<Popover open={serverMenuOpen} onOpenChange={setServerMenuOpen}>
<PopoverTrigger asChild>
- <button
+ <Button variant="unstyled"
type="button"
className={`skw-varpick${serverMenuOpen ? ' is-open' : ''}`}
aria-label={t('app.dashboard.switchServer', 'Switch server')}
@@ -569,14 +565,14 @@ const Dashboard = () => {
<span className="skw-varpick__k mono">server</span>
<span className="skw-varpick__v">{selectedServer.name || hostname}</span>
<ChevronDown size={13} aria-hidden="true" />
- </button>
+ </Button>
</PopoverTrigger>
<PopoverContent align="start" sideOffset={7} className="env-menu">
<div className="env-menu__head">{t('app.dashboard.dashboardVariableServer', 'Dashboard variable · $server')}</div>
{servers.map((server) => {
const online = server.status === 'online';
return (
- <button
+ <Button variant="unstyled"
type="button"
key={server.id}
className="env-opt"
@@ -597,7 +593,7 @@ const Dashboard = () => {
{server.id === selectedServer.id && (
<span className="env-opt__check" aria-hidden="true"><Check size={15} /></span>
)}
- </button>
+ </Button>
);
})}
</PopoverContent>
@@ -621,7 +617,7 @@ const Dashboard = () => {
))}
</select>
</div>
- <button
+ <Button variant="unstyled"
type="button"
className="skw-iconbtn"
title={t('app.dashboard.refreshNow', 'Refresh now')}
@@ -629,8 +625,8 @@ const Dashboard = () => {
onClick={() => { setTick((k) => k + 1); if (isRemote) fetchRemote(); else refreshMetrics(); }}
>
<RefreshCw size={15} />
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className="skw-iconbtn"
title={t('app.dashboard.tvMode', 'TV mode')}
@@ -638,12 +634,12 @@ const Dashboard = () => {
onClick={() => setTvMode(true)}
>
<Maximize2 size={15} />
- </button>
+ </Button>
{edit ? (
<>
- <button type="button" className="skw-barbtn" onClick={() => setLibraryOpen(true)}>
+ <Button variant="unstyled" type="button" className="skw-barbtn" onClick={() => setLibraryOpen(true)}>
<Plus size={14} /> {t('app.dashboard.addWidget', 'Add widget')}
- </button>
+ </Button>
<Button
type="button"
variant="ghost"
@@ -655,7 +651,7 @@ const Dashboard = () => {
>
<Keyboard size={14} />
</Button>
- <button
+ <Button variant="unstyled"
type="button"
className="skw-iconbtn"
onClick={handleReset}
@@ -663,12 +659,12 @@ const Dashboard = () => {
aria-label={t('app.dashboard.restoreTheShippedLayout', 'Restore the shipped layout')}
>
<History size={14} />
- </button>
+ </Button>
</>
) : (
- <button type="button" className="skw-barbtn" onClick={startEdit}>
+ <Button variant="unstyled" type="button" className="skw-barbtn" onClick={startEdit}>
<SlidersHorizontal size={14} /> {t('common.actions.edit', 'Edit')}
- </button>
+ </Button>
)}
</div>
</div>
@@ -688,17 +684,17 @@ const Dashboard = () => {
{t('app.dashboard.thisBoardHasNoWidgetsYet', 'This board has no widgets yet. Add one to get started, or restore the layout it shipped with.')}
</div>
<div className="skw-empty-board__acts">
- <button
+ <Button variant="unstyled"
type="button"
className="btn btn-primary btn-sm"
onClick={() => { startEdit(); setLibraryOpen(true); }}
>
<Plus size={14} /> {t('app.dashboard.addAWidget', 'Add a widget')}
- </button>
+ </Button>
{activeBoard?.slug && (
- <button type="button" className="btn btn-outline btn-sm" onClick={handleReset}>
+ <Button variant="unstyled" type="button" className="btn btn-outline btn-sm" onClick={handleReset}>
<History size={14} /> {t('app.dashboard.restoreDefaultLayout', 'Restore default layout')}
- </button>
+ </Button>
)}
</div>
</div>
diff --git a/frontend/src/pages/DatabaseMigration.jsx b/frontend/src/pages/DatabaseMigration.jsx
index 269adcc0..c1c955c4 100644
--- a/frontend/src/pages/DatabaseMigration.jsx
+++ b/frontend/src/pages/DatabaseMigration.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
import api from '../services/api';
import {
Check, Database, AlertTriangle, ArrowRight, Download,
@@ -44,7 +44,7 @@ const DatabaseMigration = () => {
if (!needsMigration && migrationStatus && !migrationStatus.needs_migration) {
navigate('/');
}
- }, [needsMigration, migrationStatus]);
+ }, [needsMigration, migrationStatus, navigate]);
async function loadMigrationStatus() {
try {
@@ -192,7 +192,7 @@ const DatabaseMigration = () => {
: `Latest ${shownMigrations.length} of ${pendingMigrations.length} changes`}
</span>
{pendingMigrations.length > MIGRATION_PREVIEW_COUNT && (
- <button
+ <Button variant="unstyled"
type="button"
className="migration-list-toggle"
onClick={() => setShowAllMigrations(v => !v)}
@@ -200,7 +200,7 @@ const DatabaseMigration = () => {
{showAllMigrations
? 'Show less'
: `Show all ${pendingMigrations.length}`}
- </button>
+ </Button>
)}
</div>
{/* Scrolls within itself so Continue stays reachable no matter
diff --git a/frontend/src/pages/Databases.jsx b/frontend/src/pages/Databases.jsx
index da85c9d2..b7903a27 100644
--- a/frontend/src/pages/Databases.jsx
+++ b/frontend/src/pages/Databases.jsx
@@ -11,7 +11,7 @@ import Modal from '@/components/Modal';
import { SearchField } from '@/components/ds';
import ManagedDatabasesPanel from '../components/databases/ManagedDatabasesPanel';
import { formatBytes } from '@/utils/formatBytes';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import EmptyState from '../components/EmptyState';
import SourceTree from '../components/databases/SourceTree';
@@ -37,6 +37,7 @@ import { listTables, connKey, connLabel, quoteIdent, ENGINE_META } from '../comp
import { copyToClipboard } from '@/utils/clipboard';
import { usePolling } from '@/hooks/usePolling';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Cadence while an engine install is in flight.
const ENGINE_POLL_MS = 4000;
@@ -701,7 +702,7 @@ export default function Databases() {
{/* ─── Toolbar ─────────────────────────────── */}
<header className="dbx-toolbar">
<div className="dbx-toolbar-left">
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-icon-btn"
onClick={() => setSidebarVisible((v) => !v)}
@@ -709,13 +710,13 @@ export default function Databases() {
title={sidebarVisible ? t('app.databases.hideSources', 'Hide sources') : t('app.databases.showSources', 'Show sources')}
>
{sidebarVisible ? <PanelLeftClose size={16} aria-hidden="true" /> : <PanelLeftOpen size={16} aria-hidden="true" />}
- </button>
+ </SharedButton>
<h1 className="dbx-title"><Database size={17} aria-hidden="true" /> {t('app.databases.databaseExplorer', 'Database Explorer')}</h1>
</div>
<div className="dbx-toolbar-right">
<div className="dbx-new" ref={newMenuRef}>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-primary"
onClick={() => setShowNewMenu((s) => !s)}
@@ -723,10 +724,10 @@ export default function Databases() {
aria-expanded={showNewMenu}
>
<Plus size={15} aria-hidden="true" /> {t('app.databases.new', 'New')} <ChevronDown size={13} aria-hidden="true" />
- </button>
+ </SharedButton>
{showNewMenu && (
<div className="dbx-menu" role="menu">
- <button
+ <SharedButton variant="unstyled"
type="button"
role="menuitem"
disabled={!newConsoleConn}
@@ -734,48 +735,48 @@ export default function Databases() {
>
<Terminal size={14} aria-hidden="true" /> {t('app.databases.sqlConsole', 'SQL console')}
{!newConsoleConn && <span className="dbx-menu-hint">{t('app.databases.selectADatabase', 'select a database')}</span>}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
role="menuitem"
onClick={() => { setModal({ type: 'new-table', preset: dbPreset(selectedNode) }); setShowNewMenu(false); }}
>
<Table2 size={14} aria-hidden="true" /> {t('app.databases.tableOrCollection', 'Table or collection')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="unstyled"
type="button"
role="menuitem"
onClick={() => { setModal({ type: 'import', preset: dbPreset(selectedNode) }); setShowNewMenu(false); }}
>
<Download size={14} aria-hidden="true" /> {t('app.databases.importSqlDump', 'Import SQL dump…')}
- </button>
+ </SharedButton>
<div className="dbx-menu-sep" />
- <button type="button" role="menuitem" disabled={engineState('mysql', status) !== 'active'} onClick={() => { setModal({ type: 'mysql-db' }); setShowNewMenu(false); }}>
+ <SharedButton variant="unstyled" type="button" role="menuitem" disabled={engineState('mysql', status) !== 'active'} onClick={() => { setModal({ type: 'mysql-db' }); setShowNewMenu(false); }}>
<Database size={14} aria-hidden="true" /> {t('app.databases.mysqlDatabase', 'MySQL database')}
- </button>
- <button type="button" role="menuitem" disabled={engineState('postgresql', status) !== 'active'} onClick={() => { setModal({ type: 'pg-db' }); setShowNewMenu(false); }}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" role="menuitem" disabled={engineState('postgresql', status) !== 'active'} onClick={() => { setModal({ type: 'pg-db' }); setShowNewMenu(false); }}>
<Database size={14} aria-hidden="true" /> {t('app.databases.postgresqlDatabase', 'PostgreSQL database')}
- </button>
+ </SharedButton>
<div className="dbx-menu-sep" />
- <button type="button" role="menuitem" disabled={engineState('mysql', status) !== 'active'} onClick={() => { openUserModal('mysql'); setShowNewMenu(false); }}>
+ <SharedButton variant="unstyled" type="button" role="menuitem" disabled={engineState('mysql', status) !== 'active'} onClick={() => { openUserModal('mysql'); setShowNewMenu(false); }}>
<Server size={14} aria-hidden="true" /> {t('app.databases.mysqlUser', 'MySQL user')}
- </button>
- <button type="button" role="menuitem" disabled={engineState('postgresql', status) !== 'active'} onClick={() => { openUserModal('postgresql'); setShowNewMenu(false); }}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" role="menuitem" disabled={engineState('postgresql', status) !== 'active'} onClick={() => { openUserModal('postgresql'); setShowNewMenu(false); }}>
<Server size={14} aria-hidden="true" /> {t('app.databases.postgresqlUser', 'PostgreSQL user')}
- </button>
+ </SharedButton>
<div className="dbx-menu-sep" />
- <button type="button" role="menuitem" onClick={() => { openCatalog(); setShowNewMenu(false); }}>
+ <SharedButton variant="unstyled" type="button" role="menuitem" onClick={() => { openCatalog(); setShowNewMenu(false); }}>
<Layers size={14} aria-hidden="true" /> {t('app.databases.installADatabaseEngine', 'Install a database engine…')}
- </button>
+ </SharedButton>
</div>
)}
</div>
- <button type="button" className="dbx-chip" onClick={() => setShowManaged(true)}>
+ <SharedButton variant="unstyled" type="button" className="dbx-chip" onClick={() => setShowManaged(true)}>
<BookMarked size={14} aria-hidden="true" /> {t('app.databases.managed', 'Managed')}
- </button>
- <button type="button" className="dbx-chip" onClick={openBackups}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="dbx-chip" onClick={openBackups}>
<Archive size={14} aria-hidden="true" /> {t('common.labels.backups', 'Backups')}
- </button>
+ </SharedButton>
</div>
</header>
@@ -812,7 +813,7 @@ export default function Databases() {
list yet, right where you notice it's
missing. */}
{!engineData.unavailable && (
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-tree-install"
onClick={() => openCatalog()}
@@ -826,7 +827,7 @@ export default function Databases() {
{engineData.catalog.length}
</span>
)}
- </button>
+ </SharedButton>
)}
</>
)}
@@ -849,17 +850,17 @@ export default function Databases() {
>
<TabIcon tab={tab} />
<span className="dbx-tab-title">{tab.title}</span>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-tab-close"
onClick={(e) => closeTab(tab.id, e)}
aria-label={t('app.databases.close', 'Close {{title}}', { title: tab.title })}
>
<X size={13} aria-hidden="true" />
- </button>
+ </SharedButton>
</div>
))}
- <button
+ <SharedButton variant="unstyled"
type="button"
className="dbx-tab dbx-tab-new"
disabled={!newConsoleConn}
@@ -868,7 +869,7 @@ export default function Databases() {
aria-label={t('app.databases.newSqlConsole', 'New SQL console')}
>
<Plus size={14} aria-hidden="true" />
- </button>
+ </SharedButton>
</div>
)}
@@ -989,7 +990,7 @@ export default function Databases() {
{ctxMenu && (
<div className="dbx-context" style={{ left: ctxMenu.x, top: ctxMenu.y }} role="menu">
{ctxActions(ctxMenu.node).map((a) => (
- <button
+ <SharedButton variant="unstyled"
key={a.label}
type="button"
role="menuitem"
@@ -997,7 +998,7 @@ export default function Databases() {
onClick={() => { a.onClick(); setCtxMenu(null); }}
>
<a.icon size={14} aria-hidden="true" /> {a.label}
- </button>
+ </SharedButton>
))}
</div>
)}
diff --git a/frontend/src/pages/DeliveryLog.jsx b/frontend/src/pages/DeliveryLog.jsx
index e6d7f7b2..8dac477f 100644
--- a/frontend/src/pages/DeliveryLog.jsx
+++ b/frontend/src/pages/DeliveryLog.jsx
@@ -13,8 +13,8 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import PageLayout from '../layouts/PageLayout';
import EmptyState from '../components/EmptyState';
import { Button } from '@/components/ui/button';
-import { useAuth } from '../contexts/AuthContext';
-import { useToast } from '../contexts/ToastContext';
+import { useAuth } from '../contexts/useAuth.js';
+import { useToast } from '../contexts/useToast.js';
import { timeAgo } from '../utils/time';
import EmailProviders from '../components/EmailProviders';
import { usePolling } from '@/hooks/usePolling';
diff --git a/frontend/src/pages/Deployments.jsx b/frontend/src/pages/Deployments.jsx
index 4ef13c8b..aa73b8f3 100644
--- a/frontend/src/pages/Deployments.jsx
+++ b/frontend/src/pages/Deployments.jsx
@@ -426,7 +426,7 @@ const Deployments = () => {
</label>
<div className="deployments-page__sim-list">
{(simInfo?.scenarios || []).map((s) => (
- <button
+ <Button variant="unstyled"
key={s.id}
type="button"
className="deployments-page__sim-scenario"
@@ -440,7 +440,7 @@ const Deployments = () => {
{simBusy === s.id && (
<Loader2 size={15} className="spin" />
)}
- </button>
+ </Button>
))}
</div>
</Modal>
diff --git a/frontend/src/pages/Docker.jsx b/frontend/src/pages/Docker.jsx
index a11dad6f..8eb84085 100644
--- a/frontend/src/pages/Docker.jsx
+++ b/frontend/src/pages/Docker.jsx
@@ -244,7 +244,7 @@ const Docker = () => {
</div>
<div className="dx-resource-nav">
{availableServers.map(server => (
- <button type="button"
+ <Button variant="unstyled" type="button"
key={server.id}
className={`dx-resource-nav-item ${selectedServer.id === server.id ? 'active' : ''}`}
onClick={() => setSelectedServer(server)}
@@ -252,7 +252,7 @@ const Docker = () => {
<ServerIcon size={15} />
<span>{server.name || server.hostname || server.id}</span>
<strong>{server.status || 'online'}</strong>
- </button>
+ </Button>
))}
</div>
</section>
@@ -267,7 +267,7 @@ const Docker = () => {
{tabs.map(tab => {
const Icon = tab.icon;
return (
- <button type="button"
+ <Button variant="unstyled" type="button"
key={tab.id}
className={`dx-resource-nav-item ${activeTab === tab.id ? 'active' : ''}`}
onClick={() => setActiveTab(tab.id)}
@@ -275,7 +275,7 @@ const Docker = () => {
<Icon size={15} />
<span>{tab.label}</span>
{tab.count !== null && <strong>{tab.count}</strong>}
- </button>
+ </Button>
);
})}
</div>
diff --git a/frontend/src/pages/Domains.jsx b/frontend/src/pages/Domains.jsx
index 695de3b1..a43c8e3a 100644
--- a/frontend/src/pages/Domains.jsx
+++ b/frontend/src/pages/Domains.jsx
@@ -5,8 +5,8 @@ import {
AlertTriangle, Lock, Search, ChevronRight,
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
-import { useAuth } from '../contexts/AuthContext';
+import { useToast } from '../contexts/useToast.js';
+import { useAuth } from '../contexts/useAuth.js';
import EmptyState from '../components/EmptyState';
import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
@@ -490,7 +490,7 @@ const Domains = () => {
render: (d) => {
const days = daysUntil(d.expires_at);
if (days == null) return <span className="dom-dash">—</span>;
- return <span style={days < 40 ? { color: 'var(--amber)' } : undefined}>{days}d</span>;
+ return <span className={days < 40 ? 'dom-expiry--amber' : undefined}>{days}d</span>;
},
},
{
@@ -514,7 +514,7 @@ const Domains = () => {
return <Pill kind={state === 'active' ? 'green' : 'amber'}>{state}</Pill>;
},
},
- ], [appName]);
+ ], [appName, t]);
const grid = useGridConfig({
page: 'domains',
@@ -630,7 +630,7 @@ const Domains = () => {
{error && (
<div className="error-banner">
{error}
- <button type="button" className="error-banner__close" onClick={() => setError('')} aria-label={t('app.domains.dismissError', 'Dismiss error')}>×</button>
+ <Button variant="unstyled" type="button" className="error-banner__close" onClick={() => setError('')} aria-label={t('app.domains.dismissError', 'Dismiss error')}>×</Button>
</div>
)}
@@ -660,10 +660,10 @@ const Domains = () => {
/>
<GridBulkBar count={picked.length} noun="domain" onClear={() => setPicked([])}>
- <button type="button" onClick={loadData}>
+ <Button variant="unstyled" type="button" onClick={loadData}>
<RefreshCw size={13} /> {t('app.domains.checkDns', 'Check DNS')}
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
onClick={() => {
const n = exportRows(
@@ -676,7 +676,7 @@ const Domains = () => {
}}
>
<ExternalLink size={13} /> {t('app.domains.exportCsv', 'Export CSV')}
- </button>
+ </Button>
</GridBulkBar>
{portfolioErrors.length > 0 && (
@@ -798,7 +798,7 @@ const Domains = () => {
<>
<div className="sk-spec-card">
<div className="sk-spec-card__label">{t('app.domains.sslCertificate', 'SSL certificate')}</div>
- <div style={{ marginTop: 8 }}>{sslPill(drawerDomain)}</div>
+ <div className="dom-specs__value">{sslPill(drawerDomain)}</div>
<div className="sk-spec-card__sub">
{drawerDomain.ssl_enabled
? (drawerDomain.ssl_expires_at ? `Expires ${new Date(drawerDomain.ssl_expires_at).toLocaleDateString()}` : "Let's Encrypt")
@@ -812,7 +812,7 @@ const Domains = () => {
</div>
<div className="sk-spec-card">
<div className="sk-spec-card__label">{t('common.labels.status', 'Status')}</div>
- <div style={{ marginTop: 8 }}>
+ <div className="dom-specs__value">
<Pill kind={drawerDomain.ssl_enabled ? 'green' : 'amber'}>{drawerDomain.ssl_enabled ? 'active' : 'unconfigured'}</Pill>
</div>
<div className="sk-spec-card__sub">{t('app.domains.autoRenew', 'Auto-renew')} {drawerDomain.ssl_auto_renew ? 'on' : 'off'}</div>
@@ -827,7 +827,7 @@ const Domains = () => {
</div>
<div className="sk-spec-card">
<div className="sk-spec-card__label">{t('app.domains.zoneStatus', 'Zone status')}</div>
- <div style={{ marginTop: 8 }}>
+ <div className="dom-specs__value">
<Pill kind={drawerDomain.cfStatus === 'active' ? 'green' : 'amber'}>{drawerDomain.cfStatus || 'active'}</Pill>
</div>
<div className="sk-spec-card__sub">{drawerDomain.provider}</div>
diff --git a/frontend/src/pages/Downloads.jsx b/frontend/src/pages/Downloads.jsx
index f8976aac..60a705ff 100644
--- a/frontend/src/pages/Downloads.jsx
+++ b/frontend/src/pages/Downloads.jsx
@@ -166,7 +166,7 @@ function Downloads() {
{error && (
<div className="alert alert-error">
<p>{error}</p>
- <button type="button" onClick={fetchVersionInfo}>{t('app.downloads.tryAgain', 'Try Again')}</button>
+ <Button variant="unstyled" type="button" onClick={fetchVersionInfo}>{t('app.downloads.tryAgain', 'Try Again')}</Button>
</div>
)}
@@ -253,13 +253,13 @@ function Downloads() {
<pre>
<code>{platforms[0].command}</code>
</pre>
- <button type="button"
+ <Button variant="unstyled" type="button"
className="copy-btn"
onClick={() => copyCommand(platforms[0].command, 'linux')}
title={t('app.downloads.copyToClipboard', 'Copy to clipboard')}
>
{copiedCommand === 'linux' ? <CheckIcon /> : <CopyIcon />}
- </button>
+ </Button>
</div>
</div>
@@ -272,13 +272,13 @@ function Downloads() {
<pre>
<code>{platforms[2].command}</code>
</pre>
- <button type="button"
+ <Button variant="unstyled" type="button"
className="copy-btn"
onClick={() => copyCommand(platforms[2].command, 'windows')}
title={t('app.downloads.copyToClipboard', 'Copy to clipboard')}
>
{copiedCommand === 'windows' ? <CheckIcon /> : <CopyIcon />}
- </button>
+ </Button>
</div>
<p className="command-note">{t('app.downloads.runPowershellAsAdministrator', 'Run PowerShell as Administrator')}</p>
</div>
diff --git a/frontend/src/pages/Errors.jsx b/frontend/src/pages/Errors.jsx
index f5137e9d..ce99dbcf 100644
--- a/frontend/src/pages/Errors.jsx
+++ b/frontend/src/pages/Errors.jsx
@@ -15,8 +15,8 @@ import {
import { Button } from '@/components/ui/button';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import { useConfirm } from '@/hooks/useConfirm';
-import { useAuth } from '../contexts/AuthContext';
-import { useToast } from '../contexts/ToastContext';
+import { useAuth } from '../contexts/useAuth.js';
+import { useToast } from '../contexts/useToast.js';
import EmptyState from '../components/EmptyState';
import { timeAgo } from '../utils/time';
import { useTranslation } from 'react-i18next';
diff --git a/frontend/src/pages/FTPServer.jsx b/frontend/src/pages/FTPServer.jsx
index 2661a1ae..dbe4af93 100644
--- a/frontend/src/pages/FTPServer.jsx
+++ b/frontend/src/pages/FTPServer.jsx
@@ -1,4 +1,4 @@
-import { useState, useEffect } from 'react';
+import { useCallback, useState, useEffect } from 'react';
import {
FolderUp, UserPlus, Network, Activity, Server, Users as UsersIcon,
Cable, KeyRound, Ban, Check, Trash2, RefreshCw, X,
@@ -13,7 +13,7 @@ import {
} from '@/components/ds/grid';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import EmptyState from '../components/EmptyState';
import ConfirmDialog from '../components/ConfirmDialog';
import Modal from '@/components/Modal';
@@ -91,26 +91,16 @@ function FTPServer() {
setHiddenKeys: setConnHiddenKeys,
} = useColumnVisibility({ storageKey: 'serverkit-table-ftp-connections-cols' });
- useEffect(() => {
- loadData();
- }, []);
-
- const loadData = async () => {
- setLoading(true);
+ const loadConfig = useCallback(async (service) => {
try {
- await Promise.all([
- loadStatus(),
- loadUsers(),
- loadConnections()
- ]);
+ const data = await api.getFTPConfig(service);
+ setConfig(data);
} catch (error) {
- console.error('Failed to load FTP data:', error);
- } finally {
- setLoading(false);
+ console.error('Failed to load FTP config:', error);
}
- };
+ }, []);
- const loadStatus = async () => {
+ const loadStatus = useCallback(async () => {
try {
const data = await api.getFTPStatus();
setStatus(data);
@@ -120,40 +110,51 @@ function FTPServer() {
} catch (error) {
console.error('Failed to load FTP status:', error);
}
- };
+ }, [loadConfig]);
- const loadConfig = async (service) => {
- try {
- const data = await api.getFTPConfig(service);
- setConfig(data);
- } catch (error) {
- console.error('Failed to load FTP config:', error);
- }
- };
-
- const loadUsers = async () => {
+ const loadUsers = useCallback(async () => {
try {
const data = await api.getFTPUsers();
setUsers(data.users || []);
} catch (error) {
console.error('Failed to load FTP users:', error);
}
- };
+ }, []);
- const loadConnections = async () => {
+ const loadConnections = useCallback(async () => {
try {
const data = await api.getFTPConnections();
setConnections(data.connections || []);
} catch (error) {
console.error('Failed to load FTP connections:', error);
}
- };
+ }, []);
+
+ const loadData = useCallback(async () => {
+ setLoading(true);
+ try {
+ await Promise.all([
+ loadStatus(),
+ loadUsers(),
+ loadConnections()
+ ]);
+ } catch (error) {
+ console.error('Failed to load FTP data:', error);
+ } finally {
+ setLoading(false);
+ }
+ }, [loadStatus, loadUsers, loadConnections]);
+
+ useEffect(() => {
+ loadData();
+ }, [loadData]);
+
const loadLogs = async () => {
try {
const data = await api.getFTPLogs(200);
setLogs(data.content || 'No logs available');
- } catch (error) {
+ } catch {
setLogs('Failed to load logs');
}
};
diff --git a/frontend/src/pages/FileManager.jsx b/frontend/src/pages/FileManager.jsx
index 38e41878..c718f357 100644
--- a/frontend/src/pages/FileManager.jsx
+++ b/frontend/src/pages/FileManager.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useRef, useMemo, useCallback } from 'react';
import { api } from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import ConfirmDialog from '../components/ConfirmDialog';
import EmptyState from '../components/EmptyState';
import Modal from '@/components/Modal';
@@ -347,7 +347,7 @@ function FileManager() {
return true;
}
return false;
- }, [isRemote, isS3, toast]);
+ }, [isRemote, isS3, t, toast]);
// When the user switches to a remote target, jump to its first
// advertised allowed_path so they don't see a "panel /home" view
@@ -392,7 +392,7 @@ function FileManager() {
} finally {
setLoading(false);
}
- }, [showHidden, toast, fileApi]);
+ }, [fileApi, showHidden, toast, t]);
useEffect(() => {
loadDirectory(currentPath);
@@ -964,9 +964,9 @@ function FileManager() {
{activeUploads.length > 0 && (
<span className="upload-tray-percent">{Math.round(totalUploadProgress)}%</span>
)}
- <button type="button" className="toolbar-icon-btn small" onClick={() => setUploads([])} title={t('common.actions.clear', 'Clear')}>
+ <Button variant="unstyled" type="button" className="toolbar-icon-btn small" onClick={() => setUploads([])} title={t('common.actions.clear', 'Clear')}>
<X size={14} />
- </button>
+ </Button>
</div>
<div className="upload-tray-list">
{uploads.map((u) => (
@@ -986,37 +986,37 @@ function FileManager() {
<div className="file-manager-toolbar">
<div className="toolbar-left">
- <button type="button"
+ <Button variant="unstyled" type="button"
className="toolbar-icon-btn"
onClick={() => setSidebarVisible(!sidebarVisible)}
title={sidebarVisible ? t('app.fileManager.hideSidebar', 'Hide sidebar') : t('app.fileManager.showSidebar', 'Show sidebar')}
>
{sidebarVisible ? <PanelLeftClose size={14} /> : <PanelLeftOpen size={14} />}
- </button>
+ </Button>
<div className="nav-buttons">
- <button type="button" className="nav-btn" onClick={goBack} disabled={historyIdx === 0} title={t('common.actions.back', 'Back')}>
+ <Button variant="unstyled" type="button" className="nav-btn" onClick={goBack} disabled={historyIdx === 0} title={t('common.actions.back', 'Back')}>
<ArrowLeft size={14} />
- </button>
- <button type="button" className="nav-btn" onClick={goForward} disabled={historyIdx >= history.length - 1} title={t('app.fileManager.forward', 'Forward')}>
+ </Button>
+ <Button variant="unstyled" type="button" className="nav-btn" onClick={goForward} disabled={historyIdx >= history.length - 1} title={t('app.fileManager.forward', 'Forward')}>
<ArrowRight size={14} />
- </button>
- <button type="button" className="nav-btn" onClick={goUp} disabled={!parentPath} title="Up">
+ </Button>
+ <Button variant="unstyled" type="button" className="nav-btn" onClick={goUp} disabled={!parentPath} title="Up">
<ArrowUp size={14} />
- </button>
- <button type="button" className="nav-btn" onClick={() => navigateTo(isS3 ? '/' : '/home')} title={t('app.fileManager.home', 'Home')}>
+ </Button>
+ <Button variant="unstyled" type="button" className="nav-btn" onClick={() => navigateTo(isS3 ? '/' : '/home')} title={t('app.fileManager.home', 'Home')}>
<Home size={14} />
- </button>
+ </Button>
</div>
<div className="path-breadcrumb">
{breadcrumbs.map((crumb, idx) => (
<span key={crumb.path + idx} className="crumb-segment">
{idx > 0 && <span className="crumb-separator">/</span>}
- <button type="button"
+ <Button variant="unstyled" type="button"
className={`crumb ${idx === breadcrumbs.length - 1 ? 'crumb-active' : ''}`}
onClick={() => navigateTo(crumb.path)}
>
{crumb.name}
- </button>
+ </Button>
</span>
))}
</div>
@@ -1071,45 +1071,45 @@ function FileManager() {
onKeyDown={(e) => e.key === 'Enter' && handleSearch()}
/>
{(searchResults || searchQuery) && (
- <button type="button"
+ <Button variant="unstyled" type="button"
className="search-field-clear"
onClick={() => { setSearchResults(null); setSearchQuery(''); }}
title={t('common.actions.clear', 'Clear')}
>
<X size={12} />
- </button>
+ </Button>
)}
</div>
<div className="view-toggle">
- <button type="button"
+ <Button variant="unstyled" type="button"
className={`view-toggle-btn ${viewMode === 'grid' ? 'active' : ''}`}
onClick={() => setViewMode('grid')}
title={t('app.fileManager.gridView', 'Grid view')}
>
<LayoutGrid size={14} />
- </button>
- <button type="button"
+ </Button>
+ <Button variant="unstyled" type="button"
className={`view-toggle-btn ${viewMode === 'list' ? 'active' : ''}`}
onClick={() => setViewMode('list')}
title={t('app.fileManager.listView', 'List view')}
>
<List size={14} />
- </button>
+ </Button>
</div>
- <button type="button"
+ <Button variant="unstyled" type="button"
className={`toolbar-icon-btn ${showHidden ? 'active' : ''}`}
onClick={() => setShowHidden(!showHidden)}
title={t('app.fileManager.toggleHiddenFiles', 'Toggle hidden files')}
>
{showHidden ? <Eye size={14} /> : <EyeOff size={14} />}
- </button>
- <button type="button"
+ </Button>
+ <Button variant="unstyled" type="button"
className="toolbar-icon-btn"
onClick={() => loadDirectory(currentPath)}
title={t('common.actions.refresh', 'Refresh')}
>
<RefreshCw size={14} className={loading ? 'spinning' : ''} />
- </button>
+ </Button>
</div>
</div>
@@ -1120,25 +1120,25 @@ function FileManager() {
<span>{selectedPaths.size} {t('app.fileManager.selected', 'selected ·')} {formatBytes(stats.selectedBytes)}</span>
</div>
<div className="bulk-bar-actions">
- <button type="button" className="bulk-btn" onClick={downloadSelected}>
+ <Button variant="unstyled" type="button" className="bulk-btn" onClick={downloadSelected}>
<Download size={14} /> {t('common.actions.download', 'Download')}
- </button>
+ </Button>
{selectedEntries.length === 1 && (
<>
- <button type="button" className="bulk-btn" onClick={() => openRenameModal(selectedEntries[0])}>
+ <Button variant="unstyled" type="button" className="bulk-btn" onClick={() => openRenameModal(selectedEntries[0])}>
<Edit3 size={14} /> {t('app.fileManager.rename', 'Rename')}
- </button>
- <button type="button" className="bulk-btn" onClick={() => copyPathToClipboard(selectedEntries[0].path)}>
+ </Button>
+ <Button variant="unstyled" type="button" className="bulk-btn" onClick={() => copyPathToClipboard(selectedEntries[0].path)}>
<Copy size={14} /> {t('app.fileManager.copyPath', 'Copy path')}
- </button>
+ </Button>
</>
)}
- <button type="button" className="bulk-btn danger" onClick={() => handleDelete(selectedEntries)}>
+ <Button variant="unstyled" type="button" className="bulk-btn danger" onClick={() => handleDelete(selectedEntries)}>
<Trash2 size={14} /> {t('common.actions.delete', 'Delete')}
- </button>
- <button type="button" className="bulk-btn ghost" onClick={clearSelection}>
+ </Button>
+ <Button variant="unstyled" type="button" className="bulk-btn ghost" onClick={clearSelection}>
<X size={14} /> {t('common.actions.clear', 'Clear')}
- </button>
+ </Button>
</div>
</div>
)}
@@ -1147,14 +1147,14 @@ function FileManager() {
{sidebarVisible && (
<aside className="file-manager-sidebar left">
<div className="file-manager-source">
- <button
+ <Button variant="unstyled"
type="button"
className="file-manager-source__close"
onClick={() => setSidebarVisible(false)}
aria-label={t('app.fileManager.hideSidebar', 'Hide sidebar')}
>
<X size={14} />
- </button>
+ </Button>
<TargetPicker
feature="files"
value={target}
@@ -1180,13 +1180,13 @@ function FileManager() {
<HardDrive size={13} />
<span>{t('app.fileManager.volumes', 'Volumes')}</span>
</span>
- <button type="button" className="sidebar-action-btn" onClick={loadDiskMounts} disabled={diskLoading} title={t('common.actions.refresh', 'Refresh')}>
+ <Button variant="unstyled" type="button" className="sidebar-action-btn" onClick={loadDiskMounts} disabled={diskLoading} title={t('common.actions.refresh', 'Refresh')}>
<RefreshCw size={12} className={diskLoading ? 'spinning' : ''} />
- </button>
+ </Button>
</div>
<div className="sidebar-section-content disk-mount-list">
{diskMounts.map((mount) => (
- <button
+ <Button variant="unstyled"
type="button"
key={`${mount.device}:${mount.mountpoint}`}
className={`disk-mount-item${activeMount?.mountpoint === mount.mountpoint ? ' active' : ''}`}
@@ -1206,7 +1206,7 @@ function FileManager() {
<div className={`disk-progress ${getDiskColor(mount.percent)}`}>
<span className="disk-progress-fill" style={{ width: `${mount.percent}%` }} />
</div>
- </button>
+ </Button>
))}
{diskLastUpdated && (
<span className="disk-updated disk-updated--footer">
@@ -1226,21 +1226,21 @@ function FileManager() {
</div>
<div className="sidebar-section-content quick-access-list">
{quickAccess.map(q => (
- <button type="button"
+ <Button variant="unstyled" type="button"
key={q.label}
className={`quick-access-item ${currentPath === q.path ? 'active' : ''}`}
onClick={() => navigateTo(q.path)}
>
<q.icon size={14} />
<span>{q.label}</span>
- </button>
+ </Button>
))}
</div>
</div>
<div className="sidebar-section">
<div className="sidebar-section-header sidebar-section-header--split">
- <button
+ <Button variant="unstyled"
type="button"
className="sidebar-section-toggle"
onClick={() => setTreeCollapsed(!treeCollapsed)}
@@ -1249,15 +1249,15 @@ function FileManager() {
<FolderTreeIcon size={16} />
<span>{t('app.fileManager.fileSystem', 'File system')}</span>
{treeCollapsed ? <ChevronRight size={16} /> : <ChevronDown size={16} />}
- </button>
- <button type="button"
+ </Button>
+ <Button variant="unstyled" type="button"
className="sidebar-action-btn"
onClick={() => setShowNewFolderModal(true)}
disabled={isRemote}
title={t('app.fileManager.newFolder', 'New folder')}
>
<FolderPlus size={14} />
- </button>
+ </Button>
</div>
{!treeCollapsed && (
<div className="sidebar-section-content tree-content">
@@ -1326,7 +1326,7 @@ function FileManager() {
<div className="file-list">
<div className="file-list-header">
<span className="col-check">
- <button type="button"
+ <Button variant="unstyled" type="button"
className="checkbox-btn"
onClick={() => {
if (selectedPaths.size === sortedFiltered.length) clearSelection();
@@ -1339,7 +1339,7 @@ function FileManager() {
<span className={`checkbox ${selectedPaths.size === sortedFiltered.length && sortedFiltered.length > 0 ? 'checked' : ''}`}>
{selectedPaths.size === sortedFiltered.length && sortedFiltered.length > 0 && <Check size={12} />}
</span>
- </button>
+ </Button>
</span>
<span className="col-name">{t('common.labels.name', 'Name')}</span>
<span className="col-size">{t('common.labels.size', 'Size')}</span>
diff --git a/frontend/src/pages/FleetProxy.jsx b/frontend/src/pages/FleetProxy.jsx
index 67920f5f..06c274eb 100644
--- a/frontend/src/pages/FleetProxy.jsx
+++ b/frontend/src/pages/FleetProxy.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react';
import { Link } from 'react-router-dom';
import { AlertTriangle, Network, RefreshCw, Server as ServerIcon } from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
@@ -327,7 +327,7 @@ const FleetProxy = () => {
} finally {
setLoading(false);
}
- }, [toast]);
+ }, [t, toast]);
useEffect(() => {
load();
diff --git a/frontend/src/pages/GithubAppCallback.jsx b/frontend/src/pages/GithubAppCallback.jsx
index d0aedab1..08fa950e 100644
--- a/frontend/src/pages/GithubAppCallback.jsx
+++ b/frontend/src/pages/GithubAppCallback.jsx
@@ -2,8 +2,9 @@ import { useEffect, useRef, useState } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { Github, Loader2 } from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Lands here after the operator confirms the one-click GitHub App on github.com.
// We convert the returned manifest code into stored app credentials, then chain
@@ -47,7 +48,7 @@ const GithubAppCallback = () => {
}
}
run();
- }, [navigate, searchParams, toast]);
+ }, [navigate, searchParams, toast, t]);
return (
<div className="auth-page">
@@ -59,9 +60,9 @@ const GithubAppCallback = () => {
{error ? (
<>
<p className="auth-error">{error}</p>
- <button type="button" className="btn btn-primary" onClick={() => navigate('/settings/connections')}>
+ <SharedButton variant="primary" type="button" className="btn btn-primary" onClick={() => navigate('/settings/connections')}>
{t('app.githubAppCallback.backToConnections', 'Back to Connections')}
- </button>
+ </SharedButton>
</>
) : (
<div className="sso-loading">
diff --git a/frontend/src/pages/ImportWizard.jsx b/frontend/src/pages/ImportWizard.jsx
index 69fd9f48..d233519a 100644
--- a/frontend/src/pages/ImportWizard.jsx
+++ b/frontend/src/pages/ImportWizard.jsx
@@ -1,3 +1,4 @@
+import { formatBytes } from '@/utils/formatBytes';
import { useState, useEffect, useCallback, useRef } from 'react';
import { Link } from 'react-router-dom';
import {
@@ -7,7 +8,7 @@ import {
} from 'lucide-react';
import api from '../services/api';
import HtaccessConverter from '../components/apps/HtaccessConverter';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import { Pill, statusKind } from '@/components/ds';
import PageLayout from '../layouts/PageLayout';
@@ -46,16 +47,6 @@ function StatusPill({ status }) {
return <Pill kind={statusKind(status)}>{status}</Pill>;
}
-function formatSize(bytes) {
- if (bytes == null || bytes === '') return '—';
- const n = Number(bytes);
- if (Number.isNaN(n)) return String(bytes);
- if (n < 1024) return `${n} B`;
- if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
- if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;
- return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`;
-}
-
// Analysis report (step 3): domains/databases tables, db users, crontab,
// warnings + unsupported callouts. Pure render off the contract's shape.
function AnalysisReport({ analysis }) {
@@ -133,7 +124,7 @@ function AnalysisReport({ analysis }) {
<tr key={db.name}>
<td>{db.name}</td>
<td>{db.engine || '—'}</td>
- <td>{formatSize(db.size)}</td>
+ <td>{formatBytes(db.size)}</td>
<td><code>{db.dump_path || '—'}</code></td>
</tr>
))}
@@ -401,7 +392,7 @@ function ImportWizard() {
<h2>{t('app.importWizard.whereIsTheSiteComingFrom', 'Where is the site coming from?')}</h2>
<div className="import-wizard__sources">
{SOURCE_TYPES.map((s) => (
- <button
+ <Button variant="unstyled"
key={s.id}
type="button"
className="import-wizard__source-card"
@@ -411,7 +402,7 @@ function ImportWizard() {
<strong>{s.name}</strong>
<p>{s.description}</p>
<ChevronRight size={16} className="import-wizard__source-chev" aria-hidden="true" />
- </button>
+ </Button>
))}
<Link to="/wordpress/ssh-import" className="import-wizard__source-card import-wizard__source-card--link">
<span className="import-wizard__source-ico"><Server size={18} aria-hidden="true" /></span>
@@ -428,20 +419,20 @@ function ImportWizard() {
<div className="import-wizard__panel">
<h2>{t('app.importWizard.provideTheBackupArchive', 'Provide the backup archive')}</h2>
<div className="import-wizard__mode">
- <button
+ <Button variant="unstyled"
type="button"
className={`import-wizard__mode-btn${inputMode === 'upload' ? ' is-active' : ''}`}
onClick={() => setInputMode('upload')}
>
<Upload size={14} aria-hidden="true" /> {t('app.importWizard.uploadAFile', 'Upload a file')}
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className={`import-wizard__mode-btn${inputMode === 'url' ? ' is-active' : ''}`}
onClick={() => setInputMode('url')}
>
<Link2 size={14} aria-hidden="true" /> {t('app.importWizard.fetchFromUrl', 'Fetch from URL')}
- </button>
+ </Button>
</div>
{inputMode === 'upload' ? (
@@ -465,7 +456,7 @@ function ImportWizard() {
/>
<Upload size={22} aria-hidden="true" />
{file ? (
- <p><strong>{file.name}</strong> · {formatSize(file.size)}</p>
+ <p><strong>{file.name}</strong> · {formatBytes(file.size)}</p>
) : (
<p>{t('app.importWizard.dragTheBackupArchiveHereOr', 'Drag the backup archive here, or click to browse')}</p>
)}
diff --git a/frontend/src/pages/Incidents.jsx b/frontend/src/pages/Incidents.jsx
index 797a89ae..558db6ec 100644
--- a/frontend/src/pages/Incidents.jsx
+++ b/frontend/src/pages/Incidents.jsx
@@ -14,7 +14,7 @@ import {
AlertTriangle, CheckCircle2, ChevronRight, Eye, Radar, RefreshCw, Siren,
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import EmptyState from '../components/EmptyState';
import { DataTable, DataTableFooter, Drawer, Pill, SearchField } from '@/components/ds';
import {
@@ -322,7 +322,7 @@ export default function Incidents() {
} catch {
toast.error(t('app.incidents.failedToAlert', 'Failed to {{value}} alert', { value: action === 'ack' ? 'acknowledge' : 'resolve' }));
}
- }, [load, toast]);
+ }, [load, t, toast]);
const onPostUpdate = async (state) => {
if (!selected || selected.kind !== 'incident') return;
@@ -450,7 +450,7 @@ export default function Incidents() {
</>
),
},
- ], [onAlertAction]);
+ ], [onAlertAction, t]);
const viewPageState = useMemo(() => ({ search }), [search]);
const applyViewPageState = useCallback((saved) => {
diff --git a/frontend/src/pages/Jobs.jsx b/frontend/src/pages/Jobs.jsx
index 1f20b594..1988daf5 100644
--- a/frontend/src/pages/Jobs.jsx
+++ b/frontend/src/pages/Jobs.jsx
@@ -27,8 +27,8 @@ import EmptyState from '../components/EmptyState';
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
-import { useAuth } from '../contexts/AuthContext';
-import { useToast } from '../contexts/ToastContext';
+import { useAuth } from '../contexts/useAuth.js';
+import { useToast } from '../contexts/useToast.js';
import { timeAgo } from '../utils/time';
import { usePolling } from '@/hooks/usePolling';
import { useTranslation } from 'react-i18next';
diff --git a/frontend/src/pages/Login.jsx b/frontend/src/pages/Login.jsx
index 6132abda..b4cd9d34 100644
--- a/frontend/src/pages/Login.jsx
+++ b/frontend/src/pages/Login.jsx
@@ -1,7 +1,7 @@
-import { useState, useRef, useEffect } from 'react';
+import { useState, useRef, useEffect, useCallback } from 'react';
import { useNavigate, Link, useLocation } from 'react-router-dom';
import { Trans, useTranslation } from 'react-i18next';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
import api from '../services/api';
import SSOProviderIcon from '../components/SSOProviderIcon';
import ServerKitLogo from '../components/ServerKitLogo';
@@ -29,8 +29,10 @@ const Login = () => {
const [totpCode, setTotpCode] = useState(['', '', '', '', '', '']);
const [useBackupCode, setUseBackupCode] = useState(false);
const [backupCode, setBackupCode] = useState('');
+ const twoFactorInFlight = useRef(false);
+ const submittedTotp = useRef(null);
- const { login, setUser, setTokens, registrationEnabled, ssoProviders, passwordLoginEnabled, publicTitle } = useAuth();
+ const { setUser, registrationEnabled, ssoProviders, passwordLoginEnabled, publicTitle } = useAuth();
const navigate = useNavigate();
const location = useLocation();
const [ssoLoading, setSsoLoading] = useState(null);
@@ -128,8 +130,10 @@ const Login = () => {
}
}
- async function handle2FASubmit(e) {
+ const handle2FASubmit = useCallback(async (e) => {
e.preventDefault();
+ if (twoFactorInFlight.current) return;
+ twoFactorInFlight.current = true;
setError('');
setLoading(true);
@@ -157,9 +161,10 @@ const Login = () => {
inputRefs.current[0]?.focus();
}
} finally {
+ twoFactorInFlight.current = false;
setLoading(false);
}
- }
+ }, [useBackupCode, backupCode, totpCode, tempToken, setUser, navigate]);
function handleTotpChange(index, value) {
// Only allow digits
@@ -214,10 +219,18 @@ const Login = () => {
// Auto-submit when all 6 digits are entered
useEffect(() => {
- if (!useBackupCode && totpCode.every(c => c) && !loading) {
- handle2FASubmit({ preventDefault: () => {} });
+ if (!requires2FA || useBackupCode || !totpCode.every(c => c)) {
+ submittedTotp.current = null;
+ return;
}
- }, [totpCode, useBackupCode]);
+ if (loading || !tempToken) return;
+ // Loading and auth-context updates must not resubmit a completed code.
+ // Editing/clearing the digits re-arms the next attempt after a failure.
+ const attempt = `${tempToken}:${totpCode.join('')}`;
+ if (submittedTotp.current === attempt) return;
+ submittedTotp.current = attempt;
+ handle2FASubmit({ preventDefault: () => {} });
+ }, [totpCode, useBackupCode, requires2FA, tempToken, loading, handle2FASubmit]);
// Render 2FA verification form
if (requires2FA) {
@@ -336,7 +349,7 @@ const Login = () => {
{ssoProviders && ssoProviders.length > 0 && (
<div className="sso-providers">
{ssoProviders.map(p => (
- <button type="button"
+ <Button variant="unstyled" type="button"
key={p.id}
className={`btn-sso btn-sso--${p.id}`}
onClick={() => handleSSOLogin(p.id)}
@@ -344,7 +357,7 @@ const Login = () => {
>
<SSOProviderIcon provider={p.id} />
{ssoLoading === p.id ? 'Redirecting...' : `Continue with ${p.name}`}
- </button>
+ </Button>
))}
</div>
)}
diff --git a/frontend/src/pages/Marketplace.jsx b/frontend/src/pages/Marketplace.jsx
index 51c20ef6..c937beea 100644
--- a/frontend/src/pages/Marketplace.jsx
+++ b/frontend/src/pages/Marketplace.jsx
@@ -21,7 +21,7 @@ import {
UploadCloud,
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { sanitizeSvgInner } from '../utils/sanitizeSvg';
import Modal from '@/components/Modal';
import PageLoader from '../components/PageLoader';
@@ -34,9 +34,8 @@ import {
import { useTopbarActions } from '@/hooks/useTopbarActions';
import ManualInstallModal from '../components/marketplace/ManualInstallModal';
import ExtensionPermissionsDialog from '../components/marketplace/ExtensionPermissionsDialog';
-import {
- ExtensionBrandMark, hasBrandMark, extensionCoverStyle,
-} from '../components/icons/ExtensionBrands';
+import { ExtensionBrandMark } from '../components/icons/ExtensionBrands';
+import { hasBrandMark, extensionCoverStyle } from '../components/icons/extensionBrandData';
import { resolveExtensionIcon } from '../components/icons/ExtensionIcons';
import { useTranslation } from 'react-i18next';
@@ -275,7 +274,7 @@ const Marketplace = () => {
} finally {
setLoading(false);
}
- }, [toast]);
+ }, [t, toast]);
useEffect(() => { loadExtensions(); }, [loadExtensions]);
diff --git a/frontend/src/pages/MonitorDetail.jsx b/frontend/src/pages/MonitorDetail.jsx
index e4fa349d..8a268055 100644
--- a/frontend/src/pages/MonitorDetail.jsx
+++ b/frontend/src/pages/MonitorDetail.jsx
@@ -12,7 +12,7 @@ import {
Pause, Play, RefreshCw, Rows3, ShieldAlert, SlidersHorizontal, Trash2, Zap,
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import { useRecordVisit } from '@/hooks/useRecordVisit';
import FavoriteStar from '@/components/FavoriteStar';
diff --git a/frontend/src/pages/Monitoring.jsx b/frontend/src/pages/Monitoring.jsx
index 0a53734f..dc978e0c 100644
--- a/frontend/src/pages/Monitoring.jsx
+++ b/frontend/src/pages/Monitoring.jsx
@@ -2,7 +2,7 @@ import { useEffect, useMemo, useState } from 'react';
import { Link } from 'react-router-dom';
import useTabParam from '../hooks/useTabParam';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import EmptyState from '../components/EmptyState';
import DoctorPanel from '../components/monitoring/DoctorPanel';
import MonitoringOverview from '../components/monitoring/MonitoringOverview';
@@ -297,7 +297,7 @@ const Monitoring = () => {
{error && (
<div className="alert alert-danger">
{error}
- <button type="button" onClick={() => setError(null)} className="alert-close">&times;</button>
+ <Button variant="unstyled" type="button" onClick={() => setError(null)} className="alert-close">&times;</Button>
</div>
)}
diff --git a/frontend/src/pages/Monitors.jsx b/frontend/src/pages/Monitors.jsx
index 14dfb6d8..d6fdeec5 100644
--- a/frontend/src/pages/Monitors.jsx
+++ b/frontend/src/pages/Monitors.jsx
@@ -15,7 +15,7 @@ import {
ChevronRight, Globe, Pause, Play, Plus, Radar, RefreshCw,
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import EmptyState from '../components/EmptyState';
import {
DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer,
diff --git a/frontend/src/pages/Notifications.jsx b/frontend/src/pages/Notifications.jsx
index 19a916d1..3cb514e2 100644
--- a/frontend/src/pages/Notifications.jsx
+++ b/frontend/src/pages/Notifications.jsx
@@ -4,8 +4,8 @@ import { Bell, CheckCheck, ScrollText, X } from 'lucide-react';
import api from '../services/api';
import PageLayout from '../layouts/PageLayout';
import { Button } from '@/components/ui/button';
-import { useAuth } from '../contexts/AuthContext';
-import { useNotifications } from '../contexts/NotificationsContext';
+import { useAuth } from '../contexts/useAuth.js';
+import { useNotifications } from '../contexts/useNotifications.js';
import { timeAgo } from '../utils/time';
import { useTranslation } from 'react-i18next';
@@ -113,7 +113,7 @@ export default function Notifications() {
>
<div className="sk-notif-page">
<div className="sk-notif-page__filters" role="tablist" aria-label={t('app.notifications.filterNotifications', 'Filter notifications')}>
- <button
+ <Button variant="unstyled"
type="button"
role="tab"
aria-selected={!unreadOnly}
@@ -121,8 +121,8 @@ export default function Notifications() {
onClick={() => setUnreadOnly(false)}
>
{t('common.labels.all', 'All')}
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
role="tab"
aria-selected={unreadOnly}
@@ -130,32 +130,32 @@ export default function Notifications() {
onClick={() => setUnreadOnly(true)}
>
{t('app.notifications.unread', 'Unread')}
- </button>
+ </Button>
</div>
<div className="sk-notif-page__chips">
<div className="sk-notif-chipset" aria-label={t('app.notifications.filterByCategory', 'Filter by category')}>
{CATEGORY_CHIPS.map((c) => (
- <button
+ <Button variant="unstyled"
type="button"
key={c.key || 'all'}
className={`sk-notif-chip${category === c.key ? ' is-active' : ''}`}
onClick={() => setCategory(c.key)}
>
{c.label}
- </button>
+ </Button>
))}
</div>
<div className="sk-notif-chipset" aria-label={t('app.notifications.filterBySeverity', 'Filter by severity')}>
{SEVERITY_CHIPS.map((s) => (
- <button
+ <Button variant="unstyled"
type="button"
key={s.key || 'any'}
className={`sk-notif-chip sk-notif-chip--sev${severity === s.key ? ' is-active' : ''}`}
onClick={() => setSeverity(s.key)}
>
{s.label}
- </button>
+ </Button>
))}
</div>
</div>
@@ -187,14 +187,14 @@ export default function Notifications() {
<div className="sk-notif-row__action">{item.action_label} →</div>
)}
</div>
- <button
+ <Button variant="unstyled"
type="button"
className="sk-notif-row__dismiss"
onClick={(e) => { e.stopPropagation(); if (dismissNotice) dismissNotice(item.notice_id); }}
aria-label={t('app.notifications.dismiss', 'Dismiss {{title}}', { title: item.title })}
>
<X size={15} aria-hidden="true" />
- </button>
+ </Button>
</li>
))}
{items.map((item) => (
diff --git a/frontend/src/pages/ProjectDetail.jsx b/frontend/src/pages/ProjectDetail.jsx
index ecc36139..f56ca633 100644
--- a/frontend/src/pages/ProjectDetail.jsx
+++ b/frontend/src/pages/ProjectDetail.jsx
@@ -11,7 +11,7 @@ import {
ExternalLink,
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useRecordVisit } from '@/hooks/useRecordVisit';
import FavoriteStar from '@/components/FavoriteStar';
import EmptyState from '../components/EmptyState';
@@ -181,7 +181,7 @@ const ProjectDetail = () => {
key={env.id}
className={`project-env-tab ${env.id === activeEnvId ? 'is-active' : ''}`}
>
- <button
+ <Button variant="unstyled"
type="button"
role="tab"
aria-selected={env.id === activeEnvId}
@@ -191,9 +191,9 @@ const ProjectDetail = () => {
{env.name}
{env.is_default && <Badge variant="outline">default</Badge>}
<span className="project-env-tab__count">{env.app_count ?? 0}</span>
- </button>
+ </Button>
<div className="project-env-tab__controls">
- <button
+ <Button variant="unstyled"
type="button"
title={t('common.actions.moveUp', 'Move up')}
aria-label={t('app.projectDetail.moveUp2', 'Move {{name}} up', { name: env.name })}
@@ -201,8 +201,8 @@ const ProjectDetail = () => {
onClick={() => handleReorder(env.id, -1)}
>
<ArrowUp size={13} />
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
title={t('common.actions.moveDown', 'Move down')}
aria-label={t('app.projectDetail.moveDown2', 'Move {{name}} down', { name: env.name })}
@@ -210,8 +210,8 @@ const ProjectDetail = () => {
onClick={() => handleReorder(env.id, 1)}
>
<ArrowDown size={13} />
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className="project-env-tab__delete"
title={t('app.projectDetail.deleteEnvironment', 'Delete environment')}
@@ -220,7 +220,7 @@ const ProjectDetail = () => {
onClick={() => setDeleteEnv(env)}
>
<Trash2 size={13} />
- </button>
+ </Button>
</div>
</div>
))}
diff --git a/frontend/src/pages/Projects.jsx b/frontend/src/pages/Projects.jsx
index 53bcb734..0a79297d 100644
--- a/frontend/src/pages/Projects.jsx
+++ b/frontend/src/pages/Projects.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback, useMemo } from 'react';
import { useNavigate } from 'react-router-dom';
import { FolderKanban, Plus } from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import ResourceListPage from '../components/layouts/ResourceListPage';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import useFocusParam from '@/hooks/useFocusParam';
@@ -70,7 +70,7 @@ const Projects = () => {
} finally {
setLoading(false);
}
- }, [toast]);
+ }, [t, toast]);
useEffect(() => {
loadProjects();
diff --git a/frontend/src/pages/QueueDetail.jsx b/frontend/src/pages/QueueDetail.jsx
index 6dbf01f5..e4a8dcf5 100644
--- a/frontend/src/pages/QueueDetail.jsx
+++ b/frontend/src/pages/QueueDetail.jsx
@@ -10,7 +10,7 @@ import {
X,
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import EmptyState from '../components/EmptyState';
import Modal from '@/components/Modal';
@@ -333,9 +333,9 @@ const QueueDetail = () => {
return (
<div className="queue-page queue-detail">
<div className="queue-detail-header">
- <button type="button" className="queue-back" onClick={() => navigate('/queue')}>
+ <Button variant="unstyled" type="button" className="queue-back" onClick={() => navigate('/queue')}>
<ArrowLeft size={16} /> {t('app.queueDetail.queueBus', 'Queue Bus')}
- </button>
+ </Button>
<div className="queue-detail-headline">
<div className="queue-workbar-title">
<span>{t('app.queueDetail.queue', 'Queue')}</span>
@@ -450,9 +450,9 @@ const QueueDetail = () => {
<aside className="queue-detail-panel">
<div className="queue-detail-panel-header">
<h2>{t('app.queueDetail.message', 'Message')}</h2>
- <button type="button" className="queue-panel-close" onClick={() => setSelectedMessage(null)} aria-label={t('common.actions.close', 'Close')}>
+ <Button variant="unstyled" type="button" className="queue-panel-close" onClick={() => setSelectedMessage(null)} aria-label={t('common.actions.close', 'Close')}>
<X size={16} />
- </button>
+ </Button>
</div>
<div className="queue-message-detail">
<div><strong>{t('app.queueDetail.id', 'ID:')}</strong> <code>{selectedMessage.id}</code></div>
@@ -474,7 +474,7 @@ const QueueDetail = () => {
{!viewOnly && (selectedMessage.status === 'failed' || selectedMessage.status === 'dead_letter') && (
<div className="queue-detail-panel-footer">
<Button onClick={() => handleRequeue(selectedMessage)}>
- <RefreshCw size={14} className="mr-2" /> {t('app.queueDetail.requeue', 'Requeue')}
+ <RefreshCw size={14} className="queue-action-icon" /> {t('app.queueDetail.requeue', 'Requeue')}
</Button>
</div>
)}
@@ -500,7 +500,7 @@ const QueueDetail = () => {
</div>
<div className="modal-actions">
<Button type="button" variant="outline" onClick={() => setShowSend(false)}>{t('common.actions.cancel', 'Cancel')}</Button>
- <Button type="submit"><Send size={14} className="mr-2" /> {t('app.queueDetail.send', 'Send')}</Button>
+ <Button type="submit"><Send size={14} className="queue-action-icon" /> {t('app.queueDetail.send', 'Send')}</Button>
</div>
</form>
</Modal>
diff --git a/frontend/src/pages/QueueOperations.jsx b/frontend/src/pages/QueueOperations.jsx
index b95ad1c9..8fad8cd3 100644
--- a/frontend/src/pages/QueueOperations.jsx
+++ b/frontend/src/pages/QueueOperations.jsx
@@ -13,7 +13,7 @@ import {
AlertCircle,
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import EmptyState from '../components/EmptyState';
import Modal from '@/components/Modal';
@@ -464,10 +464,10 @@ const QueueOperations = () => {
<section className="queue-rail-section">
<div className="queue-rail-section-header queue-rail-section-header--split">
<span><Folder size={14} /> {t('app.queueOperations.groups', 'Groups')}</span>
- <button type="button" onClick={() => setShowGroupModal(true)}>{t('app.queueOperations.new', 'New')}</button>
+ <Button variant="unstyled" type="button" onClick={() => setShowGroupModal(true)}>{t('app.queueOperations.new', 'New')}</Button>
</div>
<div className="queue-group-nav">
- <button
+ <Button variant="unstyled"
type="button"
className={`queue-group-nav-item ${selectedGroup === '' ? 'active' : ''}`}
onClick={() => setSelectedGroup('')}
@@ -475,9 +475,9 @@ const QueueOperations = () => {
<Server size={14} />
<span>{t('app.queueOperations.allGroups', 'All groups')}</span>
<b title={String(formatFull(totalQueues))}>{formatCompact(totalQueues)}</b>
- </button>
+ </Button>
{groups.map(group => (
- <button
+ <Button variant="unstyled"
type="button"
key={group.id}
className={`queue-group-nav-item ${selectedGroup === group.slug ? 'active' : ''}`}
@@ -489,7 +489,7 @@ const QueueOperations = () => {
<span className="queue-group-badge">system</span>
)}
<b>{formatCompact(group.stats?.queues || 0)}</b>
- </button>
+ </Button>
))}
</div>
</section>
@@ -500,16 +500,16 @@ const QueueOperations = () => {
<span>{t('app.queueOperations.messageStatus', 'Message Status')}</span>
</div>
<div className="queue-status-nav">
- <button
+ <Button variant="unstyled"
type="button"
className={`queue-status-nav-item ${messageFilter === 'all' ? 'active' : ''}`}
onClick={() => setMessageFilter('all')}
>
<span><strong>{t('common.labels.all', 'All')}</strong><small>{t('app.queueOperations.anyStatus', 'Any status')}</small></span>
<b title={String(formatFull(totalMessages))}>{formatCompact(totalMessages)}</b>
- </button>
+ </Button>
{STATUS_ORDER.map(status => (
- <button
+ <Button variant="unstyled"
type="button"
key={status}
className={`queue-status-nav-item queue-status-nav-item--${status} ${messageFilter === status ? 'active' : ''}`}
@@ -520,7 +520,7 @@ const QueueOperations = () => {
<small>{status}</small>
</span>
<b title={String(formatFull(statusCounts[status] || 0))}>{formatCompact(statusCounts[status] || 0)}</b>
- </button>
+ </Button>
))}
</div>
</section>
@@ -586,7 +586,7 @@ const QueueOperations = () => {
</select>
</div>
{hasActiveFilters && (
- <button
+ <Button variant="unstyled"
type="button"
className="queue-clear-filters"
onClick={() => {
@@ -596,7 +596,7 @@ const QueueOperations = () => {
}}
>
{t('common.actions.clearFilters', 'Clear filters')}
- </button>
+ </Button>
)}
</div>
@@ -737,7 +737,7 @@ const QueueOperations = () => {
</div>
<div className="modal-actions">
<Button type="button" variant="outline" onClick={() => setSendTarget(null)}>{t('common.actions.cancel', 'Cancel')}</Button>
- <Button type="submit"><Send size={14} className="mr-2" /> {t('app.queueOperations.sendMessage2', 'Send Message')}</Button>
+ <Button type="submit"><Send size={14} className="queue-action-icon" /> {t('app.queueOperations.sendMessage2', 'Send Message')}</Button>
</div>
</form>
)}
diff --git a/frontend/src/pages/Recipes.jsx b/frontend/src/pages/Recipes.jsx
index 32f1470b..54af8dda 100644
--- a/frontend/src/pages/Recipes.jsx
+++ b/frontend/src/pages/Recipes.jsx
@@ -1,3 +1,4 @@
+import { Card as SharedCard } from '@/components/ui/card';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
@@ -10,8 +11,9 @@ import { Drawer } from '../components/ds';
import EmptyState from '../components/EmptyState';
import FormField from '../components/FormField';
import { runRecipe, useRecipeCatalog } from '../hooks/useRecipeCatalog';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { formatBytes } from '../utils/formatBytes';
+import { Button as SharedButton } from '@/components/ui/button';
// Recipe catalog (serverkit-recipes registry). A Recipe is a ready-to-go
// installer: pick one, point it at a server, fill in the non-secret inputs,
@@ -160,14 +162,14 @@ export default function Recipes() {
{categories.length > 1 && (
<div className="recipes-page__cats">
{categories.map(cat => (
- <button
+ <SharedButton variant="unstyled"
key={cat}
type="button"
className={`sk-pill${category === cat ? ' is-active' : ''}`}
onClick={() => setCategory(cat)}
>
{cat === 'all' ? t('common.labels.all', 'All') : cat}
- </button>
+ </SharedButton>
))}
</div>
)}
@@ -232,14 +234,14 @@ export default function Recipes() {
plural: handoffCount === 1 ? '' : 's',
})}
</span>
- <button
+ <SharedButton variant="primary"
type="button"
className="btn btn-primary btn-sm"
onClick={() => openInstall(recipe)}
>
<Play size={13} />
{t('app.recipes.install', 'Install')}
- </button>
+ </SharedButton>
</div>
</div>
);
@@ -258,9 +260,9 @@ export default function Recipes() {
{selected && (
<div className="recipe-install">
<FormField label={t('app.recipes.runOn', 'Run on')}>
- <div className="recipe-install__servers card">
+ <SharedCard variant="legacy" className="recipe-install__servers card">
{servers.filter(s => s.status === 'running').map(server => (
- <button
+ <SharedButton variant="unstyled"
type="button"
key={server.id}
className={`recipe-install__server${String(targetId) === String(server.id) ? ' is-on' : ''}`}
@@ -273,19 +275,19 @@ export default function Recipes() {
{formatBytes(server.total_memory, { decimals: 0 })}
</span>
{String(targetId) === String(server.id) && <Check size={15} />}
- </button>
+ </SharedButton>
))}
{!servers.some(s => s.status === 'running') && (
<p className="recipe-install__nosrv">
{t('app.recipes.noServers', 'No running servers. Start one first.')}
</p>
)}
- </div>
+ </SharedCard>
</FormField>
{!!selectedRows.length && (
<FormField label={t('app.recipes.preflight', 'Preflight')}>
- <div className="recipe-install__preflight card">
+ <SharedCard variant="legacy" className="recipe-install__preflight card">
{selectedRows.map(row => {
const label = row.key === 'cpu'
? t('app.recipes.cpu', 'CPU')
@@ -301,7 +303,7 @@ export default function Recipes() {
</div>
);
})}
- </div>
+ </SharedCard>
{!!selectedBlockers.length && (
<p className="recipe-install__blocked">
{t('app.recipes.blocked', 'This server does not meet the requirements above. Pick another server.')}
@@ -329,7 +331,7 @@ export default function Recipes() {
<FormField label={t('app.recipes.askedDuringRun', 'Asked for during the run')}>
{(selected.handoffs || []).length ? (
- <div className="recipe-install__handoffs card">
+ <SharedCard variant="legacy" className="recipe-install__handoffs card">
{selected.handoffs.map(handoff => (
<div className="recipe-handoff-row" key={handoff.key}>
<Lock size={13} />
@@ -341,7 +343,7 @@ export default function Recipes() {
)}
</div>
))}
- </div>
+ </SharedCard>
) : (
<p className="recipe-install__unattended">
{t('app.recipes.noHandoffs', 'Nothing — this recipe runs unattended.')}
@@ -350,10 +352,10 @@ export default function Recipes() {
</FormField>
<div className="recipe-install__actions">
- <button type="button" className="btn" onClick={() => setSelected(null)}>
+ <SharedButton variant="unstyled" type="button" className="btn" onClick={() => setSelected(null)}>
{t('common.actions.cancel', 'Cancel')}
- </button>
- <button
+ </SharedButton>
+ <SharedButton variant="primary"
type="button"
className="btn btn-primary"
disabled={!targetServer || !!selectedBlockers.length || starting}
@@ -361,7 +363,7 @@ export default function Recipes() {
>
{starting ? <Loader2 size={14} className="spin" /> : <Play size={14} />}
{t('app.recipes.runRecipe', 'Run recipe')}
- </button>
+ </SharedButton>
</div>
</div>
)}
diff --git a/frontend/src/pages/Register.jsx b/frontend/src/pages/Register.jsx
index 72e3683b..b22013dd 100644
--- a/frontend/src/pages/Register.jsx
+++ b/frontend/src/pages/Register.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react';
import { useNavigate, Link, useSearchParams } from 'react-router-dom';
import { Trans, useTranslation } from 'react-i18next';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
import api from '../services/api';
import ServerKitLogo from '../components/ServerKitLogo';
import { Button } from '@/components/ui/button';
diff --git a/frontend/src/pages/RemoteAccess.jsx b/frontend/src/pages/RemoteAccess.jsx
index cfc609dc..71fb8d93 100644
--- a/frontend/src/pages/RemoteAccess.jsx
+++ b/frontend/src/pages/RemoteAccess.jsx
@@ -6,7 +6,7 @@ import {
ArrowRight, HardDrive, Cloud, AlertTriangle,
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import EmptyState from '../components/EmptyState';
import Modal from '../components/Modal';
import ResourcePicker from '../components/ResourcePicker';
@@ -17,7 +17,7 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Switch } from '@/components/ui/switch';
import { useTranslation } from 'react-i18next';
-import { useWorkspace } from '../contexts/WorkspaceContext';
+import { useWorkspace } from '../contexts/useWorkspace.js';
// Tunnel / service status → status-pill tone.
const pillKind = (status) => statusKind(status);
@@ -105,7 +105,7 @@ const RemoteAccess = ({ serverId }) => {
} finally {
setLoading(false);
}
- }, [toast]);
+ }, [t, toast]);
useEffect(() => {
load();
@@ -297,7 +297,6 @@ const RemoteAccess = ({ serverId }) => {
<Button
variant="ghost"
size="sm"
- className="text-red-600"
onClick={() => setTeardown(t)}
title={t('app.remoteAccess.tearDownTunnel', 'Tear down tunnel')}
>
@@ -360,7 +359,6 @@ const RemoteAccess = ({ serverId }) => {
<Button
variant="ghost"
size="sm"
- className="text-red-600"
onClick={() => unpublish(t.id, svc)}
>
{t('common.actions.remove', 'Remove')}
@@ -393,16 +391,15 @@ const RemoteAccess = ({ serverId }) => {
</>
}
>
- <div className="space-y-4">
+ <div className="ra-service-form">
{!wizardTunnel && (
<>
- <div className="space-y-1.5">
+ <div className="ra-service-field">
<Label>{t('app.remoteAccess.privateHostWhereTheServiceRuns', 'Private host (where the service runs)')}</Label>
{serverId ? (
<Input
value={currentServer?.name || serverId}
disabled
- className="bg-muted"
/>
) : (
<ResourcePicker
@@ -426,7 +423,7 @@ const RemoteAccess = ({ serverId }) => {
/>
)}
</div>
- <div className="space-y-1.5">
+ <div className="ra-service-field">
<Label>{t('app.remoteAccess.edgeServerPublicIpFrontsThe', 'Edge server (public IP — fronts the tunnel)')}</Label>
<ResourcePicker
value={form.edgeServerId
@@ -447,15 +444,15 @@ const RemoteAccess = ({ serverId }) => {
searchPlaceholder={t('app.serverPicker.findAServer', 'Find a server…')}
className="sk-resource-picker__trigger--full"
/>
- <p className="text-xs text-muted-foreground">
+ <p className="ra-service-hint">
{t('app.remoteAccess.aTunnelBetweenTheseTwoIs', 'A tunnel between these two is created (or reused) automatically.')}
</p>
</div>
</>
)}
- <div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
- <div className="sm:col-span-2 space-y-1.5">
+ <div className="ra-service-routing">
+ <div className="ra-service-field ra-service-field--host">
<Label>{t('app.remoteAccess.publicHostname', 'Public hostname')}</Label>
<Input
placeholder="jellyfin.example.com"
@@ -463,7 +460,7 @@ const RemoteAccess = ({ serverId }) => {
onChange={(e) => setField('hostname', e.target.value)}
/>
</div>
- <div className="space-y-1.5">
+ <div className="ra-service-field">
<Label>{t('app.remoteAccess.servicePort', 'Service port')}</Label>
<Input
type="number"
@@ -474,32 +471,32 @@ const RemoteAccess = ({ serverId }) => {
</div>
</div>
- <div className="flex items-center justify-between">
+ <div className="ra-service-option">
<div>
<Label>{t('app.remoteAccess.httpsLetSEncrypt', 'HTTPS (Let\'s Encrypt)')}</Label>
- <p className="text-xs text-muted-foreground">{t('app.remoteAccess.obtainACertificateOnTheEdge', 'Obtain a certificate on the edge.')}</p>
+ <p className="ra-service-hint">{t('app.remoteAccess.obtainACertificateOnTheEdge', 'Obtain a certificate on the edge.')}</p>
</div>
<Switch checked={form.ssl} onCheckedChange={(v) => setField('ssl', v)} />
</div>
- <div className="flex items-center justify-between">
+ <div className="ra-service-option">
<div>
<Label>{t('app.remoteAccess.requireLoginBasicAuth', 'Require login (basic auth)')}</Label>
- <p className="text-xs text-muted-foreground">{t('app.remoteAccess.putAUsernamePasswordInFront', 'Put a username/password in front of the service.')}</p>
+ <p className="ra-service-hint">{t('app.remoteAccess.putAUsernamePasswordInFront', 'Put a username/password in front of the service.')}</p>
</div>
<Switch checked={form.requireAuth} onCheckedChange={(v) => setField('requireAuth', v)} />
</div>
{form.requireAuth && (
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
- <div className="space-y-1.5">
+ <div className="ra-service-credentials">
+ <div className="ra-service-field">
<Label>{t('common.labels.username', 'Username')}</Label>
<Input
value={form.authUsername}
onChange={(e) => setField('authUsername', e.target.value)}
/>
</div>
- <div className="space-y-1.5">
+ <div className="ra-service-field">
<Label>{t('common.labels.password', 'Password')}</Label>
<Input
type="password"
@@ -529,7 +526,7 @@ const RemoteAccess = ({ serverId }) => {
</>
}
>
- <p className="text-sm text-muted-foreground">
+ <p className="ra-service-description">
{t('app.remoteAccess.thisRemovesTheWireguardTunnel', 'This removes the WireGuard tunnel')}{teardown ? ` between ${teardown.private_server_name || teardown.private_server_id} and ${teardown.edge_server_name || teardown.edge_server_id}` : ''} {t('app.remoteAccess.andAnyServicesPublishedOverIt', 'and any services published over it. The agents\' interfaces are brought down.')}
</p>
</Modal>
diff --git a/frontend/src/pages/SSLCertificates.jsx b/frontend/src/pages/SSLCertificates.jsx
index b49aaae6..0c3106b9 100644
--- a/frontend/src/pages/SSLCertificates.jsx
+++ b/frontend/src/pages/SSLCertificates.jsx
@@ -8,7 +8,7 @@ import Modal from '@/components/Modal';
import { Pill, SearchField } from '@/components/ds';
import ResourceListPage from '../components/layouts/ResourceListPage';
import { useTopbarActions } from '@/hooks/useTopbarActions';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
diff --git a/frontend/src/pages/SSOCallback.jsx b/frontend/src/pages/SSOCallback.jsx
index f799f9a2..59829888 100644
--- a/frontend/src/pages/SSOCallback.jsx
+++ b/frontend/src/pages/SSOCallback.jsx
@@ -1,6 +1,6 @@
-import { useEffect, useState } from 'react';
+import { useEffect, useState, useRef } from 'react';
import { useParams, useNavigate, useSearchParams, Link } from 'react-router-dom';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
import api from '../services/api';
import { consumeRedirect } from '../utils/redirectAfterLogin';
import { Loader } from 'lucide-react';
@@ -15,42 +15,47 @@ const SSOCallback = () => {
const { setUser } = useAuth();
const [error, setError] = useState('');
+ const attempted = useRef(null);
+ const code = searchParams.get('code');
+ const state = searchParams.get('state');
+
useEffect(() => {
- const code = searchParams.get('code');
- const state = searchParams.get('state');
const redirectUri = `${window.location.origin}/login/callback/${provider}`;
-
if (!code || !state) {
setError('Missing authorization code or state parameter.');
return;
}
+ const attempt = JSON.stringify([provider, code, state]);
+ if (attempted.current === attempt) return;
+ attempted.current = attempt;
- completeAuth(code, state, redirectUri);
- }, []);
+ async function completeAuth(code, state, redirectUri) {
+ try {
+ const response = await api.completeSSOAuth(provider, code, state, redirectUri);
- async function completeAuth(code, state, redirectUri) {
- try {
- const response = await api.completeSSOAuth(provider, code, state, redirectUri);
+ if (attempted.current !== attempt) return;
+ if (response.requires_2fa) {
+ // Redirect to login page with 2FA state
+ navigate('/login', {
+ state: {
+ requires2FA: true,
+ tempToken: response.temp_token,
+ }
+ });
+ return;
+ }
- if (response.requires_2fa) {
- // Redirect to login page with 2FA state
- navigate('/login', {
- state: {
- requires2FA: true,
- tempToken: response.temp_token,
- }
- });
- return;
+ setUser(response.user);
+ // sessionStorage survived the round trip to the identity provider;
+ // react-router state would not have.
+ navigate(consumeRedirect());
+ } catch (err) {
+ if (attempted.current === attempt) setError(err.message || 'SSO authentication failed');
}
-
- setUser(response.user);
- // sessionStorage survived the round trip to the identity provider;
- // react-router state would not have.
- navigate(consumeRedirect());
- } catch (err) {
- setError(err.message || 'SSO authentication failed');
}
- }
+
+ completeAuth(code, state, redirectUri);
+ }, [provider, code, state, navigate, setUser]);
if (error) {
return (
diff --git a/frontend/src/pages/Security.jsx b/frontend/src/pages/Security.jsx
index 2c77ff39..9276dc25 100644
--- a/frontend/src/pages/Security.jsx
+++ b/frontend/src/pages/Security.jsx
@@ -1,5 +1,4 @@
import { useState, useEffect } from 'react';
-import { useAuth } from '../contexts/AuthContext';
import useTabParam from '../hooks/useTabParam';
import api from '../services/api';
import {
@@ -23,7 +22,7 @@ const VALID_TABS = ['overview', 'firewall', 'ssh-keys', 'ip-lists', 'integrity',
const Security = () => {
const { t } = useTranslation();
- const { isAdmin } = useAuth();
+
const [activeTab, setActiveTab] = useTabParam('/security', VALID_TABS);
const [status, setStatus] = useState(null);
const [loading, setLoading] = useState(true);
diff --git a/frontend/src/pages/ServerDetail.jsx b/frontend/src/pages/ServerDetail.jsx
index ef8c230f..a3d00e28 100644
--- a/frontend/src/pages/ServerDetail.jsx
+++ b/frontend/src/pages/ServerDetail.jsx
@@ -1,7 +1,8 @@
+import { serverStatusKind } from '../components/serverdetail/serverDetailData';
import { useState, useEffect, useCallback } from 'react';
import { useParams, Link, useNavigate } from 'react-router-dom';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import { useRecordVisit } from '@/hooks/useRecordVisit';
import FavoriteStar from '@/components/FavoriteStar';
@@ -19,7 +20,6 @@ import ServerMetricsTab from '../components/serverdetail/ServerMetricsTab';
import SurveyTab from '../components/serverdetail/SurveyTab';
import ServerSettingsTab, { TokenModal } from '../components/serverdetail/ServerSettingsTab';
import {
- serverStatusKind,
CopyChip,
FolderTinyIcon,
RefreshIcon,
@@ -29,7 +29,7 @@ import RemoteAccess from '../pages/RemoteAccess';
import EmptyState from '../components/EmptyState';
import { usePolling } from '@/hooks/usePolling';
import { useTranslation } from 'react-i18next';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
import ServerRestorePointsTab from '../components/serverdetail/ServerRestorePointsTab';
// Live host metrics cadence while the server is online.
@@ -179,7 +179,7 @@ const ServerDetail = () => {
} else {
toast.error(t('app.serverDetail.serverDidNotRespond', 'Server did not respond'));
}
- } catch (err) {
+ } catch {
toast.error(t('app.serverDetail.failedToPingServer', 'Failed to ping server'));
}
}
diff --git a/frontend/src/pages/ServerTemplates.jsx b/frontend/src/pages/ServerTemplates.jsx
index 4e025e98..d5637acf 100644
--- a/frontend/src/pages/ServerTemplates.jsx
+++ b/frontend/src/pages/ServerTemplates.jsx
@@ -1,10 +1,11 @@
+import { Card as SharedCard } from '@/components/ui/card';
import { useState, useEffect, useCallback, useMemo } from 'react';
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
-import { useAuth } from '../contexts/AuthContext';
+import { useToast } from '../contexts/useToast.js';
+import { useAuth } from '../contexts/useAuth.js';
import PageLoader from '../components/PageLoader';
import ConfirmDialog from '../components/ConfirmDialog';
import EmptyState from '../components/EmptyState';
@@ -251,12 +252,12 @@ const ServerTemplates = () => {
// (after creating or deleting one) never yanks the tab out from
// under whoever is reading it.
setActiveTab(current => current ?? (mine.length > 0 ? 'templates' : 'library'));
- } catch (err) {
+ } catch {
toast.error(t('app.serverTemplates.failedToLoadTemplates', 'Failed to load templates'));
} finally {
setLoading(false);
}
- }, [toast]);
+ }, [t, toast]);
useEffect(() => {
loadData();
@@ -310,25 +311,9 @@ const ServerTemplates = () => {
}
};
- const handleCheckDrift = async (assignmentId) => {
- try {
- await api.checkTemplateDrift(assignmentId);
- toast.success(t('app.serverTemplates.driftCheckInitiated', 'Drift check initiated'));
- loadData();
- } catch (err) {
- toast.error(err.message);
- }
- };
- const handleRemediate = async (assignmentId) => {
- try {
- await api.remediateTemplateDrift(assignmentId);
- toast.success(t('app.serverTemplates.remediationInitiated', 'Remediation initiated'));
- loadData();
- } catch (err) {
- toast.error(err.message);
- }
- };
+
+
// Publish the admin "Create Template" action to the shared tab-group top bar.
useTopbarActions(() =>
@@ -493,7 +478,7 @@ const ServerTemplates = () => {
sortable: false,
hideable: false,
render: (tmpl) => (
- <div className="flex gap-2">
+ <div className="server-template-error-actions">
<Button
size="sm"
onClick={() => { setSelectedTemplate(tmpl); setShowAssignModal(true); }}
@@ -508,7 +493,7 @@ const ServerTemplates = () => {
</div>
),
},
- ], [user?.is_admin]);
+ ], [t, user?.is_admin]);
// No `pageState`: the list is this endpoint's whole response, with no
// search and no server-side filter of its own, so there is nothing
@@ -580,7 +565,7 @@ const ServerTemplates = () => {
views={chrome.views}
label="templates"
onCreate={chrome.createView}
-
+
actions={chromeActions}
/>
@@ -605,7 +590,7 @@ const ServerTemplates = () => {
<TabsContent value="library">
<div className="templates-grid">
{Object.entries(library).map(([key, tmpl]) => (
- <div key={key} className="template-card card">
+ <SharedCard variant="legacy" key={key} className="template-card card">
<div className="template-card__header">
<h3>{tmpl.name}</h3>
<Badge variant="outline">{CATEGORY_LABELS[tmpl.category] || tmpl.category}</Badge>
@@ -621,7 +606,7 @@ const ServerTemplates = () => {
{t('app.serverTemplates.useTemplate', 'Use Template')}
</Button>
</div>
- </div>
+ </SharedCard>
))}
</div>
</TabsContent>
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index c9733c32..02b8c516 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback, useMemo } from 'react';
import { useNavigate } from 'react-router-dom';
import { ChevronRight, Folder, Plus, RefreshCw, Server as ServerLucideIcon, X } from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import EmptyState from '../components/EmptyState';
import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
@@ -303,7 +303,7 @@ const Servers = () => {
} finally {
setLoading(false);
}
- }, [toast]);
+ }, [t, toast]);
useEffect(() => {
loadData();
@@ -487,14 +487,14 @@ const Servers = () => {
<option value="none">{t('app.servers.ungrouped', 'Ungrouped')}</option>
</select>
</div>
- <button
+ <Button variant="unstyled"
type="button"
className="sk-bulkbar__clear"
onClick={() => setSelectedIds(new Set())}
aria-label={t('app.servers.clearSelection', 'Clear selection')}
>
<X size={14} />
- </button>
+ </Button>
</div>
)}
@@ -805,27 +805,27 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${registratio
>
{step === 1 && (
<div className="mode-switcher" data-walkthrough="server-setup">
- <button
+ <Button variant="unstyled"
type="button"
className={`mode-switcher__tab${mode === 'install' ? ' is-active' : ''}`}
onClick={() => setMode('install')}
>
{t('app.servers.connectionString', 'Connection string')}
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className={`mode-switcher__tab${mode === 'pair' ? ' is-active' : ''}`}
onClick={() => setMode('pair')}
>
{t('app.servers.pairCode', 'Pair code')}
- </button>
- <button
+ </Button>
+ <Button variant="unstyled"
type="button"
className={`mode-switcher__tab${mode === 'link' ? ' is-active' : ''}`}
onClick={() => setMode('link')}
>
{t('app.servers.linkPanel', 'Link panel')}
- </button>
+ </Button>
</div>
)}
@@ -1079,20 +1079,20 @@ const ManageGroupsModal = ({ groups, onClose, onUpdated }) => {
</span>
<span className="group-count">{group.server_count || 0} servers</span>
<div className="group-actions">
- <button type="button"
+ <Button variant="unstyled" type="button"
className="btn-icon"
onClick={() => setEditingGroup(group.id)}
title={t('common.actions.edit', 'Edit')}
>
<EditIcon />
- </button>
- <button type="button"
+ </Button>
+ <Button variant="unstyled" type="button"
className="btn-icon danger"
onClick={() => handleDeleteGroup(group.id)}
title={t('common.actions.delete', 'Delete')}
>
<TrashIcon />
- </button>
+ </Button>
</div>
</>
)}
diff --git a/frontend/src/pages/ServiceDetail.jsx b/frontend/src/pages/ServiceDetail.jsx
index 82edaf16..bf930511 100644
--- a/frontend/src/pages/ServiceDetail.jsx
+++ b/frontend/src/pages/ServiceDetail.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from 'react';
import { useParams, useNavigate, Link } from 'react-router-dom';
import { servicePortUrl } from '@/utils/serviceUrl';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import { useService } from '../hooks/useService';
import useTabParam from '../hooks/useTabParam';
@@ -76,6 +76,7 @@ const ServiceDetail = () => {
const { id, tab: rawTab } = useParams();
const navigate = useNavigate();
const toast = useToast();
+ const toastError = toast.error;
const { confirm } = useConfirm();
const { service, deployConfig, loading, error, reload, performAction, deleteService } = useService(id);
// Active tab lives in the URL (/services/:id/:tab) so it's shareable and
@@ -116,9 +117,9 @@ const ServiceDetail = () => {
setVersions(data.versions || []);
setCurrentVersion(data.current);
})
- .catch(() => toast.error(t('app.serviceDetail.failedToLoadVersions', 'Failed to load versions')))
+ .catch(() => toastError(t('app.serviceDetail.failedToLoadVersions', 'Failed to load versions')))
.finally(() => setVersionsLoading(false));
- }, [service?.source, id, toast]);
+ }, [service?.source, id, toastError, t]);
// Close menus on outside click
useEffect(() => {
@@ -288,28 +289,28 @@ const ServiceDetail = () => {
<div className="svc-detail__dropdown" ref={deployMenuRef}>
<Button onClick={() => setShowDeployMenu(!showDeployMenu)}>
{t('app.serviceDetail.deploy', 'Deploy')}
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" className="ml-1">
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" className="svc-title-link-icon">
<polyline points="6 9 12 15 18 9"/>
</svg>
</Button>
{showDeployMenu && (
<div className="svc-detail__dropdown-menu">
- <button type="button" onClick={() => handleAction('restart')} disabled={actionLoading === 'restart'}>
+ <Button variant="unstyled" type="button" onClick={() => handleAction('restart')} disabled={actionLoading === 'restart'}>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<polyline points="23 4 23 10 17 10"/>
<path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>
</svg>
{t('app.serviceDetail.manualDeployRestart', 'Manual Deploy (Restart)')}
- </button>
+ </Button>
{isGitBased && deployConfig && (
- <button type="button" onClick={handleDeployLatest} disabled={actionLoading === 'deploy-latest'}>
+ <Button variant="unstyled" type="button" onClick={handleDeployLatest} disabled={actionLoading === 'deploy-latest'}>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<circle cx="18" cy="18" r="3"/>
<circle cx="6" cy="6" r="3"/>
<path d="M6 21V9a9 9 0 0 0 9 9"/>
</svg>
{actionLoading === 'deploy-latest' ? 'Deploying...' : 'Deploy Latest Commit'}
- </button>
+ </Button>
)}
</div>
)}
@@ -353,12 +354,12 @@ const ServiceDetail = () => {
{showMoreMenu && (
<div className="svc-detail__dropdown-menu svc-detail__dropdown-menu--right">
{service.isRunning && (
- <button type="button" onClick={() => handleAction('stop')} disabled={actionLoading === 'stop'}>
+ <Button variant="unstyled" type="button" onClick={() => handleAction('stop')} disabled={actionLoading === 'stop'}>
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<rect x="6" y="6" width="12" height="12"/>
</svg>
{t('app.serviceDetail.suspendService', 'Suspend Service')}
- </button>
+ </Button>
)}
{openUrl && (
<a
@@ -376,7 +377,7 @@ const ServiceDetail = () => {
</a>
)}
<div className="svc-detail__dropdown-divider" />
- <button type="button"
+ <Button variant="unstyled" type="button"
className="svc-detail__dropdown-danger"
onClick={handleDelete}
disabled={actionLoading === 'delete'}
@@ -386,7 +387,7 @@ const ServiceDetail = () => {
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
</svg>
{t('app.serviceDetail.deleteService', 'Delete Service')}
- </button>
+ </Button>
</div>
)}
</div>
@@ -503,14 +504,14 @@ const ServiceDetail = () => {
)}
</div>
) : (
- <button type="button" className="svc-detail__connect-repo" onClick={() => navigate(`/services/${id}/settings/git`)}>
+ <Button variant="unstyled" type="button" className="svc-detail__connect-repo" onClick={() => navigate(`/services/${id}/settings/git`)}>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<circle cx="18" cy="18" r="3"/>
<circle cx="6" cy="6" r="3"/>
<path d="M6 21V9a9 9 0 0 0 9 9"/>
</svg>
{t('app.serviceDetail.connectARepository', 'Connect a repository')}
- </button>
+ </Button>
)}
</div>
@@ -565,14 +566,14 @@ const ServiceDetail = () => {
{availableTabs.map(tab => {
const Icon = TAB_ICONS[tab];
return (
- <button type="button"
+ <Button variant="unstyled" type="button"
key={tab}
className={`app-detail-tab ${activeTab === tab ? 'active' : ''} ${tab === 'settings' ? 'app-detail-tab--end' : ''}`}
onClick={() => setActiveTab(tab)}
>
{Icon && <Icon size={14} />}
{TAB_LABELS[tab] || tab}
- </button>
+ </Button>
);
})}
</div>
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index cd7d0f7b..1512db16 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -1,8 +1,8 @@
-import { useState, useEffect, useMemo } from 'react';
+import { useCallback, useState, useEffect, useMemo } from 'react';
import { useNavigate, Link } from 'react-router-dom';
import { Layers, Plus, Square, Play, RotateCw, GitBranch, Github, FolderOpen, FileArchive, FolderKanban, ArrowDownToLine } from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { getServiceType, getStatusConfig, formatRelativeTime } from '../utils/serviceTypes';
import ResourceListPage from '../components/layouts/ResourceListPage';
import BandwidthSparkline from '../components/BandwidthSparkline';
@@ -106,6 +106,7 @@ const Services = () => {
const { t } = useTranslation();
const navigate = useNavigate();
const toast = useToast();
+ const toastError = toast.error;
const [apps, setApps] = useState([]);
const [loading, setLoading] = useState(true);
const [searchTerm, setSearchTerm] = useState('');
@@ -115,24 +116,25 @@ const Services = () => {
const [showMoveDialog, setShowMoveDialog] = useState(false);
const [bandwidth, setBandwidth] = useState({});
+ const loadApps = useCallback(async () => {
+ try {
+ const data = await api.getApps();
+ setApps(data.apps || []);
+ } catch {
+ toastError(t('app.services.failedToLoadServices', 'Failed to load services'));
+ } finally {
+ setLoading(false);
+ }
+ }, [t, toastError]);
+
useEffect(() => {
loadApps();
// Best-effort: one call for every row's sparkline; absence is fine.
api.getBandwidthApps()
.then((data) => setBandwidth(data?.apps || {}))
.catch(() => {});
- }, []);
+ }, [loadApps]);
- async function loadApps() {
- try {
- const data = await api.getApps();
- setApps(data.apps || []);
- } catch (err) {
- toast.error(t('app.services.failedToLoadServices', 'Failed to load services'));
- } finally {
- setLoading(false);
- }
- }
async function handleAction(e, appId, action) {
e.stopPropagation();
@@ -142,7 +144,7 @@ const Services = () => {
else if (action === 'stop') await api.stopApp(appId);
else if (action === 'restart') await api.restartApp(appId);
await loadApps();
- } catch (err) {
+ } catch {
toast.error(t('app.services.failedToService', 'Failed to {{action}} service', { action: action }));
} finally {
setActionLoading(null);
@@ -163,7 +165,7 @@ const Services = () => {
toast.success(t('app.services.sentToServiceS', '{{action}} sent to {{size}} service(s)', { action: action, size: selectedIds.size }));
setSelectedIds(new Set());
await loadApps();
- } catch (err) {
+ } catch {
toast.error(t('app.services.bulkFailed', 'Bulk {{action}} failed', { action: action }));
} finally {
setBulkLoading(false);
@@ -453,6 +455,7 @@ const Services = () => {
const MoveToProjectDialog = ({ open, onOpenChange, count, onMove }) => {
const { t } = useTranslation();
const toast = useToast();
+ const toastError = toast.error;
const [projects, setProjects] = useState([]);
const [environments, setEnvironments] = useState([]);
const [projectValue, setProjectValue] = useState(UNASSIGN);
@@ -470,9 +473,9 @@ const MoveToProjectDialog = ({ open, onOpenChange, count, onMove }) => {
setLoadingProjects(true);
api.getProjects()
.then((data) => setProjects(Array.isArray(data?.projects) ? data.projects : []))
- .catch(() => toast.error(t('app.services.failedToLoadProjects', 'Failed to load projects')))
+ .catch(() => toastError(t('app.services.failedToLoadProjects', 'Failed to load projects')))
.finally(() => setLoadingProjects(false));
- }, [open, toast]);
+ }, [open, toastError, t]);
async function handleProjectChange(value) {
setProjectValue(value);
diff --git a/frontend/src/pages/Settings.jsx b/frontend/src/pages/Settings.jsx
index 89240b61..b0fd8084 100644
--- a/frontend/src/pages/Settings.jsx
+++ b/frontend/src/pages/Settings.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react';
import useTabParam from '../hooks/useTabParam';
import { refreshDevMode } from '../hooks/useDevMode';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
import api from '../services/api';
import ProfileTab from '../components/settings/ProfileTab';
import SecuritySettingsTab from '../components/settings/SecuritySettingsTab';
diff --git a/frontend/src/pages/Setup.jsx b/frontend/src/pages/Setup.jsx
index 8a041120..d06f8f20 100644
--- a/frontend/src/pages/Setup.jsx
+++ b/frontend/src/pages/Setup.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
-import { useAuth } from '../contexts/AuthContext';
+import { useAuth } from '../contexts/useAuth.js';
import { Check, ArrowLeft } from 'lucide-react';
import ServerKitLogo from '../components/ServerKitLogo';
import SetupStepAccount from '../components/setup/SetupStepAccount';
@@ -33,8 +33,8 @@ const Setup = () => {
// If user is already authenticated (e.g. page refresh mid-wizard), skip to step 2
useEffect(() => {
- if (isAuthenticated && currentStep === 1) {
- setCurrentStep(2);
+ if (isAuthenticated) {
+ setCurrentStep(step => step === 1 ? 2 : step);
}
}, [isAuthenticated]);
@@ -140,7 +140,7 @@ const Setup = () => {
{currentStep > 2 && (
<Button
variant="ghost"
- className="btn-wizard-prev mb-4"
+ className="btn-wizard-prev setup-back-action"
onClick={handleBack}
>
<ArrowLeft size={16} />
diff --git a/frontend/src/pages/SharedVariables.jsx b/frontend/src/pages/SharedVariables.jsx
index dc8bb8cb..f146e273 100644
--- a/frontend/src/pages/SharedVariables.jsx
+++ b/frontend/src/pages/SharedVariables.jsx
@@ -1,5 +1,5 @@
import SharedVariableGroups from '../components/shared/SharedVariableGroups';
-import { useWorkspace } from '../contexts/WorkspaceContext';
+import { useWorkspace } from '../contexts/useWorkspace.js';
/**
* SharedVariables — workspace-scoped management of shared variable groups
diff --git a/frontend/src/pages/SourceConnectionCallback.jsx b/frontend/src/pages/SourceConnectionCallback.jsx
index 91f2f2d3..5deb6245 100644
--- a/frontend/src/pages/SourceConnectionCallback.jsx
+++ b/frontend/src/pages/SourceConnectionCallback.jsx
@@ -3,8 +3,9 @@ import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
import { Github, Gitlab, GitBranch, Loader2 } from 'lucide-react';
import { SiBitbucket } from 'react-icons/si';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
const PROVIDER_LABELS = {
github: 'GitHub',
@@ -68,9 +69,9 @@ const SourceConnectionCallback = () => {
{error ? (
<>
<p className="auth-error">{error}</p>
- <button type="button" className="btn btn-primary" onClick={() => navigate('/settings/connections')}>
+ <SharedButton variant="primary" type="button" className="btn btn-primary" onClick={() => navigate('/settings/connections')}>
{t('app.sourceConnectionCallback.backToConnections', 'Back to Connections')}
- </button>
+ </SharedButton>
</>
) : (
<div className="sso-loading">
diff --git a/frontend/src/pages/StatusPages.jsx b/frontend/src/pages/StatusPages.jsx
index fcc82a01..38252c11 100644
--- a/frontend/src/pages/StatusPages.jsx
+++ b/frontend/src/pages/StatusPages.jsx
@@ -1,7 +1,7 @@
import { useEffect, useMemo, useState } from 'react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
-import { useAuth } from '../contexts/AuthContext';
+import { useToast } from '../contexts/useToast.js';
+import { useAuth } from '../contexts/useAuth.js';
import PageLoader from '../components/PageLoader';
import ConfirmDialog from '../components/ConfirmDialog';
import EmptyState from '../components/EmptyState';
@@ -358,7 +358,7 @@ const StatusPages = () => {
<div className="status-layout">
<aside className="status-pages-list" aria-label={t('app.statusPages.statusPages', 'Status pages')}>
{pages.map((page) => (
- <button
+ <Button variant="unstyled"
key={page.id}
type="button"
className={`status-page-item ${selectedPage?.id === page.id ? 'active' : ''}`}
@@ -375,7 +375,7 @@ const StatusPages = () => {
<Globe2 size={13} />
{page.component_count} component{page.component_count !== 1 ? 's' : ''}
</span>
- </button>
+ </Button>
))}
{pages.length === 0 && (
<EmptyState icon={Activity} title={t('app.statusPages.noStatusPagesYet', 'No status pages yet')} />
@@ -675,7 +675,7 @@ const StatusPages = () => {
</p>
<div className="status-attach-list">
{unattached.map((monitor) => (
- <button
+ <Button variant="unstyled"
key={monitor.id}
type="button"
className="status-attach-row"
@@ -688,7 +688,7 @@ const StatusPages = () => {
<Pill kind={(STATUS_META[monitor.status] || STATUS_META.operational).pill}>
{(STATUS_META[monitor.status] || STATUS_META.operational).label}
</Pill>
- </button>
+ </Button>
))}
{unattached.length === 0 && (
<p className="form-help">{t('app.statusPages.everyMonitorIsAlreadyOnA2', 'Every monitor is already on a page.')}</p>
diff --git a/frontend/src/pages/StyleGuide.jsx b/frontend/src/pages/StyleGuide.jsx
index 912e2b24..cd825de1 100644
--- a/frontend/src/pages/StyleGuide.jsx
+++ b/frontend/src/pages/StyleGuide.jsx
@@ -1,21 +1,13 @@
-/* eslint-disable no-restricted-syntax --
- * The style guide demonstrates the raw elements and legacy classes that the
- * design-system rules exist to discourage — showing a bare <button> next to the
- * shared <Button> is the entire point of the page. Left un-suppressed it
- * contributed 165 of ~950 no-restricted-syntax warnings, i.e. one file hiding
- * the real drift in every other file behind it.
- */
import { useState } from 'react';
import useTabParam from '../hooks/useTabParam';
import { useLogsDrawer } from '../contexts/LogsDrawerContext';
import {
Palette, Type, Box, Layout, Square, ToggleLeft, AlertTriangle,
- Info, CheckCircle, XCircle, Bell, Search, Plus, Trash2, Edit3,
- Download, Upload, RefreshCw, Settings, Eye, EyeOff, Copy, Star,
- ChevronDown, ChevronRight, ExternalLink, Server, Database, Globe,
- Shield, Lock, Zap, Activity, BarChart3, Cloud, Terminal, Layers,
+ Info, CheckCircle, Search, Plus, Trash2, Edit3,
+ Download, RefreshCw, Settings, Eye, Copy, ChevronRight, Server, Database, Globe,
+ Shield, Lock, Zap, Activity, BarChart3, Cloud, Layers,
Inbox, Table, AlertCircle, FileText, Monitor, Key, FolderOpen,
- GitBranch, Package, HardDrive, Wifi, WifiOff, Clock
+ GitBranch, WifiOff, Clock
} from 'lucide-react';
import { PageTopbar, SearchField } from '@/components/ds';
import Modal from '../components/Modal';
@@ -42,6 +34,7 @@ import { useTranslation } from 'react-i18next';
import {
Sheet, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, SheetClose,
} from '@/components/ui/sheet';
+import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent, CardFooter as SharedCardFooter } from '@/components/ui/card';
const SECTIONS = [
{ id: 'colors', labelKey: 'app.styleGuide.colors', label: 'Colors', icon: Palette },
@@ -119,7 +112,7 @@ export default function StyleGuide() {
{/* ── COLORS ── */}
{activeSection === 'colors' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.backgroundColors', 'Background Colors')} />
<div className="styleguide__swatch-grid">
<Swatch name="--bg-body" label={t('app.styleGuide.body', 'Body')} />
@@ -179,45 +172,45 @@ export default function StyleGuide() {
{/* ── TYPOGRAPHY ── */}
{activeSection === 'typography' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.fontFamilies', 'Font Families')} />
- <div className="card" style={{ padding: 24 }}>
- <p style={{ fontFamily: "'Inter', sans-serif", marginBottom: 16 }}>
- <span className="text-tertiary text-sm">$font-main:</span><br />
- {t('app.styleGuide.theQuickBrownFoxJumpsOver', 'The quick brown fox jumps over the lazy dog — Inter')}
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <p className="styleguide__font-sample">
+ <span className="styleguide__description styleguide__description--muted">$font-main:</span><br />
+ {t('app.styleGuide.theQuickBrownFoxJumpsOver', 'The quick brown fox jumps over the lazy dog — IBM Plex Sans')}
</p>
- <p className="mono" style={{ fontSize: 14 }}>
- <span className="text-tertiary text-sm">$font-mono:</span><br />
- {'const server = createApp(); // JetBrains Mono'}
+ <p className="styleguide__code-sample">
+ <span className="styleguide__description styleguide__description--muted">$font-mono:</span><br />
+ {'const server = createApp(); // IBM Plex Mono'}
</p>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.fontSizes', 'Font Sizes')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
{[
['$font-size-xs', '10px'], ['$font-size-sm', '12px'],
['$font-size-base', '14px'], ['$font-size-md', '16px'],
['$font-size-lg', '18px'], ['$font-size-xl', '20px'],
['$font-size-2xl', '24px'], ['$font-size-3xl', '30px'],
].map(([token, size]) => (
- <div key={token} className="flex items-center gap-4 mb-2">
- <span className="mono text-tertiary" style={{ minWidth: 160 }}>{token}</span>
+ <div key={token} className="styleguide__token-row">
+ <span className="styleguide__token-name styleguide__token-name--font">{token}</span>
<span style={{ fontSize: size }}>{size} {t('app.styleGuide.theQuickBrownFox', '— The quick brown fox')}</span>
</div>
))}
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.fontWeights', 'Font Weights')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
{[['Normal (400)', 400], ['Medium (500)', 500], ['Semibold (600)', 600], ['Bold (700)', 700]].map(([label, weight]) => (
- <p key={weight} style={{ fontWeight: weight, marginBottom: 8 }}>
+ <p key={weight} className="styleguide__weight-sample" style={{ fontWeight: weight }}>
{label} {t('app.styleGuide.theQuickBrownFoxJumpsOver2', '— The quick brown fox jumps over the lazy dog')}
</p>
))}
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.headingTags', 'Heading Tags')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<h1>{t('app.styleGuide.h1PageTitle', 'h1 — Page Title')}</h1>
<h2>{t('app.styleGuide.h2SectionTitle', 'h2 — Section Title')}</h2>
<h3>{t('app.styleGuide.h3CardTitle', 'h3 — Card Title')}</h3>
@@ -226,10 +219,10 @@ export default function StyleGuide() {
<p>{t('app.styleGuide.pBodyTextParagraphWithNormal', 'p — Body text paragraph with normal weight and base font size.')}</p>
<p className="text-secondary">{t('app.styleGuide.pTextSecondarySecondaryParagraphText', 'p.text-secondary — Secondary paragraph text.')}</p>
<p className="text-tertiary">{t('app.styleGuide.pTextTertiaryTertiaryMutedParagraph', 'p.text-tertiary — Tertiary/muted paragraph text.')}</p>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.textUtilityClasses', 'Text Utility Classes')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<p className="text-primary">.text-primary</p>
<p className="text-secondary">.text-secondary</p>
<p className="text-tertiary">.text-tertiary</p>
@@ -237,27 +230,27 @@ export default function StyleGuide() {
<p className="text-warning">.text-warning</p>
<p className="text-danger">.text-danger</p>
<p className="text-accent">.text-accent</p>
- </div>
+ </SharedCard>
</div>
)}
{/* ── SPACING & RADIUS ── */}
{activeSection === 'spacing' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.spacingScale', 'Spacing Scale')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
{[
['$space-1', 4], ['$space-2', 8], ['$space-3', 12], ['$space-4', 16],
['$space-5', 20], ['$space-6', 24], ['$space-8', 32], ['$space-10', 40],
['$space-12', 48], ['$space-16', 64],
].map(([token, px]) => (
- <div key={token} className="flex items-center gap-4 mb-3">
- <span className="mono text-tertiary" style={{ minWidth: 120 }}>{token}</span>
- <span className="mono text-secondary" style={{ minWidth: 50 }}>{px}px</span>
- <div className="styleguide__spacing-bar" style={{ width: px, height: 16 }} />
+ <div key={token} className="styleguide__token-row styleguide__token-row--spacing">
+ <span className="styleguide__token-name styleguide__token-name--spacing">{token}</span>
+ <span className="styleguide__token-value">{px}px</span>
+ <div className="styleguide__spacing-bar" style={{ width: px }} />
</div>
))}
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.borderRadius', 'Border Radius')} />
<div className="styleguide__swatch-grid">
@@ -265,21 +258,21 @@ export default function StyleGuide() {
['$radius-sm', '4px'], ['$radius-md', '6px'], ['$radius-lg', '8px'],
['$radius-xl', '12px'], ['$radius-2xl', '16px'], ['$radius-full', '9999px'],
].map(([token, val]) => (
- <div key={token} className="card flex flex-col items-center gap-3" style={{ padding: 20 }}>
+ <SharedCard variant="legacy" key={token} className="card styleguide__swatch-card">
<div className="styleguide__radius-box" style={{ borderRadius: val }} />
- <span className="mono text-sm text-tertiary">{token}</span>
- <span className="text-sm text-secondary">{val}</span>
- </div>
+ <span className="styleguide__description styleguide__description--muted styleguide__description--mono">{token}</span>
+ <span className="styleguide__description">{val}</span>
+ </SharedCard>
))}
</div>
<SectionTitle title={t('app.styleGuide.shadows', 'Shadows')} />
<div className="styleguide__swatch-grid">
{['sm', 'md', 'lg'].map(size => (
- <div key={size} className="card flex flex-col items-center gap-3" style={{ padding: 20 }}>
+ <SharedCard variant="legacy" key={size} className="card styleguide__swatch-card">
<div className="styleguide__shadow-box" style={{ boxShadow: `var(--shadow-${size})` }} />
- <span className="mono text-sm text-tertiary">$shadow-{size}</span>
- </div>
+ <span className="styleguide__description styleguide__description--muted styleguide__description--mono">$shadow-{size}</span>
+ </SharedCard>
))}
</div>
</div>
@@ -287,35 +280,35 @@ export default function StyleGuide() {
{/* ── BUTTONS ── */}
{activeSection === 'buttons' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.buttonVariants', 'Button Variants')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="flex flex-wrap gap-3 mb-6">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <div className="styleguide__actions styleguide__actions--section-end">
<Button><Plus size={16} /> {t('app.styleGuide.primary', 'Primary')}</Button>
<Button variant="outline"><Edit3 size={16} /> {t('app.styleGuide.outline', 'Outline')}</Button>
<Button variant="destructive"><Trash2 size={16} /> {t('app.styleGuide.destructive', 'Destructive')}</Button>
<Button variant="ghost"><Eye size={16} /> {t('app.styleGuide.ghost', 'Ghost')}</Button>
<Button variant="secondary"><Settings size={16} /> {t('app.styleGuide.secondary', 'Secondary')}</Button>
</div>
- <div className="flex flex-wrap gap-3">
+ <div className="styleguide__actions">
<Button disabled>{t('app.styleGuide.disabledPrimary', 'Disabled Primary')}</Button>
<Button variant="outline" disabled>{t('app.styleGuide.disabledOutline', 'Disabled Outline')}</Button>
<Button variant="destructive" disabled>{t('app.styleGuide.disabledDestructive', 'Disabled Destructive')}</Button>
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.buttonSizes', 'Button Sizes')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="flex flex-wrap items-center gap-3">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <div className="styleguide__actions styleguide__actions--aligned">
<Button size="sm">{t('app.styleGuide.small', 'Small')}</Button>
<Button>{t('common.labels.default', 'Default')}</Button>
<Button size="lg">{t('app.styleGuide.large', 'Large')}</Button>
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.iconButtons', 'Icon Buttons')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="flex flex-wrap gap-3">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <div className="styleguide__actions">
<Button size="icon"><Plus size={16} /></Button>
<Button size="icon" variant="outline"><Edit3 size={16} /></Button>
<Button size="icon" variant="destructive"><Trash2 size={16} /></Button>
@@ -323,12 +316,12 @@ export default function StyleGuide() {
<Button size="icon" variant="ghost"><Copy size={16} /></Button>
<Button size="icon" variant="ghost"><RefreshCw size={16} /></Button>
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.fullWidthLoading', 'Full Width & Loading')} />
- <div className="card" style={{ padding: 24 }}>
- <Button className="w-full mb-4">{t('app.styleGuide.fullWidthButton', 'Full Width Button')}</Button>
- <div className="flex flex-wrap gap-3">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <Button className="styleguide__full-width-button">{t('app.styleGuide.fullWidthButton', 'Full Width Button')}</Button>
+ <div className="styleguide__actions">
<Button disabled>
<Spinner size="sm" />
{t('common.editing.saving', 'Saving…')}
@@ -338,15 +331,15 @@ export default function StyleGuide() {
{t('common.loading', 'Loading…')}
</Button>
</div>
- </div>
+ </SharedCard>
</div>
)}
{/* ── FORMS ── */}
{activeSection === 'forms' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.textInputs', 'Text Inputs')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<div className="form-group">
<label>{t('app.styleGuide.defaultInput', 'Default Input')}</label>
<Input type="text" placeholder={t('app.styleGuide.enterText', 'Enter text…')} value={inputValue} onChange={e => setInputValue(e.target.value)} />
@@ -356,10 +349,10 @@ export default function StyleGuide() {
<label>{t('app.styleGuide.disabledInput', 'Disabled Input')}</label>
<Input type="text" placeholder={t('app.styleGuide.disabled', 'Disabled…')} disabled />
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.selectTextarea', 'Select & Textarea')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<div className="form-group">
<label>{t('app.styleGuide.selectDropdown', 'Select Dropdown')}</label>
<select className="form-select" value={selectValue} onChange={e => setSelectValue(e.target.value)}>
@@ -376,10 +369,10 @@ export default function StyleGuide() {
<label>{t('app.styleGuide.codeEditor', 'Code Editor')}</label>
<Textarea className="code-editor" rows={3} placeholder={t('app.styleGuide.serverListen80', 'server { listen 80; }')} />
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.formRow2Column', 'Form Row (2-column)')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<div className="form-row">
<div className="form-group">
<label>{t('app.styleGuide.firstName', 'First Name')}</label>
@@ -390,39 +383,39 @@ export default function StyleGuide() {
<Input type="text" placeholder={t('app.styleGuide.doe', 'Doe')} />
</div>
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.inlineForm', 'Inline Form')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<div className="install-form">
<Input type="text" placeholder={t('app.styleGuide.searchPackages', 'Search packages…')} />
<Button><Search size={16} /> {t('app.styleGuide.search', 'Search')}</Button>
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.checkboxToggle', 'Checkbox Toggle')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<label className="filter-toggle">
<input type="checkbox" checked={checkValue} onChange={e => setCheckValue(e.target.checked)} />
<span>{t('app.styleGuide.enableFeature', 'Enable feature')}</span>
</label>
- </div>
+ </SharedCard>
</div>
)}
{/* ── TABLES ── */}
{activeSection === 'tables' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.standardTableTable', 'Standard Table (.table)')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="card-header">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.styleGuide.sshAuthorizedKeys', 'SSH Authorized Keys')}</h3>
- <div className="card-actions">
+ <SharedCardFooter variant="legacy">
<Button size="sm">{t('app.styleGuide.addKey', 'Add Key')}</Button>
<Button size="sm" variant="outline">{t('common.actions.refresh', 'Refresh')}</Button>
- </div>
- </div>
- <div className="card-body">
+ </SharedCardFooter>
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<table className="table">
<thead>
<tr>
@@ -453,16 +446,16 @@ export default function StyleGuide() {
</tr>
</tbody>
</table>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.tableWithBadges', 'Table with Badges')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="card-header">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.styleGuide.scanHistory', 'Scan History')}</h3>
<Button size="sm" variant="outline">{t('common.actions.refresh', 'Refresh')}</Button>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<table className="table">
<thead>
<tr>
@@ -493,15 +486,15 @@ export default function StyleGuide() {
</tr>
</tbody>
</table>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.tableWithStatusBadges', 'Table with Status Badges')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="card-header">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.styleGuide.firewallRules', 'Firewall Rules')}</h3>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<table className="table">
<thead>
<tr>
@@ -536,27 +529,27 @@ export default function StyleGuide() {
</tr>
</tbody>
</table>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
</div>
)}
{/* ── CARDS & STATS ── */}
{activeSection === 'cards' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.basicCard', 'Basic Card')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="card-header">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.styleGuide.cardTitle', 'Card Title')}</h3>
- <div className="card-actions">
+ <SharedCardFooter variant="legacy">
<Button size="sm" variant="outline">{t('common.actions.refresh', 'Refresh')}</Button>
<Button size="sm">{t('common.labels.action', 'Action')}</Button>
- </div>
- </div>
- <div className="card-body">
+ </SharedCardFooter>
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<p className="text-secondary">{t('app.styleGuide.cardBodyContentWithCardHeader', 'Card body content with card-header and card-actions in the header.')}</p>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.statsGridStatcardStatsgrid', 'Stats Grid (StatCard / StatsGrid)')} />
<StatsGrid>
@@ -567,33 +560,33 @@ export default function StyleGuide() {
</StatsGrid>
<SectionTitle title={t('app.styleGuide.metricRowMetricrowMetricitem', 'Metric Row (MetricRow / MetricItem)')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<MetricRow>
<MetricItem label="CPU" value="23%" />
<MetricItem label={t('common.labels.memory', 'Memory')} value="1.2 GB" />
<MetricItem label={t('common.labels.disk', 'Disk')} value="48 GB" />
<MetricItem label={t('app.styleGuide.network', 'Network')} value="2.4 Mbps" />
</MetricRow>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.progressBarProgressbar', 'Progress Bar (ProgressBar)')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="space-y-4">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <div className="styleguide__examples">
{[
['Storage', '48 / 100 GB', 48, null],
['Memory', '6.2 / 8 GB', 78, '#f59e0b'],
['CPU', '92%', 92, '#ef4444'],
].map(([label, text, percent, color]) => (
<div key={label}>
- <div className="flex justify-between mb-1">
- <span className="text-sm text-secondary">{label}</span>
- <span className="text-sm mono">{text}</span>
+ <div className="styleguide__progress-labels">
+ <span className="styleguide__description">{label}</span>
+ <span className="styleguide__progress-value">{text}</span>
</div>
<ProgressBar percent={percent} color={color} />
</div>
))}
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.dangerZoneDangerzone', 'Danger Zone (DangerZone)')} />
<DangerZone
@@ -606,39 +599,39 @@ export default function StyleGuide() {
{/* ── BADGES & STATUS ── */}
{activeSection === 'badges' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.statusBadgesComponent', 'Status Badges (Component)')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="flex flex-wrap gap-3 mb-4">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <div className="styleguide__actions styleguide__actions--spaced">
<StatusBadge status="online" />
<StatusBadge status="running" />
<StatusBadge status="healthy" />
<StatusBadge status="active" />
<StatusBadge status="connected" />
</div>
- <div className="flex flex-wrap gap-3 mb-4">
+ <div className="styleguide__actions styleguide__actions--spaced">
<StatusBadge status="offline" />
<StatusBadge status="stopped" />
<StatusBadge status="error" />
<StatusBadge status="failed" />
<StatusBadge status="disconnected" />
</div>
- <div className="flex flex-wrap gap-3 mb-4">
+ <div className="styleguide__actions styleguide__actions--spaced">
<StatusBadge status="warning" />
<StatusBadge status="degraded" />
<StatusBadge status="pending" />
<StatusBadge status="building" />
<StatusBadge status="deploying" />
</div>
- <div className="flex flex-wrap gap-3">
+ <div className="styleguide__actions">
<StatusBadge status="paused" />
<StatusBadge status="unknown" />
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.shadcnBadgeVariants', 'shadcn Badge Variants')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="flex flex-wrap gap-3">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <div className="styleguide__actions">
<Badge>{t('common.labels.default', 'Default')}</Badge>
<Badge variant="info">{t('common.labels.info', 'Info')}</Badge>
<Badge variant="success">{t('app.styleGuide.success', 'Success')}</Badge>
@@ -647,42 +640,42 @@ export default function StyleGuide() {
<Badge variant="secondary">{t('app.styleGuide.secondary', 'Secondary')}</Badge>
<Badge variant="outline">{t('app.styleGuide.outline', 'Outline')}</Badge>
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.appTypeEnvDbBadges', 'App Type / Env / DB Badges')} />
- <div className="card" style={{ padding: 24 }}>
- <p className="text-sm text-tertiary mb-2">{t('app.styleGuide.appTypes', 'App Types')}</p>
- <div className="flex flex-wrap gap-3 mb-4">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">{t('app.styleGuide.appTypes', 'App Types')}</p>
+ <div className="styleguide__actions styleguide__actions--spaced">
<span className="app-type">PHP</span>
<span className="app-type">{t('app.styleGuide.python', 'Python')}</span>
<span className="app-type">{t('app.styleGuide.nodeJs', 'Node.js')}</span>
<span className="app-type">{t('app.styleGuide.wordpress', 'WordPress')}</span>
<span className="app-type">{t('app.styleGuide.static', 'Static')}</span>
</div>
- <p className="text-sm text-tertiary mb-2">{t('app.styleGuide.environments', 'Environments')}</p>
- <div className="flex flex-wrap gap-3 mb-4">
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">{t('app.styleGuide.environments', 'Environments')}</p>
+ <div className="styleguide__actions styleguide__actions--spaced">
<span className="env-badge env-production">{t('app.styleGuide.production', 'Production')}</span>
<span className="env-badge env-staging">{t('app.styleGuide.staging', 'Staging')}</span>
<span className="env-badge env-development">{t('app.styleGuide.development', 'Development')}</span>
</div>
- <p className="text-sm text-tertiary mb-2">{t('app.styleGuide.databaseTypes', 'Database Types')}</p>
- <div className="flex flex-wrap gap-3 mb-4">
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">{t('app.styleGuide.databaseTypes', 'Database Types')}</p>
+ <div className="styleguide__actions styleguide__actions--spaced">
<span className="db-type-badge mysql">{t('app.styleGuide.mysql', 'MySQL')}</span>
<span className="db-type-badge postgresql">{t('app.styleGuide.postgresql', 'PostgreSQL')}</span>
</div>
- <p className="text-sm text-tertiary mb-2">SSL</p>
- <div className="flex flex-wrap gap-3">
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">SSL</p>
+ <div className="styleguide__actions">
<span className="ssl-badge"><Lock size={12} /> {t('app.styleGuide.sslActive', 'SSL Active')}</span>
</div>
- </div>
+ </SharedCard>
</div>
)}
{/* ── ALERTS & ERRORS ── */}
{activeSection === 'alerts' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.alertBannersAlert', 'Alert Banners (.alert)')} />
- <div className="space-y-2">
+ <div className="styleguide__examples styleguide__examples--compact">
<div className="alert alert-success">
<CheckCircle size={16} /> {t('app.styleGuide.operationCompletedSuccessfully', 'Operation completed successfully.')}
</div>
@@ -698,34 +691,34 @@ export default function StyleGuide() {
</div>
<SectionTitle title={t('app.styleGuide.alertWithCloseButton', 'Alert with Close Button')} />
- <div className="space-y-2">
+ <div className="styleguide__examples styleguide__examples--compact">
<div className="alert alert-danger">
{t('app.styleGuide.somethingWentWrongWhileSaving', 'Something went wrong while saving.')}
- <button className="alert-close">&times;</button>
+ <Button variant="unstyled" className="alert-close">&times;</Button>
</div>
</div>
<SectionTitle title={t('app.styleGuide.errorMessageErrorMessage', 'Error Message (.error-message)')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<div className="error-message">
<AlertTriangle size={16} /> {t('app.styleGuide.thisIsAnInlineErrorMessage', 'This is an inline error message.')}
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.errorBannerErrorBanner', 'Error Banner (.error-banner)')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<div className="error-banner">
<AlertTriangle size={16} /> {t('app.styleGuide.thisIsAFullWidthError', 'This is a full-width error banner.')}
</div>
- </div>
+ </SharedCard>
</div>
)}
{/* ── MODALS ── */}
{activeSection === 'modals' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.modalDialog', 'Modal Dialog')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<Button onClick={() => setModalOpen(true)}>
{t('app.styleGuide.openModal', 'Open Modal')}
</Button>
@@ -739,17 +732,17 @@ export default function StyleGuide() {
</>}
>
<p className="text-secondary">{t('app.styleGuide.modalBodyContentWithAForm', 'Modal body content with a form field.')}</p>
- <div className="form-group mt-4">
+ <div className="form-group styleguide__modal-field">
<label>{t('app.styleGuide.exampleField', 'Example Field')}</label>
<Input type="text" placeholder={t('app.styleGuide.typeSomething', 'Type something…')} />
</div>
</Modal>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.sideDrawerSheet', 'Side Drawer (Sheet)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.rightLeftAnchoredPanelBuiltOn', 'Right/left-anchored panel built on Radix Dialog. Used for forms like “Add Server” or “Add Service” where a slide-in panel is preferred over a centered modal.')}</p>
- <div className="card" style={{ padding: 24 }}>
- <div className="flex flex-wrap gap-3">
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.rightLeftAnchoredPanelBuiltOn', 'Right/left-anchored panel built on Radix Dialog. Used for forms like “Add Server” or “Add Service” where a slide-in panel is preferred over a centered modal.')}</p>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <div className="styleguide__actions">
<Button onClick={() => { setSheetSide('right'); setSheetOpen(true); }}>
<Plus size={16} /> {t('app.styleGuide.openRightDrawer', 'Open Right Drawer')}
</Button>
@@ -765,7 +758,7 @@ export default function StyleGuide() {
{t('app.styleGuide.configureANewServiceThisDrawer', 'Configure a new service. This drawer pattern is the panel-style alternative to a centered modal.')}
</SheetDescription>
</SheetHeader>
- <div className="space-y-4" style={{ padding: '16px 0' }}>
+ <div className="styleguide__drawer-fields">
<div className="form-group">
<label>{t('app.styleGuide.serviceName', 'Service name')}</label>
<Input type="text" placeholder="my-service" />
@@ -783,19 +776,19 @@ export default function StyleGuide() {
</SheetFooter>
</SheetContent>
</Sheet>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.logsDrawerLogsdrawer', 'Logs Drawer (LogsDrawer)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.globalBottomPinnedDrawerForStreaming', 'Global bottom-pinned drawer for streaming logs. Opens via the LogsDrawer context.')}</p>
- <div className="card" style={{ padding: 24 }}>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.globalBottomPinnedDrawerForStreaming', 'Global bottom-pinned drawer for streaming logs. Opens via the LogsDrawer context.')}</p>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<Button onClick={() => openDrawer({ name: 'sample-service', logPath: '/var/log/syslog', appType: 'logfile' })}>
<FileText size={16} /> {t('app.styleGuide.openLogsDrawer', 'Open Logs Drawer')}
</Button>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.confirmDialogs', 'Confirm Dialogs')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="flex flex-wrap gap-3">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <div className="styleguide__actions">
<Button variant="destructive" onClick={() => { setConfirmVariant('danger'); setConfirmOpen(true); }}>{t('app.styleGuide.danger', 'Danger')}</Button>
<Button variant="outline" onClick={() => { setConfirmVariant('warning'); setConfirmOpen(true); }}>{t('common.labels.warning', 'Warning')}</Button>
<Button variant="outline" onClick={() => { setConfirmVariant('info'); setConfirmOpen(true); }}>{t('common.labels.info', 'Info')}</Button>
@@ -809,15 +802,15 @@ export default function StyleGuide() {
onConfirm={() => setConfirmOpen(false)}
onCancel={() => setConfirmOpen(false)}
/>
- </div>
+ </SharedCard>
</div>
)}
{/* ── TABS ── */}
{activeSection === 'tabs' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.tabsBasic', 'Tabs (Basic)')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<Tabs defaultValue="tab1">
<TabsList>
<TabsTrigger value="tab1"><Server size={14} /> {t('app.styleGuide.general', 'General')}</TabsTrigger>
@@ -825,20 +818,20 @@ export default function StyleGuide() {
<TabsTrigger value="tab3"><Activity size={14} /> {t('common.labels.monitoring', 'Monitoring')}</TabsTrigger>
</TabsList>
<TabsContent value="tab1">
- <p className="text-secondary" style={{ paddingTop: 16 }}>{t('app.styleGuide.generalTabContent', 'General tab content.')}</p>
+ <p className="styleguide__tab-content">{t('app.styleGuide.generalTabContent', 'General tab content.')}</p>
</TabsContent>
<TabsContent value="tab2">
- <p className="text-secondary" style={{ paddingTop: 16 }}>{t('app.styleGuide.securityTabContent', 'Security tab content.')}</p>
+ <p className="styleguide__tab-content">{t('app.styleGuide.securityTabContent', 'Security tab content.')}</p>
</TabsContent>
<TabsContent value="tab3">
- <p className="text-secondary" style={{ paddingTop: 16 }}>{t('app.styleGuide.monitoringTabContent', 'Monitoring tab content.')}</p>
+ <p className="styleguide__tab-content">{t('app.styleGuide.monitoringTabContent', 'Monitoring tab content.')}</p>
</TabsContent>
</Tabs>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.tabsControlled', 'Tabs (Controlled)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.controlledValueOnvaluechangeUsageThisShould', 'Controlled value/onValueChange usage. This should match URL-backed pages behaviorally.')}</p>
- <div className="card" style={{ padding: 24 }}>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.controlledValueOnvaluechangeUsageThisShould', 'Controlled value/onValueChange usage. This should match URL-backed pages behaviorally.')}</p>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<Tabs value={controlledDemoTab} onValueChange={setControlledDemoTab}>
<TabsList>
<TabsTrigger value="general"><Server size={14} /> {t('app.styleGuide.general', 'General')}</TabsTrigger>
@@ -847,20 +840,20 @@ export default function StyleGuide() {
<TabsTrigger value="disabled" disabled><Lock size={14} /> {t('app.styleGuide.disabled2', 'Disabled')}</TabsTrigger>
</TabsList>
<TabsContent value="general">
- <p className="text-secondary" style={{ paddingTop: 16 }}>{t('app.styleGuide.controlledGeneralContent', 'Controlled general content.')}</p>
+ <p className="styleguide__tab-content">{t('app.styleGuide.controlledGeneralContent', 'Controlled general content.')}</p>
</TabsContent>
<TabsContent value="security">
- <p className="text-secondary" style={{ paddingTop: 16 }}>{t('app.styleGuide.controlledSecurityContent', 'Controlled security content.')}</p>
+ <p className="styleguide__tab-content">{t('app.styleGuide.controlledSecurityContent', 'Controlled security content.')}</p>
</TabsContent>
<TabsContent value="monitoring">
- <p className="text-secondary" style={{ paddingTop: 16 }}>{t('app.styleGuide.controlledMonitoringContent', 'Controlled monitoring content.')}</p>
+ <p className="styleguide__tab-content">{t('app.styleGuide.controlledMonitoringContent', 'Controlled monitoring content.')}</p>
</TabsContent>
</Tabs>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.tabsOverflowMenu', 'Tabs (Overflow Menu)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.manyTabsForceTheOverflowMenu', 'Many tabs force the overflow menu. Selecting an item from the ellipsis must activate the tab and close the popover.')}</p>
- <div className="card" style={{ padding: 24 }}>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.manyTabsForceTheOverflowMenu', 'Many tabs force the overflow menu. Selecting an item from the ellipsis must activate the tab and close the popover.')}</p>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<Tabs defaultValue="overview">
<TabsList>
{MANY_TAB_ITEMS.map(([value, label]) => (
@@ -869,31 +862,31 @@ export default function StyleGuide() {
</TabsList>
{MANY_TAB_ITEMS.map(([value, label]) => (
<TabsContent key={value} value={value}>
- <p className="text-secondary" style={{ paddingTop: 16 }}>{label} {t('app.styleGuide.tabContent', 'tab content.')}</p>
+ <p className="styleguide__tab-content">{label} {t('app.styleGuide.tabContent', 'tab content.')}</p>
</TabsContent>
))}
</Tabs>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.tabsHalfHalfLayout', 'Tabs (Half + Half Layout)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.constrainedCardsCatchLayoutBugsThat', 'Constrained cards catch layout bugs that full-width tabs hide.')}</p>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.constrainedCardsCatchLayoutBugsThat', 'Constrained cards catch layout bugs that full-width tabs hide.')}</p>
<div className="styleguide__split-demo">
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<Tabs value={halfDemoTab} onValueChange={setHalfDemoTab}>
<TabsList>
<TabsTrigger value="summary">{t('app.styleGuide.summary', 'Summary')}</TabsTrigger>
<TabsTrigger value="activity">{t('app.styleGuide.activity', 'Activity')}</TabsTrigger>
</TabsList>
<TabsContent value="summary">
- <p className="text-secondary" style={{ paddingTop: 16 }}>{t('app.styleGuide.shortTwoTabCardContent', 'Short two-tab card content.')}</p>
+ <p className="styleguide__tab-content">{t('app.styleGuide.shortTwoTabCardContent', 'Short two-tab card content.')}</p>
</TabsContent>
<TabsContent value="activity">
- <p className="text-secondary" style={{ paddingTop: 16 }}>{t('app.styleGuide.recentActivityContent', 'Recent activity content.')}</p>
+ <p className="styleguide__tab-content">{t('app.styleGuide.recentActivityContent', 'Recent activity content.')}</p>
</TabsContent>
</Tabs>
- </div>
+ </SharedCard>
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<Tabs value={halfOverflowTab} onValueChange={setHalfOverflowTab}>
<TabsList>
{MANY_TAB_ITEMS.map(([value, label]) => (
@@ -902,20 +895,20 @@ export default function StyleGuide() {
</TabsList>
{MANY_TAB_ITEMS.map(([value, label]) => (
<TabsContent key={value} value={value}>
- <p className="text-secondary" style={{ paddingTop: 16 }}>{label} {t('app.styleGuide.contentInsideAHalfWidthCard', 'content inside a half-width card.')}</p>
+ <p className="styleguide__tab-content">{label} {t('app.styleGuide.contentInsideAHalfWidthCard', 'content inside a half-width card.')}</p>
</TabsContent>
))}
</Tabs>
- </div>
+ </SharedCard>
</div>
</div>
)}
{/* ── LISTS & INFO ── */}
{activeSection === 'lists' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.infoListInfolistInfoitem', 'Info List (InfoList / InfoItem)')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<InfoList>
<InfoItem label={t('app.styleGuide.hostname', 'Hostname')} value="srv-01.example.com" mono />
<InfoItem label={t('common.labels.ipAddress', 'IP Address')} value="192.168.1.100" mono />
@@ -925,10 +918,10 @@ export default function StyleGuide() {
<StatusBadge status="online" />
</InfoItem>
</InfoList>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.environmentVariables', 'Environment Variables')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<div className="env-list">
{[
['DATABASE_URL', 'postgresql://localhost:5432/mydb'],
@@ -941,10 +934,10 @@ export default function StyleGuide() {
</div>
))}
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.packageList', 'Package List')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<div className="packages-list">
{[['nginx', '1.24.0'], ['postgresql-15', '15.4'], ['redis-server', '7.2.1']].map(([name, ver]) => (
<div key={name} className="package-item">
@@ -953,30 +946,30 @@ export default function StyleGuide() {
</div>
))}
</div>
- </div>
+ </SharedCard>
</div>
)}
{/* ── FEEDBACK & LOADING ── */}
{activeSection === 'feedback' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.spinners', 'Spinners')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="flex items-center gap-6">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <div className="styleguide__spinner-row">
{['sm', 'md', 'lg'].map(size => (
- <div key={size} className="flex flex-col items-center gap-2">
+ <div key={size} className="styleguide__spinner-example">
<Spinner size={size} />
- <span className="text-sm text-tertiary">{size}</span>
+ <span className="styleguide__description styleguide__description--muted">{size}</span>
</div>
))}
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.spinnerSizesStandalone', 'Spinner Sizes (standalone)')} />
- <p className="text-sm text-tertiary mb-2">{t('app.styleGuide.useSpinnerDirectlyOnlyInsideButtons', 'Use Spinner directly only inside buttons or inline indicators.')}</p>
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">{t('app.styleGuide.useSpinnerDirectlyOnlyInsideButtons', 'Use Spinner directly only inside buttons or inline indicators.')}</p>
<SectionTitle title={t('app.styleGuide.loadingSkeletonArchetypes', 'Loading skeleton archetypes')} />
- <p className="text-sm text-tertiary mb-2">
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">
{t('app.styleGuide.aSkeletonShouldPredictTheLayout', 'A skeleton should predict the layout that is about to arrive. Pick the archetype matching the page shape via')}
{' '}<code>{t('app.styleGuide.emptystateLoadingLoadingvariantTable', '<EmptyState loading loadingVariant="table" />')}</code>{t('app.styleGuide.orRender', ', or render')}
{' '}<code>{t('app.styleGuide.pageskeleton', '<PageSkeleton />')}</code> {t('app.styleGuide.directlyForAPixelExactSkeleton', 'directly. For a pixel-exact skeleton of one region, capture bones instead (')}<code>{t('app.styleGuide.npmRunCaptureSkeletons', 'npm run capture:skeletons')}</code>).
@@ -992,8 +985,8 @@ export default function StyleGuide() {
{/* ── EMPTY, LOADING & UNAVAILABLE STATES ── */}
{activeSection === 'empty' && (
- <div className="space-y-6">
- <p className="text-secondary text-sm">{t('app.styleGuide.oneComponentForEverythingEmptyLoading', 'One component for everything: empty, loading, not-installed, unavailable. Import EmptyState from components/EmptyState.')}</p>
+ <div className="styleguide__section">
+ <p className="styleguide__description">{t('app.styleGuide.oneComponentForEverythingEmptyLoading', 'One component for everything: empty, loading, not-installed, unavailable. Import EmptyState from components/EmptyState.')}</p>
<SectionTitle title={t('app.styleGuide.defaultNoData', 'Default (No Data)')} />
<EmptyState />
@@ -1007,7 +1000,7 @@ export default function StyleGuide() {
/>
<SectionTitle title={t('app.styleGuide.loadingState', 'Loading State')} />
- <p className="text-sm text-tertiary mb-2">{t('app.styleGuide.passLoadingTrueSameComponentSpinner', 'Pass loading=true. Same component, spinner instead of icon.')}</p>
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">{t('app.styleGuide.passLoadingTrueSameComponentSpinner', 'Pass loading=true. Same component, spinner instead of icon.')}</p>
<EmptyState loading title={t('app.styleGuide.loadingServices', 'Loading services…')} />
<SectionTitle title={t('app.styleGuide.searchEmpty', 'Search Empty')} />
@@ -1018,7 +1011,7 @@ export default function StyleGuide() {
/>
<SectionTitle title={t('app.styleGuide.largeNotInstalledSizeLg', 'Large — Not Installed (size="lg")')} />
- <p className="text-sm text-tertiary mb-2">{t('app.styleGuide.fullPageStateForGitDocker', 'Full-page state for Git, Docker, FTP when not installed.')}</p>
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">{t('app.styleGuide.fullPageStateForGitDocker', 'Full-page state for Git, Docker, FTP when not installed.')}</p>
<EmptyState
size="lg"
icon={GitBranch}
@@ -1040,22 +1033,22 @@ export default function StyleGuide() {
<EmptyState size="lg" loading title={t('app.styleGuide.loadingServices', 'Loading services…')} />
<SectionTitle title={t('app.styleGuide.insideACardEGEmpty', 'Inside a Card (e.g. empty table)')} />
- <div className="card" style={{ padding: 24 }}>
- <div className="card-header">
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.styleGuide.scanHistory', 'Scan History')}</h3>
<Button size="sm" variant="outline">{t('common.actions.refresh', 'Refresh')}</Button>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<EmptyState
icon={Search}
title={t('app.styleGuide.noScansYet', 'No scans yet')}
description={t('app.styleGuide.startAScanAboveToCheck', 'Start a scan above to check for threats.')}
/>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.contextGrid', 'Context Grid')} />
- <div className="grid grid-cols-2 gap-4">
+ <div className="styleguide__comparison-grid">
<EmptyState icon={Database} title={t('app.styleGuide.noDatabases', 'No databases')} description={t('app.styleGuide.createYourFirstDatabase', 'Create your first database.')} action={<Button size="sm"><Plus size={14} /> {t('common.actions.create', 'Create')}</Button>} />
<EmptyState icon={Globe} title={t('app.styleGuide.noDomainsConfigured', 'No domains configured')} description={t('app.styleGuide.addADomainToGetStarted', 'Add a domain to get started.')} action={<Button size="sm"><Plus size={14} /> {t('app.styleGuide.addDomain', 'Add Domain')}</Button>} />
<EmptyState icon={Key} title={t('app.styleGuide.noSshKeys', 'No SSH keys')} description={t('app.styleGuide.addAnSshKeyForSecure', 'Add an SSH key for secure access.')} action={<Button size="sm"><Plus size={14} /> {t('app.styleGuide.addKey', 'Add Key')}</Button>} />
@@ -1066,12 +1059,12 @@ export default function StyleGuide() {
{/* ── PAGE HEADERS ── */}
{activeSection === 'pageheaders' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.tabGroupTheDefaultNoTitle', 'Tab group — the default (no title)')} />
- <p className="text-sm text-secondary mb-2">
+ <p className="styleguide__description styleguide__description--spaced">
{t('app.styleGuide.howMostPagesGetTheirBar', 'How most pages get their bar: a parent')} <code>{t('app.styleGuide.tabgrouplayout', 'TabGroupLayout')}</code> {t('app.styleGuide.rendersOneTitleless', 'renders one titleless')} <code>{t('app.styleGuide.pagetopbar', 'PageTopbar')}</code> {t('app.styleGuide.forTheWholeGroupAndSwaps', 'for the whole group and swaps only the content below. Child pages render')} <strong>{t('app.styleGuide.noBarOfTheirOwn', 'no bar of their own')}</strong> {t('app.styleGuide.theyPublishActionsThrough', '— they publish actions through')} <code>useTopbarActions()</code>{t('app.styleGuide.searchRightMostTheTabStrip', ', search right-most. The tab strip is the heading, so there is no title to repeat.')}
</p>
- <div className="card" style={{ padding: 0, overflow: 'hidden' }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card styleguide__demo-card--flush">
<PageTopbar
navLabel="Domains"
tabs={[
@@ -1086,13 +1079,13 @@ export default function StyleGuide() {
</>
)}
/>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.standalonePageTitledBar', 'Standalone page — titled bar')} />
- <p className="text-sm text-secondary mb-2">
+ <p className="styleguide__description styleguide__description--spaced">
{t('app.styleGuide.onlyForPagesWithNoTab', 'Only for pages with no tab group, and for entity pages where the title names')} <em>which</em> {t('app.styleGuide.recordYouAreOnServiceDetail', 'record you are on (Service Detail, Workspace…). Everything else should join a group.')}
</p>
- <div className="card" style={{ padding: 0, overflow: 'hidden' }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card styleguide__demo-card--flush">
<PageTopbar
icon={<Clock size={18} />}
title={t('app.styleGuide.cronJobs', 'Cron Jobs')}
@@ -1104,45 +1097,45 @@ export default function StyleGuide() {
</>
)}
/>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.retiredPageHeader', 'Retired: .page-header')} />
- <p className="text-sm text-secondary mb-2">
+ <p className="styleguide__description styleguide__description--spaced">
{t('app.styleGuide.theOld', 'The old')} <code>{t('app.styleGuide.divClassnamePageHeader', '<div className="page-header">')}</code> +{' '}
<code>&lt;h1&gt;</code> {t('app.styleGuide.blockHasBeenRemovedFromThe', 'block has been removed from the codebase and its styles deleted. Don\'t reintroduce it — use one of the two bars above. Bespoke workspace pages (Docker, Database Explorer) intentionally carry no page bar at all; that is not a licence to invent a third header.')}
</p>
<SectionTitle title={t('app.styleGuide.cardWithHeaderActions', 'Card with Header + Actions')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.forCardsInsidePagesThatNeed', 'For cards inside pages that need their own header row.')}</p>
- <div className="card" style={{ padding: 24 }}>
- <div className="card-header">
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.forCardsInsidePagesThatNeed', 'For cards inside pages that need their own header row.')}</p>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.styleGuide.cardSectionTitle', 'Card Section Title')}</h3>
- <div className="card-actions">
+ <SharedCardFooter variant="legacy">
<Button size="sm">{t('common.actions.add', 'Add')}</Button>
<Button size="sm" variant="outline">{t('common.actions.refresh', 'Refresh')}</Button>
- </div>
- </div>
- <div className="card-body">
+ </SharedCardFooter>
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<p className="text-secondary">{t('app.styleGuide.contentBelowTheCardHeader', 'Content below the card header.')}</p>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
</div>
)}
{/* ── PAGE PATTERNS ── */}
{activeSection === 'patterns' && (
- <div className="space-y-6">
+ <div className="styleguide__section">
<SectionTitle title={t('app.styleGuide.cardTablePattern', 'Card + Table Pattern')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.standardLayoutForTabularDataInside', 'Standard layout for tabular data inside a card.')}</p>
- <div className="card" style={{ padding: 24 }}>
- <div className="card-header">
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.standardLayoutForTabularDataInside', 'Standard layout for tabular data inside a card.')}</p>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.styleGuide.authorizedKeys', 'Authorized Keys')}</h3>
- <div className="card-actions">
+ <SharedCardFooter variant="legacy">
<Button size="sm"><Plus size={14} /> {t('app.styleGuide.addKey', 'Add Key')}</Button>
<Button size="sm" variant="outline"><RefreshCw size={14} /></Button>
- </div>
- </div>
- <div className="card-body">
+ </SharedCardFooter>
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<table className="table">
<thead>
<tr><th>{t('common.labels.type', 'Type')}</th><th>{t('app.styleGuide.fingerprint', 'Fingerprint')}</th><th>{t('app.styleGuide.comment', 'Comment')}</th><th>{t('common.labels.actions', 'Actions')}</th></tr>
@@ -1156,54 +1149,54 @@ export default function StyleGuide() {
</tr>
</tbody>
</table>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.cardEmptyStatePattern', 'Card + Empty State Pattern')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.whenTheCardTableHasNo', 'When the card table has no data.')}</p>
- <div className="card" style={{ padding: 24 }}>
- <div className="card-header">
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.whenTheCardTableHasNo', 'When the card table has no data.')}</p>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <SharedCardHeader variant="legacy" className="card-header">
<h3>{t('app.styleGuide.scanHistory', 'Scan History')}</h3>
<Button size="sm" variant="outline">{t('common.actions.refresh', 'Refresh')}</Button>
- </div>
- <div className="card-body">
+ </SharedCardHeader>
+ <SharedCardContent variant="legacy" className="card-body">
<EmptyState
icon={Search}
title={t('app.styleGuide.noScansYet', 'No scans yet')}
description={t('app.styleGuide.startAScanAboveToCheck', 'Start a scan above to check for threats.')}
/>
- </div>
- </div>
+ </SharedCardContent>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.cardGridScanOptions', 'Card Grid (Scan Options)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.actionCardsInAGridFor', 'Action cards in a grid for scan/setup type selections.')}</p>
- <div className="grid grid-cols-3 gap-4">
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.actionCardsInAGridFor', 'Action cards in a grid for scan/setup type selections.')}</p>
+ <div className="styleguide__scan-grid">
{[
{ icon: Zap, titleKey: 'app.styleGuide.quickScan', title: 'Quick Scan', desc: 'Scan common web directories' },
{ icon: Globe, titleKey: 'app.styleGuide.fullScan', title: 'Full Scan', desc: 'Scan entire system (slow)' },
{ icon: FolderOpen, titleKey: 'app.styleGuide.customPath', title: 'Custom Path', desc: 'Scan a specific directory' },
].map(item => (
- <div key={item.title} className="card" style={{ padding: 24, textAlign: 'center', cursor: 'pointer' }}>
- <div className="flex justify-center mb-3">
+ <SharedCard variant="legacy" key={item.title} className="card styleguide__demo-card styleguide__demo-card--interactive">
+ <div className="styleguide__scan-icon">
<div className="stat-icon"><item.icon size={20} /></div>
</div>
- <h4 style={{ marginBottom: 4 }}>{item.title}</h4>
- <p className="text-sm text-tertiary mb-4">{item.desc}</p>
+ <h4 className="styleguide__scan-title">{item.title}</h4>
+ <p className="styleguide__description styleguide__description--muted styleguide__description--section-end">{item.desc}</p>
<Button size="sm">{t('app.styleGuide.startScan', 'Start Scan')}</Button>
- </div>
+ </SharedCard>
))}
</div>
<SectionTitle title={t('app.styleGuide.errorBannerAtPageLevel', 'Error Banner at Page Level')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.shownBelowPageHeaderWhenAn', 'Shown below page header when an API call fails.')}</p>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.shownBelowPageHeaderWhenAn', 'Shown below page header when an API call fails.')}</p>
<div className="alert alert-danger">
{t('app.styleGuide.failedToLoadServicesPleaseTry', 'Failed to load services. Please try again.')}
- <button className="alert-close">&times;</button>
+ <Button variant="unstyled" className="alert-close">&times;</Button>
</div>
<SectionTitle title={t('app.styleGuide.logViewerLogviewer', 'Log Viewer (LogViewer)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.splitLayoutFileListSidebarLog', 'Split layout: file list sidebar + log content viewer with toolbar.')}</p>
- <div style={{ height: 360 }}>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.splitLayoutFileListSidebarLog', 'Split layout: file list sidebar + log content viewer with toolbar.')}</p>
+ <div className="styleguide__log-example">
<LogViewer
files={[
{ name: 'error.log', path: '/var/log/nginx/error.log', size: 2516582, type: 'error' },
@@ -1226,8 +1219,8 @@ export default function StyleGuide() {
</div>
<SectionTitle title={t('app.styleGuide.journalControlsJournalcontrols', 'Journal Controls (JournalControls)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.journalTabWithServiceUnitChips', 'Journal tab with service unit chips and priority filter.')}</p>
- <div className="card" style={{ padding: 24 }}>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.journalTabWithServiceUnitChips', 'Journal tab with service unit chips and priority filter.')}</p>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
<JournalControls
unit="nginx"
onUnitChange={() => {}}
@@ -1238,16 +1231,16 @@ export default function StyleGuide() {
onPriorityChange={() => {}}
onLoad={() => {}}
/>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.codeLogViewerBlock', 'Code/Log Viewer Block')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.monospacePreformattedContentWithDarkBackground', 'Monospace preformatted content with dark background.')}</p>
- <div className="journal-viewer" style={{ height: 160 }}>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.monospacePreformattedContentWithDarkBackground', 'Monospace preformatted content with dark background.')}</p>
+ <div className="journal-viewer styleguide__journal-example">
<pre>{`Mar 29 14:23:01 srv-01 nginx[1234]: worker process started\nMar 29 14:23:02 srv-01 systemd[1]: Started Nginx HTTP Server\nMar 29 14:23:05 srv-01 sshd[5678]: Accepted publickey for deploy\nMar 29 14:23:12 srv-01 cron[91011]: (root) CMD (/usr/local/bin/backup.sh)`}</pre>
</div>
<SectionTitle title={t('app.styleGuide.processTableProcesstable', 'Process Table (ProcessTable)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.tableWithInlineUsageBarsAnd', 'Table with inline usage bars and action buttons.')}</p>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.tableWithInlineUsageBarsAnd', 'Table with inline usage bars and action buttons.')}</p>
<ProcessTable
processes={[
{ pid: 1234, name: 'nginx', user: 'www-data', cpu_percent: 12.5, memory_percent: 3.2, memory_info: { rss: 134543872 }, status: 'running' },
@@ -1259,7 +1252,7 @@ export default function StyleGuide() {
/>
<SectionTitle title={t('app.styleGuide.detailPanelProcessdetailspanel', 'Detail Panel (ProcessDetailsPanel)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.expandableDetailPanelBelowAList', 'Expandable detail panel below a list/table selection.')}</p>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.expandableDetailPanelBelowAList', 'Expandable detail panel below a list/table selection.')}</p>
<ProcessDetailsPanel
process={{
pid: 1234,
@@ -1276,7 +1269,7 @@ export default function StyleGuide() {
/>
<SectionTitle title={t('app.styleGuide.serviceCardsGridServicecardServicesgrid', 'Service Cards Grid (ServiceCard / ServicesGrid)')} />
- <p className="text-sm text-secondary mb-2">{t('app.styleGuide.gridOfServiceCardsWithStatus', 'Grid of service cards with status dot, metadata, and action buttons.')}</p>
+ <p className="styleguide__description styleguide__description--spaced">{t('app.styleGuide.gridOfServiceCardsWithStatus', 'Grid of service cards with status dot, metadata, and action buttons.')}</p>
<ServicesGrid>
{[
{ name: 'nginx', status: 'running', desc: 'HTTP and reverse proxy server', pid: 1234, mem: '48.2 MB' },
@@ -1317,62 +1310,62 @@ export default function StyleGuide() {
{/* ── UTILITIES ── */}
{activeSection === 'utilities' && (
- <div className="space-y-6">
- <SectionTitle title={t('app.styleGuide.flexUtilities', 'Flex Utilities')} />
- <div className="card" style={{ padding: 24 }}>
- <p className="text-sm text-tertiary mb-2">.flex .items-center .gap-3</p>
- <div className="flex items-center gap-3 mb-4" style={{ padding: 8, border: '1px dashed var(--border-active)' }}>
+ <div className="styleguide__section">
+ <SectionTitle title={t('app.styleGuide.flexUtilities', 'Flex Layouts')} />
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">.styleguide__flex-example</p>
+ <div className="styleguide__flex-example">
<div className="styleguide__util-box">A</div>
<div className="styleguide__util-box">B</div>
<div className="styleguide__util-box">C</div>
</div>
- <p className="text-sm text-tertiary mb-2">.flex .justify-between</p>
- <div className="flex justify-between mb-4" style={{ padding: 8, border: '1px dashed var(--border-active)' }}>
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">.styleguide__flex-example--spread</p>
+ <div className="styleguide__flex-example styleguide__flex-example--spread">
<div className="styleguide__util-box">{t('app.styleGuide.left', 'Left')}</div>
<div className="styleguide__util-box">{t('app.styleGuide.right', 'Right')}</div>
</div>
- <p className="text-sm text-tertiary mb-2">.flex .flex-col .gap-2</p>
- <div className="flex flex-col gap-2" style={{ padding: 8, border: '1px dashed var(--border-active)', maxWidth: 200 }}>
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">.styleguide__flex-example--stack</p>
+ <div className="styleguide__flex-example styleguide__flex-example--stack">
<div className="styleguide__util-box">{t('app.styleGuide.row1', 'Row 1')}</div>
<div className="styleguide__util-box">{t('app.styleGuide.row2', 'Row 2')}</div>
</div>
- </div>
+ </SharedCard>
- <SectionTitle title={t('app.styleGuide.gridUtilities', 'Grid Utilities')} />
- <div className="card" style={{ padding: 24 }}>
- <p className="text-sm text-tertiary mb-2">.grid .grid-cols-4 .gap-3</p>
- <div className="grid grid-cols-4 gap-3">
+ <SectionTitle title={t('app.styleGuide.gridUtilities', 'Grid Layouts')} />
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
+ <p className="styleguide__description styleguide__description--muted styleguide__description--spaced">.styleguide__layout-grid</p>
+ <div className="styleguide__layout-grid">
{[1,2,3,4,5,6,7,8].map(i => (
<div key={i} className="styleguide__util-box">{t('app.styleGuide.cell', 'Cell')} {i}</div>
))}
</div>
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.zIndexScale', 'Z-Index Scale')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
{[
['$z-dropdown', 10], ['$z-sticky', 20], ['$z-fixed', 30],
['$z-modal-backdrop', 40], ['$z-modal', 50], ['$z-tooltip', 60],
].map(([token, val]) => (
- <div key={token} className="flex items-center gap-4 mb-2">
- <span className="mono text-tertiary" style={{ minWidth: 180 }}>{token}</span>
+ <div key={token} className="styleguide__token-row">
+ <span className="styleguide__token-name styleguide__token-name--layout">{token}</span>
<span className="mono">{val}</span>
</div>
))}
- </div>
+ </SharedCard>
<SectionTitle title={t('app.styleGuide.breakpoints', 'Breakpoints')} />
- <div className="card" style={{ padding: 24 }}>
+ <SharedCard variant="legacy" className="card styleguide__demo-card">
{[
['$breakpoint-sm', '640px'], ['$breakpoint-md', '768px'],
['$breakpoint-lg', '1024px'], ['$breakpoint-xl', '1280px'],
].map(([token, val]) => (
- <div key={token} className="flex items-center gap-4 mb-2">
- <span className="mono text-tertiary" style={{ minWidth: 180 }}>{token}</span>
+ <div key={token} className="styleguide__token-row">
+ <span className="styleguide__token-name styleguide__token-name--layout">{token}</span>
<span className="mono">{val}</span>
</div>
))}
- </div>
+ </SharedCard>
</div>
)}
</div>
@@ -1391,7 +1384,7 @@ function Swatch({ name, label, text }) {
return (
<div className="styleguide__swatch">
<div className="styleguide__swatch-preview" style={style}>
- {text && <span style={{ fontSize: 14, fontWeight: 600 }}>Aa</span>}
+ {text && <span className="styleguide__swatch-text">Aa</span>}
</div>
<span className="styleguide__swatch-label">{label}</span>
<span className="styleguide__swatch-token">{name}</span>
diff --git a/frontend/src/pages/Telemetry.jsx b/frontend/src/pages/Telemetry.jsx
index 13054683..2801d767 100644
--- a/frontend/src/pages/Telemetry.jsx
+++ b/frontend/src/pages/Telemetry.jsx
@@ -37,8 +37,8 @@ import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useConfirm } from '@/hooks/useConfirm';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
-import { useAuth } from '../contexts/AuthContext';
-import { useToast } from '../contexts/ToastContext';
+import { useAuth } from '../contexts/useAuth.js';
+import { useToast } from '../contexts/useToast.js';
import EmptyState from '../components/EmptyState';
import { statusKind } from '@/components/ds/status';
import { useTranslation } from 'react-i18next';
@@ -171,7 +171,7 @@ export default function Telemetry() {
} finally {
setLoading(false);
}
- }, [filters, q, showToast]);
+ }, [filters, q, showToast, t]);
useEffect(() => {
loadFilterOptions();
diff --git a/frontend/src/pages/Templates.jsx b/frontend/src/pages/Templates.jsx
index 9dbbe3ed..83dbb7ae 100644
--- a/frontend/src/pages/Templates.jsx
+++ b/frontend/src/pages/Templates.jsx
@@ -1,15 +1,15 @@
-import { useState, useEffect, useMemo } from 'react';
+import { useCallback, useState, useEffect, useMemo, useRef } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import {
Search, Star, ExternalLink, BookOpen, Container, Globe, BarChart3,
Database, Shield, Cloud, MessageSquare, Video, Music, Image, Home,
Code, Server, GitBranch, Workflow, HardDrive, Lock, Users, FileText,
- Settings, Layers, LayoutTemplate, Check, Tag, Cpu,
+ Layers, LayoutTemplate, Check, Cpu,
Newspaper, TrendingUp, Rocket, Box, Download, ChevronRight,
CheckCircle2, AlertTriangle, XCircle, HelpCircle
} from 'lucide-react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Badge } from '@/components/ui/badge';
@@ -218,6 +218,7 @@ const Templates = () => {
const { t } = useTranslation();
const navigate = useNavigate();
const toast = useToast();
+ const toastError = toast.error;
const [searchParams, setSearchParams] = useSearchParams();
const [templates, setTemplates] = useState([]);
@@ -233,31 +234,78 @@ const Templates = () => {
const selectedKind = searchParams.get('kind') || '';
const searchQuery = searchParams.get('search') || '';
const installTemplateId = searchParams.get('install');
+ const installAttempt = useRef(null);
+ const templatesRequest = useRef(0);
const { sorts, setSorts } = useTableSort({
defaultSorts: FEATURED_SORT,
storageKey: 'serverkit-table-templates-sort',
});
+ const loadCategories = useCallback(async () => {
+ try {
+ const result = await api.getTemplateCategories();
+ setCategories(result.categories || []);
+ } catch {
+ toastError(t('app.templates.failedToLoadTemplates', 'Failed to load templates'));
+ }
+ }, [t, toastError]);
+
+ const loadTemplates = useCallback(async () => {
+ const request = ++templatesRequest.current;
+ setLoading(true);
+ try {
+ const result = await api.listTemplates(selectedCategory || null, searchQuery || null);
+ if (request === templatesRequest.current) setTemplates(result.templates || []);
+ } catch (err) {
+ console.error('Failed to load templates:', err);
+ } finally {
+ if (request === templatesRequest.current) setLoading(false);
+ }
+ }, [selectedCategory, searchQuery]);
+
+ const handleViewTemplate = useCallback(async (template) => {
+ // WordPress has its own dedicated page
+ if (template.id === 'wordpress') {
+ navigate('/wordpress');
+ return;
+ }
+ try {
+ const result = await api.getTemplate(template.id);
+ if (result.template) {
+ setSelectedTemplate(result.template);
+ }
+ } catch {
+ toastError(t('app.templates.failedToLoadTemplateDetails', 'Failed to load template details'));
+ }
+ }, [navigate, t, toastError]);
+
useEffect(() => {
- loadData();
- }, []);
+ loadCategories();
+ }, [loadCategories]);
// Compat: the old `#deploy-templates` anchor (linked from the wizard + docs)
// now redirects to the repo-kind filtered view of the unified grid.
useEffect(() => {
if (window.location.hash === '#deploy-templates' && !selectedKind) {
- updateFilters({ kind: 'repo' });
+ setSearchParams(previous => {
+ const next = new URLSearchParams(previous);
+ next.set('kind', 'repo');
+ return next;
+ });
// Drop the hash so a refresh doesn't re-trigger.
window.history.replaceState(null, '', window.location.pathname + window.location.search);
}
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
+ }, [selectedKind, setSearchParams]);
// Auto-open install modal if template ID is in URL (compose templates only;
// repo templates deploy through the wizard, never the install modal).
useEffect(() => {
- if (installTemplateId && templates.length > 0 && !loading) {
+ if (!installTemplateId) {
+ installAttempt.current = null;
+ return;
+ }
+ if (templates.length > 0 && !loading && installAttempt.current !== installTemplateId) {
if (installTemplateId === 'wordpress') {
navigate('/wordpress', { replace: true });
return;
@@ -266,19 +314,22 @@ const Templates = () => {
// Repo templates are no longer excluded — they deploy from this same
// drawer, so ?install=<id> works for the whole catalog.
if (template) {
+ installAttempt.current = installTemplateId;
handleViewTemplate(template).then(() => {
setShowInstallModal(true);
});
- const newParams = new URLSearchParams(searchParams);
- newParams.delete('install');
- setSearchParams(newParams, { replace: true });
+ setSearchParams(previous => {
+ const next = new URLSearchParams(previous);
+ next.delete('install');
+ return next;
+ }, { replace: true });
}
}
- }, [installTemplateId, templates, loading]);
+ }, [installTemplateId, templates, loading, handleViewTemplate, navigate, setSearchParams]);
useEffect(() => {
loadTemplates();
- }, [selectedCategory, searchQuery]);
+ }, [loadTemplates]);
// Functional update: ?view= is written by the chrome from its own copy of
// the search string, so rebuilding this one from a captured `searchParams`
@@ -304,29 +355,6 @@ const Templates = () => {
updateFilters({ category: null, kind: null, search: null });
}
- async function loadData() {
- try {
- const [templatesRes, categoriesRes] = await Promise.all([
- api.listTemplates(),
- api.getTemplateCategories()
- ]);
- setTemplates(templatesRes.templates || []);
- setCategories(categoriesRes.categories || []);
- } catch (err) {
- toast.error(t('app.templates.failedToLoadTemplates', 'Failed to load templates'));
- } finally {
- setLoading(false);
- }
- }
-
- async function loadTemplates() {
- try {
- const result = await api.listTemplates(selectedCategory || null, searchQuery || null);
- setTemplates(result.templates || []);
- } catch (err) {
- console.error('Failed to load templates:', err);
- }
- }
function handleIconError(templateId) {
setFailedIcons(prev => new Set(prev).add(templateId));
@@ -352,101 +380,10 @@ const Templates = () => {
return <IconComponent size={size} />;
}
- function getCategoryIcon(category) {
- const icons = {
- monitoring: BarChart3,
- devops: Settings,
- docker: Container,
- cms: FileText,
- blog: BookOpen,
- storage: HardDrive,
- collaboration: Users,
- git: GitBranch,
- development: Code,
- networking: Globe,
- proxy: Workflow,
- ssl: Lock,
- productivity: Layers,
- management: Server,
- publishing: Newspaper,
- media: Video,
- security: Shield,
- database: Database,
- 'home-automation': Home,
- analytics: TrendingUp,
- iot: Cpu,
- // AI / LLM
- ai: Cpu,
- llm: Cpu,
- gateway: Server,
- rag: Cpu,
- chat: MessageSquare,
- 'low-code': Workflow,
- workflow: Workflow,
- website: Globe,
- deployment: Rocket,
- // Search
- search: Search,
- vector: Database,
- // Notifications / messaging
- notifications: MessageSquare,
- messaging: MessageSquare,
- communication: MessageSquare,
- support: MessageSquare,
- // Documents / news
- documents: FileText,
- pdf: FileText,
- notes: FileText,
- rss: Newspaper,
- news: Newspaper,
- // Finance / business
- finance: TrendingUp,
- business: TrendingUp,
- // Productivity / tasks
- tasks: Workflow,
- 'project-management': Workflow,
- bookmarks: BookOpen,
- ebooks: BookOpen,
- audiobooks: Music,
- automation: Workflow,
- downloads: HardDrive,
- // Identity / networking / privacy
- identity: Shield,
- sso: Shield,
- vpn: Shield,
- privacy: Lock,
- dns: Globe,
- forum: Users,
- community: Users,
- // Observability
- observability: BarChart3,
- apm: BarChart3
- };
- const Icon = icons[category] || Container;
- return <Icon size={14} />;
- }
// Load the full template record. Used by the ?install=<id> deep link, which
// needs variables/description before the deploy drawer can open.
- async function handleViewTemplate(template) {
- // WordPress has its own dedicated page
- if (template.id === 'wordpress') {
- navigate('/wordpress');
- return;
- }
- try {
- const result = await api.getTemplate(template.id);
- if (result.template) {
- setSelectedTemplate(result.template);
- }
- } catch (err) {
- toast.error(t('app.templates.failedToLoadTemplateDetails', 'Failed to load template details'));
- }
- }
- function deployRepoTemplate(templateId) {
- navigate(`/services/new?template=${encodeURIComponent(templateId)}`);
- }
// What both a card click and its Deploy button do — one predictable
// outcome for every template, compose or repo. A curated repo template
@@ -464,7 +401,7 @@ const Templates = () => {
setSelectedTemplate(result.template);
setShowInstallModal(true);
}
- } catch (err) {
+ } catch {
toast.error(t('app.templates.failedToLoadTemplateDetails', 'Failed to load template details'));
}
}
@@ -557,7 +494,7 @@ const Templates = () => {
placeholder={t('app.templates.searchTemplates', 'Search templates…')}
/>
<FilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={() => Promise.all([loadCategories(), loadTemplates()])} />
</>,
);
@@ -576,22 +513,22 @@ const Templates = () => {
templates entirely, so both routes lead the page rather than
hiding behind the New Service tab. */}
<div className="tpl-quickstart">
- <button type="button" className="tpl-quickstart__card" onClick={() => navigate('/services/new?source=github')}>
+ <Button variant="unstyled" type="button" className="tpl-quickstart__card" onClick={() => navigate('/services/new?source=github')}>
<span className="tpl-quickstart__ico"><GitBranch size={18} /></span>
<span className="tpl-quickstart__body">
<span className="tpl-quickstart__title">{t('app.templates.importFromGithub', 'Import from GitHub')}</span>
<span className="tpl-quickstart__sub">{t('app.templates.connectARepoAndAutoDeploy', 'Connect a repo and auto-deploy on every push')}</span>
</span>
<ChevronRight size={16} className="tpl-quickstart__arrow" />
- </button>
- <button type="button" className="tpl-quickstart__card" onClick={() => navigate('/services/new?source=archive')}>
+ </Button>
+ <Button variant="unstyled" type="button" className="tpl-quickstart__card" onClick={() => navigate('/services/new?source=archive')}>
<span className="tpl-quickstart__ico"><Download size={18} /></span>
<span className="tpl-quickstart__body">
<span className="tpl-quickstart__title">{t('app.templates.importAZip', 'Import a ZIP')}</span>
<span className="tpl-quickstart__sub">{t('app.templates.dropInAProjectArchiveTo', 'Drop in a project archive to build & run')}</span>
</span>
<ChevronRight size={16} className="tpl-quickstart__arrow" />
- </button>
+ </Button>
</div>
{/* The one row of chrome: the active view names what you are looking
@@ -755,7 +692,6 @@ const CapacityNote = ({ capacity, loading }) => {
const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
const { t } = useTranslation();
- const toast = useToast();
const navigate = useNavigate();
const isRepo = (template.kind || 'compose') === 'repo';
const [appName, setAppName] = useState(
diff --git a/frontend/src/pages/Terminal.jsx b/frontend/src/pages/Terminal.jsx
index 8299b00a..b9a65dcf 100644
--- a/frontend/src/pages/Terminal.jsx
+++ b/frontend/src/pages/Terminal.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useRef, useMemo } from 'react';
import useTabParam from '../hooks/useTabParam';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { useConfirm } from '../hooks/useConfirm';
import TargetPicker from '../components/TargetPicker';
import RemoteTerminal from '../components/RemoteTerminal';
@@ -11,7 +11,8 @@ import LogContent from '../components/log-viewer/LogContent';
import { formatBytes, logKindFromPath } from '../components/log-viewer/logHelpers';
import { formatBytes as formatMemory } from '@/utils/formatBytes';
import { Drawer } from '../components/ds';
-import ProcessTable, { procUser } from '../components/ProcessTable';
+import ProcessTable from '../components/ProcessTable';
+import { procUser } from '../components/processData';
import SystemdServicesTab from '../components/serverdetail/ServicesTab';
import { useTableSort } from '@/hooks/useTableSort';
import PageLayout from '../layouts/PageLayout';
@@ -29,6 +30,7 @@ import {
Terminal as TerminalIcon, Server as ServerIcon,
ScrollText, Cpu, Settings,
} from 'lucide-react';
+import { Button as SharedButton } from '@/components/ui/button';
// 'logs' stays first so the default landing keeps working on installs with no
// paired agents (the interactive shell needs a connected agent).
@@ -110,7 +112,7 @@ const TerminalShellTab = () => {
{servers.map(s => {
const online = s.status === 'online';
return (
- <button
+ <SharedButton variant="unstyled"
key={s.id}
type="button"
className={`term-shell__row ${s.id === selectedId ? 'is-active' : ''}`}
@@ -122,7 +124,7 @@ const TerminalShellTab = () => {
<span className="term-shell__name">{s.name || s.hostname || s.id}</span>
{s.ip_address && <span className="term-shell__sub">{s.ip_address}</span>}
<span className={`term-shell__dot ${online ? 'is-on' : ''}`} />
- </button>
+ </SharedButton>
);
})}
</aside>
@@ -373,7 +375,7 @@ const LogFilesTab = () => {
<div className="lv-error">
<AlertCircle size={14} />
<span>{error}</span>
- <button type="button" onClick={() => setError(null)}>&times;</button>
+ <SharedButton variant="unstyled" type="button" onClick={() => setError(null)}>&times;</SharedButton>
</div>
)}
@@ -498,7 +500,7 @@ const JournalTab = () => {
const [showLineNumbers, setShowLineNumbers] = useState(() => localStorage.getItem(JOURNAL_PREFS.showLineNumbers) !== 'false');
const [wrapLines, setWrapLines] = useState(() => localStorage.getItem(JOURNAL_PREFS.wrapLines) !== 'false');
const [isFullscreen, setIsFullscreen] = useState(false);
- const [unitFilter, setUnitFilter] = useState('');
+ const [unitFilter] = useState('');
const [lastUpdated, setLastUpdated] = useState(null);
const contentRef = useRef(null);
@@ -652,20 +654,20 @@ const JournalTab = () => {
placeholder={t('app.terminal.typeUnitName', 'Type unit name…')}
/>
</div>
- <button type="button" className="lv-icon-btn" onClick={applyUnitInput} title={t('app.terminal.applyUnitFilter', 'Apply unit filter')}>
+ <SharedButton variant="unstyled" type="button" className="lv-icon-btn" onClick={applyUnitInput} title={t('app.terminal.applyUnitFilter', 'Apply unit filter')}>
<Search size={13} />
- </button>
+ </SharedButton>
</div>
<div className="lv-sidebar-body">
<div className="lv-group">
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className={`lv-file lv-file--compact ${!unit ? 'active' : ''}`}
onClick={clearUnit}
>
<span className="lv-file-dot" />
<span className="lv-file-name">{t('app.terminal.allServices', 'All services')}</span>
- </button>
+ </SharedButton>
</div>
<div className="lv-group">
@@ -676,14 +678,14 @@ const JournalTab = () => {
</div>
<div className="lv-group-files">
{filteredUnits.map(u => (
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
key={u.id}
className={`lv-file lv-file--compact ${unit === u.id ? 'active' : ''}}`}
onClick={() => pickUnit(u.id)}
>
<span className={`lv-file-dot kind-${u.kind}`} />
<span className="lv-file-name">{u.label}</span>
- </button>
+ </SharedButton>
))}
{filteredUnits.length === 0 && (
<div className="lv-empty-hint is-compact">
@@ -701,14 +703,14 @@ const JournalTab = () => {
</div>
<div className="lv-group-files">
{PRIORITY_OPTIONS.map(opt => (
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
key={opt.value}
className={`lv-file lv-file--compact ${priority === opt.value ? 'active' : ''}`}
onClick={() => { setPriority(opt.value); setTimeout(loadJournalLogs, 0); }}
>
<span className="lv-file-dot" style={{ background: priorityColor(opt.value) }} />
<span className="lv-file-name">{opt.label}</span>
- </button>
+ </SharedButton>
))}
</div>
</div>
@@ -944,14 +946,14 @@ const ProcessesTab = () => {
<option key={n} value={n}>{t('app.terminal.top', 'Top')} {n}</option>
))}
</select>
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className={`lv-chip ${autoRefresh ? 'active' : ''}`}
onClick={() => setAutoRefresh(!autoRefresh)}
disabled={isRemote}
>
<span className={`lv-pulse ${autoRefresh ? 'on' : ''}`} />
<span>{t('app.terminal.live', 'Live')}</span>
- </button>
+ </SharedButton>
</>
)}
/>
@@ -1005,12 +1007,12 @@ const ProcessesTab = () => {
</div>
</div>
<div className="preview-drawer-actions">
- <button type="button" className="drawer-action-btn" onClick={() => handleKillProcess(selectedProcess.pid)}>
+ <SharedButton variant="unstyled" type="button" className="drawer-action-btn" onClick={() => handleKillProcess(selectedProcess.pid)}>
<X size={14} /> {t('app.terminal.killSigterm', 'Kill (SIGTERM)')}
- </button>
- <button type="button" className="drawer-action-btn danger" onClick={() => handleKillProcess(selectedProcess.pid, true)}>
+ </SharedButton>
+ <SharedButton variant="unstyled" type="button" className="drawer-action-btn danger" onClick={() => handleKillProcess(selectedProcess.pid, true)}>
<AlertTriangle size={14} /> {t('app.terminal.forceKillSigkill', 'Force kill (SIGKILL)')}
- </button>
+ </SharedButton>
</div>
<div className="preview-drawer-body is-padded">
{selectedProcess.command && (
diff --git a/frontend/src/pages/TestSandbox.jsx b/frontend/src/pages/TestSandbox.jsx
index c9e9e98b..12c20cf3 100644
--- a/frontend/src/pages/TestSandbox.jsx
+++ b/frontend/src/pages/TestSandbox.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useRef, useMemo, useCallback } from 'react';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import EmptyState from '../components/EmptyState';
import { Pill, statusKind } from '@/components/ds';
import PageLayout from '../layouts/PageLayout';
diff --git a/frontend/src/pages/Vaults.jsx b/frontend/src/pages/Vaults.jsx
index ab3f3e51..75a07c76 100644
--- a/frontend/src/pages/Vaults.jsx
+++ b/frontend/src/pages/Vaults.jsx
@@ -1,4 +1,4 @@
-import { useEffect, useMemo, useState } from 'react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
import api from '../services/api';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -7,7 +7,7 @@ import { Textarea } from '@/components/ui/textarea';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
import Modal from '@/components/Modal';
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import { ArrowLeft, Plus, MoreVertical, Copy, Eye, EyeOff, KeyRound, Trash2 } from 'lucide-react';
import ResourceListPage from '../components/layouts/ResourceListPage';
import { useTopbarActions } from '@/hooks/useTopbarActions';
@@ -15,7 +15,7 @@ import { SearchField, ServiceTile } from '@/components/ds';
import { formatRelativeTime } from '@/utils/time';
import { useConfirm } from '@/hooks/useConfirm';
import { useClipboard } from '@/hooks/useClipboard';
-import { useWorkspace } from '../contexts/WorkspaceContext';
+import { useWorkspace } from '../contexts/useWorkspace.js';
import { useTranslation } from 'react-i18next';
const formatDate = (d) => (d ? new Date(d).toLocaleString() : '—');
@@ -45,6 +45,7 @@ const VAULT_VIEWS = [
export default function Vaults() {
const { t } = useTranslation();
const toast = useToast();
+ const toastError = toast.error;
const { confirm } = useConfirm();
const { copy } = useClipboard({ successMessage: 'Copied' });
const { activeWorkspaceId: workspaceScopeId, isAllWorkspaces } = useWorkspace();
@@ -61,11 +62,7 @@ export default function Vaults() {
const [revealedValue, setRevealedValue] = useState('');
const [search, setSearch] = useState('');
- useEffect(() => {
- loadAll();
- }, []);
-
- async function loadAll() {
+ const loadAll = useCallback(async () => {
setLoading(true);
try {
const [v, w] = await Promise.all([
@@ -75,11 +72,16 @@ export default function Vaults() {
setVaults(v.vaults || []);
setWorkspaces(w.workspaces || []);
} catch (err) {
- toast.error(t('app.vaults.loadFailed', 'Load failed: {{message}}', { message: err.message }));
+ toastError(t('app.vaults.loadFailed', 'Load failed: {{message}}', { message: err.message }));
} finally {
setLoading(false);
}
- }
+ }, [t, toastError]);
+
+ useEffect(() => {
+ loadAll();
+ }, [loadAll]);
+
async function createVault(e) {
e.preventDefault();
diff --git a/frontend/src/pages/WorkspaceDetail.jsx b/frontend/src/pages/WorkspaceDetail.jsx
index 1a304437..c051becd 100644
--- a/frontend/src/pages/WorkspaceDetail.jsx
+++ b/frontend/src/pages/WorkspaceDetail.jsx
@@ -2,8 +2,8 @@ import { useState, useEffect, useCallback } from 'react';
import { useParams, useNavigate, Link } from 'react-router-dom';
import useTabParam from '../hooks/useTabParam';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
-import { useAuth } from '../contexts/AuthContext';
+import { useToast } from '../contexts/useToast.js';
+import { useAuth } from '../contexts/useAuth.js';
import { useRecordVisit } from '@/hooks/useRecordVisit';
import FavoriteStar from '@/components/FavoriteStar';
import ConfirmDialog from '../components/ConfirmDialog';
@@ -22,7 +22,7 @@ import WorkspaceServicesTab from '../components/workspaces/WorkspaceServicesTab'
import WorkspaceSitesTab from '../components/workspaces/WorkspaceSitesTab';
import WorkspaceMembersTab from '../components/workspaces/WorkspaceMembersTab';
import WorkspaceSettingsTab from '../components/workspaces/WorkspaceSettingsTab';
-import { useWorkspace } from '../contexts/WorkspaceContext';
+import { useWorkspace } from '../contexts/useWorkspace.js';
import { useTranslation } from 'react-i18next';
const VALID_TABS = ['overview', 'servers', 'services', 'sites', 'members', 'settings'];
@@ -90,13 +90,13 @@ const WorkspaceDetail = () => {
setApps(appData.apps || []);
setServers(asServerList(srvData));
setAllUsers(uData.users || []);
- } catch (err) {
+ } catch {
toast.error(t('app.workspaceDetail.failedToLoadWorkspace', 'Failed to load workspace'));
setWs(null);
} finally {
setLoading(false);
}
- }, [wsId, toast, refreshActiveWorkspace]);
+ }, [wsId, refreshActiveWorkspace, toast, t]);
useEffect(() => { setLoading(true); load(); }, [load]);
@@ -170,7 +170,7 @@ const WorkspaceDetail = () => {
const gData = await api.getAppGrants(appObj.id);
setGrants(gData.grants || []);
setSharingApp(appObj);
- } catch (err) { toast.error(t('app.workspaceDetail.failedToLoadSharing', 'Failed to load sharing')); }
+ } catch { toast.error(t('app.workspaceDetail.failedToLoadSharing', 'Failed to load sharing')); }
};
const handleGrant = async (userId) => {
diff --git a/frontend/src/pages/Workspaces.jsx b/frontend/src/pages/Workspaces.jsx
index 3f6b329a..61a12a71 100644
--- a/frontend/src/pages/Workspaces.jsx
+++ b/frontend/src/pages/Workspaces.jsx
@@ -1,7 +1,7 @@
import { useState, useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import api from '../services/api';
-import { useToast } from '../contexts/ToastContext';
+import { useToast } from '../contexts/useToast.js';
import Modal from '@/components/Modal';
import ResourceListPage from '../components/layouts/ResourceListPage';
import { LayoutGrid, Plus, ChevronRight } from 'lucide-react';
@@ -11,8 +11,8 @@ import useFocusParam from '@/hooks/useFocusParam';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
-import { useWorkspace } from '../contexts/WorkspaceContext';
-import { useAuth } from '../contexts/AuthContext';
+import { useWorkspace } from '../contexts/useWorkspace.js';
+import { useAuth } from '../contexts/useAuth.js';
import { useServerMutation, useServerQuery } from '../hooks/useServerQuery';
import { useTranslation } from 'react-i18next';
diff --git a/frontend/src/pages/auth/AuthLayout.jsx b/frontend/src/pages/auth/AuthLayout.jsx
index 42b01203..bedba1d2 100644
--- a/frontend/src/pages/auth/AuthLayout.jsx
+++ b/frontend/src/pages/auth/AuthLayout.jsx
@@ -1,4 +1,4 @@
-import { useAuth } from '../../contexts/AuthContext';
+import { useAuth } from '../../contexts/useAuth.js';
import CenteredLayout from './layouts/CenteredLayout';
import SplitHeroLayout from './layouts/SplitHeroLayout';
import MinimalLayout from './layouts/MinimalLayout';
diff --git a/frontend/src/pages/auth/layouts/SplitHeroLayout.jsx b/frontend/src/pages/auth/layouts/SplitHeroLayout.jsx
index a3d65978..ab420313 100644
--- a/frontend/src/pages/auth/layouts/SplitHeroLayout.jsx
+++ b/frontend/src/pages/auth/layouts/SplitHeroLayout.jsx
@@ -1,5 +1,5 @@
import ServerKitLogo from '../../../components/ServerKitLogo';
-import { useAuth } from '../../../contexts/AuthContext';
+import { useAuth } from '../../../contexts/useAuth.js';
// Split auth layout: a branded hero panel beside the form card. The hero is
// hidden on small screens (the card just centers), so it stays usable on mobile.
diff --git a/frontend/src/pages/new-service/ConnectStep.jsx b/frontend/src/pages/new-service/ConnectStep.jsx
index e7166d5a..ebd47578 100644
--- a/frontend/src/pages/new-service/ConnectStep.jsx
+++ b/frontend/src/pages/new-service/ConnectStep.jsx
@@ -73,7 +73,7 @@ const ConnectStep = ({ form }) => {
<div className="new-service-page__repo-state">{t('app.connectStep.noRepositoriesFound', 'No repositories found.')}</div>
)}
{!reposLoading && repos.map(repo => (
- <button
+ <Button variant="unstyled"
key={repo.id}
type="button"
className={`new-service-page__repo-row ${selectedRepo?.id === repo.id ? 'new-service-page__repo-row--active' : ''}`}
@@ -84,7 +84,7 @@ const ConnectStep = ({ form }) => {
<small>{repo.description || repo.language || 'No description'}</small>
</span>
<em>{repo.private ? 'Private' : 'Public'}</em>
- </button>
+ </Button>
))}
</div>
</>
diff --git a/frontend/src/pages/new-service/NewService.jsx b/frontend/src/pages/new-service/NewService.jsx
index b3de74f2..ca56ba1b 100644
--- a/frontend/src/pages/new-service/NewService.jsx
+++ b/frontend/src/pages/new-service/NewService.jsx
@@ -51,7 +51,7 @@ const NewService = () => {
{STEPS.map(({ n, label }) => {
const state = step === n ? 'current' : step > n ? 'done' : 'todo';
return (
- <button
+ <Button variant="unstyled"
key={n}
type="button"
className={`new-service-page__stepper-item new-service-page__stepper-item--${state}`}
@@ -63,7 +63,7 @@ const NewService = () => {
{step > n ? <Check size={14} /> : n}
</span>
<span className="new-service-page__stepper-label">{label}</span>
- </button>
+ </Button>
);
})}
</nav>
diff --git a/frontend/src/pages/new-service/ReviewStep.jsx b/frontend/src/pages/new-service/ReviewStep.jsx
index 1b811201..f15960be 100644
--- a/frontend/src/pages/new-service/ReviewStep.jsx
+++ b/frontend/src/pages/new-service/ReviewStep.jsx
@@ -8,11 +8,12 @@ import { Input } from '@/components/ui/input';
import { Switch } from '@/components/ui/switch';
import BuildpackPreview from '@/components/buildpack/BuildpackPreview';
import ResourcePicker from '@/components/ResourcePicker';
-import { useWorkspace } from '@/contexts/WorkspaceContext';
+import { useWorkspace } from '@/contexts/useWorkspace.js';
import { useTranslation } from 'react-i18next';
import {
APP_TYPE_OPTIONS, BUILD_METHOD_OPTIONS, formatAppType, formatBuildMethod,
} from './useNewServiceForm';
+import { Button as SharedButton } from '@/components/ui/button';
// Step 3 — Review & deploy. Only renders cards that have real data; the core
// fields live in one grid, Advanced keeps the genuinely rare bits.
@@ -315,7 +316,7 @@ const ReviewStep = ({ form }) => {
{/* Advanced keeps only the genuinely rare bits. */}
{showBuild && (
<>
- <button
+ <SharedButton variant="unstyled"
type="button"
className="new-service-page__advanced-toggle"
onClick={() => setAdvancedOpen(open => !open)}
@@ -323,7 +324,7 @@ const ReviewStep = ({ form }) => {
>
<span><Settings2 size={16} /> {t('app.reviewStep.advanced', 'Advanced')}</span>
<ChevronDown size={16} />
- </button>
+ </SharedButton>
{advancedOpen && (
<div className="new-service-page__advanced">
<p className="new-service-page__advanced-note">
diff --git a/frontend/src/pages/new-service/SourceStep.jsx b/frontend/src/pages/new-service/SourceStep.jsx
index 1bf0ac58..d6e752ab 100644
--- a/frontend/src/pages/new-service/SourceStep.jsx
+++ b/frontend/src/pages/new-service/SourceStep.jsx
@@ -1,6 +1,7 @@
import { GitBranch, FolderOpen, FileArchive } from 'lucide-react';
import { SiGithub } from 'react-icons/si';
import { useTranslation } from 'react-i18next';
+import { Button as SharedButton } from '@/components/ui/button';
// Step 1 — Source. Four clean radio-cards; selecting one advances to Connect.
//
@@ -30,7 +31,7 @@ const SourceStep = ({ form }) => {
</div>
<div className="new-service-page__sources" data-walkthrough="service-sources" role="radiogroup" aria-label={t('app.sourceStep.serviceSource', 'Service source')}>
{SOURCES.map(({ mode, Icon, title, sub }) => (
- <button
+ <SharedButton variant="unstyled"
key={mode}
type="button"
role="radio"
@@ -45,7 +46,7 @@ const SourceStep = ({ form }) => {
<strong>{title}</strong>
<span>{sub}</span>
</span>
- </button>
+ </SharedButton>
))}
</div>
</div>
diff --git a/frontend/src/pages/new-service/useNewServiceForm.js b/frontend/src/pages/new-service/useNewServiceForm.js
index c51b5928..8e2f9d66 100644
--- a/frontend/src/pages/new-service/useNewServiceForm.js
+++ b/frontend/src/pages/new-service/useNewServiceForm.js
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate, useSearchParams } from 'react-router-dom';
import api from '../../services/api';
-import { useToast } from '../../contexts/ToastContext';
+import { useToast } from '../../contexts/useToast.js';
export const APP_TYPE_OPTIONS = [
{ value: 'auto', labelKey: 'app.useNewServiceForm.autoDetect', label: 'Auto-detect' },
diff --git a/frontend/src/plugins/sdk/index.js b/frontend/src/plugins/sdk/index.js
index f072245d..6f56def0 100644
--- a/frontend/src/plugins/sdk/index.js
+++ b/frontend/src/plugins/sdk/index.js
@@ -71,9 +71,9 @@ export { default as SchedulePicker } from '../../components/SchedulePicker';
// Common UI primitives plugins are likely to want. Re-exports kept thin
// on purpose — plugins can still reach for niche components directly,
// but the everyday surface lives here.
-export { useToast } from '../../contexts/ToastContext';
-export { useAuth } from '../../contexts/AuthContext';
-export { useTheme } from '../../contexts/ThemeContext';
+export { useToast } from '../../contexts/useToast.js';
+export { useAuth } from '../../contexts/useAuth.js';
+export { useTheme } from '../../contexts/useTheme.js';
// AI assistant — plugins consume the core assistant rather than building their
// own chat UI. `useServerkitAI()` exposes:
@@ -86,7 +86,7 @@ export { useTheme } from '../../contexts/ThemeContext';
//
// Plugins can also declare contributions.ai = { suggested_prompts: [{route,label,prompt}],
// tool_renderers: [{tool, component}] } in plugin.json.
-export { useServerkitAI, AIContext } from '../../contexts/AIContext';
+export { useServerkitAI, AIContext } from '../../contexts/useServerkitAI.js';
// Routing helpers — plugin pages need these to navigate within the SPA.
export {
@@ -141,7 +141,7 @@ export { timeAgo, formatRelativeTime, formatDuration } from '../../utils/time';
// rather than a raw key path.
export { useTranslation, Trans } from 'react-i18next';
export { t } from '../../i18n/t';
-export { useLocale } from '../../contexts/LocaleContext';
+export { useLocale } from '../../contexts/useLocale.js';
export { translateLabel, default as useLabel } from '../../i18n/labels';
// The one locale-aware formatting door. An extension MUST NOT call
@@ -170,9 +170,8 @@ export { default as PluginSlot } from '../../components/PluginSlot';
export { default as ResourceListPage } from '../../components/layouts/ResourceListPage';
export { useLogsDrawer } from '../../contexts/LogsDrawerContext';
export { default as RepoConnectForm } from '../../components/git/RepoConnectForm';
-export {
- GIT_PROVIDERS, detectProvider, RepoProviderStrip,
-} from '../../components/git/GitProviders';
+export { RepoProviderStrip } from '../../components/git/GitProviders';
+export { GIT_PROVIDERS, detectProvider } from '../../components/git/gitProviderData';
export { default as ProtectionPanel } from '../../components/backups/ProtectionPanel';
// List-page chrome (1.4.0, plan 52 Phase 2 — the email/cloudflare-ops frontend
diff --git a/frontend/src/plugins/serverkit-gui/components/ServerGui.jsx b/frontend/src/plugins/serverkit-gui/components/ServerGui.jsx
index 3d56d5e0..5a7d2f50 100644
--- a/frontend/src/plugins/serverkit-gui/components/ServerGui.jsx
+++ b/frontend/src/plugins/serverkit-gui/components/ServerGui.jsx
@@ -4,6 +4,7 @@ import { useEffect, useRef, useState, useCallback } from 'react';
// extension follows the panel's language and locale with no wiring of its own.
import { useTranslation, useFormat } from 'serverkit-sdk';
import SyntheticDesktop from './SyntheticDesktop.jsx';
+import { Button as SharedButton } from 'serverkit-sdk';
const FRAME_INTERVAL_MS_DEFAULT = 700;
const STORAGE_KEY = 'sk-gui:prefs';
@@ -206,7 +207,7 @@ function Toolbar({
function ModeBtn({ label, active, disabled, title, onClick }) {
return (
- <button
+ <SharedButton variant="unstyled"
type="button"
title={title}
disabled={disabled}
@@ -214,7 +215,7 @@ function ModeBtn({ label, active, disabled, title, onClick }) {
className={`sk-gui__mode-btn ${active ? 'sk-gui__mode-btn--active' : ''}`}
>
{label}
- </button>
+ </SharedButton>
);
}
@@ -263,12 +264,12 @@ function ScreenshotView({ baseUrl, fetchJson, intervalMs, scale, quality }) {
return (
<div className="sk-gui__viewport">
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className="sk-gui__viewport-btn"
onClick={() => setPaused(p => !p)}
>
{paused ? t('gui.resume', 'Resume') : t('gui.pause', 'Pause')}
- </button>
+ </SharedButton>
{error && <div className="sk-gui__banner sk-gui__banner--error">{error}</div>}
{imgSrc ? (
<img className="sk-gui__frame" src={imgSrc} alt={t('gui.frameAlt', 'Remote desktop frame')} />
diff --git a/frontend/src/plugins/serverkit-gui/components/ServerGuiLauncher.jsx b/frontend/src/plugins/serverkit-gui/components/ServerGuiLauncher.jsx
index 71ea9500..9d5429bb 100644
--- a/frontend/src/plugins/serverkit-gui/components/ServerGuiLauncher.jsx
+++ b/frontend/src/plugins/serverkit-gui/components/ServerGuiLauncher.jsx
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
import { useLocation } from 'react-router-dom';
import ServerGui from './ServerGui.jsx';
import { useTranslation } from 'serverkit-sdk';
+import { Button as SharedButton } from 'serverkit-sdk';
/**
* Floating launcher that appears only on /servers/:id pages.
@@ -29,27 +30,27 @@ export default function ServerGuiLauncher({ api }) {
return (
<>
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className="sk-gui-launcher"
onClick={() => setOpen(true)}
title={t('gui.launcher.open', 'Open desktop view')}
>
<DesktopIcon />
<span>{t('gui.launcher.label', 'Desktop')}</span>
- </button>
+ </SharedButton>
{open && (
<div className="sk-gui-modal" onClick={() => setOpen(false)}>
<div className="sk-gui-modal__inner" onClick={e => e.stopPropagation()}>
<header className="sk-gui-modal__header">
<h3>{t('gui.launcher.title', 'Desktop view')}</h3>
- <button type="button"
+ <SharedButton variant="unstyled" type="button"
className="sk-gui-modal__close"
onClick={() => setOpen(false)}
aria-label={t('common.actions.close', 'Close')}
>
×
- </button>
+ </SharedButton>
</header>
<div className="sk-gui-modal__body">
<ServerGui api={api} serverId={serverId} />
diff --git a/frontend/src/plugins/serverkit-gui/components/SyntheticDesktop.jsx b/frontend/src/plugins/serverkit-gui/components/SyntheticDesktop.jsx
index 21b534a9..9745f445 100644
--- a/frontend/src/plugins/serverkit-gui/components/SyntheticDesktop.jsx
+++ b/frontend/src/plugins/serverkit-gui/components/SyntheticDesktop.jsx
@@ -10,7 +10,7 @@ const SYNTHETIC_REFRESH_MS = 4000;
* Fake desktop UI rendered from agent data, used when the host has no
* display server. Each "window" is just data the agent already exposes.
*/
-export default function SyntheticDesktop({ api, serverId, fetchJson }) {
+export default function SyntheticDesktop({ serverId, fetchJson }) {
const { t } = useTranslation();
const [data, setData] = useState(null);
const [error, setError] = useState(null);
diff --git a/frontend/src/plugins/serverkit-remote-access/styles/remote-access.scss b/frontend/src/plugins/serverkit-remote-access/styles/remote-access.scss
index 2401ad23..e4f14d03 100644
--- a/frontend/src/plugins/serverkit-remote-access/styles/remote-access.scss
+++ b/frontend/src/plugins/serverkit-remote-access/styles/remote-access.scss
@@ -254,3 +254,22 @@
}
.ra-svc__right { width: 100%; justify-content: space-between; }
}
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.ra-service-form > * + * { margin-top: 1rem; }
+.ra-service-field > * + * { margin-top: 0.375rem; }
+.ra-service-hint { font-size: 0.75rem; color: $text-tertiary; }
+.ra-service-routing { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 0.75rem; }
+@media (min-width: $breakpoint-sm) {
+ .ra-service-routing { grid-template-columns: repeat(3, minmax(0, 1fr)); }
+}
+@media (min-width: $breakpoint-sm) {
+ .ra-service-field--host { grid-column: span 2 / span 2; }
+}
+.ra-service-field--host > * + * { margin-top: 0.375rem; }
+.ra-service-option { display: flex; align-items: center; justify-content: space-between; }
+.ra-service-credentials { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 0.75rem; }
+@media (min-width: $breakpoint-sm) {
+ .ra-service-credentials { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+}
+.ra-service-description { font-size: 0.875rem; color: $text-tertiary; }
diff --git a/frontend/src/plugins/serverkit-walkthrough-studio/index.jsx b/frontend/src/plugins/serverkit-walkthrough-studio/index.jsx
index b11b9300..819c07ab 100644
--- a/frontend/src/plugins/serverkit-walkthrough-studio/index.jsx
+++ b/frontend/src/plugins/serverkit-walkthrough-studio/index.jsx
@@ -409,18 +409,18 @@ export function WalkthroughStudioPage() {
<div className="wts-library__list">
{loading && <p className="wts-muted">{t('common.loading', 'Loading…')}</p>}
{!loading && library.length === 0 && (
- <button type="button" className="wts-library__empty" onClick={newGuide}>
+ <Button variant="unstyled" type="button" className="wts-library__empty" onClick={newGuide}>
<Sparkles size={18} />
<strong>{t('walkthroughStudio.createFirst', 'Create the first custom guide')}</strong>
<span>{t('walkthroughStudio.noCodeRequired', 'No application code required')}</span>
- </button>
+ </Button>
)}
{library.map((guide) => (
<div key={guide.id} className={`wts-library__item${originalId === guide.id ? ' is-active' : ''}`}>
- <button type="button" onClick={() => selectGuide(guide)}>
+ <Button variant="unstyled" type="button" onClick={() => selectGuide(guide)}>
<strong>{guide.title}</strong>
<span>{guide.steps.length} {t('walkthroughStudio.steps', 'steps')}</span>
- </button>
+ </Button>
<Button type="button" variant="ghost" size="icon" onClick={() => deleteGuide(guide)} aria-label={t('common.actions.delete', 'Delete')}>
<Trash2 size={13} />
</Button>
@@ -486,7 +486,7 @@ export function WalkthroughStudioPage() {
<div className="wts-step-workbench">
<div className="wts-step-rail">
{draft.steps.map((step, index) => (
- <button
+ <Button variant="unstyled"
key={`${step.id}-${index}`}
type="button"
className={index === stepIndex ? 'is-active' : ''}
@@ -496,7 +496,7 @@ export function WalkthroughStudioPage() {
<span>{String(index + 1).padStart(2, '0')}</span>
<strong>{step.title || t('walkthroughStudio.untitledStep', 'Untitled step')}</strong>
<small>{step.completion?.type || 'manual'}</small>
- </button>
+ </Button>
))}
</div>
diff --git a/frontend/src/services/__tests__/apiRegistry.test.mjs b/frontend/src/services/__tests__/apiRegistry.test.mjs
new file mode 100644
index 00000000..a1d82046
--- /dev/null
+++ b/frontend/src/services/__tests__/apiRegistry.test.mjs
@@ -0,0 +1,58 @@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { readFile } from 'node:fs/promises';
+import { parse } from 'espree';
+import { bindApiMethods } from '../api/registry.js';
+import * as apps from '../api/apps.js';
+import * as system from '../api/system.js';
+import * as jobs from '../api/jobs.js';
+import * as servers from '../api/servers.js';
+import * as plugins from '../api/plugins.js';
+
+test('rejects domain and inherited client collisions before binding any methods', () => {
+ const client = Object.create({ request() {} });
+ assert.throws(() => bindApiMethods(client, [{ okay() {}, request() {} }]), /Duplicate API method: request/);
+ assert.equal(Object.hasOwn(client, 'okay'), false);
+ assert.throws(() => bindApiMethods(client, [{ duplicate() {} }, { duplicate() {} }]), /duplicate/);
+});
+
+test('all registered domain exports are unique and avoid client methods and fields', async () => {
+ const index = await readFile(new URL('../api/index.js', import.meta.url), 'utf8');
+ const clientSource = await readFile(new URL('../api/client.js', import.meta.url), 'utf8');
+ const clientAst = parse(clientSource, { ecmaVersion: 'latest', sourceType: 'module' });
+ const clientClass = clientAst.body.find((node) => node.type === 'ClassDeclaration');
+ const client = {};
+ for (const member of clientClass.body.body) client[member.key.name] = () => {};
+ // Instance fields assigned by the constructor are reserved too.
+ for (const match of clientSource.matchAll(/this\.(\w+)\s*=/g)) client[match[1]] = null;
+ const modules = [];
+ for (const [, path] of index.matchAll(/import \* as \w+ from '(.+)'/g)) {
+ const source = await readFile(new URL(`../api/${path}`, import.meta.url), 'utf8');
+ const ast = parse(source, { ecmaVersion: 'latest', sourceType: 'module' });
+ const exports = {};
+ for (const node of ast.body) {
+ if (node.type === 'ExportNamedDeclaration' && node.declaration?.type === 'FunctionDeclaration') {
+ exports[node.declaration.id.name] = () => {};
+ }
+ }
+ modules.push(exports);
+ }
+ assert.ok(modules.length > 40);
+ assert.doesNotThrow(() => bindApiMethods(client, modules));
+});
+
+test('previously colliding operations have distinct URLs, preserving public winners', async () => {
+ const paths = [];
+ const client = { request: async (path) => { paths.push(path); } };
+ bindApiMethods(client, [apps, system, jobs, servers, plugins]);
+ await client.getServices();
+ await client.getAppServices();
+ await client.getJobStats();
+ await client.getBackgroundJobStats();
+ await client.uninstallPlugin('panel');
+ await client.uninstallPluginInstall('agent');
+ assert.deepEqual(paths, [
+ '/system/services', '/apps', '/jobs/stats', '/performance/jobs/stats',
+ '/plugins/panel', '/agent-plugins/installs/agent',
+ ]);
+});
diff --git a/frontend/src/services/__tests__/widgetQueries.test.mjs b/frontend/src/services/__tests__/widgetQueries.test.mjs
new file mode 100644
index 00000000..f66382b5
--- /dev/null
+++ b/frontend/src/services/__tests__/widgetQueries.test.mjs
@@ -0,0 +1,50 @@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { queryClient } from '../queryClient.js';
+import { fetchShared, widgetQueryKey, pruneWidgetQueries } from '../widgetQueries.js';
+
+test('board and fullscreen share a pending payload and a fresh result; tick and workspace isolate', async () => {
+ queryClient.clear();
+ let calls = 0;
+ let resolve;
+ const load = () => { calls += 1; return new Promise((done) => { resolve = done; }); };
+ const first = fetchShared('history|local|1h|0', load, 'a');
+ const fullscreen = fetchShared('history|local|1h|0', load, 'a');
+ await Promise.resolve();
+ resolve({ points: [1] });
+ assert.deepEqual(await first, await fullscreen);
+ await fetchShared('history|local|1h|0', load, 'a');
+ assert.equal(calls, 1);
+ await fetchShared('history|local|1h|1', async () => 'tick', 'a');
+ await fetchShared('history|local|1h|0', async () => 'other workspace', 'b');
+ assert.equal(queryClient.getSnapshot(widgetQueryKey('history|local|1h|1', 'a')).data, 'tick');
+ assert.equal(queryClient.getSnapshot(widgetQueryKey('history|local|1h|0', 'b')).data, 'other workspace');
+});
+
+test('permission errors remain visible to all consumers and retry on the next mount', async () => {
+ queryClient.clear();
+ const error = Object.assign(new Error('Forbidden'), { status: 403 });
+ await assert.rejects(fetchShared('activity', async () => { throw error; }, 'a'), error);
+ assert.equal(queryClient.getSnapshot(widgetQueryKey('activity', 'a')).error.status, 403);
+ assert.equal(await fetchShared('activity', async () => 'allowed now', 'a'), 'allowed now');
+});
+
+test('retention is bounded without evicting pending or observed widget data', async () => {
+ queryClient.clear();
+ const pinned = widgetQueryKey('pinned', 'a');
+ const unsubscribe = queryClient.subscribe(pinned, () => {}, { cancelOnUnsubscribe: false });
+ await fetchShared('pinned', async () => 'visible', 'a');
+ let resolve;
+ const pending = fetchShared('pending', () => new Promise((done) => { resolve = done; }), 'a');
+ for (let i = 0; i < 120; i += 1) await fetchShared(`tick-${i}`, async () => i, 'a');
+ assert.equal(queryClient.getSnapshot(pinned).data, 'visible');
+ assert.equal(queryClient.getSnapshot(widgetQueryKey('tick-0', 'a')).status, 'idle');
+ let duplicateCalls = 0;
+ const duplicate = fetchShared('pending', async () => { duplicateCalls += 1; }, 'a');
+ resolve('slow result');
+ assert.equal(await pending, 'slow result');
+ assert.equal(await duplicate, 'slow result');
+ assert.equal(duplicateCalls, 0);
+ unsubscribe();
+ pruneWidgetQueries();
+});
diff --git a/frontend/src/services/api/apps.js b/frontend/src/services/api/apps.js
index 1de36f94..1869e286 100644
--- a/frontend/src/services/api/apps.js
+++ b/frontend/src/services/api/apps.js
@@ -13,7 +13,7 @@ export async function getApps(options = {}) {
// "Services" is the user-facing term for what the backend calls Applications
// (§1 unification). These aliases let new code speak "services" while the
// API client and backend model keep the canonical `apps`/`Application` names.
-export async function getServices(options = {}) {
+export async function getAppServices(options = {}) {
return getApps.call(this, options);
}
diff --git a/frontend/src/services/api/files.js b/frontend/src/services/api/files.js
index 198b0e7a..7a904407 100644
--- a/frontend/src/services/api/files.js
+++ b/frontend/src/services/api/files.js
@@ -436,63 +436,6 @@ export async function getDomainsSslStatus() {
return this.request('/domains/ssl/status');
}
-// DNS Zones endpoints
-export async function getDNSZones() {
- return this.request('/dns/');
-}
-
-export async function getDNSZone(id) {
- return this.request(`/dns/${id}`);
-}
-
-export async function createDNSZone(data) {
- return this.request('/dns/', { method: 'POST', body: data });
-}
-
-export async function deleteDNSZone(id) {
- return this.request(`/dns/${id}`, { method: 'DELETE' });
-}
-
-export async function getDNSRecords(zoneId) {
- return this.request(`/dns/${zoneId}/records`);
-}
-
-export async function createDNSRecord(zoneId, data) {
- return this.request(`/dns/${zoneId}/records`, { method: 'POST', body: data });
-}
-
-export async function updateDNSRecord(recordId, data) {
- return this.request(`/dns/records/${recordId}`, { method: 'PUT', body: data });
-}
-
-export async function deleteDNSRecord(recordId) {
- return this.request(`/dns/records/${recordId}`, { method: 'DELETE' });
-}
-
-export async function getDNSPresets() {
- return this.request('/dns/presets');
-}
-
-export async function applyDNSPreset(zoneId, preset, variables) {
- return this.request(`/dns/${zoneId}/apply-preset`, {
- method: 'POST', body: { preset, variables }
- });
-}
-
-export async function checkDNSPropagation(domain, type = 'A') {
- return this.request(`/dns/propagation/${domain}?type=${type}`);
-}
-
-export async function exportDNSZone(zoneId) {
- return this.request(`/dns/${zoneId}/export`);
-}
-
-export async function importDNSZone(zoneId, zoneFile) {
- return this.request(`/dns/${zoneId}/import`, {
- method: 'POST', body: { zone_file: zoneFile }
- });
-}
-
// Status Pages endpoints
export async function getStatusPages() {
return this.request('/status/');
diff --git a/frontend/src/services/api/index.js b/frontend/src/services/api/index.js
index c63f5f71..fb6b46a1 100644
--- a/frontend/src/services/api/index.js
+++ b/frontend/src/services/api/index.js
@@ -1,3 +1,4 @@
+import { bindApiMethods } from './registry.js';
import ApiClient from './client.js';
import * as authMethods from './auth.js';
import * as appMethods from './apps.js';
@@ -116,13 +117,7 @@ class ApiService extends ApiClient {
recipeMethods,
restorePointMethods,
];
- for (const mod of modules) {
- for (const [key, fn] of Object.entries(mod)) {
- if (typeof fn === 'function') {
- this[key] = fn.bind(this);
- }
- }
- }
+ bindApiMethods(this, modules);
}
}
diff --git a/frontend/src/services/api/registry.js b/frontend/src/services/api/registry.js
new file mode 100644
index 00000000..15217334
--- /dev/null
+++ b/frontend/src/services/api/registry.js
@@ -0,0 +1,15 @@
+// Reject collisions with other domains and with the client's own API. A typo
+// must fail at startup instead of silently changing an existing endpoint.
+export function bindApiMethods(client, modules) {
+ const methods = new Map();
+ for (const mod of modules) {
+ for (const [name, fn] of Object.entries(mod)) {
+ if (typeof fn !== 'function') continue;
+ if (name in client || methods.has(name)) {
+ throw new Error(`Duplicate API method: ${name}`);
+ }
+ methods.set(name, fn);
+ }
+ }
+ for (const [name, fn] of methods) client[name] = fn.bind(client);
+}
diff --git a/frontend/src/services/api/servers.js b/frontend/src/services/api/servers.js
index 52db1432..c41b3584 100644
--- a/frontend/src/services/api/servers.js
+++ b/frontend/src/services/api/servers.js
@@ -835,7 +835,7 @@ export async function disablePluginInstall(installId) {
return this.request(`/agent-plugins/installs/${installId}/disable`, { method: 'POST' });
}
-export async function uninstallPlugin(installId) {
+export async function uninstallPluginInstall(installId) {
return this.request(`/agent-plugins/installs/${installId}`, { method: 'DELETE' });
}
diff --git a/frontend/src/services/api/system.js b/frontend/src/services/api/system.js
index 406631a0..b2fe32af 100644
--- a/frontend/src/services/api/system.js
+++ b/frontend/src/services/api/system.js
@@ -827,7 +827,7 @@ export async function getJobStatus(jobId) {
return this.request(`/performance/jobs/${jobId}`);
}
-export async function getJobStats() {
+export async function getBackgroundJobStats() {
return this.request('/performance/jobs/stats');
}
diff --git a/frontend/src/services/queryClient.js b/frontend/src/services/queryClient.js
index 5dc3de96..5994155c 100644
--- a/frontend/src/services/queryClient.js
+++ b/frontend/src/services/queryClient.js
@@ -58,12 +58,12 @@ export function createQueryClient() {
if (entry.state.isFetching) updateState(entry, { isFetching: false });
};
- const subscribe = (queryKey, listener) => {
+ const subscribe = (queryKey, listener, { cancelOnUnsubscribe = true } = {}) => {
const entry = ensureEntry(queryKey);
entry.listeners.add(listener);
return () => {
entry.listeners.delete(listener);
- if (entry.listeners.size === 0) cancelEntry(entry);
+ if (cancelOnUnsubscribe && entry.listeners.size === 0) cancelEntry(entry);
};
};
@@ -135,6 +135,22 @@ export function createQueryClient() {
});
};
+ // Bound retained results for high-cardinality consumers (e.g. dashboard
+ // refresh ticks). Active observers and pending requests cannot be evicted;
+ // their eventual completion/unsubscribe can prune the namespace again.
+ const pruneQueries = (queryKeyPrefix, maxEntries) => {
+ const matching = [...entries.values()].filter((entry) => (
+ keyStartsWith(entry.queryKey, queryKeyPrefix)
+ ));
+ let excess = matching.length - Math.max(0, maxEntries);
+ for (const entry of matching) {
+ if (excess <= 0) break;
+ if (entry.promise || entry.listeners.size) continue;
+ entries.delete(entry.hash);
+ excess -= 1;
+ }
+ };
+
const clear = () => {
entries.forEach(cancelEntry);
entries.clear();
@@ -146,6 +162,7 @@ export function createQueryClient() {
fetchQuery,
invalidateQueries,
cancelQueries,
+ pruneQueries,
clear,
};
}
diff --git a/frontend/src/services/widgetQueries.js b/frontend/src/services/widgetQueries.js
new file mode 100644
index 00000000..1ffeb498
--- /dev/null
+++ b/frontend/src/services/widgetQueries.js
@@ -0,0 +1,22 @@
+import { queryClient } from './queryClient.js';
+import { workspaceStore } from './workspaceStore.js';
+
+const PREFIX = ['dashboard-widget'];
+const CACHE_TTL_MS = 4000;
+const CACHE_MAX_ENTRIES = 96;
+
+export const widgetQueryKey = (key, workspaceId) => [...PREFIX, workspaceId, key];
+
+export function pruneWidgetQueries() {
+ queryClient.pruneQueries(PREFIX, CACHE_MAX_ENTRIES);
+}
+
+// Board refresh ticks remain part of the caller's key. Fullscreen and adjacent
+// charts reuse the same payload; failures remain retryable on the next mount.
+export function fetchShared(key, loader, workspaceId = workspaceStore.getSnapshot().activeWorkspaceId) {
+ const promise = queryClient.fetchQuery(widgetQueryKey(key, workspaceId), loader, {
+ staleTime: CACHE_TTL_MS,
+ });
+ pruneWidgetQueries();
+ return promise.finally(pruneWidgetQueries);
+}
diff --git a/frontend/src/styles/base/_typography.scss b/frontend/src/styles/base/_typography.scss
index 36b09849..3939b546 100644
--- a/frontend/src/styles/base/_typography.scss
+++ b/frontend/src/styles/base/_typography.scss
@@ -16,8 +16,12 @@ h4 { font-size: $font-size-base; }
// Text utilities
.text-primary { color: $text-primary; }
-.text-secondary { color: $text-secondary; }
-.text-tertiary { color: $text-tertiary; }
+.text-secondary {
+color: $text-secondary;
+}
+.text-tertiary {
+color: $text-tertiary;
+}
.text-success { color: $success; }
.text-warning { color: $warning; }
.text-danger { color: $danger; }
@@ -25,19 +29,25 @@ h4 { font-size: $font-size-base; }
// Weight utilities
.font-normal { font-weight: $font-weight-normal; }
-.font-medium { font-weight: $font-weight-medium; }
-.font-semibold { font-weight: $font-weight-semibold; }
-.font-bold { font-weight: $font-weight-bold; }
+.font-medium {
+font-weight: $font-weight-medium;
+}
+.font-semibold {
+font-weight: $font-weight-semibold;
+}
+.font-bold {
+font-weight: $font-weight-bold;
+}
// Mono text
.mono {
- font-family: $font-mono;
font-size: $font-size-sm;
+ font-family: $font-mono;
}
// Truncate
.truncate {
- @include truncate();
+@include truncate();
}
// Subtitle (used in page headers)
diff --git a/frontend/src/styles/base/_utilities.scss b/frontend/src/styles/base/_utilities.scss
index 4bca40df..b0b462a9 100644
--- a/frontend/src/styles/base/_utilities.scss
+++ b/frontend/src/styles/base/_utilities.scss
@@ -140,9 +140,6 @@
.text-red-500 { color: $danger; }
.text-yellow-600 { color: $warning; }
.text-yellow-700 { color: $warning; }
-.font-medium { font-weight: 500; }
-.font-semibold { font-weight: 600; }
-.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: $text-tertiary; }
@@ -171,7 +168,6 @@
.block { display: block; }
.inline-flex { display: inline-flex; }
.hidden { display: none; }
-.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
@@ -288,8 +284,6 @@
.text-muted-foreground { color: $text-tertiary; }
.text-accent-foreground { color: $text-primary; }
.text-popover-foreground { color: $text-primary; }
-.text-secondary { color: $text-secondary; }
-.text-tertiary { color: $text-tertiary; }
.text-destructive { color: $danger; }
.text-yellow-400 { color: $warning; }
.text-blue-400 { color: $accent-primary; }
diff --git a/frontend/src/styles/components/_alerts.scss b/frontend/src/styles/components/_alerts.scss
index 98ad78a9..28b008a4 100644
--- a/frontend/src/styles/components/_alerts.scss
+++ b/frontend/src/styles/components/_alerts.scss
@@ -64,15 +64,30 @@
}
}
-.error-message,
.error-banner {
display: flex;
align-items: flex-start;
gap: $space-2;
line-height: 1.5;
+ background: $danger-bg;
+ border: 1px solid $danger-border;
+ color: $danger;
+ padding: $space-3 $space-4;
+ border-radius: $radius-lg;
+ margin-bottom: $space-6;
> svg {
flex-shrink: 0;
margin-top: 2px;
}
+
+ &__close {
+ float: right;
+ background: none;
+ border: none;
+ cursor: pointer;
+ color: inherit;
+ font-size: 18px;
+ line-height: 1;
+ }
}
diff --git a/frontend/src/styles/components/_badges.scss b/frontend/src/styles/components/_badges.scss
index 5cc19c3a..4e5126b3 100644
--- a/frontend/src/styles/components/_badges.scss
+++ b/frontend/src/styles/components/_badges.scss
@@ -3,23 +3,17 @@
// ============================================
// Status badge
-.status-badge {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- gap: $space-1;
- min-height: 24px;
- padding: 4px $space-3;
- border-radius: $radius-full;
- font-size: $font-size-xs;
- font-weight: $font-weight-semibold;
- line-height: 1;
- border: 1px solid transparent;
- white-space: nowrap;
-}
.status-dot {
@include status-dot(currentColor);
+ width: 12px;
+ height: 12px;
+ border-radius: 50%;
+
+ &.large {
+ width: 14px;
+ height: 14px;
+ }
}
// Status variants
@@ -162,12 +156,14 @@
align-items: center;
justify-content: center;
min-height: 1.5rem;
- padding: 0.25rem 0.625rem;
- font-size: 0.75rem;
- font-weight: 600;
line-height: 1;
- border-radius: 9999px;
white-space: nowrap;
+ padding: 2px 8px;
+ border-radius: $radius-sm;
+ font-size: $font-size-xs;
+ text-transform: uppercase;
+ font-weight: $font-weight-semibold;
+ letter-spacing: 0.5px;
}
.badge-info {
@@ -188,6 +184,8 @@
.badge-warning {
background-color: fade($warning-raw, 15%);
color: $warning;
+ @include status-variant($warning, $warning-bg);
+ border: 1px solid $warning-border;
}
.badge-default {
diff --git a/frontend/src/styles/components/_build.scss b/frontend/src/styles/components/_build.scss
index 081b9aae..37f0fa04 100644
--- a/frontend/src/styles/components/_build.scss
+++ b/frontend/src/styles/components/_build.scss
@@ -51,38 +51,6 @@
}
// Info List
-.info-list {
- display: flex;
- flex-direction: column;
- gap: $space-3;
-}
-
-.info-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: $space-2 0;
- border-bottom: 1px solid $border-subtle;
-
- &:last-child {
- border-bottom: none;
- }
-}
-
-.info-label {
- font-size: $font-size-sm;
- color: $text-secondary;
-}
-
-.info-value {
- font-size: $font-size-sm;
- font-weight: $font-weight-medium;
- color: $text-primary;
-
- &.mono {
- font-family: $font-mono;
- }
-}
// Current Deployment Card
.current-deployment {
@@ -225,18 +193,7 @@
}
// Modal Large
-.modal-lg {
- max-width: 900px;
- width: 90%;
-}
// Button extra small
-.btn-xs {
- padding: $space-1 $space-2;
- font-size: $font-size-xs;
-}
// Utility classes
-.mono {
- font-family: $font-mono;
-}
diff --git a/frontend/src/styles/components/_buttons.scss b/frontend/src/styles/components/_buttons.scss
index 42e30e73..ff13d182 100644
--- a/frontend/src/styles/components/_buttons.scss
+++ b/frontend/src/styles/components/_buttons.scss
@@ -117,29 +117,6 @@
}
}
-.btn-ghost {
- background: transparent;
- color: $text-secondary;
-
- &:hover:not(:disabled) {
- background-color: $bg-hover;
- color: $text-primary;
- }
-}
-
-.btn-link {
- height: auto;
- min-width: 0;
- padding: 0;
- background: transparent;
- color: $accent-primary;
- text-decoration: none;
-
- &:hover:not(:disabled) {
- text-decoration: underline;
- }
-}
-
// --------------------------------------------
// Size variants
// --------------------------------------------
@@ -170,37 +147,80 @@
}
}
+.btn-link {
+height: auto;
+ min-width: 0;
+ padding: 0;
+ background: none;
+ border: none;
+ color: $accent-primary;
+ cursor: pointer;
+ font-size: $font-size-sm;
+ text-decoration: none;
+
+ // Named sizes retain their geometry while links keep zero padding.
+ &.btn-sm { height: 32px; min-width: 72px; }
+ &.btn-lg { height: 44px; min-width: 128px; }
+
+ &:hover,
+ &:hover:not(:disabled) { text-decoration: underline; }
+}
+
// Icon-only square button — matches default height so it lines up
// next to regular buttons in toolbars.
.btn-icon {
- width: 40px;
- height: 40px;
- min-width: 0;
- padding: 0;
+display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 28px;
+ height: 28px;
+ min-width: auto !important;
+ padding: $space-2 !important;
+ background: transparent;
+ border: none;
+ border-radius: $radius-sm;
+ color: $text-tertiary;
+ cursor: pointer;
+ transition: all 0.2s;
svg {
width: 18px;
height: 18px;
+ margin: 0 !important;
}
&.btn-sm {
width: 32px;
height: 32px;
- svg {
- width: 16px;
- height: 16px;
- }
+ svg { width: 16px; height: 16px; }
}
&.btn-lg {
width: 44px;
height: 44px;
- svg {
- width: 20px;
- height: 20px;
- }
+ svg { width: 20px; height: 20px; }
+ }
+
+ &:hover {
+ color: $text-primary;
+ background: $bg-hover;
+ }
+
+ &.btn-danger:hover {
+ background: fade($danger-raw, 20%);
+ color: $danger;
+ }
+
+ &.success {
+ color: $success;
+ &:hover { background: $success-bg; }
+ }
+
+ &.danger {
+ color: $danger;
+ &:hover { background: $danger-bg; }
}
}
@@ -232,3 +252,30 @@
// Loading state styling lives in _spinner.scss alongside .spinner overrides.
+.btn-xs {
+ padding: 2px 6px;
+ font-size: 11px;
+
+ svg {
+ stroke: currentColor;
+ fill: none;
+ stroke-width: 2;
+ }
+}
+
+// Ghost takes precedence when combined with the icon size.
+.btn-ghost {
+background: transparent;
+ border: 1px solid transparent;
+ color: $text-secondary;
+
+ &:hover {
+ background: $bg-elevated;
+ color: $text-primary;
+ }
+
+ &:hover:not(:disabled) {
+ background-color: $bg-hover;
+ color: $text-primary;
+ }
+}
diff --git a/frontend/src/styles/components/_cards.scss b/frontend/src/styles/components/_cards.scss
index 550eeb07..b30e115a 100644
--- a/frontend/src/styles/components/_cards.scss
+++ b/frontend/src/styles/components/_cards.scss
@@ -7,7 +7,6 @@
padding: $space-6;
position: relative;
overflow: hidden;
-
}
.card-header {
@@ -252,39 +251,6 @@
}
// Empty state card
-.empty-state {
- text-align: center;
- padding: $space-16 $space-5;
- background: $bg-card;
- border-radius: $radius-xl;
- border: 1px solid $border-subtle;
-
- > svg,
- &__icon svg {
- color: $text-tertiary;
- margin-bottom: $space-4;
- }
-
- h3 {
- font-size: $font-size-md;
- font-weight: $font-weight-semibold;
- margin-bottom: $space-2;
- }
-
- p {
- color: $text-secondary;
- margin-bottom: $space-6;
- }
-
- // When nested inside a card, drop the card-in-card double background.
- .card &,
- .card-body & {
- background: transparent;
- border: none;
- border-radius: 0;
- padding: $space-10 $space-5;
- }
-}
// Card body (content area below card-header)
.card-body {
diff --git a/frontend/src/styles/components/_connection-status.scss b/frontend/src/styles/components/_connection-status.scss
new file mode 100644
index 00000000..c14aa042
--- /dev/null
+++ b/frontend/src/styles/components/_connection-status.scss
@@ -0,0 +1,39 @@
+// Shared connection status indicator.
+
+.conn-status {
+ gap: $space-2;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ flex-shrink: 0;
+ display: inline-flex;
+ align-items: center;
+ padding: 2px $space-2;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-full;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-medium;
+ color: $text-tertiary;
+ white-space: nowrap;
+
+ .conn-status__dot {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ flex-shrink: 0;
+ }
+
+ &--live .conn-status__dot {
+ background: $success;
+ box-shadow: 0 0 8px $success;
+ }
+
+ &--down .conn-status__dot {
+ background: $warning;
+ box-shadow: 0 0 8px $warning;
+ }
+
+ &--ok {
+ @include status-variant($success, $success-bg);
+ border-color: $success-border;
+ }
+}
diff --git a/frontend/src/styles/components/_datagrid.scss b/frontend/src/styles/components/_datagrid.scss
index 9089c38c..c3afde78 100644
--- a/frontend/src/styles/components/_datagrid.scss
+++ b/frontend/src/styles/components/_datagrid.scss
@@ -913,6 +913,8 @@
align-items: center;
gap: 10px;
margin-bottom: 13px;
+
+ &--separated { margin-top: 18px; }
}
&__t {
diff --git a/frontend/src/styles/components/_deploy.scss b/frontend/src/styles/components/_deploy.scss
index 4561934c..2d91207d 100644
--- a/frontend/src/styles/components/_deploy.scss
+++ b/frontend/src/styles/components/_deploy.scss
@@ -4,9 +4,116 @@
// Deploy Tab Container
.deploy-tab {
- display: flex;
- flex-direction: column;
- gap: $space-6;
+ @include flex-column-gap($space-5);
+
+ .deploy-setup {
+ padding: $space-8 0;
+ }
+
+ .deploy-header {
+ margin-bottom: 0;
+ }
+
+ .deploy-status-card {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: $space-4;
+ padding: $space-4 $space-5;
+ background: var(--surface);
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+
+ @media (max-width: $breakpoint-md) {
+ flex-direction: column;
+ align-items: flex-start;
+ }
+ }
+
+ .deploy-repo-info {
+ display: flex;
+ align-items: center;
+ gap: $space-3;
+
+ svg {
+ flex-shrink: 0;
+ color: var(--text-faint);
+ }
+
+ > div {
+ display: flex;
+ flex-direction: column;
+ gap: $space-1;
+ }
+
+ .repo-url {
+ font-family: var(--mono);
+ font-size: $font-size-sm;
+ color: var(--text);
+ word-break: break-all;
+ }
+
+ .repo-branch {
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--accent-bright);
+ }
+ }
+
+ .deploy-actions {
+ display: flex;
+ gap: $space-2;
+ flex-shrink: 0;
+ }
+
+ .deploy-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
+ gap: $space-5;
+ }
+
+ .checkbox-label {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ cursor: pointer;
+
+ input[type="checkbox"] {
+ width: 16px;
+ height: 16px;
+ cursor: pointer;
+ accent-color: var(--accent-primary);
+ }
+
+ span {
+ font-size: $font-size-sm;
+ color: var(--text);
+ }
+ }
+
+ .form-help {
+ display: block;
+ margin-top: $space-1;
+ font-size: $font-size-xs;
+ color: var(--text-faint);
+ }
+
+ textarea {
+ font-family: var(--mono);
+ font-size: $font-size-sm;
+ resize: vertical;
+ min-height: 80px;
+ }
+
+ .text-danger {
+ color: $danger;
+ font-size: $font-size-sm;
+ }
+
+ .text-muted {
+ color: var(--text-faint);
+ font-size: $font-size-sm;
+ }
}
// Deploy Setup Empty State
diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scss
index b0ac920e..ad7fd914 100644
--- a/frontend/src/styles/components/_design-system.scss
+++ b/frontend/src/styles/components/_design-system.scss
@@ -229,6 +229,7 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
display: flex;
flex-direction: column;
gap: 10px;
+ margin-bottom: $space-5;
}
.sk-kpiband {
@@ -1029,6 +1030,10 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
flex-direction: column;
padding: $space-4;
+ > .empty-state--loading:has(.sk-page-wrap) {
+ padding: 0;
+ }
+
// The toolbar row is the shared .sk-listhead (ResourceListPage renders
// ListToolbar); only the search fallback and the layout switch stay here.
@@ -1318,6 +1323,7 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
// Drawer — right-side slide-over header chrome (panel comes from ui/sheet).
// ------------------------------------------------------------
.sk-drawer {
+ max-width: 95vw;
// Cancel the sheet's own padding/gap/scroll. This element owns three
// full-height regions — head, body, foot — that each manage their own
// padding, so the panel's must be zero or every one of them is inset:
@@ -1530,7 +1536,6 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
&__chevron { color: var(--text-faint); flex-shrink: 0; margin-left: 4px; }
}
-
// ------------------------------------------------------------
// ErrorState — consistent empty error panel.
// ------------------------------------------------------------
diff --git a/frontend/src/styles/components/_detail-tabs.scss b/frontend/src/styles/components/_detail-tabs.scss
new file mode 100644
index 00000000..a5c15d6d
--- /dev/null
+++ b/frontend/src/styles/components/_detail-tabs.scss
@@ -0,0 +1,218 @@
+// Shared legacy detail-tab layouts.
+
+.events-tab {
+ .failed-login-summary {
+ display: flex;
+ align-items: baseline;
+ gap: $space-3;
+
+ .count {
+ font-family: var(--mono);
+ font-size: 26px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: -0.02em;
+
+ &.danger {
+ color: var(--red);
+ }
+ }
+
+ .label {
+ font-family: var(--mono);
+ font-size: 11.5px;
+ color: var(--text-faint);
+ }
+ }
+
+ .recent-failures {
+ margin-top: $space-4;
+
+ summary {
+ cursor: pointer;
+ font-size: 12.5px;
+ color: var(--accent-bright);
+
+ &:hover {
+ text-decoration: underline;
+ }
+ }
+
+ pre {
+ margin-top: $space-2;
+ padding: $space-4;
+ max-height: 200px;
+ overflow: auto;
+ background: var(--bg-code);
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius-sm);
+ font-family: var(--mono);
+ font-size: 11px;
+ line-height: 1.6;
+ color: var(--text-code);
+ }
+ }
+
+ // The Event cell stacks the message over its meta line, so the ellipsis on
+ // the message needs a min-width:0 flex parent to bite against.
+ &__cell {
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ }
+
+ // Config and audit rows carry everything they have in the row itself —
+ // only a deploy opens a drawer, so only a deploy gets a pointer.
+ .sk-dtable tbody tr.is-static {
+ cursor: default;
+ }
+
+ // A cell with genuinely nothing behind it (an audit entry has no outcome).
+ &__none {
+ color: var(--text-faint);
+ }
+
+ &__event-sha {
+ font-family: var(--mono);
+ font-size: $font-size-sm;
+ @include status-variant(var(--accent-bright), var(--accent-bg));
+ padding: 1px $space-2;
+ border-radius: $radius-sm;
+ flex-shrink: 0;
+ }
+
+ &__event-message {
+ font-size: $font-size-base - 1;
+ color: $text-primary;
+ font-weight: $font-weight-medium;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ // The build log, now shown in the deploy drawer rather than in an expanded
+ // row. Flat BEM, so it styles the same block wherever it is portalled to.
+ &__event-logs {
+ padding: $space-3;
+ background: var(--bg-code);
+ border: 1px solid var(--border-soft);
+ border-radius: $radius-md;
+ max-height: 60vh;
+ overflow-y: auto;
+
+ pre {
+ margin: 0;
+ font-family: var(--mono);
+ font-size: $font-size-sm;
+ color: var(--text-code);
+ white-space: pre-wrap;
+ word-break: break-all;
+ }
+ }
+}
+
+.settings-tab {
+ max-width: none;
+
+ .card { max-width: 860px; }
+
+ .form-group {
+ margin: 0;
+ padding: 2px 0;
+
+ & + .form-group {
+ border-top: 1px solid var(--border-soft);
+ }
+
+ // Eyebrow-style field labels (text inputs)
+ > label {
+ display: block;
+ margin: 10px 0 6px;
+ font-family: var(--mono);
+ font-size: 10px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--text-faint);
+ }
+ }
+
+ .toggle-switch-label {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: $space-4;
+ padding: 9px 0;
+
+ label {
+ margin: 0;
+ font-size: 13.5px;
+ font-weight: $font-weight-medium;
+ color: var(--text);
+ cursor: pointer;
+ }
+ }
+
+ .form-actions {
+ display: flex;
+ justify-content: flex-start;
+ }
+
+}
+
+.metrics-tab {
+ padding: 0;
+
+ &__grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
+ gap: $space-4;
+ }
+
+ &__card {
+ background: var(--surface);
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+ padding: $space-4 $space-5;
+ transition: border-color 0.15s;
+
+ &:hover {
+ border-color: var(--border-strong);
+ }
+
+ .sk-gauge {
+ margin-top: $space-3;
+ }
+ }
+
+ &__card-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: $space-3;
+
+ h4 {
+ margin: 0;
+ font-family: var(--mono);
+ font-size: 11px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--text-faint);
+ }
+
+ span {
+ font-family: var(--mono);
+ font-size: 22px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: -0.02em;
+ color: $text-primary;
+ }
+ }
+
+ &__info {
+ margin-top: $space-2;
+ font-family: var(--mono);
+ font-size: $font-size-sm;
+ color: var(--text-dim);
+ }
+}
diff --git a/frontend/src/styles/components/_empty-state.scss b/frontend/src/styles/components/_empty-state.scss
index c7dfe68a..80522d3a 100644
--- a/frontend/src/styles/components/_empty-state.scss
+++ b/frontend/src/styles/components/_empty-state.scss
@@ -1,4 +1,8 @@
.empty-state {
+ background: $bg-card;
+ border-radius: $radius-xl;
+ border: 1px solid $border-subtle;
+ color: $text-secondary;
display: flex;
flex-direction: column;
align-items: center;
@@ -7,6 +11,32 @@
text-align: center;
min-height: 200px;
+ > svg,
+ &__icon svg {
+ color: $text-tertiary;
+ margin-bottom: $space-4;
+ }
+
+ h3 {
+ font-size: $font-size-md;
+ font-weight: $font-weight-semibold;
+ margin-bottom: $space-2;
+ }
+
+ p {
+ color: $text-secondary;
+ margin-bottom: $space-6;
+ }
+
+ // When nested inside a card, drop the card-in-card double background.
+ .card &,
+ .card-body & {
+ background: transparent;
+ border: none;
+ border-radius: 0;
+ padding: $space-10 $space-5;
+ }
+
&__icon {
color: $text-tertiary;
margin-bottom: $spacing-md;
diff --git a/frontend/src/styles/components/_env-vars.scss b/frontend/src/styles/components/_env-vars.scss
index f8e0f470..19893618 100644
--- a/frontend/src/styles/components/_env-vars.scss
+++ b/frontend/src/styles/components/_env-vars.scss
@@ -87,20 +87,23 @@
// DataTable now), but still the documented "list of pairs" block in the style
// guide, so it keeps its own styling.
.env-list {
- display: flex;
- flex-direction: column;
- gap: $space-2;
+@include flex-column-gap($space-2);
}
.env-item {
- // One tier brighter than the surface it sits on, so rows have depth
- // (body < panel --surface < row --surface-2) instead of blending together.
+ display: flex;
+ align-items: center;
+ gap: $space-4;
+ @include card-base();
background: var(--surface-2);
border: 1px solid var(--border-soft);
border-radius: $radius-md;
padding: $space-3 $space-4;
transition: border-color 0.15s, background 0.15s;
+ // One tier brighter than the surface it sits on, so rows have depth
+ // (body < panel --surface < row --surface-2) instead of blending together.
+
&:hover {
border-color: var(--border-strong);
background: var(--surface-3);
@@ -142,30 +145,6 @@
white-space: nowrap;
}
-.btn-icon {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 28px;
- height: 28px;
- background: transparent;
- border: none;
- border-radius: $radius-sm;
- color: $text-tertiary;
- cursor: pointer;
- transition: all 0.2s;
-
- &:hover {
- background: $bg-hover;
- color: $text-primary;
- }
-
- &.btn-danger:hover {
- background: fade($danger-raw, 20%);
- color: $danger;
- }
-}
-
// The shared EmptyState allows a single action node; an app with no variables
// yet can start from scratch or from a file, so it gets both side by side.
.env-empty-actions {
@@ -207,6 +186,3 @@
}
// Modal large variant
-.modal-lg {
- max-width: 700px;
-}
diff --git a/frontend/src/styles/components/_form-affordances.scss b/frontend/src/styles/components/_form-affordances.scss
new file mode 100644
index 00000000..96542c83
--- /dev/null
+++ b/frontend/src/styles/components/_form-affordances.scss
@@ -0,0 +1,7 @@
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.sk-form-hint { font-size: 0.75rem; color: $text-tertiary; }
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.sk-form-stack > * + * { margin-top: 1rem; }
+.sk-form-field > * + * { margin-top: 0.375rem; }
diff --git a/frontend/src/styles/components/_forms.scss b/frontend/src/styles/components/_forms.scss
index d285f9b4..53e07824 100644
--- a/frontend/src/styles/components/_forms.scss
+++ b/frontend/src/styles/components/_forms.scss
@@ -37,11 +37,14 @@
// Two column form row
.form-row {
- display: grid;
- grid-template-columns: 1fr 1fr;
+ // Keep system-domain fields on the shared responsive grid.
+ &.system-domain-row { display: grid; gap: $space-4; }
+
+display: grid;
+ grid-template-columns: repeat(2, 1fr);
gap: $space-4;
- @media (max-width: $breakpoint-md) {
+ @media (max-width: $breakpoint-sm) {
grid-template-columns: 1fr;
}
}
@@ -109,32 +112,25 @@
// Error message
.error-message {
- background: $danger-bg;
- border: 1px solid $danger-border;
- color: $danger;
- padding: $space-3 $space-4;
- border-radius: $radius-lg;
- margin-bottom: $space-5;
- font-size: $font-size-sm + 1;
+ display: flex;
+ align-items: flex-start;
+ gap: $space-2;
+ line-height: 1.5;
+
+ > svg {
+ flex-shrink: 0;
+ margin-top: 2px;
+ }
}
-.error-banner {
+.error-message {
background: $danger-bg;
border: 1px solid $danger-border;
color: $danger;
padding: $space-3 $space-4;
border-radius: $radius-lg;
- margin-bottom: $space-6;
-
- &__close {
- float: right;
- background: none;
- border: none;
- cursor: pointer;
- color: inherit;
- font-size: 18px;
- line-height: 1;
- }
+ margin-bottom: $space-5;
+ font-size: $font-size-sm + 1;
}
// Filter toggle (checkbox)
@@ -191,3 +187,103 @@
border-color: $accent-primary;
}
}
+
+.checkbox-label {
+@include flex-start();
+ gap: $space-2;
+ cursor: pointer;
+
+ input[type="checkbox"] {
+ width: 16px;
+ height: 16px;
+ cursor: pointer;
+ accent-color: $accent-primary;
+ }
+
+ .checkbox-text { font-weight: 400; }
+}
+
+.permission-checkbox {
+display: flex;
+ justify-content: center;
+ align-items: center;
+ gap: $space-2;
+ font-size: $font-size-sm;
+ color: $text-secondary;
+ cursor: pointer;
+
+ input[type="checkbox"] {
+ width: 16px;
+ height: 16px;
+ cursor: pointer;
+ accent-color: $accent-primary;
+ }
+
+ &:hover { color: $text-primary; }
+}
+
+.settings-form {
+ margin-bottom: 0;
+ background: transparent;
+ border: none;
+ border-radius: 0;
+ padding: 0;
+
+ .form-group {
+ margin-bottom: $space-4;
+
+ &:last-of-type {
+ margin-bottom: 0;
+ }
+
+ label {
+ display: block;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-medium;
+ color: $text-secondary;
+ margin-bottom: $space-2;
+ }
+
+ input:not([type="checkbox"]):not([type="radio"]), select, textarea {
+ width: 100%;
+ padding: $space-3;
+ background: $bg-hover;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-md;
+ color: $text-primary;
+ font-size: $font-size-sm;
+ transition: border-color $transition-fast;
+
+ &:focus {
+ outline: none;
+ border-color: $accent-primary;
+ }
+
+ &:disabled,
+ &.input-disabled {
+ opacity: 0.6;
+ cursor: not-allowed;
+ background: $bg-body;
+ }
+ }
+
+ .form-help {
+ display: block;
+ margin-top: $space-1;
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+ }
+ }
+
+ .form-actions {
+ margin-top: $space-5;
+ padding-top: $space-5;
+ border-top: 1px solid $border-subtle;
+ display: flex;
+ gap: $space-2;
+ }
+
+ .form-section .btn[type="submit"] {
+ margin-top: $space-4;
+ }
+}
diff --git a/frontend/src/styles/components/_lists.scss b/frontend/src/styles/components/_lists.scss
index e980539c..cb4ca4bb 100644
--- a/frontend/src/styles/components/_lists.scss
+++ b/frontend/src/styles/components/_lists.scss
@@ -9,31 +9,89 @@
// Info list (key-value pairs)
.info-list {
- @include flex-column-gap($space-3);
+@include flex-column-gap($space-3);
+
+ .info-item {
+ @include flex-between();
+ padding: $space-2 0;
+ border-bottom: 1px solid $border-subtle;
+
+ &:last-child { border-bottom: none; }
+
+ .info-label {
+ font-size: $font-size-sm;
+ color: $text-tertiary;
+ }
+
+ .info-value {
+ font-size: $font-size-sm;
+ font-weight: $font-weight-medium;
+ color: $text-primary;
+ }
+ }
}
.info-item {
@include flex-between();
padding: $space-2 0;
border-bottom: 1px solid $border-subtle;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
&:last-child {
border-bottom: none;
}
+
+ &:last-child {
+ border-bottom: none;
+ }
+
+ &:last-child {
+ border-bottom: none;
+ }
+
+ .info-label {
+ color: $text-secondary;
+ }
+
+ .info-value {
+ font-weight: 500;
+ }
+
+ .info-label {
+ font-size: $font-size-sm;
+ color: $text-tertiary;
+ }
+
+ .info-value {
+ font-size: $font-size-sm;
+ color: $text-primary;
+
+ &.mono {
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ }
+ }
}
.info-label {
- color: $text-tertiary;
- font-size: $font-size-sm + 1;
+ font-size: $font-size-sm;
+ color: $text-secondary;
}
.info-value {
- color: $text-primary;
+ font-size: $font-size-sm;
font-weight: $font-weight-medium;
+ color: $text-primary;
&.mono {
@include mono-text();
}
+
+ &.mono {
+ font-family: $font-mono;
+ }
}
// Packages list
@@ -57,17 +115,6 @@
}
// Environment variables list
-.env-list {
- @include flex-column-gap($space-2);
-}
-
-.env-item {
- display: flex;
- align-items: center;
- gap: $space-4;
- padding: $space-3 $space-4;
- @include card-base();
-}
.env-key {
font-weight: $font-weight-semibold;
diff --git a/frontend/src/styles/components/_logs.scss b/frontend/src/styles/components/_logs.scss
index e441cb7c..adace22e 100644
--- a/frontend/src/styles/components/_logs.scss
+++ b/frontend/src/styles/components/_logs.scss
@@ -134,7 +134,71 @@
min-width: 0;
display: flex;
flex-direction: column;
- background: $bg-card;
+ background: var(--bg-code);
+ border: 1px solid var(--border-soft);
+ border-top: none;
+ border-radius: 0 0 var(--radius) var(--radius);
+ min-height: 400px;
+ max-height: 600px;
+ overflow-y: auto;
+ font-family: var(--mono);
+ font-size: $font-size-sm;
+ line-height: 1.7;
+ scroll-behavior: smooth;
+
+ &__loading, &__empty {
+ font-size: $font-size-sm;
+ padding: $space-8;
+ text-align: center;
+ color: var(--text-faint);
+ }
+
+ &__line {
+ display: flex;
+ padding: 0 $space-4;
+ transition: background 0.1s;
+
+ &:hover {
+ background: var(--surface-hover);
+ }
+
+ &--error {
+ background: rgba(251, 111, 111, 0.06);
+ .logs-viewer__line-text { color: var(--red); }
+ }
+
+ &--warn {
+ background: rgba(245, 185, 69, 0.06);
+ .logs-viewer__line-text { color: var(--amber); }
+ }
+
+ &--debug {
+ .logs-viewer__line-text { color: var(--text-faint); }
+ }
+ }
+
+ &__line-num {
+ width: 48px;
+ padding-right: $space-3;
+ color: var(--text-ghost);
+ text-align: right;
+ flex-shrink: 0;
+ user-select: none;
+ }
+
+ &__line-text {
+ flex: 1;
+ color: var(--text-code);
+ white-space: pre-wrap;
+ word-break: break-all;
+ }
+
+ &__highlight {
+ background: rgba(245, 185, 69, 0.35);
+ color: var(--text);
+ border-radius: 2px;
+ padding: 0 1px;
+ }
}
.viewer-toolbar {
@@ -212,8 +276,6 @@
}
}
-.logs-viewer__loading,
-.logs-viewer__empty,
.empty-hint {
color: $text-tertiary;
font-size: $font-size-sm;
diff --git a/frontend/src/styles/components/_metrics-graph.scss b/frontend/src/styles/components/_metrics-graph.scss
index 81aa22d2..48ec0650 100644
--- a/frontend/src/styles/components/_metrics-graph.scss
+++ b/frontend/src/styles/components/_metrics-graph.scss
@@ -333,7 +333,6 @@
fill: $text-secondary;
}
-
.recharts-tooltip-cursor {
stroke: $text-tertiary;
stroke-dasharray: 4 4;
diff --git a/frontend/src/styles/components/_modals.scss b/frontend/src/styles/components/_modals.scss
index facbb928..49b78482 100644
--- a/frontend/src/styles/components/_modals.scss
+++ b/frontend/src/styles/components/_modals.scss
@@ -24,7 +24,8 @@
}
.modal-lg {
- max-width: 800px;
+ max-width: 900px;
+ width: 90%;
}
.modal-header {
diff --git a/frontend/src/styles/components/_notifications.scss b/frontend/src/styles/components/_notifications.scss
index 6d1e77af..a276a273 100644
--- a/frontend/src/styles/components/_notifications.scss
+++ b/frontend/src/styles/components/_notifications.scss
@@ -218,16 +218,6 @@
}
}
-.form-row {
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: $space-4;
-
- @media (max-width: 600px) {
- grid-template-columns: 1fr;
- }
-}
-
.severity-toggles {
display: flex;
flex-wrap: wrap;
diff --git a/frontend/src/styles/components/_private-url.scss b/frontend/src/styles/components/_private-url.scss
index 4a4b2a2f..267402c6 100644
--- a/frontend/src/styles/components/_private-url.scss
+++ b/frontend/src/styles/components/_private-url.scss
@@ -118,19 +118,6 @@
}
}
-.btn-link {
- background: none;
- border: none;
- color: $accent-primary;
- cursor: pointer;
- padding: 0;
- font-size: $font-size-sm;
-
- &:hover {
- text-decoration: underline;
- }
-}
-
.slug-edit-form {
margin-top: $space-4;
padding-top: $space-4;
diff --git a/frontend/src/styles/components/_services.scss b/frontend/src/styles/components/_services.scss
index 05a57460..1292b3ed 100644
--- a/frontend/src/styles/components/_services.scss
+++ b/frontend/src/styles/components/_services.scss
@@ -3,10 +3,11 @@
// ============================================
.services-grid {
- display: flex;
flex-wrap: wrap;
- gap: $space-3;
margin-bottom: $space-6;
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
+ gap: $space-4;
}
.service-item {
diff --git a/frontend/src/styles/components/_skeleton.scss b/frontend/src/styles/components/_skeleton.scss
index 46f15ab4..15a95b30 100644
--- a/frontend/src/styles/components/_skeleton.scss
+++ b/frontend/src/styles/components/_skeleton.scss
@@ -143,14 +143,6 @@
}
}
-.sk-tabgroup__inner,
-.page-container,
-.wp-list {
- > .empty-state--loading:has(.sk-page-wrap) {
- padding: 0;
- }
-}
-
// ============================================
// PAGE SKELETON ARCHETYPES (components/PageSkeleton.jsx)
// One shape per page layout, so the placeholder predicts what is about to
diff --git a/frontend/src/styles/components/_spinner.scss b/frontend/src/styles/components/_spinner.scss
index 216a06eb..2b62fa04 100644
--- a/frontend/src/styles/components/_spinner.scss
+++ b/frontend/src/styles/components/_spinner.scss
@@ -60,12 +60,14 @@
// Loading state component
.loading-state {
+ min-height: 40vh;
+ text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: $space-3;
- padding: $space-8;
+ padding: $space-10;
color: $text-secondary;
span {
@@ -106,3 +108,35 @@
border-top-color: #fff;
}
}
+
+.loading {
+ // Card roots also set padding; retain the shared loading inset.
+ &.uptime-card,
+ &.metrics-graph-card { padding: $space-12; }
+
+ @include flex-center();
+ min-height: 60vh;
+ padding: $space-12;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+}
+
+.loading-sm {
+ color: $text-tertiary;
+ font-size: $font-size-sm;
+ padding: $space-4;
+}
+
+.spinner-inline {
+ display: inline-block;
+ width: 14px;
+ height: 14px;
+ border: 2px solid var(--border-strong);
+ border-top-color: var(--accent);
+ border-radius: 50%;
+ animation: spin 0.8s linear infinite;
+}
+
+.spin {
+ animation: spin 1s linear infinite;
+}
diff --git a/frontend/src/styles/components/_status-badge.scss b/frontend/src/styles/components/_status-badge.scss
index 336ce17f..9f25bc02 100644
--- a/frontend/src/styles/components/_status-badge.scss
+++ b/frontend/src/styles/components/_status-badge.scss
@@ -1,14 +1,17 @@
.status-badge {
- display: inline-flex;
- align-items: center;
- gap: $spacing-xs;
+ justify-content: center;
+ border: 1px solid transparent;
min-height: 24px;
- padding: 4px $spacing-sm;
- border-radius: $radius-full;
- font-size: $font-size-xs;
- font-weight: $font-weight-semibold;
line-height: 1;
white-space: nowrap;
+ display: inline-flex;
+ align-items: center;
+ gap: $space-1;
+ padding: $space-1 $space-2;
+ border-radius: $radius-sm;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-medium;
+ text-transform: capitalize;
&__dot {
width: 6px;
@@ -46,4 +49,21 @@
color: $text-tertiary;
.status-badge__dot { background: $text-tertiary; }
}
+
+ &.online {
+ @include status-variant($success, $success-bg);
+ }
+
+ &.offline {
+ @include status-variant($danger, $danger-bg);
+ }
+
+ &.connecting {
+ @include status-variant($warning, $warning-bg);
+ }
+
+ &.pending {
+ background: $bg-secondary;
+ color: $text-tertiary;
+ }
}
diff --git a/frontend/src/styles/components/_tables.scss b/frontend/src/styles/components/_tables.scss
index 7fccd34b..43ce590c 100644
--- a/frontend/src/styles/components/_tables.scss
+++ b/frontend/src/styles/components/_tables.scss
@@ -51,3 +51,50 @@
}
}
}
+
+.data-table {
+width: 100%;
+ border-collapse: collapse;
+ font-size: $font-size-sm;
+
+ th {
+ text-align: left;
+ padding: $space-3;
+ background: $bg-hover;
+ color: $text-tertiary;
+ font-weight: $font-weight-semibold;
+ text-transform: uppercase;
+ font-size: $font-size-xs;
+ letter-spacing: 0.05em;
+ border-bottom: 1px solid $border-subtle;
+ }
+
+ td {
+ padding: $space-3;
+ border-bottom: 1px solid $border-subtle;
+ font-family: $font-mono;
+ font-size: $font-size-sm;
+ color: $text-secondary;
+ }
+
+ tr:hover { background: $bg-hover; }
+ tr:last-child td { border-bottom: none; }
+
+ .container-name {
+ display: block;
+ color: $text-primary;
+ font-weight: $font-weight-medium;
+ }
+
+ .container-id {
+ display: block;
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+ }
+
+ .mono {
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ }
+}
diff --git a/frontend/src/styles/components/_tabs.scss b/frontend/src/styles/components/_tabs.scss
index bb60e034..d306f24d 100644
--- a/frontend/src/styles/components/_tabs.scss
+++ b/frontend/src/styles/components/_tabs.scss
@@ -133,27 +133,25 @@
}
.tab-btn {
- display: inline-flex;
+display: inline-flex;
align-items: center;
gap: $space-2;
- background: none;
+ white-space: nowrap;
+ background: transparent;
border: none;
- padding: $space-3 $space-5;
- color: $text-secondary;
- font-size: $font-size-base;
+ color: $text-tertiary;
+ font-size: $font-size-sm;
font-weight: $font-weight-medium;
+ padding: $space-3 $space-4;
cursor: pointer;
border-bottom: 2px solid transparent;
margin-bottom: -1px;
- @include transition();
- white-space: nowrap;
+ transition: all $transition-base;
- &:hover {
- color: $text-primary;
- }
+ &:hover { color: $text-primary; }
&.active {
- color: $accent-primary;
+ color: $text-primary;
border-bottom-color: $accent-primary;
}
}
diff --git a/frontend/src/styles/components/_two-factor.scss b/frontend/src/styles/components/_two-factor.scss
index ee01e6ee..7f9a716c 100644
--- a/frontend/src/styles/components/_two-factor.scss
+++ b/frontend/src/styles/components/_two-factor.scss
@@ -300,7 +300,3 @@
}
// Loading small
-.loading-sm {
- color: $text-tertiary;
- font-size: $font-size-sm;
-}
diff --git a/frontend/src/styles/components/_ui.scss b/frontend/src/styles/components/_ui.scss
index bdd95d9c..88fd75bd 100644
--- a/frontend/src/styles/components/_ui.scss
+++ b/frontend/src/styles/components/_ui.scss
@@ -870,6 +870,23 @@
&--lg { max-width: 42rem; }
&--xl { max-width: 56rem; }
&--2xl { max-width: 72rem; }
+
+ .form-group > label:not(.checkbox-label) {
+ font-family: var(--mono);
+ font-size: 10.5px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--text-faint);
+ }
+
+ .form-help {
+ display: block;
+ margin-top: $space-2;
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--text-faint);
+ }
}
.sk-modal__header {
diff --git a/frontend/src/styles/components/_uptime.scss b/frontend/src/styles/components/_uptime.scss
index 5b06476f..587b2206 100644
--- a/frontend/src/styles/components/_uptime.scss
+++ b/frontend/src/styles/components/_uptime.scss
@@ -289,14 +289,6 @@
margin-bottom: $space-5;
}
-.legend-item {
- display: flex;
- align-items: center;
- gap: $space-2;
- font-size: $font-size-xs;
- color: $text-secondary;
-}
-
.legend-dot {
width: 10px;
height: 10px;
diff --git a/frontend/src/styles/components/_users.scss b/frontend/src/styles/components/_users.scss
index a2d57854..e61315bb 100644
--- a/frontend/src/styles/components/_users.scss
+++ b/frontend/src/styles/components/_users.scss
@@ -199,32 +199,6 @@
// --------------------------------------------
// User Modal Styles
// --------------------------------------------
-.form-row {
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: $space-4;
-
- @media (max-width: 600px) {
- grid-template-columns: 1fr;
- }
-}
-
-.checkbox-label {
- display: flex;
- align-items: center;
- gap: $space-2;
- cursor: pointer;
-
- input[type="checkbox"] {
- width: 18px;
- height: 18px;
- cursor: pointer;
- }
-
- .checkbox-text {
- font-weight: 400;
- }
-}
.form-help {
display: block;
@@ -326,20 +300,9 @@
}
}
-.settings-nav-spacer {
- flex: 1;
- min-height: $space-4;
-}
-
// --------------------------------------------
// Loading & Empty States
// --------------------------------------------
-.loading-state,
-.empty-state {
- padding: $space-10;
- text-align: center;
- color: $text-secondary;
-}
// --------------------------------------------
// Button Variants
@@ -432,17 +395,6 @@
font-size: $font-size-sm;
}
-.permission-checkbox {
- display: flex;
- justify-content: center;
-
- input[type="checkbox"] {
- width: 16px;
- height: 16px;
- cursor: pointer;
- }
-}
-
.customize-permissions-section {
margin-top: $space-4;
diff --git a/frontend/src/styles/layout/_grid.scss b/frontend/src/styles/layout/_grid.scss
index fad01d4d..8c435e23 100644
--- a/frontend/src/styles/layout/_grid.scss
+++ b/frontend/src/styles/layout/_grid.scss
@@ -14,11 +14,11 @@
// Overview grid (2-column)
.overview-grid {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
- gap: $space-6;
+display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: $space-5;
- @media (max-width: $breakpoint-md) {
+ @media (max-width: $breakpoint-lg) {
grid-template-columns: 1fr;
}
}
diff --git a/frontend/src/styles/layout/_main-content.scss b/frontend/src/styles/layout/_main-content.scss
index a885c18a..f9dcb981 100644
--- a/frontend/src/styles/layout/_main-content.scss
+++ b/frontend/src/styles/layout/_main-content.scss
@@ -45,6 +45,8 @@
.top-bar {
@include flex-between();
margin-bottom: $space-10;
+ padding-bottom: $space-4;
+ border-bottom: 1px solid $border-subtle;
h1 {
font-size: $font-size-2xl;
@@ -54,7 +56,6 @@
@media (max-width: $breakpoint-md) {
flex-direction: column;
- align-items: flex-start;
gap: $space-4;
}
}
@@ -175,16 +176,8 @@
// New pages should use .page-container directly.
// Loading state (full-page spinner)
-.loading {
- @include flex-center();
- min-height: 60vh;
- color: $text-secondary;
-}
// Route-level loading (within dashboard)
-.loading-state {
- min-height: 40vh;
-}
// ============================================================
// APP-LEVEL INITIAL LOADER
@@ -286,3 +279,11 @@
width: 100%;
}
}
+
+// Skeletons already provide their own page spacing.
+.sk-tabgroup__inner,
+.page-container {
+ > .empty-state--loading:has(.sk-page-wrap) {
+ padding: 0;
+ }
+}
diff --git a/frontend/src/styles/main.scss b/frontend/src/styles/main.scss
index 18a5afa5..b85294d9 100644
--- a/frontend/src/styles/main.scss
+++ b/frontend/src/styles/main.scss
@@ -37,6 +37,7 @@
@import 'components/_modals';
@import 'components/_htaccess-converter';
@import 'components/_forms';
+@import 'components/_form-affordances';
@import 'components/_badges';
@import 'components/_tabs';
@import 'components/_lists';
@@ -63,6 +64,8 @@
@import 'components/_api-settings';
@import 'components/_empty-state';
@import 'components/_status-badge';
+@import 'components/_connection-status';
+@import 'components/_detail-tabs';
@import 'components/_server-selector';
@import 'components/_schedule-picker'; // shared cron picker (CronJobs, Backups, server-detail)
@import 'components/_contribution-graph';
@@ -138,6 +141,7 @@
@import 'pages/_services';
@import 'pages/_service-detail';
@import 'pages/_fleet-monitor';
+@import 'pages/_agent-fleet';
@import 'pages/_server-templates';
@import 'pages/_server-packages';
@import 'pages/_server-services';
diff --git a/frontend/src/styles/pages/_agent-fleet.scss b/frontend/src/styles/pages/_agent-fleet.scss
new file mode 100644
index 00000000..c3c52c97
--- /dev/null
+++ b/frontend/src/styles/pages/_agent-fleet.scss
@@ -0,0 +1,90 @@
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.fleet-rollout-progress { display: flex; align-items: center; gap: 0.75rem; }
+.fleet-rollout-progress__gauge { width: 6rem; }
+.fleet-caption { font-size: 0.875rem; color: $text-secondary; }
+.fleet-rollout-failure { margin-inline-start: 0.25rem; color: $danger; }
+.fleet-command-error { font-size: 0.75rem; color: $danger; }
+.fleet-tab-count { margin-inline-start: 0.5rem; }
+.fleet-tab-content { margin-top: 1.5rem; }
+.fleet-section-stack > * + * { margin-top: 1.5rem; }
+.fleet-health-grid { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 1.5rem; }
+@media (min-width: $breakpoint-lg) {
+ .fleet-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+}
+.fleet-metric-stack > * + * { margin-top: 1rem; }
+.fleet-summary-row { display: flex; align-items: center; justify-content: space-between; }
+.fleet-metric-label { color: $text-secondary; }
+.fleet-uptime-value { font-weight: $font-weight-semibold; color: $success; }
+.fleet-summary-row--latency { display: flex; align-items: center; justify-content: space-between; margin-top: 1.5rem; }
+.fleet-value { font-weight: $font-weight-semibold; }
+.fleet-warnrow--spaced { margin-top: 1rem; }
+.fleet-inline-label { display: flex; align-items: center; gap: 0.5rem; }
+.fleet-version-distribution > * + * { margin-top: 0.25rem; }
+.fleet-version-distribution__label { display: flex; justify-content: space-between; font-size: 0.875rem; }
+.fleet-note { color: $text-secondary; }
+.fleet-version-empty { padding-top: 1rem; padding-bottom: 1rem; color: $text-secondary; text-align: center; }
+.fleet-table-scroll { overflow-x: auto; }
+.fleet-table-empty { color: $text-secondary; text-align: center; padding-top: 2rem; padding-bottom: 2rem; }
+.fleet-release-notes { border-top: 1px solid $border-subtle; }
+.fleet-release-notes__title { font-weight: $font-weight-semibold; margin-bottom: 0.5rem; font-size: 0.875rem; }
+.fleet-release-notes__text { font-size: 0.875rem; color: $text-secondary; white-space: pre-wrap; }
+.fleet-rollout-description { margin-bottom: 1rem; color: $text-secondary; }
+.fleet-rollout-fields { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 1rem; }
+@media (min-width: $breakpoint-md) {
+ .fleet-rollout-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+}
+@media (min-width: $breakpoint-lg) {
+ .fleet-rollout-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
+}
+.fleet-rollout-select { width: 100%; }
+.fleet-rollout-actions { display: flex; justify-content: flex-end; margin-top: 1.5rem; }
+// Shared card/card-body rules already own padding; legacy padding utilities
+// lost in the cascade and must not override that geometry during migration.
+.fleet-card-empty { color: $text-secondary; text-align: center; }
+.fleet-empty-icon { margin-bottom: 1rem; margin-inline-start: auto; margin-inline-end: auto; color: $text-tertiary; }
+.fleet-card-heading { display: flex; align-items: center; justify-content: space-between; }
+.fleet-refresh-spinner { animation: spin 1s linear infinite; }
+.fleet-discovery-grid { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 1rem; }
+@media (min-width: $breakpoint-md) {
+ .fleet-discovery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+}
+@media (min-width: $breakpoint-lg) {
+ .fleet-discovery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
+}
+.fleet-discovered-agent { display: flex; flex-direction: column; justify-content: space-between; }
+.fleet-discovered-agent__heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.5rem; }
+.fleet-agent-name { font-weight: $font-weight-bold; }
+.fleet-agent-facts > * + * { margin-top: 0.5rem; }
+.fleet-agent-facts { margin-top: 1rem; font-size: 0.875rem; }
+.fleet-agent-fact { display: flex; justify-content: space-between; }
+.fleet-agent-actions { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid $border-subtle; }
+.fleet-agent-action { width: 100%; }
+.fleet-discovery-empty { text-align: center; grid-column: 1 / -1; }
+.fleet-diagnostics-overlay { display: flex; align-items: center; justify-content: center; position: fixed; inset: 0; z-index: 50; background-color: rgba(0, 0, 0, 0.6); }
+.fleet-diagnostics-dialog { width: 100%; overflow-y: auto; max-width: 42rem; max-height: 80vh; margin: 1rem; }
+.fleet-diagnostics-heading { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem; border-bottom: 1px solid $border-subtle; }
+.fleet-diagnostics-title { font-weight: $font-weight-semibold; font-size: 1.125rem; }
+.fleet-diagnostics-body > * + * { margin-top: 1.5rem; }
+.fleet-diagnostics-body { padding: 1.5rem; }
+.fleet-diagnostics-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
+.fleet-connection-value { font-weight: $font-weight-semibold; display: flex; align-items: center; gap: 0.5rem; }
+.fleet-connected-icon { color: $success; }
+.fleet-disconnected-icon { color: $danger; }
+.fleet-diagnostics-section-title { font-weight: $font-weight-semibold; margin-bottom: 0.75rem; }
+.fleet-command-statistics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
+.fleet-command-total { font-weight: $font-weight-bold; font-size: 1.125rem; }
+.fleet-command-statistic-label { font-size: 0.75rem; color: $text-secondary; }
+.fleet-command-success { font-weight: $font-weight-bold; font-size: 1.125rem; color: $success; }
+.fleet-command-failed { font-weight: $font-weight-bold; font-size: 1.125rem; color: $danger; }
+.fleet-command-timeout { font-weight: $font-weight-bold; font-size: 1.125rem; color: $warning; }
+.fleet-queued-description { font-size: 0.875rem; }
+.fleet-session-list > * + * { margin-top: 0.5rem; }
+.fleet-session-list { overflow-y: auto; max-height: 12rem; }
+.fleet-session-row { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem; font-size: 0.875rem; border-radius: $radius-md; }
+.fleet-session-offline { color: $text-tertiary; }
+.fleet-session-disconnect-reason { margin-inline-start: 0.5rem; color: $danger; }
+.fleet-command-retry { color: $warning; }
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.fleet-command-type { font-size: 0.875rem; }
diff --git a/frontend/src/styles/pages/_applications.scss b/frontend/src/styles/pages/_applications.scss
index e6456238..146ca2e1 100644
--- a/frontend/src/styles/pages/_applications.scss
+++ b/frontend/src/styles/pages/_applications.scss
@@ -320,13 +320,6 @@
}
// Icon-only button (legacy global utility; LinkedAppsSection consumes it)
-.btn-icon {
- padding: $space-2 !important;
-
- svg {
- margin: 0 !important;
- }
-}
// ============================================
// APP DETAIL — SHARED BASE CHROME
@@ -790,7 +783,6 @@
// ============================================
.app-detail-page {
-
// ---- shadcn tab strip (.tabs/.tab) → accent-wash chips ----
.tabs {
gap: 2px;
@@ -1315,119 +1307,6 @@
// DEPLOY TAB
// ============================================
-.deploy-tab {
- @include flex-column-gap($space-5);
-
- .deploy-setup {
- padding: $space-8 0;
- }
-
- .deploy-header {
- margin-bottom: 0;
- }
-
- .deploy-status-card {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: $space-4;
- padding: $space-4 $space-5;
- background: var(--surface);
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
-
- @media (max-width: $breakpoint-md) {
- flex-direction: column;
- align-items: flex-start;
- }
- }
-
- .deploy-repo-info {
- display: flex;
- align-items: center;
- gap: $space-3;
-
- svg {
- flex-shrink: 0;
- color: var(--text-faint);
- }
-
- > div {
- display: flex;
- flex-direction: column;
- gap: $space-1;
- }
-
- .repo-url {
- font-family: var(--mono);
- font-size: $font-size-sm;
- color: var(--text);
- word-break: break-all;
- }
-
- .repo-branch {
- font-family: var(--mono);
- font-size: 11px;
- color: var(--accent-bright);
- }
- }
-
- .deploy-actions {
- display: flex;
- gap: $space-2;
- flex-shrink: 0;
- }
-
- .deploy-grid {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
- gap: $space-5;
- }
-
- .checkbox-label {
- display: flex;
- align-items: center;
- gap: $space-2;
- cursor: pointer;
-
- input[type="checkbox"] {
- width: 16px;
- height: 16px;
- cursor: pointer;
- accent-color: var(--accent-primary);
- }
-
- span {
- font-size: $font-size-sm;
- color: var(--text);
- }
- }
-
- .form-help {
- display: block;
- margin-top: $space-1;
- font-size: $font-size-xs;
- color: var(--text-faint);
- }
-
- textarea {
- font-family: var(--mono);
- font-size: $font-size-sm;
- resize: vertical;
- min-height: 80px;
- }
-
- .text-danger {
- color: $danger;
- font-size: $font-size-sm;
- }
-
- .text-muted {
- color: var(--text-faint);
- font-size: $font-size-sm;
- }
-}
-
// ============================================
// RESPONSIVE ADJUSTMENTS
// ============================================
diff --git a/frontend/src/styles/pages/_connections.scss b/frontend/src/styles/pages/_connections.scss
index 61472271..0baaabae 100644
--- a/frontend/src/styles/pages/_connections.scss
+++ b/frontend/src/styles/pages/_connections.scss
@@ -188,23 +188,6 @@
}
// ── Status pill (top-right of a card) ──
-.conn-status {
- flex-shrink: 0;
- display: inline-flex;
- align-items: center;
- padding: 2px $space-2;
- border: 1px solid $border-subtle;
- border-radius: $radius-full;
- font-size: $font-size-xs;
- font-weight: $font-weight-medium;
- color: $text-tertiary;
- white-space: nowrap;
-
- &--ok {
- @include status-variant($success, $success-bg);
- border-color: $success-border;
- }
-}
// ── Scope chip (access level) ──
.conn-pill {
diff --git a/frontend/src/styles/pages/_cron.scss b/frontend/src/styles/pages/_cron.scss
index 986186de..87521abc 100644
--- a/frontend/src/styles/pages/_cron.scss
+++ b/frontend/src/styles/pages/_cron.scss
@@ -3,7 +3,6 @@
// ============================================
.cron-page {
-
.cron-servicenote {
font-family: var(--mono);
font-size: 11px;
@@ -144,24 +143,6 @@
// it silently matches nothing.
// create/edit modal (field labels → mono eyebrows)
-.sk-modal {
- .form-group > label:not(.checkbox-label) {
- font-family: var(--mono);
- font-size: 10.5px;
- font-weight: $font-weight-semibold;
- letter-spacing: 0.08em;
- text-transform: uppercase;
- color: var(--text-faint);
- }
-
- .form-help {
- display: block;
- margin-top: $space-2;
- font-family: var(--mono);
- font-size: 11px;
- color: var(--text-faint);
- }
-}
.run-output {
display: flex;
@@ -213,15 +194,6 @@
}
// spinner inside the run-now button (list row + drawer header)
-.spinner-inline {
- display: inline-block;
- width: 14px;
- height: 14px;
- border: 2px solid var(--border-strong);
- border-top-color: var(--accent);
- border-radius: 50%;
- animation: spin 0.8s linear infinite;
-}
// ── Job drawer (row click) ──────────────────────────────────
.cron-drawer__headeractions {
diff --git a/frontend/src/styles/pages/_dashboard.scss b/frontend/src/styles/pages/_dashboard.scss
index e908e3fa..298acbc5 100644
--- a/frontend/src/styles/pages/_dashboard.scss
+++ b/frontend/src/styles/pages/_dashboard.scss
@@ -15,13 +15,6 @@
}
// --- Top Bar: Pro Layout ---
-.top-bar {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding-bottom: $space-4;
- border-bottom: 1px solid $border-subtle;
-}
.server-identity {
h1 {
@@ -159,33 +152,6 @@
// Connection status: dot + text label (never color alone), announced to
// screen readers via role="status". The label stays a readable neutral
// (contrast-safe in both themes); the dot carries the status color.
-.conn-status {
- display: inline-flex;
- align-items: center;
- gap: $space-2;
- font-size: $font-size-xs;
- font-weight: $font-weight-semibold;
- text-transform: uppercase;
- letter-spacing: 0.06em;
- color: $text-secondary;
-
- .conn-status__dot {
- width: 8px;
- height: 8px;
- border-radius: 50%;
- flex-shrink: 0;
- }
-
- &--live .conn-status__dot {
- background: $success;
- box-shadow: 0 0 8px $success;
- }
-
- &--down .conn-status__dot {
- background: $warning;
- box-shadow: 0 0 8px $warning;
- }
-}
.server-details {
display: flex;
@@ -547,38 +513,6 @@
color: $text-primary;
}
-.data-table {
- width: 100%;
- border-collapse: collapse;
- font-size: $font-size-sm;
-
- th {
- text-align: left;
- padding: $space-4 $space-5;
- background: $bg-hover;
- color: $text-tertiary;
- font-weight: $font-weight-semibold;
- text-transform: uppercase;
- font-size: $font-size-xs;
- letter-spacing: 0.05em;
- }
-
- td {
- padding: $space-4 $space-5;
- border-bottom: 1px solid $border-subtle;
- font-family: $font-mono;
- color: $text-secondary;
- }
-
- tr:hover {
- background: $bg-hover;
- }
-
- tr:last-child td {
- border-bottom: none;
- }
-}
-
.app-name-cell {
display: flex;
align-items: center;
@@ -606,25 +540,12 @@
}
// Status Badges
-.badge {
- padding: 2px 8px;
- border-radius: $radius-sm;
- font-size: $font-size-xs;
- text-transform: uppercase;
- font-weight: $font-weight-semibold;
- letter-spacing: 0.5px;
-}
.badge-running {
@include status-variant($success, $success-bg);
border: 1px solid $success-border;
}
-.badge-warning {
- @include status-variant($warning, $warning-bg);
- border: 1px solid $warning-border;
-}
-
.badge-stopped {
@include status-variant($danger, $danger-bg);
border: 1px solid $danger-border;
diff --git a/frontend/src/styles/pages/_docker.scss b/frontend/src/styles/pages/_docker.scss
index 13cc31fe..94897d05 100644
--- a/frontend/src/styles/pages/_docker.scss
+++ b/frontend/src/styles/pages/_docker.scss
@@ -7,7 +7,6 @@
padding: 0;
}
-
.docker-page-title {
h2 {
font-size: $font-size-xl;
@@ -377,16 +376,6 @@
}
}
-.spinner-inline {
- display: inline-block;
- width: 14px;
- height: 14px;
- border: 2px solid $border-subtle;
- border-top-color: $accent-primary;
- border-radius: 50%;
- animation: spin 0.8s linear infinite;
-}
-
.exec-input-form {
display: flex;
align-items: center;
@@ -435,7 +424,6 @@
@media (max-width: $breakpoint-md) {
padding: $space-5;
}
-
}
.docker-unavailable {
@@ -772,8 +760,8 @@
border-radius: 50%;
flex-shrink: 0;
- &.running { background: $success; box-shadow: 0 0 0 3px fade($success-raw, 16%); }
- &.stopped { background: $text-tertiary; }
+ &.running { background: $success; box-shadow: 0 0 0 3px fade($success-raw, 16%); opacity: 1; }
+ &.stopped { background: $text-tertiary; opacity: 0.4; }
}
.dx-status-pill {
@@ -1916,7 +1904,6 @@
animation: drawer-slide 0.24s cubic-bezier(0.32, 0.72, 0.24, 1);
}
-
@media (max-width: $breakpoint-xl) {
.dx-workspace {
grid-template-columns: 220px minmax(0, 1fr);
@@ -1966,3 +1953,10 @@
width: 100%;
}
}
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.docker-compose-log-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
+.docker-compose-log-select { padding-inline-start: 0.5rem; padding-inline-end: 0.5rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.docker-compose-actions-column { text-align: right; }
diff --git a/frontend/src/styles/pages/_domains.scss b/frontend/src/styles/pages/_domains.scss
index f41b02cd..5e15d6fd 100644
--- a/frontend/src/styles/pages/_domains.scss
+++ b/frontend/src/styles/pages/_domains.scss
@@ -397,6 +397,8 @@
}
.dom-specs {
+ &__value { margin-top: $space-2; }
+
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: $space-3;
@@ -434,18 +436,6 @@
}
}
-.checkbox-label {
- @include flex-start();
- gap: $space-2;
- cursor: pointer;
-
- input[type="checkbox"] {
- width: 16px;
- height: 16px;
- accent-color: $accent-primary;
- }
-}
-
// ── Relocated from the retired DNS Zones / Dynamic DNS pages ─────────────────
// Colored DNS record-type chip — used by the drawer's record table and the
// Connections → DNS activity feed (DnsActivity.jsx), so it stays global.
diff --git a/frontend/src/styles/pages/_fleet-monitor.scss b/frontend/src/styles/pages/_fleet-monitor.scss
index a425655f..4b0066e1 100644
--- a/frontend/src/styles/pages/_fleet-monitor.scss
+++ b/frontend/src/styles/pages/_fleet-monitor.scss
@@ -11,7 +11,6 @@
// again with a `dom-kpis` class that no stylesheet ever defined. The page uses
// the <KpiBand> primitive now, so there is one definition of the grid and no
// copy of it to lose. Only the page's own spacing stays.
-.sk-kpiband-wrap { margin-bottom: $space-5; }
// Amber warning row (queued commands, forecast errors)
.fleet-warnrow {
diff --git a/frontend/src/styles/pages/_migration-wizard.scss b/frontend/src/styles/pages/_migration-wizard.scss
index ec067e05..42aa0169 100644
--- a/frontend/src/styles/pages/_migration-wizard.scss
+++ b/frontend/src/styles/pages/_migration-wizard.scss
@@ -359,7 +359,3 @@
}
// Spin animation for loader
-
-.spin {
- animation: spin 1s linear infinite;
-}
diff --git a/frontend/src/styles/pages/_monitoring.scss b/frontend/src/styles/pages/_monitoring.scss
index dcffce33..17f27412 100644
--- a/frontend/src/styles/pages/_monitoring.scss
+++ b/frontend/src/styles/pages/_monitoring.scss
@@ -2,680 +2,8 @@
// MONITORING PAGE (redesign — infra console look)
// ============================================
-// Every page in the Monitoring group shares one `mon-*` vocabulary (panels,
-// section heads, hints, info rows). Listing the roots here rather than copying
-// the rules is what keeps Monitors / Incidents / the monitor detail page
-// looking like the same product as Overview.
-.monitoring-page,
-.monitors-page,
-.incidents-page,
-.monitor-detail {
-
- // ── shared bits ─────────────────────────────────────────
- // Mono-uppercase eyebrow section headers
- .mon-section-head h3,
- .monitoring-panel__header h3 {
- margin: 0;
- font-family: var(--mono);
- font-size: 10.5px;
- font-weight: $font-weight-semibold;
- letter-spacing: 0.08em;
- text-transform: uppercase;
- color: var(--text-faint);
- }
-
- // Neutral icon tile (rule editors, channel tiles, host cards)
- .mon-ico {
- width: 30px;
- height: 30px;
- border-radius: 8px;
- display: grid;
- place-items: center;
- flex-shrink: 0;
- background: var(--surface-3);
- color: var(--text-dim);
-
- &--sm {
- width: 26px;
- height: 26px;
- border-radius: 7px;
- }
- }
-
- // Every section stacks the same way, so a tab change never shifts the
- // rhythm of the page.
- .mon-overview,
- .monitoring-stack,
- .monitoring-delivery-layout {
- display: grid;
- gap: $space-5;
- }
-
- // Two equal panels side by side (charts row, alerts + speed test row) —
- // the mock's `dash-grid` with two `span-2` cards.
- .mon-grid2 {
- display: grid;
- grid-template-columns: repeat(2, minmax(0, 1fr));
- gap: $space-5;
-
- @media (max-width: 1000px) { grid-template-columns: 1fr; }
- }
-
- // ── section heads + panels ──────────────────────────────
- .mon-section-head {
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: $space-3;
- margin-bottom: -$space-2; // the grid gap already spaces it off the grid
-
- &__meta {
- font-family: var(--mono);
- font-size: 11px;
- color: var(--text-faint);
- }
- }
-
- // Caption under a panel heading — says what the panel is showing and,
- // crucially, WHICH host it is showing it for. One line: a wrapped caption
- // pushes the chart down and makes the two panels in a row disagree on where
- // their plots start.
- .mon-panel-sub {
- display: block;
- max-width: 100%;
- font-family: var(--mono);
- font-size: 11px;
- color: var(--text-faint);
- @include truncate();
- }
-
- .monitoring-panel__header > div {
- // A heading with a caption stacks and takes the free space; the default
- // row layout is for headers whose second child is a button cluster.
- &:has(> h3) {
- flex: 1 1 auto;
- min-width: 0;
- flex-direction: column;
- align-items: flex-start;
- gap: 3px;
- }
- }
-
- // Controls on the right of a panel header never wrap or shrink — letting
- // them do either steals width from the caption and folds a 4-button switch
- // onto two lines.
- .mon-period-switch,
- .mon-legend {
- flex: none;
- flex-wrap: nowrap;
- }
-
- .mon-legend {
- display: flex;
- gap: $space-3;
- font-family: var(--mono);
- font-size: 11px;
- color: var(--text-faint);
-
- span { display: inline-flex; align-items: center; gap: 5px; }
-
- i {
- width: 8px;
- height: 8px;
- border-radius: 2px;
-
- &.is-memory { background: var(--cyan); }
- &.is-disk { background: var(--green); }
- }
- }
-
- .monitoring-panel {
- min-width: 0;
- padding: $space-5;
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
- background: var(--surface);
-
- &--warning {
- border-color: rgba(251, 111, 111, 0.28);
- }
- }
-
- .monitoring-panel__header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: $space-3;
- margin-bottom: $space-4;
-
- > div {
- display: flex;
- flex-wrap: wrap;
- gap: $space-2;
- }
-
- @media (max-width: 640px) {
- align-items: flex-start;
- flex-direction: column;
- }
- }
-
- // The KPI band is the shared DS tile (MetricCard + KpiBand) — the
- // monitoring-only copy that lived here was the same geometry twice, so the
- // sparkline slot moved into the primitive instead.
-
- // ── Host health strip: one card per machine, the panel host first ──
- // This is the ex-Fleet-Monitor heatmap, except each card is a button that
- // re-scopes the whole page rather than a cell you can only read.
- .mon-fleet-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
- gap: 14px;
- }
-
- .mon-host {
- display: block;
- width: 100%;
- min-width: 0;
- padding: 14px 16px 12px;
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
- background: var(--surface);
- text-align: left;
- cursor: pointer;
- transition: border-color $transition-fast, background $transition-fast;
-
- &:hover { border-color: var(--border-strong); }
-
- &.is-active {
- border-color: var(--accent-dim);
- background: var(--accent-bg);
- }
-
- &__head {
- display: flex;
- align-items: center;
- gap: 9px;
- margin-bottom: 10px;
-
- .sk-pill { margin-left: auto; flex-shrink: 0; }
- }
-
- &__ico {
- width: 28px;
- height: 28px;
- border-radius: 8px;
- display: grid;
- place-items: center;
- flex-shrink: 0;
- background: var(--surface-3);
- color: var(--text-dim);
- }
-
- &__name {
- flex: 1;
- min-width: 0;
- font-size: 13px;
- font-weight: $font-weight-semibold;
- color: var(--text);
- @include truncate();
-
- small {
- display: block;
- font-family: var(--mono);
- font-size: 10px;
- font-weight: 400;
- color: var(--text-faint);
- @include truncate();
- }
- }
-
- &__spark {
- display: block;
- height: 38px;
-
- svg { width: 100%; height: 100%; }
-
- &--empty {
- border-bottom: 1px dashed var(--border-soft);
- height: 37px;
- }
- }
-
- // mono footer stats (mock `.host-mini`)
- &__mini {
- display: flex;
- justify-content: space-between;
- gap: 10px;
- margin-top: 10px;
- font-family: var(--mono);
- font-size: 11px;
- color: var(--text-faint);
-
- span { white-space: nowrap; }
- b { color: var(--text-dim); font-weight: 600; }
- }
- }
-
- // ── alert rows (active alerts + history; prototype .alert-row)
- .mon-alert-list {
- display: flex;
- flex-direction: column;
- }
-
- .mon-alert-row {
- display: flex;
- align-items: center;
- gap: 14px;
- padding: 12px 0;
- border-top: 1px solid var(--border-soft);
-
- &:first-child {
- border-top: none;
- padding-top: 0;
- }
-
- &:last-child { padding-bottom: 0; }
-
- &__body {
- flex: 1;
- min-width: 0;
- }
-
- &__title {
- font-size: 13.5px;
- font-weight: 550;
- color: var(--text);
- }
-
- &__sub {
- margin-top: 2px;
- font-family: var(--mono);
- font-size: 11.5px;
- color: var(--text-faint);
- }
-
- &__end {
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- gap: 4px;
- flex-shrink: 0;
- }
-
- &__time {
- font-family: var(--mono);
- font-size: 10.5px;
- color: var(--text-faint);
- white-space: nowrap;
- }
-
- @media (max-width: 640px) {
- align-items: flex-start;
-
- &__end { align-items: flex-start; }
- }
- }
-
- // Severity dot (prototype .sev)
- .mon-sev {
- width: 9px;
- height: 9px;
- border-radius: 3px;
- flex-shrink: 0;
- background: var(--text-ghost);
-
- &--critical { background: var(--red); }
- &--warning { background: var(--amber); }
- &--info { background: var(--cyan); }
- }
-
- // State chip (prototype .alert-state: st-firing / st-resolved) —
- // shape from the shared %sk-state primitive (_design-system.scss)
- .mon-state {
- @extend %sk-state;
-
- &--red { color: var(--red); background: var(--red-bg); }
- &--amber { color: var(--amber); background: var(--amber-bg); }
- &--cyan { color: var(--cyan); background: var(--cyan-bg); }
- &--green { color: var(--green); background: var(--green-bg); }
- &--gray { color: var(--text-faint); background: var(--surface-3); }
- }
-
- // ── alert-rule editors (thresholds tab) ─────────────────
- .metric-rule-grid {
- display: grid;
- grid-template-columns: repeat(2, minmax(0, 1fr));
- gap: $space-3;
-
- @media (max-width: 1024px) {
- grid-template-columns: 1fr;
- }
- }
-
- .metric-rule-editor {
- min-width: 0;
- display: grid;
- grid-template-columns: minmax(0, 1fr) 150px auto;
- gap: $space-4;
- align-items: center;
- padding: 15px 16px;
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
- background: var(--surface-2);
-
- &.is-alerting {
- border-color: rgba(245, 185, 69, 0.35);
- }
-
- &__main {
- display: flex;
- gap: $space-3;
- align-items: center;
- min-width: 0;
-
- h4 {
- margin: 0 0 3px;
- font-size: 13.5px;
- font-weight: $font-weight-semibold;
- }
-
- span {
- font-family: var(--mono);
- font-size: 11.5px;
- color: var(--text-faint);
- }
- }
-
- &__threshold {
- display: grid;
- gap: $space-2;
- }
-
- > .sk-pill { justify-self: end; }
-
- @media (max-width: 820px) {
- grid-template-columns: 1fr;
- align-items: start;
-
- > .sk-pill { justify-self: start; }
- }
- }
-
- // Eyebrow-style field labels inside the editor + delivery forms
- .metric-rule-editor__threshold label,
- .monitoring-delivery-layout .form-group label {
- font-family: var(--mono);
- font-size: 10px;
- font-weight: $font-weight-semibold;
- letter-spacing: 0.08em;
- text-transform: uppercase;
- color: var(--text-faint);
- }
-
- // ── delivery tab ────────────────────────────────────────
- .monitoring-delivery-layout {
- grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
-
- @media (max-width: 1000px) {
- grid-template-columns: 1fr;
- }
- }
-
- .monitoring-switch-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: $space-4;
- padding: $space-4;
- margin-bottom: $space-4;
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
- background: var(--surface-2);
-
- strong {
- display: block;
- font-size: 13px;
- font-weight: $font-weight-semibold;
- }
-
- span {
- display: block;
- margin-top: 3px;
- font-family: var(--mono);
- font-size: 11px;
- color: var(--text-faint);
- }
- }
-
- .notification-channel-grid {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
- gap: $space-3;
- }
-
- .notification-channel-tile {
- display: grid;
- grid-template-columns: auto minmax(0, 1fr) auto;
- gap: $space-3;
- align-items: center;
- padding: 13px 14px;
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
- background: var(--surface-2);
-
- &.is-ready {
- border-color: rgba(61, 220, 151, 0.3);
-
- .mon-ico {
- @include status-variant(var(--green), var(--green-bg));
- }
- }
-
- // A channel with no credentials yet is a to-do, not a failure: dim the
- // brand mark rather than colouring it like a live one.
- &.is-unset .mon-ico { opacity: 0.5; }
-
- > div { min-width: 0; }
-
- strong {
- display: block;
- font-size: 13px;
- font-weight: $font-weight-semibold;
- @include truncate();
- }
-
- span {
- display: block;
- margin-top: 2px;
- font-family: var(--mono);
- font-size: 10.5px;
- color: var(--text-faint);
- // "Configured but off" is longer than the tile is wide at three
- // across; clip it rather than let it fold and grow the row.
- @include truncate();
- }
- }
-
- .form-help {
- display: block;
- margin-top: $space-1;
- font-family: var(--mono);
- font-size: 11px;
- color: var(--text-faint);
- }
-
- // Speed test — three readings in a row, sized to sit beside the alerts
- // panel rather than take a band of its own.
- .mon-speed-row {
- display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: $space-3;
- }
-
- .mon-speed {
- min-width: 0;
- padding: 12px 14px;
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
- background: var(--surface-2);
-
- // Only the glyph is tinted here — the tile keeps the quiet surface, so
- // three of them side by side don't read as three status badges.
- &__ico {
- display: block;
- margin-bottom: 6px;
- background: none;
-
- &.is-cpu { color: var(--accent-bright); }
- &.is-memory { color: var(--cyan); }
- &.is-extra { color: var(--violet); }
- }
-
- &__val {
- display: block;
- font-family: var(--mono);
- font-size: 19px;
- font-weight: $font-weight-semibold;
- letter-spacing: -0.02em;
- line-height: 1;
- color: var(--text);
-
- small {
- margin-left: 3px;
- font-size: 11px;
- color: var(--text-faint);
- }
- }
-
- &__label {
- display: block;
- margin-top: 5px;
- font-size: 11.5px;
- color: var(--text-dim);
- }
- }
-
- .mon-speed-meta {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: $space-3;
- margin-top: $space-3;
-
- span {
- font-family: var(--mono);
- font-size: 11px;
- color: var(--text-faint);
- }
- }
-
- // ── fleet-scoped panels (Host health, Capacity, Fleet alerts) ──
- // Folded in from the old standalone Fleet Monitor page; they reuse the
- // panel chrome above so the sections read as one page rather than two
- // stapled together.
-
- // Small mono caption used for every field label in the fleet panels.
- .mon-field-label {
- display: block;
- margin-bottom: 4px;
- font-family: var(--mono);
- font-size: 10.5px;
- font-weight: $font-weight-semibold;
- letter-spacing: 0.06em;
- text-transform: uppercase;
- color: var(--text-faint);
- }
-
- .mon-field-hint,
- .mon-panel-hint {
- display: flex;
- align-items: center;
- gap: $space-2;
- margin: 0;
- font-size: $font-size-sm;
- color: var(--text-faint);
- }
-
- .mon-panel-hint svg { flex-shrink: 0; color: var(--green); }
-
- // Wide tables keep their own scroller so the panel never widens the page.
- .mon-table-scroll { overflow-x: auto; }
-
- .mon-row-actions {
- display: flex;
- justify-content: flex-end;
- gap: $space-1;
- white-space: nowrap;
- }
-
- // Add-a-rule form on the Rules tab: fields in a row, save at the end.
- .mon-threshold-form {
- display: flex;
- flex-wrap: wrap;
- align-items: flex-end;
- gap: $space-3;
- margin-bottom: $space-4;
- padding: $space-4;
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
- background: var(--surface-2);
-
- .form-group { margin: 0; min-width: 150px; flex: 1 1 150px; }
- }
-
- // Comparison / forecast control rows: a servers picker that grows, plus
- // fixed-width selects.
- .mon-compare-controls {
- display: flex;
- flex-wrap: wrap;
- align-items: flex-start;
- gap: $space-4;
- margin-bottom: $space-4;
-
- .form-group { margin: 0; min-width: 160px; }
-
- &__servers { flex: 1 1 320px; min-width: 0; }
- }
-
- .mon-server-picker {
- display: flex;
- flex-wrap: wrap;
- gap: $space-2;
- max-height: 96px;
- overflow-y: auto;
- padding: $space-2;
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
- background: var(--surface-2);
- }
-
- .mon-period-switch { display: flex; gap: 4px; align-items: center; }
-
- .mon-forecast {
- display: flex;
- flex-direction: column;
- gap: $space-4;
- }
-
- .mon-forecast__stats,
- .mon-forecast__predictions {
- display: grid;
- gap: $space-3;
- }
-
- .mon-forecast__stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
- .mon-forecast__predictions { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
-
- .mon-forecast strong {
- display: block;
- font-size: $font-size-lg;
- color: var(--text);
-
- em { font-style: normal; font-size: $font-size-sm; color: var(--text-faint); }
- }
-
-}
+// Shared page surfaces live in _monitors.scss; this partial owns the
+// group topbar scope picker and its portalled menu.
// ── server scope picker ──────────────────────────────────────
// Lives in the group top bar and its menu portals to <body>, so neither can be
diff --git a/frontend/src/styles/pages/_monitors.scss b/frontend/src/styles/pages/_monitors.scss
index 6dc678da..43e25cf1 100644
--- a/frontend/src/styles/pages/_monitors.scss
+++ b/frontend/src/styles/pages/_monitors.scss
@@ -1,14 +1,682 @@
// ============================================
// MONITORS — list, detail, incidents, uptime strip
// ============================================
-// Shared `mon-*` panel/section/hint rules come from _monitoring.scss, whose
-// root selector list includes these pages. Only what is new lives here.
+// Owns the shared `mon-*` panel, section, and hint vocabulary for the whole
+// Monitoring group, including its overview and detail pages.
// ── panels ──────────────────────────────────────────────────
+.monitoring-page,
.monitors-page,
.incidents-page,
.monitor-detail {
+ // ── shared bits ─────────────────────────────────────────
+ // Mono-uppercase eyebrow section headers
+ .mon-section-head h3,
+ .monitoring-panel__header h3 {
+ margin: 0;
+ font-family: var(--mono);
+ font-size: 10.5px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--text-faint);
+ }
+
+ // Neutral icon tile (rule editors, channel tiles, host cards)
+ .mon-ico {
+ width: 30px;
+ height: 30px;
+ border-radius: 8px;
+ display: grid;
+ place-items: center;
+ flex-shrink: 0;
+ background: var(--surface-3);
+ color: var(--text-dim);
+
+ &--sm {
+ width: 26px;
+ height: 26px;
+ border-radius: 7px;
+ }
+ }
+
+ // Every section stacks the same way, so a tab change never shifts the
+ // rhythm of the page.
+ .mon-overview,
+ .monitoring-stack,
+ .monitoring-delivery-layout {
+ display: grid;
+ gap: $space-5;
+ }
+
+ // Two equal panels side by side (charts row, alerts + speed test row) —
+ // the mock's `dash-grid` with two `span-2` cards.
+ .mon-grid2 {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: $space-5;
+
+ @media (max-width: 1000px) { grid-template-columns: 1fr; }
+ }
+
+ // ── section heads + panels ──────────────────────────────
+ .mon-section-head {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: $space-3;
+ margin-bottom: -$space-2; // the grid gap already spaces it off the grid
+
+ &__meta {
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--text-faint);
+ }
+ }
+
+ // Caption under a panel heading — says what the panel is showing and,
+ // crucially, WHICH host it is showing it for. One line: a wrapped caption
+ // pushes the chart down and makes the two panels in a row disagree on where
+ // their plots start.
+ .mon-panel-sub {
+ display: block;
+ max-width: 100%;
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--text-faint);
+ @include truncate();
+ }
+
+ .monitoring-panel__header > div {
+ // A heading with a caption stacks and takes the free space; the default
+ // row layout is for headers whose second child is a button cluster.
+ &:has(> h3) {
+ flex: 1 1 auto;
+ min-width: 0;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 3px;
+ }
+ }
+
+ // Controls on the right of a panel header never wrap or shrink — letting
+ // them do either steals width from the caption and folds a 4-button switch
+ // onto two lines.
+ .mon-period-switch,
+ .mon-legend {
+ flex: none;
+ flex-wrap: nowrap;
+ }
+
+ .mon-legend {
+ display: flex;
+ gap: $space-3;
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--text-faint);
+
+ span { display: inline-flex; align-items: center; gap: 5px; }
+
+ i {
+ width: 8px;
+ height: 8px;
+ border-radius: 2px;
+
+ &.is-memory { background: var(--cyan); }
+ &.is-disk { background: var(--green); }
+ }
+ }
+
+ .monitoring-panel {
+ min-width: 0;
+ padding: $space-5;
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+ background: var(--surface);
+
+ &--warning {
+ border-color: rgba(251, 111, 111, 0.28);
+ }
+ }
+
+ .monitoring-panel__header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: $space-3;
+ margin-bottom: $space-4;
+
+ > div {
+ display: flex;
+ flex-wrap: wrap;
+ gap: $space-2;
+ }
+
+ @media (max-width: 640px) {
+ align-items: flex-start;
+ flex-direction: column;
+ }
+ }
+
+ // The KPI band is the shared DS tile (MetricCard + KpiBand) — the
+ // monitoring-only copy that lived here was the same geometry twice, so the
+ // sparkline slot moved into the primitive instead.
+
+ // ── Host health strip: one card per machine, the panel host first ──
+ // This is the ex-Fleet-Monitor heatmap, except each card is a button that
+ // re-scopes the whole page rather than a cell you can only read.
+ .mon-fleet-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
+ gap: 14px;
+ }
+
+ .mon-host {
+ display: block;
+ width: 100%;
+ min-width: 0;
+ padding: 14px 16px 12px;
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+ background: var(--surface);
+ text-align: left;
+ cursor: pointer;
+ transition: border-color $transition-fast, background $transition-fast;
+
+ &:hover { border-color: var(--border-strong); }
+
+ &.is-active {
+ border-color: var(--accent-dim);
+ background: var(--accent-bg);
+ }
+
+ &__head {
+ display: flex;
+ align-items: center;
+ gap: 9px;
+ margin-bottom: 10px;
+
+ .sk-pill { margin-left: auto; flex-shrink: 0; }
+ }
+
+ &__ico {
+ width: 28px;
+ height: 28px;
+ border-radius: 8px;
+ display: grid;
+ place-items: center;
+ flex-shrink: 0;
+ background: var(--surface-3);
+ color: var(--text-dim);
+ }
+
+ &__name {
+ flex: 1;
+ min-width: 0;
+ font-size: 13px;
+ font-weight: $font-weight-semibold;
+ color: var(--text);
+ @include truncate();
+
+ small {
+ display: block;
+ font-family: var(--mono);
+ font-size: 10px;
+ font-weight: 400;
+ color: var(--text-faint);
+ @include truncate();
+ }
+ }
+
+ &__spark {
+ display: block;
+ height: 38px;
+
+ svg { width: 100%; height: 100%; }
+
+ &--empty {
+ border-bottom: 1px dashed var(--border-soft);
+ height: 37px;
+ }
+ }
+
+ // mono footer stats (mock `.host-mini`)
+ &__mini {
+ display: flex;
+ justify-content: space-between;
+ gap: 10px;
+ margin-top: 10px;
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--text-faint);
+
+ span { white-space: nowrap; }
+ b { color: var(--text-dim); font-weight: 600; }
+ }
+ }
+
+ // ── alert rows (active alerts + history; prototype .alert-row)
+ .mon-alert-list {
+ display: flex;
+ flex-direction: column;
+ }
+
+ .mon-alert-row {
+ display: flex;
+ align-items: center;
+ gap: 14px;
+ padding: 12px 0;
+ border-top: 1px solid var(--border-soft);
+
+ &:first-child {
+ border-top: none;
+ padding-top: 0;
+ }
+
+ &:last-child { padding-bottom: 0; }
+
+ &__body {
+ flex: 1;
+ min-width: 0;
+ }
+
+ &__title {
+ font-size: 13.5px;
+ font-weight: 550;
+ color: var(--text);
+ }
+
+ &__sub {
+ margin-top: 2px;
+ font-family: var(--mono);
+ font-size: 11.5px;
+ color: var(--text-faint);
+ }
+
+ &__end {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-end;
+ gap: 4px;
+ flex-shrink: 0;
+ }
+
+ &__time {
+ font-family: var(--mono);
+ font-size: 10.5px;
+ color: var(--text-faint);
+ white-space: nowrap;
+ }
+
+ @media (max-width: 640px) {
+ align-items: flex-start;
+
+ &__end { align-items: flex-start; }
+ }
+ }
+
+ // Severity dot (prototype .sev)
+ .mon-sev {
+ width: 9px;
+ height: 9px;
+ border-radius: 3px;
+ flex-shrink: 0;
+ background: var(--text-ghost);
+
+ &--critical { background: var(--red); }
+ &--warning { background: var(--amber); }
+ &--info { background: var(--cyan); }
+ }
+
+ // State chip (prototype .alert-state: st-firing / st-resolved) —
+ // shape from the shared %sk-state primitive (_design-system.scss)
+ .mon-state {
+ @extend %sk-state;
+
+ &--red { color: var(--red); background: var(--red-bg); }
+ &--amber { color: var(--amber); background: var(--amber-bg); }
+ &--cyan { color: var(--cyan); background: var(--cyan-bg); }
+ &--green { color: var(--green); background: var(--green-bg); }
+ &--gray { color: var(--text-faint); background: var(--surface-3); }
+ }
+
+ // ── alert-rule editors (thresholds tab) ─────────────────
+ .metric-rule-grid {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: $space-3;
+
+ @media (max-width: 1024px) {
+ grid-template-columns: 1fr;
+ }
+ }
+
+ .metric-rule-editor {
+ min-width: 0;
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 150px auto;
+ gap: $space-4;
+ align-items: center;
+ padding: 15px 16px;
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+ background: var(--surface-2);
+
+ &.is-alerting {
+ border-color: rgba(245, 185, 69, 0.35);
+ }
+
+ &__main {
+ display: flex;
+ gap: $space-3;
+ align-items: center;
+ min-width: 0;
+
+ h4 {
+ margin: 0 0 3px;
+ font-size: 13.5px;
+ font-weight: $font-weight-semibold;
+ }
+
+ span {
+ font-family: var(--mono);
+ font-size: 11.5px;
+ color: var(--text-faint);
+ }
+ }
+
+ &__threshold {
+ display: grid;
+ gap: $space-2;
+ }
+
+ > .sk-pill { justify-self: end; }
+
+ @media (max-width: 820px) {
+ grid-template-columns: 1fr;
+ align-items: start;
+
+ > .sk-pill { justify-self: start; }
+ }
+ }
+
+ // Eyebrow-style field labels inside the editor + delivery forms
+ .metric-rule-editor__threshold label,
+ .monitoring-delivery-layout .form-group label {
+ font-family: var(--mono);
+ font-size: 10px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--text-faint);
+ }
+
+ // ── delivery tab ────────────────────────────────────────
+ .monitoring-delivery-layout {
+ grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
+
+ @media (max-width: 1000px) {
+ grid-template-columns: 1fr;
+ }
+ }
+
+ .monitoring-switch-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: $space-4;
+ padding: $space-4;
+ margin-bottom: $space-4;
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+ background: var(--surface-2);
+
+ strong {
+ display: block;
+ font-size: 13px;
+ font-weight: $font-weight-semibold;
+ }
+
+ span {
+ display: block;
+ margin-top: 3px;
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--text-faint);
+ }
+ }
+
+ .notification-channel-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
+ gap: $space-3;
+ }
+
+ .notification-channel-tile {
+ display: grid;
+ grid-template-columns: auto minmax(0, 1fr) auto;
+ gap: $space-3;
+ align-items: center;
+ padding: 13px 14px;
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+ background: var(--surface-2);
+
+ &.is-ready {
+ border-color: rgba(61, 220, 151, 0.3);
+
+ .mon-ico {
+ @include status-variant(var(--green), var(--green-bg));
+ }
+ }
+
+ // A channel with no credentials yet is a to-do, not a failure: dim the
+ // brand mark rather than colouring it like a live one.
+ &.is-unset .mon-ico { opacity: 0.5; }
+
+ > div { min-width: 0; }
+
+ strong {
+ display: block;
+ font-size: 13px;
+ font-weight: $font-weight-semibold;
+ @include truncate();
+ }
+
+ span {
+ display: block;
+ margin-top: 2px;
+ font-family: var(--mono);
+ font-size: 10.5px;
+ color: var(--text-faint);
+ // "Configured but off" is longer than the tile is wide at three
+ // across; clip it rather than let it fold and grow the row.
+ @include truncate();
+ }
+ }
+
+ .form-help {
+ display: block;
+ margin-top: $space-1;
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--text-faint);
+ }
+
+ // Speed test — three readings in a row, sized to sit beside the alerts
+ // panel rather than take a band of its own.
+ .mon-speed-row {
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: $space-3;
+ }
+
+ .mon-speed {
+ min-width: 0;
+ padding: 12px 14px;
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+ background: var(--surface-2);
+
+ // Only the glyph is tinted here — the tile keeps the quiet surface, so
+ // three of them side by side don't read as three status badges.
+ &__ico {
+ display: block;
+ margin-bottom: 6px;
+ background: none;
+
+ &.is-cpu { color: var(--accent-bright); }
+ &.is-memory { color: var(--cyan); }
+ &.is-extra { color: var(--violet); }
+ }
+
+ &__val {
+ display: block;
+ font-family: var(--mono);
+ font-size: 19px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: -0.02em;
+ line-height: 1;
+ color: var(--text);
+
+ small {
+ margin-left: 3px;
+ font-size: 11px;
+ color: var(--text-faint);
+ }
+ }
+
+ &__label {
+ display: block;
+ margin-top: 5px;
+ font-size: 11.5px;
+ color: var(--text-dim);
+ }
+ }
+
+ .mon-speed-meta {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: $space-3;
+ margin-top: $space-3;
+
+ span {
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--text-faint);
+ }
+ }
+
+ // ── fleet-scoped panels (Host health, Capacity, Fleet alerts) ──
+ // Folded in from the old standalone Fleet Monitor page; they reuse the
+ // panel chrome above so the sections read as one page rather than two
+ // stapled together.
+
+ // Small mono caption used for every field label in the fleet panels.
+ .mon-field-label {
+ display: block;
+ margin-bottom: 4px;
+ font-family: var(--mono);
+ font-size: 10.5px;
+ font-weight: $font-weight-semibold;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+ color: var(--text-faint);
+ }
+ .mon-field-hint,
+ .mon-panel-hint {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ margin: 0;
+ font-size: $font-size-sm;
+ color: var(--text-faint);
+ }
+
+ .mon-panel-hint svg { flex-shrink: 0; color: var(--green); }
+
+ // Wide tables keep their own scroller so the panel never widens the page.
+ .mon-table-scroll { overflow-x: auto; }
+
+ .mon-row-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: $space-1;
+ white-space: nowrap;
+ }
+
+ // Add-a-rule form on the Rules tab: fields in a row, save at the end.
+ .mon-threshold-form {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: flex-end;
+ gap: $space-3;
+ margin-bottom: $space-4;
+ padding: $space-4;
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+ background: var(--surface-2);
+
+ .form-group { margin: 0; min-width: 150px; flex: 1 1 150px; }
+ }
+
+ // Comparison / forecast control rows: a servers picker that grows, plus
+ // fixed-width selects.
+ .mon-compare-controls {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: flex-start;
+ gap: $space-4;
+ margin-bottom: $space-4;
+
+ .form-group { margin: 0; min-width: 160px; }
+
+ &__servers { flex: 1 1 320px; min-width: 0; }
+ }
+
+ .mon-server-picker {
+ display: flex;
+ flex-wrap: wrap;
+ gap: $space-2;
+ max-height: 96px;
+ overflow-y: auto;
+ padding: $space-2;
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+ background: var(--surface-2);
+ }
+
+ .mon-period-switch { display: flex; gap: 4px; align-items: center; }
+
+ .mon-forecast {
+ display: flex;
+ flex-direction: column;
+ gap: $space-4;
+ }
+
+ .mon-forecast__stats,
+ .mon-forecast__predictions {
+ display: grid;
+ gap: $space-3;
+ }
+
+ .mon-forecast__stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
+ .mon-forecast__predictions { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
+
+ .mon-forecast strong {
+ display: block;
+ font-size: $font-size-lg;
+ color: var(--text);
+
+ em { font-style: normal; font-size: $font-size-sm; color: var(--text-faint); }
+ }
+}
+
+.monitors-page,
+.incidents-page,
+.monitor-detail {
.mon-stack { display: flex; flex-direction: column; gap: 16px; }
.mon-grid-2 {
@@ -101,9 +769,80 @@
}
}
+.monitor-detail {
+ .monitor-detail__crumb {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-bottom: 14px;
+ font-size: 12.5px;
+ color: var(--text-faint);
+
+ a { color: var(--accent-bright); text-decoration: none; }
+ a:hover { text-decoration: underline; }
+ }
+
+ .monitor-detail__sections { margin: 18px 0 16px; }
+
+ .mon-kpi-sub {
+ margin-top: 4px;
+ font-family: var(--mono);
+ font-size: 10.5px;
+ color: var(--text-faint);
+ }
+
+ .mon-statstrip {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
+ gap: 12px;
+ margin-top: 14px;
+ padding-top: 14px;
+ border-top: 1px solid var(--border-soft);
+ }
+
+ .mon-statstrip__label {
+ display: block;
+ font-family: var(--mono);
+ font-size: 10px;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ color: var(--text-faint);
+ }
+
+ .mon-statstrip__value {
+ display: block;
+ margin-top: 3px;
+ font-family: var(--mono);
+ font-size: 15px;
+ font-weight: 600;
+ }
+
+ .mon-uptime-summary { display: flex; gap: 18px; text-align: right; }
+
+ .mon-uptime-axis {
+ display: flex;
+ justify-content: space-between;
+ margin-top: 8px;
+ font-family: var(--mono);
+ font-size: 10.5px;
+ color: var(--text-faint);
+ }
+
+ .mon-checkdetail {
+ max-width: 380px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-family: var(--mono);
+ font-size: 11.5px;
+ color: var(--text-faint);
+ }
+
+ tr.is-bad .mon-checkdetail { color: var(--red); }
+}
+
// ── list ────────────────────────────────────────────────────
.monitors-page {
-
.mon-card {
background: var(--bg-card, var(--surface-1));
border: 1px solid var(--border-soft);
@@ -214,78 +953,6 @@
}
// ── detail ──────────────────────────────────────────────────
-.monitor-detail {
-
- .monitor-detail__crumb {
- display: flex;
- align-items: center;
- gap: 8px;
- margin-bottom: 14px;
- font-size: 12.5px;
- color: var(--text-faint);
-
- a { color: var(--accent-bright); text-decoration: none; }
- a:hover { text-decoration: underline; }
- }
-
- .monitor-detail__sections { margin: 18px 0 16px; }
-
- .mon-kpi-sub {
- margin-top: 4px;
- font-family: var(--mono);
- font-size: 10.5px;
- color: var(--text-faint);
- }
-
- .mon-statstrip {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
- gap: 12px;
- margin-top: 14px;
- padding-top: 14px;
- border-top: 1px solid var(--border-soft);
- }
-
- .mon-statstrip__label {
- display: block;
- font-family: var(--mono);
- font-size: 10px;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- color: var(--text-faint);
- }
-
- .mon-statstrip__value {
- display: block;
- margin-top: 3px;
- font-family: var(--mono);
- font-size: 15px;
- font-weight: 600;
- }
-
- .mon-uptime-summary { display: flex; gap: 18px; text-align: right; }
-
- .mon-uptime-axis {
- display: flex;
- justify-content: space-between;
- margin-top: 8px;
- font-family: var(--mono);
- font-size: 10.5px;
- color: var(--text-faint);
- }
-
- .mon-checkdetail {
- max-width: 380px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-family: var(--mono);
- font-size: 11.5px;
- color: var(--text-faint);
- }
-
- tr.is-bad .mon-checkdetail { color: var(--red); }
-}
// ── 90-day uptime strip ─────────────────────────────────────
.uptime-bars {
@@ -317,7 +984,6 @@
// ── overview: monitors summary ──────────────────────────────
.monitoring-page {
-
.mon-monitors-summary {
display: flex;
flex-direction: column;
@@ -378,7 +1044,6 @@
// ── incidents ───────────────────────────────────────────────
.incidents-page {
-
.incidents-list {
background: var(--bg-card, var(--surface-1));
border: 1px solid var(--border-soft);
diff --git a/frontend/src/styles/pages/_queue-operations.scss b/frontend/src/styles/pages/_queue-operations.scss
index 5bd9b36d..7c737af2 100644
--- a/frontend/src/styles/pages/_queue-operations.scss
+++ b/frontend/src/styles/pages/_queue-operations.scss
@@ -659,3 +659,6 @@
.queue-table tbody tr.is-selected {
background: $accent-glow;
}
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.queue-action-icon { margin-inline-end: 0.5rem; }
diff --git a/frontend/src/styles/pages/_security.scss b/frontend/src/styles/pages/_security.scss
index 485b8efc..28cd2ff8 100644
--- a/frontend/src/styles/pages/_security.scss
+++ b/frontend/src/styles/pages/_security.scss
@@ -7,7 +7,6 @@
// their tab-root class so nothing leaks to other pages.
.security-page {
-
// ── card chrome (all tabs) ──────────────────────────────
.tab-content {
.card {
@@ -611,105 +610,8 @@
}
// ── Events tab ───────────────────────────────────────────────
-.events-tab {
- .failed-login-summary {
- display: flex;
- align-items: baseline;
- gap: $space-3;
-
- .count {
- font-family: var(--mono);
- font-size: 26px;
- font-weight: $font-weight-semibold;
- letter-spacing: -0.02em;
-
- &.danger {
- color: var(--red);
- }
- }
-
- .label {
- font-family: var(--mono);
- font-size: 11.5px;
- color: var(--text-faint);
- }
- }
-
- .recent-failures {
- margin-top: $space-4;
-
- summary {
- cursor: pointer;
- font-size: 12.5px;
- color: var(--accent-bright);
-
- &:hover {
- text-decoration: underline;
- }
- }
-
- pre {
- margin-top: $space-2;
- padding: $space-4;
- max-height: 200px;
- overflow: auto;
- background: var(--bg-code);
- border: 1px solid var(--border-soft);
- border-radius: var(--radius-sm);
- font-family: var(--mono);
- font-size: 11px;
- line-height: 1.6;
- color: var(--text-code);
- }
- }
-}
// ── Settings tab ─────────────────────────────────────────────
-.settings-tab {
- .card { max-width: 860px; }
-
- .form-group {
- margin: 0;
- padding: 2px 0;
-
- & + .form-group {
- border-top: 1px solid var(--border-soft);
- }
-
- // Eyebrow-style field labels (text inputs)
- > label {
- display: block;
- margin: 10px 0 6px;
- font-family: var(--mono);
- font-size: 10px;
- font-weight: $font-weight-semibold;
- letter-spacing: 0.08em;
- text-transform: uppercase;
- color: var(--text-faint);
- }
- }
-
- .toggle-switch-label {
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: $space-4;
- padding: 9px 0;
-
- label {
- margin: 0;
- font-size: 13.5px;
- font-weight: $font-weight-medium;
- color: var(--text);
- cursor: pointer;
- }
- }
-
- .form-actions {
- display: flex;
- justify-content: flex-start;
- }
-}
// ── Firewall tab ─────────────────────────────────────────────
.firewall-tab {
@@ -1036,43 +938,11 @@
}
}
-.info-list {
- display: flex;
- flex-direction: column;
- gap: $space-2;
-}
-
-.info-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: $space-2 0;
- border-bottom: 1px solid $border-subtle;
-
- &:last-child {
- border-bottom: none;
- }
-
- .info-label {
- color: $text-secondary;
- }
-
- .info-value {
- font-weight: 500;
- }
-}
-
.help-text {
color: $text-secondary;
font-size: $font-size-sm;
}
-.loading-sm {
- color: $text-tertiary;
- font-size: $font-size-sm;
- padding: $space-4;
-}
-
// Scrollable tabs for many tabs
.tabs-nav-scrollable {
flex-wrap: nowrap;
diff --git a/frontend/src/styles/pages/_server-templates.scss b/frontend/src/styles/pages/_server-templates.scss
index fb9ab4a2..f0600310 100644
--- a/frontend/src/styles/pages/_server-templates.scss
+++ b/frontend/src/styles/pages/_server-templates.scss
@@ -83,3 +83,6 @@
&:hover { background: $bg-hover; }
}
}
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.server-template-error-actions { display: flex; gap: 0.5rem; }
diff --git a/frontend/src/styles/pages/_servers.scss b/frontend/src/styles/pages/_servers.scss
index bf26567d..6729b034 100644
--- a/frontend/src/styles/pages/_servers.scss
+++ b/frontend/src/styles/pages/_servers.scss
@@ -919,49 +919,7 @@
}
}
-.status-dot {
- width: 12px;
- height: 12px;
- border-radius: 50%;
-
- &.large {
- width: 14px;
- height: 14px;
- }
-}
-
-.tab-btn {
- background: transparent;
- border: none;
- color: $text-tertiary;
- font-size: $font-size-sm;
- font-weight: $font-weight-medium;
- padding: $space-3 $space-4;
- cursor: pointer;
- border-bottom: 2px solid transparent;
- margin-bottom: -1px;
- transition: all $transition-base;
-
- &:hover {
- color: $text-primary;
- }
-
- &.active {
- color: $text-primary;
- border-bottom-color: $accent-primary;
- }
-}
-
// Overview Tab
-.overview-grid {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: $space-5;
-
- @media (max-width: $breakpoint-lg) {
- grid-template-columns: 1fr;
- }
-}
.info-card {
background: $bg-card;
@@ -979,61 +937,6 @@
}
}
-.info-list {
- display: flex;
- flex-direction: column;
- gap: $space-3;
-}
-
-.info-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- .info-label {
- font-size: $font-size-sm;
- color: $text-tertiary;
- }
-
- .info-value {
- font-size: $font-size-sm;
- color: $text-primary;
-
- &.mono {
- font-family: $font-mono;
- font-size: $font-size-xs;
- }
- }
-}
-
-.status-badge {
- display: inline-flex;
- align-items: center;
- gap: $space-1;
- padding: $space-1 $space-2;
- border-radius: $radius-sm;
- font-size: $font-size-xs;
- font-weight: $font-weight-medium;
- text-transform: capitalize;
-
- &.online {
- @include status-variant($success, $success-bg);
- }
-
- &.offline {
- @include status-variant($danger, $danger-bg);
- }
-
- &.connecting {
- @include status-variant($warning, $warning-bg);
- }
-
- &.pending {
- background: $bg-secondary;
- color: $text-tertiary;
- }
-}
-
.offline-card {
grid-column: span 2;
@@ -1245,51 +1148,6 @@
}
}
-.data-table {
- width: 100%;
- border-collapse: collapse;
-
- th {
- text-align: left;
- font-size: $font-size-xs;
- font-weight: $font-weight-semibold;
- color: $text-tertiary;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- padding: $space-3;
- border-bottom: 1px solid $border-subtle;
- }
-
- td {
- padding: $space-3;
- font-size: $font-size-sm;
- color: $text-secondary;
- border-bottom: 1px solid $border-subtle;
- }
-
- tr:last-child td {
- border-bottom: none;
- }
-
- .container-name {
- display: block;
- color: $text-primary;
- font-weight: $font-weight-medium;
- }
-
- .container-id {
- display: block;
- font-family: $font-mono;
- font-size: $font-size-xs;
- color: $text-tertiary;
- }
-
- .mono {
- font-family: $font-mono;
- font-size: $font-size-xs;
- }
-}
-
.status-pill {
display: inline-flex;
align-items: center;
@@ -1315,39 +1173,6 @@
justify-content: flex-end;
}
-.btn-icon {
- background: transparent;
- border: none;
- color: $text-tertiary;
- cursor: pointer;
- padding: $space-2;
- border-radius: $radius-sm;
- display: flex;
- align-items: center;
- justify-content: center;
-
- &:hover {
- color: $text-primary;
- background: $bg-hover;
- }
-
- &.success {
- color: $success;
-
- &:hover {
- background: $success-bg;
- }
- }
-
- &.danger {
- color: $danger;
-
- &:hover {
- background: $danger-bg;
- }
- }
-}
-
.empty-list {
text-align: center;
padding: $space-8;
@@ -1355,9 +1180,6 @@
}
// Metrics Tab
-.metrics-tab {
- padding: 0;
-}
.metrics-live-stats {
margin-top: $space-6;
@@ -1544,9 +1366,6 @@
}
// Settings Tab
-.settings-tab {
- max-width: none;
-}
.settings-grid {
display: grid;
@@ -1564,18 +1383,6 @@
}
}
-.settings-form {
- margin-bottom: 0;
- background: transparent;
- border: none;
- border-radius: 0;
- padding: 0;
-
- .form-section .btn[type="submit"] {
- margin-top: $space-4;
- }
-}
-
.security-grid {
display: grid;
grid-template-columns: 1fr 1fr;
@@ -1878,16 +1685,6 @@
}
}
-.form-row {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: $space-4;
-
- @media (max-width: $breakpoint-sm) {
- grid-template-columns: 1fr;
- }
-}
-
// ============================================
// AGENT REGISTRATION SECTION
// ============================================
@@ -1982,25 +1779,6 @@
}
}
-.permission-checkbox {
- display: flex;
- align-items: center;
- gap: $space-2;
- font-size: $font-size-sm;
- color: $text-secondary;
- cursor: pointer;
-
- input[type="checkbox"] {
- width: 16px;
- height: 16px;
- accent-color: $accent-primary;
- }
-
- &:hover {
- color: $text-primary;
- }
-}
-
.install-instructions {
display: flex;
flex-direction: column;
@@ -2315,7 +2093,6 @@
font-size: $font-size-sm;
}
-
// ============================================
// SERVERS — REDESIGNED OPS CONSOLE
// ============================================
@@ -2705,17 +2482,6 @@
}
// Servers workspace polish: match the Docker route's rail + work surface.
-.btn-ghost {
- background: transparent;
- border: 1px solid transparent;
- color: $text-secondary;
-
- &:hover {
- background: $bg-elevated;
- color: $text-primary;
- }
-}
-
// ============================================
// SERVER DETAIL — REDESIGNED HEADER
@@ -3313,7 +3079,6 @@
// tabs, settings) or styled by other partials. Scoping keeps this restyle
// from leaking outside the ServerDetail route.
.server-detail-page {
-
// ---- In-page tab strip (shadcn Tabs renders .tabs / .tab) ----
// Demo `.wp-tab` spec: 13px labels, faint → dim → active text + accent
// underline. Tab ids/keys and deep-linking are untouched (JSX as-is).
diff --git a/frontend/src/styles/pages/_service-detail.scss b/frontend/src/styles/pages/_service-detail.scss
index b1f31770..deb76c61 100644
--- a/frontend/src/styles/pages/_service-detail.scss
+++ b/frontend/src/styles/pages/_service-detail.scss
@@ -434,69 +434,13 @@ h3.svc-eyebrow {
// ============================================
// EVENTS TAB — the merged activity table
// ============================================
-.events-tab {
- // The Event cell stacks the message over its meta line, so the ellipsis on
- // the message needs a min-width:0 flex parent to bite against.
- &__cell {
- display: flex;
- flex-direction: column;
- min-width: 0;
- }
-
- // Config and audit rows carry everything they have in the row itself —
- // only a deploy opens a drawer, so only a deploy gets a pointer.
- .sk-dtable tbody tr.is-static {
- cursor: default;
- }
-
- // A cell with genuinely nothing behind it (an audit entry has no outcome).
- &__none {
- color: var(--text-faint);
- }
-
- &__event-sha {
- font-family: var(--mono);
- font-size: $font-size-sm;
- @include status-variant(var(--accent-bright), var(--accent-bg));
- padding: 1px $space-2;
- border-radius: $radius-sm;
- flex-shrink: 0;
- }
-
- &__event-message {
- font-size: $font-size-base - 1;
- color: $text-primary;
- font-weight: $font-weight-medium;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- // The build log, now shown in the deploy drawer rather than in an expanded
- // row. Flat BEM, so it styles the same block wherever it is portalled to.
- &__event-logs {
- padding: $space-3;
- background: var(--bg-code);
- border: 1px solid var(--border-soft);
- border-radius: $radius-md;
- max-height: 60vh;
- overflow-y: auto;
-
- pre {
- margin: 0;
- font-family: var(--mono);
- font-size: $font-size-sm;
- color: var(--text-code);
- white-space: pre-wrap;
- word-break: break-all;
- }
- }
-}
// ============================================
// SHELL TAB — console re-tinted to tokens
// ============================================
.shell-tab {
+ &__container-select { font-size: $font-size-sm; }
+
&__container {
border: 1px solid var(--border-soft);
border-radius: var(--radius);
@@ -582,61 +526,6 @@ h3.svc-eyebrow {
// (no metrics HISTORY backend yet — see docs/REDESIGN_MAP.md §5; the cards
// bind to live point-in-time stats only, no fabricated series)
// ============================================
-.metrics-tab {
- &__grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
- gap: $space-4;
- }
-
- &__card {
- background: var(--surface);
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
- padding: $space-4 $space-5;
- transition: border-color 0.15s;
-
- &:hover {
- border-color: var(--border-strong);
- }
-
- .sk-gauge {
- margin-top: $space-3;
- }
- }
-
- &__card-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: $space-3;
-
- h4 {
- margin: 0;
- font-family: var(--mono);
- font-size: 11px;
- font-weight: $font-weight-semibold;
- letter-spacing: 0.08em;
- text-transform: uppercase;
- color: var(--text-faint);
- }
-
- span {
- font-family: var(--mono);
- font-size: 22px;
- font-weight: $font-weight-semibold;
- letter-spacing: -0.02em;
- color: $text-primary;
- }
- }
-
- &__info {
- margin-top: $space-2;
- font-family: var(--mono);
- font-size: $font-size-sm;
- color: var(--text-dim);
- }
-}
// Settings tab within service detail — grouped left sub-nav + content pane,
// mirroring the WordPress detail page's settings layout (.wp-settings).
@@ -750,10 +639,6 @@ h3.svc-eyebrow {
}
// Icon-only button (global utility consumed by several other components)
-.btn-icon {
- padding: $space-2 !important;
- min-width: auto !important;
-}
// ============================================
// MANIFEST PANEL (service settings → Manifest)
@@ -1387,73 +1272,6 @@ h3.svc-eyebrow {
}
}
-.logs-viewer {
- background: var(--bg-code);
- border: 1px solid var(--border-soft);
- border-top: none;
- border-radius: 0 0 var(--radius) var(--radius);
- min-height: 400px;
- max-height: 600px;
- overflow-y: auto;
- font-family: var(--mono);
- font-size: $font-size-sm;
- line-height: 1.7;
- scroll-behavior: smooth;
-
- &__loading, &__empty {
- padding: $space-8;
- text-align: center;
- color: var(--text-faint);
- }
-
- &__line {
- display: flex;
- padding: 0 $space-4;
- transition: background 0.1s;
-
- &:hover {
- background: var(--surface-hover);
- }
-
- &--error {
- background: rgba(251, 111, 111, 0.06);
- .logs-viewer__line-text { color: var(--red); }
- }
-
- &--warn {
- background: rgba(245, 185, 69, 0.06);
- .logs-viewer__line-text { color: var(--amber); }
- }
-
- &--debug {
- .logs-viewer__line-text { color: var(--text-faint); }
- }
- }
-
- &__line-num {
- width: 48px;
- padding-right: $space-3;
- color: var(--text-ghost);
- text-align: right;
- flex-shrink: 0;
- user-select: none;
- }
-
- &__line-text {
- flex: 1;
- color: var(--text-code);
- white-space: pre-wrap;
- word-break: break-all;
- }
-
- &__highlight {
- background: rgba(245, 185, 69, 0.35);
- color: var(--text);
- border-radius: 2px;
- padding: 0 1px;
- }
-}
-
// Open-in-new-tab affordance next to the service name, before the status pill.
.svc-detail__open,
.svc-detail__portlink {
@@ -1467,3 +1285,6 @@ h3.svc-eyebrow {
}
.svc-detail__open { margin-left: 2px; }
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.svc-title-link-icon { margin-inline-start: 0.25rem; }
diff --git a/frontend/src/styles/pages/_settings.scss b/frontend/src/styles/pages/_settings.scss
index d0b0219d..6effe9ac 100644
--- a/frontend/src/styles/pages/_settings.scss
+++ b/frontend/src/styles/pages/_settings.scss
@@ -397,66 +397,6 @@
}
// Settings Form
-.settings-form {
- background: $bg-card;
- border: 1px solid $border-subtle;
- border-radius: $radius-lg;
- padding: $space-5;
-
- .form-group {
- margin-bottom: $space-4;
-
- &:last-of-type {
- margin-bottom: 0;
- }
-
- label {
- display: block;
- font-size: $font-size-sm;
- font-weight: $font-weight-medium;
- color: $text-secondary;
- margin-bottom: $space-2;
- }
-
- input:not([type="checkbox"]):not([type="radio"]), select, textarea {
- width: 100%;
- padding: $space-3;
- background: $bg-hover;
- border: 1px solid $border-subtle;
- border-radius: $radius-md;
- color: $text-primary;
- font-size: $font-size-sm;
- transition: border-color $transition-fast;
-
- &:focus {
- outline: none;
- border-color: $accent-primary;
- }
-
- &:disabled,
- &.input-disabled {
- opacity: 0.6;
- cursor: not-allowed;
- background: $bg-body;
- }
- }
-
- .form-help {
- display: block;
- margin-top: $space-1;
- font-size: $font-size-xs;
- color: $text-tertiary;
- }
- }
-
- .form-actions {
- margin-top: $space-5;
- padding-top: $space-5;
- border-top: 1px solid $border-subtle;
- display: flex;
- gap: $space-2;
- }
-}
// Alert Messages — see components/_alerts.scss
@@ -787,35 +727,6 @@
}
}
-.info-list {
- display: flex;
- flex-direction: column;
- gap: $space-2;
-
- .info-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: $space-2 0;
- border-bottom: 1px solid $border-subtle;
-
- &:last-child {
- border-bottom: none;
- }
-
- .info-label {
- font-size: $font-size-sm;
- color: $text-tertiary;
- }
-
- .info-value {
- font-size: $font-size-sm;
- font-weight: $font-weight-medium;
- color: $text-primary;
- }
- }
-}
-
.info-list--spaced {
margin-bottom: $space-4;
}
@@ -1226,14 +1137,6 @@
}
// Loading State
-.loading {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: $space-12;
- color: $text-secondary;
- font-size: $font-size-sm;
-}
// Settings Row (for app settings tab)
.settings-row {
@@ -2628,3 +2531,17 @@
padding-top: $space-5;
border-top: 1px solid $border-subtle;
}
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.settings-notification-option { display: flex; align-items: center; gap: 0.75rem; }
+.settings-site-action-label { display: flex; align-items: center; gap: 0.5rem; }
+.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; }
+.settings-webhook-name { font-weight: $font-weight-medium; }
+.settings-webhook-form > * + * { margin-top: 1rem; }
+.settings-webhook-secret-field > * + * { margin-top: 0.5rem; }
diff --git a/frontend/src/styles/pages/_setup-wizard.scss b/frontend/src/styles/pages/_setup-wizard.scss
index 629e9979..2d1b2e21 100644
--- a/frontend/src/styles/pages/_setup-wizard.scss
+++ b/frontend/src/styles/pages/_setup-wizard.scss
@@ -835,3 +835,6 @@
padding: $space-10;
color: $text-secondary;
}
+
+// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
+.setup-back-action { margin-bottom: 1rem; }
diff --git a/frontend/src/styles/pages/_ssl.scss b/frontend/src/styles/pages/_ssl.scss
index 19da9e40..30472248 100644
--- a/frontend/src/styles/pages/_ssl.scss
+++ b/frontend/src/styles/pages/_ssl.scss
@@ -41,9 +41,6 @@
// Spinning icon — used well beyond this page (Servers, Deployments, backups…),
// so it stays global despite living in a page partial.
-.spin {
- animation: ssl-spin 1s linear infinite;
-}
@keyframes ssl-spin {
from { transform: rotate(0deg); }
diff --git a/frontend/src/styles/pages/_style-guide.scss b/frontend/src/styles/pages/_style-guide.scss
index 0ac60756..965effa9 100644
--- a/frontend/src/styles/pages/_style-guide.scss
+++ b/frontend/src/styles/pages/_style-guide.scss
@@ -3,6 +3,116 @@
// ============================================
.styleguide {
+ // The guide uses the same semantic SCSS contract it demonstrates. Dynamic
+ // token values (swatch colours, spacing widths) stay on their preview node.
+ &__section > * + * { margin-top: $space-6; }
+ &__examples > * + * { margin-top: $space-4; }
+ &__examples--compact > * + * { margin-top: $space-2; }
+
+ &__demo-card {
+ padding: $space-6;
+
+ &--flush { padding: 0; overflow: hidden; }
+ &--interactive { text-align: center; cursor: pointer; }
+ }
+
+ &__swatch-card {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: $space-3;
+ padding: $space-5;
+ }
+
+ &__font-sample { font-family: $font-main; margin-bottom: $space-4; }
+ &__code-sample { font-family: $font-mono; font-size: $font-size-base; }
+ &__weight-sample { margin-bottom: $space-2; }
+
+ &__token-row {
+ display: flex;
+ align-items: center;
+ gap: $space-4;
+ margin-bottom: $space-2;
+
+ &--spacing { margin-bottom: $space-3; }
+ }
+
+ &__token-name {
+ font-family: $font-mono;
+ font-size: $font-size-sm;
+ color: $text-tertiary;
+
+ &--font { min-width: 160px; }
+ &--spacing { min-width: 120px; }
+ &--layout { min-width: 180px; }
+ }
+
+ &__token-value {
+ min-width: 50px;
+ font-family: $font-mono;
+ font-size: $font-size-sm;
+ color: $text-secondary;
+ }
+
+ &__description {
+ font-size: $font-size-base;
+ color: $text-secondary;
+
+ &--muted { color: $text-tertiary; }
+ &--mono { font-family: $font-mono; }
+ &--spaced { margin-bottom: $space-2; }
+ &--section-end { margin-bottom: $space-4; }
+ }
+
+ &__actions {
+ display: flex;
+ flex-wrap: wrap;
+ gap: $space-3;
+
+ &--aligned { align-items: center; }
+ &--spaced { margin-bottom: $space-4; }
+ &--section-end { margin-bottom: $space-6; }
+ }
+
+ &__full-width-button { width: 100%; margin-bottom: $space-4; }
+ &__progress-value { font-family: $font-mono; font-size: $font-size-base; }
+ &__progress-labels { display: flex; justify-content: space-between; margin-bottom: $space-1; }
+ &__modal-field { margin-top: $space-4; }
+ &__drawer-fields {
+ padding: $space-4 0;
+ > * + * { margin-top: $space-4; }
+ }
+ &__tab-content { padding-top: $space-4; color: $text-secondary; }
+
+ &__spinner-row { display: flex; align-items: center; gap: $space-6; }
+ &__spinner-example { display: flex; flex-direction: column; align-items: center; gap: $space-2; }
+ &__comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: $space-4; }
+ &__scan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: $space-4; }
+ &__scan-icon { display: flex; justify-content: center; margin-bottom: $space-3; }
+ &__scan-title { margin-bottom: $space-1; }
+ &__log-example { height: 360px; }
+ &__journal-example { height: 160px; }
+
+ &__flex-example {
+ display: flex;
+ align-items: center;
+ gap: $space-3;
+ margin-bottom: $space-4;
+ padding: $space-2;
+ border: 1px dashed var(--border-active);
+
+ &--spread { align-items: normal; justify-content: space-between; gap: normal; }
+ &--stack {
+ flex-direction: column;
+ align-items: normal;
+ gap: $space-2;
+ max-width: 200px;
+ margin-bottom: 0;
+ }
+ }
+ &__layout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: $space-3; }
+ &__swatch-text { font-size: $font-size-base; font-weight: $font-weight-semibold; }
+
// Nav tabs for sections
&__nav {
display: flex;
@@ -89,6 +199,7 @@
// Spacing bars
&__spacing-bar {
+ height: $space-4;
background: $accent-primary;
border-radius: $radius-sm;
min-width: 4px;
diff --git a/frontend/src/styles/pages/_terminal.scss b/frontend/src/styles/pages/_terminal.scss
index 81bf246d..bc708f9a 100644
--- a/frontend/src/styles/pages/_terminal.scss
+++ b/frontend/src/styles/pages/_terminal.scss
@@ -1204,17 +1204,6 @@ $lk-default: #646b7a;
}
}
-.btn-xs {
- padding: 2px 6px;
- font-size: 11px;
-
- svg {
- stroke: currentColor;
- fill: none;
- stroke-width: 2;
- }
-}
-
.process-details-panel {
background: $bg-card;
border: 1px solid $border-subtle;
@@ -1307,12 +1296,6 @@ $lk-default: #646b7a;
}
}
-.services-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
- gap: $space-4;
-}
-
.service-card {
background: $bg-card;
border: 1px solid $border-subtle;
@@ -1399,10 +1382,6 @@ $lk-default: #646b7a;
}
// Modal adjustments for logs
-.modal-lg {
- max-width: 900px;
- width: 90%;
-}
.modal-log-viewer {
max-height: 500px;
diff --git a/frontend/src/utils/__tests__/backupSchedule.test.mjs b/frontend/src/utils/__tests__/backupSchedule.test.mjs
new file mode 100644
index 00000000..d8e7ae06
--- /dev/null
+++ b/frontend/src/utils/__tests__/backupSchedule.test.mjs
@@ -0,0 +1,42 @@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { nextFire, untilLabel, frequencyLabel } from '../backupSchedule.js';
+
+test('daily schedules use one clock and roll an elapsed slot across midnight', () => {
+ const now = new Date(2026, 8, 5, 23, 45);
+ const next = nextFire({ schedule_time: '00:15' }, now);
+ assert.equal(next.getDate(), 6);
+ assert.equal(untilLabel(next, now), 'in 30m');
+ assert.equal(now.getDate(), 5);
+ assert.equal(nextFire({ schedule_time: '23:45' }, now).getDate(), 6);
+});
+
+test('weekly schedules accept full and abbreviated weekdays, including next week', () => {
+ const now = new Date(2026, 8, 5, 12); // Saturday
+ assert.equal(nextFire({ schedule_time: '13:00', days: ['Saturday'] }, now).getDate(), 5);
+ assert.equal(nextFire({ schedule_time: '11:00', days: ['sat'] }, now).getDate(), 12);
+ assert.equal(frequencyLabel({ schedule_time: '02:00', days: ['sunday'] }), 'Weekly · Sun 02:00');
+});
+
+test('malformed schedules cannot silently normalize into a different run time', () => {
+ const now = new Date(2026, 8, 5);
+ for (const schedule_time of ['', '12', ':30', '24:00', '12:60', '-1:00', '12:30:00']) {
+ assert.equal(nextFire({ schedule_time }, now), null, schedule_time);
+ }
+ assert.equal(nextFire({ schedule_time: '12:30', days: ['noday'] }, now), null);
+ assert.equal(nextFire({ schedule_time: '12:30' }, new Date(NaN)), null);
+});
+
+test('spring-forward skips a wall-clock slot the server cannot execute', () => {
+ const previous = process.env.TZ;
+ process.env.TZ = 'America/New_York';
+ try {
+ const now = new Date(2026, 2, 8, 0);
+ const next = nextFire({ schedule_time: '02:30', days: ['daily'] }, now);
+ assert.equal(next.getDate(), 9);
+ assert.equal(next.getHours(), 2);
+ } finally {
+ if (previous === undefined) delete process.env.TZ;
+ else process.env.TZ = previous;
+ }
+});
diff --git a/frontend/src/utils/__tests__/metricsSubscription.test.mjs b/frontend/src/utils/__tests__/metricsSubscription.test.mjs
new file mode 100644
index 00000000..278fe8b6
--- /dev/null
+++ b/frontend/src/utils/__tests__/metricsSubscription.test.mjs
@@ -0,0 +1,53 @@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { subscribeToMetrics } from '../metricsSubscription.js';
+
+function fakeSocket(alreadyConnected = false) {
+ const handlers = new Map();
+ return {
+ socket: { connected: alreadyConnected },
+ subscriptions: 0,
+ unsubscriptions: 0,
+ connect() {},
+ on(event, handler) { handlers.set(event, handler); return () => handlers.delete(event); },
+ emit(event, value) { handlers.get(event)?.(value); },
+ subscribeMetrics() { this.subscriptions += 1; },
+ unsubscribeMetrics() { this.unsubscriptions += 1; },
+ handlers,
+ };
+}
+
+test('socket loss/error re-enables fallback, reconnection subscribes, cleanup releases listeners', () => {
+ const socket = fakeSocket();
+ const states = [];
+ const samples = [];
+ const errors = [];
+ const cleanup = subscribeToMetrics(socket, {
+ onConnected: (value) => states.push(value),
+ onMetrics: (value) => samples.push(value),
+ onError: (value) => errors.push(value),
+ });
+ socket.emit('connected');
+ socket.emit('metrics', { cpu: 20 });
+ socket.emit('disconnected');
+ socket.emit('connected');
+ socket.emit('error', { message: 'stream failed' });
+ assert.deepEqual(states, [true, false, true, false]);
+ assert.deepEqual(samples, [{ cpu: 20 }]);
+ assert.equal(errors.length, 1);
+ assert.equal(socket.subscriptions, 2);
+ cleanup();
+ assert.equal(socket.handlers.size, 0);
+ assert.equal(socket.unsubscriptions, 1);
+});
+
+test('an existing connected socket subscribes without waiting for another connect event', () => {
+ const socket = fakeSocket(true);
+ const states = [];
+ const cleanup = subscribeToMetrics(socket, {
+ onConnected: (value) => states.push(value), onMetrics() {}, onError() {},
+ });
+ assert.deepEqual(states, [true]);
+ assert.equal(socket.subscriptions, 1);
+ cleanup();
+});
diff --git a/frontend/src/utils/backupSchedule.js b/frontend/src/utils/backupSchedule.js
new file mode 100644
index 00000000..d476f2f5
--- /dev/null
+++ b/frontend/src/utils/backupSchedule.js
@@ -0,0 +1,52 @@
+const DAY_INDEX = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };
+const DAY_LABEL = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
+const scheduleDays = (schedule) => (Array.isArray(schedule.days) ? schedule.days : ['daily']);
+const dayIndex = (day) => DAY_INDEX[String(day).slice(0, 3).toLowerCase()];
+
+// Legacy schedules contain wall-clock time, without an IANA timezone. Execution
+// is server-local; this preserves the existing browser-local *estimate*. An
+// authoritative cross-zone countdown requires a next_run/timezone API field.
+// Use a single explicit clock for both calculation and wording in each render.
+export function nextFire(schedule, now) {
+ const match = /^(\d{1,2}):(\d{2})$/.exec(String(schedule.schedule_time || ''));
+ if (!match || !Number.isFinite(now?.getTime())) return null;
+ const hh = Number(match[1]);
+ const mm = Number(match[2]);
+ if (hh > 23 || mm > 59) return null;
+ const days = scheduleDays(schedule);
+ const daily = days.length === 0 || days.includes('daily');
+ const wanted = new Set(days.map(dayIndex).filter((day) => day != null));
+ if (!daily && wanted.size === 0) return null;
+ for (let offset = 0; offset <= 7; offset += 1) {
+ const candidate = new Date(now);
+ candidate.setDate(candidate.getDate() + offset);
+ candidate.setHours(hh, mm, 0, 0);
+ // Spring-forward can normalize a nonexistent 02:30 into 03:30. The
+ // scheduler matches wall time exactly, so skip that day's absent slot.
+ if (candidate.getHours() !== hh || candidate.getMinutes() !== mm) continue;
+ if (candidate.getTime() <= now.getTime()) continue;
+ if (daily || wanted.has(candidate.getDay())) return candidate;
+ }
+ return null;
+}
+
+export function untilLabel(date, now) {
+ const ms = date.getTime() - now.getTime();
+ if (ms <= 0) return 'due now';
+ const mins = Math.round(ms / 60000);
+ if (mins < 60) return `in ${mins}m`;
+ const h = Math.floor(mins / 60);
+ if (h < 24) return `in ${h}h ${mins % 60}m`;
+ return `in ${Math.round(h / 24)}d`;
+}
+
+export function frequencyLabel(schedule) {
+ const time = schedule.schedule_time || '—';
+ const days = scheduleDays(schedule);
+ if (days.length === 0 || days.includes('daily')) return `Daily · ${time}`;
+ if (days.length === 1) {
+ const idx = dayIndex(days[0]);
+ return `Weekly · ${idx == null ? days[0] : DAY_LABEL[idx]} ${time}`;
+ }
+ return `${days.length}×/week · ${time}`;
+}
diff --git a/frontend/src/utils/metricsSubscription.js b/frontend/src/utils/metricsSubscription.js
new file mode 100644
index 00000000..8286f60e
--- /dev/null
+++ b/frontend/src/utils/metricsSubscription.js
@@ -0,0 +1,21 @@
+// Socket ownership for one local metrics consumer. The hook owns fallback
+// polling; a disconnect or stream error re-enables that single scheduler.
+export function subscribeToMetrics(socket, { onConnected, onMetrics, onError }) {
+ const connected = () => {
+ onConnected(true);
+ socket.subscribeMetrics();
+ };
+ const unsubscribers = [
+ socket.on('connected', connected),
+ socket.on('disconnected', () => onConnected(false)),
+ socket.on('metrics', onMetrics),
+ socket.on('error', (error) => { onConnected(false); onError(error); }),
+ ];
+ socket.connect();
+ // An already-connected socket does not emit another connected event.
+ if (socket.socket?.connected) connected();
+ return () => {
+ unsubscribers.forEach((unsubscribe) => unsubscribe());
+ socket.unsubscribeMetrics();
+ };
+}
diff --git a/frontend/tests/browser/controls.html b/frontend/tests/browser/controls.html
new file mode 100644
index 00000000..ca38c18c
--- /dev/null
+++ b/frontend/tests/browser/controls.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<html lang="en">
+ <head><meta charset="UTF-8"><title>Shared controls contract</title></head>
+ <body><div id="root"></div><script type="module" src="./controls.jsx"></script></body>
+</html>
diff --git a/frontend/tests/browser/controls.jsx b/frontend/tests/browser/controls.jsx
new file mode 100644
index 00000000..a8ffaf68
--- /dev/null
+++ b/frontend/tests/browser/controls.jsx
@@ -0,0 +1,32 @@
+import { createElement } from 'react';
+import { createRoot } from 'react-dom/client';
+import { Button } from '../../src/components/ui/button';
+import { Card, CardHeader, CardContent } from '../../src/components/ui/card';
+import '../../src/styles/main.scss';
+
+window.controlEvents = { submits: 0, clicks: 0 };
+const submit = (event) => { event.preventDefault(); window.controlEvents.submits += 1; };
+const click = () => { window.controlEvents.clicks += 1; };
+export const NativeButton = (props) => createElement('button', props);
+
+createRoot(document.getElementById('root')).render(
+ <>
+ <form onSubmit={submit}>
+ <NativeButton id="native-submit" className="btn btn-primary">Submit</NativeButton>
+ <Button id="shared-submit" variant="primary" className="btn btn-primary">Submit</Button>
+ <NativeButton id="native-custom" type="button" className="shell-panel__action">Action</NativeButton>
+ <Button id="shared-custom" type="button" variant="unstyled" className="shell-panel__action"
+ ref={(node) => { window.controlRef = node; }} onClick={click}>Action</Button>
+ <NativeButton id="native-disabled" type="button" className="btn btn-secondary" disabled>Disabled</NativeButton>
+ <Button id="shared-disabled" type="button" variant="outline" className="btn btn-secondary" disabled onClick={click}>Disabled</Button>
+ </form>
+ <Button asChild variant="unstyled"><a id="shared-link" href="#destination">Link</a></Button>
+ {createElement('div', { id: 'native-card', className: 'card' },
+ createElement('div', { id: 'native-header', className: 'card-header' }, 'Header'),
+ createElement('div', { id: 'native-content', className: 'card-body' }, 'Content'))}
+ <Card id="shared-card" variant="legacy" className="card">
+ <CardHeader id="shared-header" variant="legacy" className="card-header">Header</CardHeader>
+ <CardContent id="shared-content" variant="legacy" className="card-body">Content</CardContent>
+ </Card>
+ </>,
+);