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`
${this.renderActivePanel()}
`; } private renderActivePanel(): TemplateResult { switch (this.activePanel) { case 'general': return this.renderGeneralPanel(); case 'network': return this.renderNetworkPanel(); case 'bluetooth': return this.renderBluetoothPanel(); case 'display': return this.renderDisplayPanel(); case 'sound': return this.renderSoundPanel(); case 'notifications': return this.renderNotificationsPanel(); case 'privacy': return this.renderPrivacyPanel(); case 'accounts': return this.renderAccountsPanel(); case 'apps': return this.renderAppsPanel(); case 'updates': return this.renderUpdatesPanel(); case 'about': return this.renderAboutPanel(); default: return this.renderGeneralPanel(); } } private renderGeneralPanel(): TemplateResult { return html`
General
Configure general system settings
Appearance
Dark Mode
Use dark theme throughout the system
this.darkMode = !this.darkMode} >
Text Size
Language & Region
Language
English (US)
Time Zone
UTC+01:00
`; } private renderNetworkPanel(): TemplateResult { return html`
Network
Manage Wi-Fi and network connections
Wi-Fi
Wi-Fi
${this.wifiEnabled ? 'Connected to HomeNetwork' : 'Off'}
this.wifiEnabled = !this.wifiEnabled} >
${this.wifiEnabled ? html`
Available Networks
HomeNetwork
Connected
OfficeWiFi
CoffeeShop_Guest
` : ''} `; } private renderBluetoothPanel(): TemplateResult { return html`
Bluetooth
Manage Bluetooth devices and connections
Bluetooth
Bluetooth
${this.bluetoothEnabled ? 'On' : 'Off'}
this.bluetoothEnabled = !this.bluetoothEnabled} >
${this.bluetoothEnabled ? html`
Connected Devices
AirPods Pro
Connected
Available Devices
Magic Keyboard
JBL Speaker
` : ''} `; } private renderDisplayPanel(): TemplateResult { return html`
Display
Adjust display and brightness settings
Brightness
Brightness
Auto-Brightness
Automatically adjust based on ambient light
Night Shift
Night Shift
Reduce blue light in the evening
Resolution
Display Resolution
`; } private renderSoundPanel(): TemplateResult { return html`
Sound
Configure audio settings and output devices
Volume
Output Volume
${this.volume}%
Mute
this.soundEnabled = !this.soundEnabled} >
Output Device
Built-in Speakers
Selected
AirPods Pro
Sound Effects
Play sound effects
Play startup sound
`; } private renderNotificationsPanel(): TemplateResult { return html`
Notifications
Control how apps notify you
Notifications
Allow Notifications
Show notifications from apps and services
this.notificationsEnabled = !this.notificationsEnabled} >
${this.notificationsEnabled ? html`
App Notifications
Mail
Banners, Sounds, Badges
Messages
Banners, Sounds, Badges
Calendar
Banners, Sounds
` : ''} `; } private renderPrivacyPanel(): TemplateResult { return html`
Privacy & Security
Manage privacy settings and app permissions
Privacy
Location Services
On
Camera
3 apps have access
Microphone
2 apps have access
Security
Touch ID & Password
`; } private renderAccountsPanel(): TemplateResult { return html`
Accounts
Manage your accounts and sign-in options
JD
John Doe
john.doe@example.com
Connected Accounts
Google
john.doe@gmail.com
Microsoft
john.doe@outlook.com
`; } private renderAppsPanel(): TemplateResult { return html`
Apps
Manage installed applications
Default Apps
Web Browser
Browser
Email Client
Mail
Installed Apps
Browser
Version 120.0.1
Mail
Version 16.0
Calendar
Version 14.0
`; } private renderUpdatesPanel(): TemplateResult { return html`
Software Updates
Keep your system up to date
Your system is up to date
Last checked: Today at 9:00 AM
Update Settings
Automatic Updates
Download and install updates automatically
Beta Updates
Receive early access to new features
`; } private renderAboutPanel(): TemplateResult { return html`
About
System information and details
Device Name
EcoBridge Desktop
System Version
EcoOS 1.0.0
Processor
ARM64
Memory
16 GB
Storage
512 GB (256 GB Available)
Legal
Terms of Service
Privacy Policy
Open Source Licenses
`; } }