import { customElement, DeesElement, type TemplateResult, html, property, css, cssManager, state, } from '@design.estate/dees-element'; import { DeesAppuiSecondarymenu, DeesIcon } from '@design.estate/dees-catalog'; import type { ISecondaryMenuGroup, ISecondaryMenuItem } from '../../elements/interfaces/secondarymenu.js'; import { demo } from './eco-view-settings.demo.js'; // Ensure components are registered DeesAppuiSecondarymenu; DeesIcon; declare global { interface HTMLElementTagNameMap { 'eco-view-settings': EcoViewSettings; } } export type TSettingsPanel = | 'general' | 'network' | 'bluetooth' | 'display' | 'sound' | 'notifications' | 'privacy' | 'accounts' | 'apps' | 'updates' | 'about'; @customElement('eco-view-settings') export class EcoViewSettings extends DeesElement { public static demo = demo; public static demoGroup = 'Views'; public static styles = [ cssManager.defaultStyles, css` :host { display: block; width: 100%; height: 100%; background: ${cssManager.bdTheme('#f5f5f7', 'hsl(240 6% 10%)')}; color: ${cssManager.bdTheme('hsl(0 0% 10%)', 'hsl(0 0% 98%)')}; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; } .settings-container { display: flex; height: 100%; } dees-appui-secondarymenu { flex-shrink: 0; background: ${cssManager.bdTheme('#ffffff', 'hsl(240 6% 8%)')}; border-right: 1px solid ${cssManager.bdTheme('hsl(0 0% 90%)', 'hsl(240 5% 15%)')}; } .content { flex: 1; overflow-y: auto; padding: 32px 48px; } .panel-header { margin-bottom: 32px; } .panel-title { font-size: 28px; font-weight: 600; color: ${cssManager.bdTheme('hsl(0 0% 10%)', 'hsl(0 0% 98%)')}; margin-bottom: 8px; } .panel-description { font-size: 14px; color: ${cssManager.bdTheme('hsl(0 0% 50%)', 'hsl(0 0% 60%)')}; } .settings-section { background: ${cssManager.bdTheme('#ffffff', 'hsl(240 6% 12%)')}; border: 1px solid ${cssManager.bdTheme('hsl(0 0% 90%)', 'hsl(240 5% 18%)')}; border-radius: 12px; margin-bottom: 24px; overflow: hidden; } .section-title { padding: 16px 20px 12px; font-size: 13px; font-weight: 600; color: ${cssManager.bdTheme('hsl(0 0% 50%)', 'hsl(0 0% 50%)')}; text-transform: uppercase; letter-spacing: 0.5px; } .settings-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid ${cssManager.bdTheme('hsl(0 0% 94%)', 'hsl(240 5% 15%)')}; transition: background 0.15s ease; } .settings-item:first-child { border-top: none; } .settings-item:hover { background: ${cssManager.bdTheme('hsl(0 0% 97%)', 'hsl(240 5% 14%)')}; } .settings-item.clickable { cursor: pointer; } .item-left { display: flex; align-items: center; gap: 14px; } .item-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; } .item-icon.blue { background: hsl(217 91% 60%); } .item-icon.green { background: hsl(142 71% 45%); } .item-icon.orange { background: hsl(25 95% 53%); } .item-icon.purple { background: hsl(262 83% 58%); } .item-icon.red { background: hsl(0 72% 51%); } .item-icon.teal { background: hsl(175 84% 32%); } .item-icon.gray { background: hsl(220 9% 46%); } .item-info { display: flex; flex-direction: column; gap: 2px; } .item-label { font-size: 15px; font-weight: 500; color: ${cssManager.bdTheme('hsl(0 0% 10%)', 'hsl(0 0% 98%)')}; } .item-sublabel { font-size: 13px; color: ${cssManager.bdTheme('hsl(0 0% 50%)', 'hsl(0 0% 55%)')}; } .item-right { display: flex; align-items: center; gap: 8px; color: ${cssManager.bdTheme('hsl(0 0% 60%)', 'hsl(0 0% 50%)')}; } .item-value { font-size: 14px; color: ${cssManager.bdTheme('hsl(0 0% 50%)', 'hsl(0 0% 55%)')}; } .toggle-switch { position: relative; width: 44px; height: 24px; background: ${cssManager.bdTheme('hsl(0 0% 85%)', 'hsl(240 5% 25%)')}; border-radius: 12px; cursor: pointer; transition: background 0.2s ease; } .toggle-switch.active { background: hsl(217 91% 60%); } .toggle-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: white; border-radius: 50%; transition: transform 0.2s ease; box-shadow: ${cssManager.bdTheme('0 1px 3px rgba(0,0,0,0.2)', 'none')}; } .toggle-switch.active::after { transform: translateX(20px); } .slider-container { display: flex; align-items: center; gap: 12px; min-width: 200px; } .slider { flex: 1; height: 4px; background: ${cssManager.bdTheme('hsl(0 0% 88%)', 'hsl(240 5% 25%)')}; border-radius: 2px; position: relative; cursor: pointer; } .slider-fill { height: 100%; background: hsl(217 91% 60%); border-radius: 2px; } .slider-value { min-width: 36px; text-align: right; font-size: 14px; color: ${cssManager.bdTheme('hsl(0 0% 40%)', 'hsl(0 0% 70%)')}; } select { padding: 8px 32px 8px 12px; font-size: 14px; border: 1px solid ${cssManager.bdTheme('hsl(0 0% 85%)', 'hsl(240 5% 25%)')}; border-radius: 8px; background: ${cssManager.bdTheme('#ffffff', 'hsl(240 6% 15%)')}; color: ${cssManager.bdTheme('hsl(0 0% 10%)', 'hsl(0 0% 90%)')}; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; } select:focus { outline: none; border-color: hsl(217 91% 60%); } `, ]; @property({ type: String }) accessor activePanel: TSettingsPanel = 'general'; @state() accessor wifiEnabled = true; @state() accessor bluetoothEnabled = true; @state() accessor darkMode = true; @state() accessor notificationsEnabled = true; @state() accessor soundEnabled = true; @state() accessor brightness = 80; @state() accessor volume = 70; private getMenuGroups(): ISecondaryMenuGroup[] { return [ { name: 'System', iconName: 'lucide:settings', items: [ { key: 'general', iconName: 'lucide:settings', action: () => this.activePanel = 'general', }, { key: 'display', iconName: 'lucide:monitor', action: () => this.activePanel = 'display', }, { key: 'sound', iconName: 'lucide:volume2', action: () => this.activePanel = 'sound', }, { key: 'notifications', iconName: 'lucide:bell', action: () => this.activePanel = 'notifications', }, ], }, { name: 'Network', iconName: 'lucide:wifi', items: [ { key: 'network', iconName: 'lucide:wifi', action: () => this.activePanel = 'network', }, { key: 'bluetooth', iconName: 'lucide:bluetooth', action: () => this.activePanel = 'bluetooth', }, ], }, { name: 'Personal', iconName: 'lucide:user', items: [ { key: 'accounts', iconName: 'lucide:user', action: () => this.activePanel = 'accounts', }, { key: 'privacy', iconName: 'lucide:shield', action: () => this.activePanel = 'privacy', }, ], }, { name: 'System Info', iconName: 'lucide:info', items: [ { key: 'apps', iconName: 'lucide:layoutGrid', action: () => this.activePanel = 'apps', }, { key: 'updates', iconName: 'lucide:download', action: () => this.activePanel = 'updates', }, { key: 'about', iconName: 'lucide:info', action: () => this.activePanel = 'about', }, ], }, ]; } private getSelectedItem(): ISecondaryMenuItem | null { for (const group of this.getMenuGroups()) { for (const item of group.items) { if ('key' in item && item.key === this.activePanel) { return item; } } } return null; } public render(): TemplateResult { return html`