2026-01-06 09:11:35 +00:00
|
|
|
import { html } from '@design.estate/dees-element';
|
2026-01-12 10:57:54 +00:00
|
|
|
import type { IAppIcon, ILoginConfig, ILoginCredentials, TApplauncherMode } from './eco-applauncher.js';
|
2026-01-06 09:11:35 +00:00
|
|
|
import type { IWifiNetwork } from '../eco-applauncher-wifimenu/index.js';
|
|
|
|
|
import type { IAudioDevice } from '../eco-applauncher-soundmenu/index.js';
|
2026-01-12 10:57:54 +00:00
|
|
|
import '../../../views/eco-view-settings/eco-view-settings.js';
|
|
|
|
|
import '../../../views/eco-view-peripherals/eco-view-peripherals.js';
|
|
|
|
|
import '../../../views/eco-view-saasshare/eco-view-saasshare.js';
|
|
|
|
|
import '../../../views/eco-view-system/eco-view-system.js';
|
|
|
|
|
import type { EcoApplauncher } from './eco-applauncher.js';
|
2026-01-06 09:11:35 +00:00
|
|
|
|
|
|
|
|
const mockApps: IAppIcon[] = [
|
2026-01-12 10:57:54 +00:00
|
|
|
{ name: 'SaaS Share', icon: 'lucide:share2', view: html`<eco-view-saasshare></eco-view-saasshare>` },
|
|
|
|
|
{ name: 'System', icon: 'lucide:activity', view: html`<eco-view-system></eco-view-system>` },
|
|
|
|
|
{ name: 'Peripherals', icon: 'lucide:monitor', view: html`<eco-view-peripherals></eco-view-peripherals>` },
|
|
|
|
|
{ name: 'Settings', icon: 'lucide:settings', view: html`<eco-view-settings></eco-view-settings>` },
|
2026-01-06 09:11:35 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const mockNetworks: IWifiNetwork[] = [
|
|
|
|
|
{ ssid: 'HomeNetwork', signalStrength: 95, secured: true },
|
|
|
|
|
{ ssid: 'OfficeWiFi', signalStrength: 75, secured: true },
|
|
|
|
|
{ ssid: 'CoffeeShop_Guest', signalStrength: 60, secured: false },
|
|
|
|
|
{ ssid: 'Neighbor_5G', signalStrength: 40, secured: true },
|
|
|
|
|
{ ssid: 'WeakSignal', signalStrength: 15, secured: true },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const mockAudioDevices: IAudioDevice[] = [
|
|
|
|
|
{ id: 'speakers', name: 'Built-in Speakers', type: 'speaker' },
|
|
|
|
|
{ id: 'headphones', name: 'AirPods Pro', type: 'bluetooth' },
|
|
|
|
|
{ id: 'hdmi', name: 'LG Monitor', type: 'hdmi' },
|
|
|
|
|
];
|
|
|
|
|
|
2026-01-12 10:57:54 +00:00
|
|
|
const loginConfig: ILoginConfig = {
|
|
|
|
|
allowedMethods: ['pin', 'password', 'qr'],
|
|
|
|
|
pinLength: 4,
|
|
|
|
|
welcomeMessage: 'Welcome to EcoBridge',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleLoginAttempt = (e: CustomEvent) => {
|
|
|
|
|
const credentials = e.detail as ILoginCredentials;
|
|
|
|
|
const applauncher = e.target as EcoApplauncher;
|
|
|
|
|
|
|
|
|
|
console.log('Login attempt:', credentials);
|
|
|
|
|
|
|
|
|
|
// Demo validation: PIN "1234" or password "demo"
|
|
|
|
|
if (
|
|
|
|
|
(credentials.method === 'pin' && credentials.value === '1234') ||
|
|
|
|
|
(credentials.method === 'password' && credentials.value === 'demo')
|
|
|
|
|
) {
|
|
|
|
|
console.log('Login successful!');
|
|
|
|
|
applauncher.setLoginResult(true);
|
|
|
|
|
} else {
|
|
|
|
|
console.log('Login failed');
|
|
|
|
|
applauncher.setLoginResult(false, 'Invalid credentials. Try PIN: 1234 or Password: demo');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Home mode demo
|
|
|
|
|
const demoHome = () => html`
|
2026-01-06 09:11:35 +00:00
|
|
|
<style>
|
|
|
|
|
.demo-container {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<div class="demo-container">
|
|
|
|
|
<eco-applauncher
|
2026-01-12 10:57:54 +00:00
|
|
|
.mode=${'home' as TApplauncherMode}
|
|
|
|
|
.loginConfig=${loginConfig}
|
2026-01-06 09:11:35 +00:00
|
|
|
.apps=${mockApps}
|
|
|
|
|
.batteryLevel=${85}
|
|
|
|
|
.networkStatus=${'online'}
|
|
|
|
|
.soundLevel=${70}
|
|
|
|
|
.networks=${mockNetworks}
|
|
|
|
|
.connectedNetwork=${'HomeNetwork'}
|
|
|
|
|
.wifiEnabled=${true}
|
|
|
|
|
.timeRemaining=${'2h 30m remaining'}
|
|
|
|
|
.outputDevices=${mockAudioDevices}
|
|
|
|
|
.activeDeviceId=${'speakers'}
|
|
|
|
|
.muted=${false}
|
|
|
|
|
.userName=${'John Doe'}
|
|
|
|
|
.notificationCount=${3}
|
2026-01-12 10:57:54 +00:00
|
|
|
@login-attempt=${handleLoginAttempt}
|
|
|
|
|
@login-success=${() => console.log('Login success event received')}
|
|
|
|
|
@login-failure=${(e: CustomEvent) => console.log('Login failure:', e.detail)}
|
2026-01-06 09:11:35 +00:00
|
|
|
@wifi-toggle=${(e: CustomEvent) => console.log('WiFi toggle:', e.detail)}
|
|
|
|
|
@network-select=${(e: CustomEvent) => console.log('Network selected:', e.detail)}
|
|
|
|
|
@wifi-settings-click=${() => console.log('WiFi settings clicked')}
|
|
|
|
|
@battery-saver-toggle=${(e: CustomEvent) => console.log('Battery saver:', e.detail)}
|
|
|
|
|
@battery-settings-click=${() => console.log('Battery settings clicked')}
|
|
|
|
|
@volume-change=${(e: CustomEvent) => console.log('Volume:', e.detail)}
|
|
|
|
|
@mute-toggle=${(e: CustomEvent) => console.log('Mute:', e.detail)}
|
|
|
|
|
@device-select=${(e: CustomEvent) => console.log('Device:', e.detail)}
|
|
|
|
|
@sound-settings-click=${() => console.log('Sound settings clicked')}
|
|
|
|
|
@search-click=${() => console.log('Search clicked')}
|
|
|
|
|
@notifications-click=${() => console.log('Notifications clicked')}
|
|
|
|
|
@user-click=${() => console.log('User clicked')}
|
|
|
|
|
></eco-applauncher>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|
2026-01-12 10:57:54 +00:00
|
|
|
demoHome.demoTitle = 'Home Mode';
|
|
|
|
|
|
|
|
|
|
// Login mode demo
|
|
|
|
|
const demoLogin = () => html`
|
|
|
|
|
<style>
|
|
|
|
|
.demo-container {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<div class="demo-container">
|
|
|
|
|
<eco-applauncher
|
|
|
|
|
.mode=${'login' as TApplauncherMode}
|
|
|
|
|
.loginConfig=${loginConfig}
|
|
|
|
|
.apps=${mockApps}
|
|
|
|
|
.batteryLevel=${85}
|
|
|
|
|
.networkStatus=${'online'}
|
|
|
|
|
.soundLevel=${70}
|
|
|
|
|
.networks=${mockNetworks}
|
|
|
|
|
.connectedNetwork=${'HomeNetwork'}
|
|
|
|
|
.wifiEnabled=${true}
|
|
|
|
|
.outputDevices=${mockAudioDevices}
|
|
|
|
|
.activeDeviceId=${'speakers'}
|
|
|
|
|
.muted=${false}
|
|
|
|
|
@login-attempt=${handleLoginAttempt}
|
|
|
|
|
@login-success=${() => console.log('Login success event received')}
|
|
|
|
|
@login-failure=${(e: CustomEvent) => console.log('Login failure:', e.detail)}
|
|
|
|
|
></eco-applauncher>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|
|
|
|
|
demoLogin.demoTitle = 'Login Mode';
|
|
|
|
|
|
|
|
|
|
// Export array of demo functions
|
|
|
|
|
export const demo = [demoHome, demoLogin];
|