From 795ffef9dc3ec827fd445b44cac9451effed0f12 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:58:20 +0100 Subject: [PATCH] feat: add auto-refresh toggle to TopBar and GlobalFilterProvider Add autoRefresh/setAutoRefresh to GlobalFilterContext, persisted in localStorage. TopBar shows a LIVE/PAUSED toggle button with pulsing dot indicator. Consumers can use useGlobalFilters().autoRefresh to conditionally enable/disable polling intervals. Co-Authored-By: Claude Opus 4.6 (1M context) --- package.json | 14 ++++-- .../layout/TopBar/TopBar.module.css | 50 +++++++++++++++++++ src/design-system/layout/TopBar/TopBar.tsx | 12 ++++- .../providers/GlobalFilterProvider.tsx | 17 ++++++- 4 files changed, 87 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index bc33ef9..66c9c5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cameleer/design-system", - "version": "0.1.0", + "version": "0.1.2", "type": "module", "main": "./dist/index.es.js", "module": "./dist/index.es.js", @@ -12,8 +12,12 @@ }, "./style.css": "./dist/style.css" }, - "files": ["dist"], - "sideEffects": ["*.css"], + "files": [ + "dist" + ], + "sideEffects": [ + "*.css" + ], "publishConfig": { "registry": "https://gitea.siegeln.net/api/packages/cameleer/npm/" }, @@ -27,7 +31,8 @@ "build:lib": "vite build --config vite.lib.config.ts", "lint": "eslint .", "preview": "vite preview", - "test": "vitest" + "test": "vitest", + "test:e2e": "playwright test" }, "dependencies": { "react": "^19.0.0", @@ -40,6 +45,7 @@ "react-router-dom": "^7.0.0" }, "devDependencies": { + "@playwright/test": "^1.58.2", "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.3.0", "@testing-library/user-event": "^14.6.1", diff --git a/src/design-system/layout/TopBar/TopBar.module.css b/src/design-system/layout/TopBar/TopBar.module.css index 827d374..652943f 100644 --- a/src/design-system/layout/TopBar/TopBar.module.css +++ b/src/design-system/layout/TopBar/TopBar.module.css @@ -81,6 +81,56 @@ flex-shrink: 0; } +.liveToggle { + display: flex; + align-items: center; + gap: 6px; + padding: 4px 10px; + border: 1px solid var(--border); + border-radius: var(--radius-sm); + background: var(--bg-raised); + color: var(--text-muted); + font-family: var(--font-mono); + font-size: 10px; + font-weight: 600; + letter-spacing: 0.5px; + cursor: pointer; + transition: color 0.15s, border-color 0.15s, background 0.15s; + height: 30px; +} + +.liveToggle:hover { + border-color: var(--text-faint); +} + +.liveToggleActive { + color: var(--success); + border-color: var(--success-border); + background: var(--success-bg); +} + +.liveToggleActive:hover { + border-color: var(--success); +} + +.liveDot { + width: 6px; + height: 6px; + border-radius: 50%; + background: var(--text-muted); + flex-shrink: 0; +} + +.liveToggleActive .liveDot { + background: var(--success); + animation: livePulse 2s ease-in-out infinite; +} + +@keyframes livePulse { + 0%, 100% { opacity: 1; } + 50% { opacity: 0.4; } +} + .themeToggle { background: none; border: 1px solid var(--border); diff --git a/src/design-system/layout/TopBar/TopBar.tsx b/src/design-system/layout/TopBar/TopBar.tsx index 8084a0d..9d00bd3 100644 --- a/src/design-system/layout/TopBar/TopBar.tsx +++ b/src/design-system/layout/TopBar/TopBar.tsx @@ -84,8 +84,18 @@ export function TopBar({ onChange={globalFilters.setTimeRange} /> - {/* Right: theme toggle, env badge, user */} + {/* Right: auto-refresh toggle, theme toggle, env badge, user */}
+