This commit is contained in:
2026-01-05 12:07:05 +00:00
parent 43db777f2c
commit e71efd409b
2 changed files with 81 additions and 32 deletions

View File

@@ -3,6 +3,8 @@ import type { DeesAppui } from './dees-appui.js';
import type { IAppConfig, IViewActivationContext } from '../../interfaces/appconfig.js';
import type * as interfaces from '../../interfaces/index.js';
import '@design.estate/dees-wcctools/demotools';
import '../../dees-statsgrid/dees-statsgrid.js';
import type { IStatsTile } from '../../dees-statsgrid/dees-statsgrid.js';
// Demo view component with lifecycle hooks
@customElement('demo-dashboard-view')
@@ -12,6 +14,77 @@ class DemoDashboardView extends DeesElement {
private ctx: IViewActivationContext;
private statsTiles: IStatsTile[] = [
{
id: 'users',
title: 'Active Users',
value: 1234,
type: 'number',
icon: 'lucide:users',
description: 'Online now',
color: '#22c55e'
},
{
id: 'api-calls',
title: 'API Calls',
value: 45200,
type: 'trend',
icon: 'lucide:activity',
description: '+12% from last hour',
color: '#3b82f6',
trendData: [32000, 35000, 38000, 41000, 39000, 42000, 45200]
},
{
id: 'health',
title: 'System Health',
value: 99.9,
unit: '%',
type: 'gauge',
icon: 'lucide:heart-pulse',
description: 'All systems operational',
color: '#10b981',
gaugeOptions: {
min: 0,
max: 100,
thresholds: [
{ value: 80, color: '#ef4444' },
{ value: 95, color: '#f59e0b' },
{ value: 100, color: '#10b981' }
]
}
},
{
id: 'response',
title: 'Avg Response',
value: 127,
unit: 'ms',
type: 'number',
icon: 'lucide:timer',
description: '-15ms from yesterday',
color: '#8b5cf6'
},
{
id: 'errors',
title: 'Error Rate',
value: 0.12,
unit: '%',
type: 'number',
icon: 'lucide:alertTriangle',
description: 'Last 24 hours',
color: '#f59e0b'
},
{
id: 'requests',
title: 'Requests/sec',
value: 1850,
type: 'trend',
icon: 'lucide:zap',
description: 'Current throughput',
color: '#06b6d4',
trendData: [1200, 1400, 1350, 1600, 1750, 1680, 1850]
}
];
onActivate(context: IViewActivationContext) {
this.ctx = context;
this.activated = true;
@@ -83,21 +156,9 @@ class DemoDashboardView extends DeesElement {
}
h1 { color: #fafafa; font-weight: 600; font-size: 24px; margin-bottom: 8px; }
p { color: #737373; margin-bottom: 32px; }
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
dees-statsgrid {
margin-bottom: 32px;
}
.card {
background: rgba(255,255,255,0.03);
border: 1px solid rgba(255,255,255,0.08);
border-radius: 8px;
padding: 20px;
}
.card h3 { color: #fafafa; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.metric { font-size: 32px; font-weight: 700; color: #fafafa; }
.status { display: inline-block; padding: 2px 8px; border-radius: 9px; font-size: 12px; }
.status.active { background: #14532d; color: #4ade80; }
.ctx-actions {
margin-top: 32px;
@@ -147,23 +208,10 @@ class DemoDashboardView extends DeesElement {
</style>
<h1>Dashboard</h1>
<p>Welcome back! Here's an overview of your system.</p>
<div class="grid">
<div class="card">
<h3>Active Users</h3>
<div class="metric">1,234</div>
<span class="status active">Online</span>
</div>
<div class="card">
<h3>API Calls</h3>
<div class="metric">45.2K</div>
<p style="color: #4ade80; font-size: 12px; margin: 0;">+12% from last hour</p>
</div>
<div class="card">
<h3>System Health</h3>
<div class="metric">99.9%</div>
<p style="color: #737373; font-size: 12px; margin: 0;">All systems operational</p>
</div>
</div>
<dees-statsgrid
.tiles=${this.statsTiles}
@tile-action=${(e: CustomEvent) => console.log('Tile action:', e.detail)}
></dees-statsgrid>
<div class="ctx-actions">
<h2>Context Actions (ctx.appui)</h2>

View File

@@ -191,7 +191,6 @@ export class DeesStatsGrid extends DeesElement {
min-height: var(--content-min-height);
display: flex;
flex-direction: column;
justify-content: center;
flex: 1;
}
@@ -306,6 +305,7 @@ export class DeesStatsGrid extends DeesElement {
display: flex;
flex-direction: column;
gap: 8px;
flex: 1;
}
.trend-header {
@@ -341,6 +341,7 @@ export class DeesStatsGrid extends DeesElement {
width: 100%;
height: 28px;
position: relative;
margin-top: auto;
}
.trend-svg {