@@ -11494,35 +11494,44 @@ class FastSearchCard extends HTMLElement {
1149411494 this.setupActionClickHandlers(container);
1149511495 }
1149611496
11497- // 🎯 RENDER ACTION ITEM - Mit Favoriten-Kennzeichnung
11497+ // 🎯 RENDER ACTION ITEM - Timeline-Event Design
1149811498 renderActionItem(action) {
1149911499 const state = this._hass.states[action.id];
1150011500 const isActive = this.isEntityActive(state);
1150111501 const icon = this.getEntityIcon(action.domain);
1150211502
11503- // 🌟 Favoriten-Kennzeichnung
11503+ // Favoriten-Kennzeichnung
11504+ const favoriteIcon = action.isFavorite ? '⭐ ' : '';
1150411505 const favoriteClass = action.isFavorite ? 'favorite-action' : '';
11505- const favoriteIcon = action.isFavorite ? '<div class="favorite-star">⭐</div>' : '';
11506- const favoriteLabel = action.isFavorite ? '<span class="favorite-label">Favorit</span>' : '';
11506+
11507+ // Status/Meta-Info
11508+ const typeLabel = this.getActionTypeLabel(action.domain);
11509+ const sourceLabel = action.isFavorite ? 'Favorit' : 'Auto-Discovery';
11510+ const areaLabel = action.area !== 'Ohne Raum' ? action.area : '';
1150711511
1150811512 return `
11509- <div class="action-item ${isActive ? 'active' : ''} ${favoriteClass}" data-action-id="${action.id}">
11510- <div class="action-icon">${icon}</div>
11511- <div class="action-info">
11512- <div class="action-name">
11513- ${action.name}
11514- ${favoriteIcon}
11513+ <div class="timeline-event action-timeline-event ${favoriteClass}"
11514+ data-action-id="${action.id}"
11515+ data-action-domain="${action.domain}">
11516+ <div class="timeline-event-icon">
11517+ ${icon}
11518+ </div>
11519+ <div class="timeline-event-content action-main-area" data-action-id="${action.id}">
11520+ <div class="timeline-event-title">
11521+ ${favoriteIcon}${action.name}
1151511522 </div>
11516- <div class="action-meta ">
11517- <span class="action-type">${this.getActionTypeLabel(action.domain) }</span>
11518- ${favoriteLabel }
11519- ${action.area !== 'Ohne Raum' ? ` <span class="action-area ">${action.area }</span>` : ''}
11523+ <div class="timeline-event-details ">
11524+ <span class="action-type-badge ">${typeLabel }</span>
11525+ ${areaLabel ? `<span class="action-area-badge">${areaLabel}</span>` : '' }
11526+ <span class="action-source-badge ">${sourceLabel }</span>
1152011527 </div>
1152111528 </div>
11522- <div class="action-trigger">
11523- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor">
11524- <path d="M8 5l8 7-8 7"/>
11525- </svg>
11529+ <div class="timeline-event-time action-trigger-area" data-action-id="${action.id}">
11530+ <button class="action-execute-btn" title="${typeLabel} ausführen">
11531+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor">
11532+ <path d="M8 5l8 7-8 7"/>
11533+ </svg>
11534+ </button>
1152611535 </div>
1152711536 </div>
1152811537 `;
@@ -11538,24 +11547,108 @@ class FastSearchCard extends HTMLElement {
1153811547 return labels[domain] || domain;
1153911548 }
1154011549
11541- // 🎯 SETUP ACTION CLICK HANDLERS
11550+ // 🎯 SETUP ACTION CLICK HANDLERS - Mit Navigation und Ausführung
1154211551 setupActionClickHandlers(container) {
11543- const actionItems = container.querySelectorAll('.action-item');
11552+ // 🎯 HAUPTBEREICH KLICKS → Navigation zur Detail-View
11553+ const actionMainAreas = container.querySelectorAll('.action-main-area');
11554+ actionMainAreas.forEach(area => {
11555+ area.addEventListener('click', (e) => {
11556+ e.stopPropagation();
11557+ const actionId = area.dataset.actionId;
11558+ const actionDomain = area.closest('.action-timeline-event').dataset.actionDomain;
11559+
11560+ console.log(`🎯 Navigation to detail view: ${actionId} (${actionDomain})`);
11561+
11562+ // Visual feedback
11563+ area.classList.add('clicked');
11564+ setTimeout(() => area.classList.remove('clicked'), 200);
11565+
11566+ // Navigate to detail view
11567+ this.navigateToActionDetail(actionId, actionDomain);
11568+ });
11569+ });
1154411570
11545- actionItems.forEach(item => {
11546- item.addEventListener('click', () => {
11547- const actionId = item.dataset.actionId;
11548- console.log(`🎯 Action clicked: ${actionId}`);
11571+ // ▶️ EXECUTE BUTTONS → Direkte Ausführung
11572+ const executeButtons = container.querySelectorAll('.action-execute-btn');
11573+ executeButtons.forEach(btn => {
11574+ btn.addEventListener('click', (e) => {
11575+ e.stopPropagation();
11576+ e.preventDefault();
11577+
11578+ const actionId = btn.closest('.action-timeline-event').dataset.actionId;
11579+ console.log(`🚀 Execute action: ${actionId}`);
1154911580
1155011581 // Visual feedback
11551- item .classList.add('clicked');
11552- setTimeout(() => item .classList.remove('clicked'), 200 );
11582+ btn .classList.add('clicked');
11583+ setTimeout(() => btn .classList.remove('clicked'), 150 );
1155311584
1155411585 // Execute action
1155511586 this.triggerAction(actionId);
1155611587 });
1155711588 });
1155811589 }
11590+
11591+ // 🎯 NAVIGATE TO ACTION DETAIL
11592+ navigateToActionDetail(actionId, actionDomain) {
11593+ console.log(`🎯 Navigating to detail view for ${actionDomain}: ${actionId}`);
11594+
11595+ // 1. Bestimme Ziel-Kategorie basierend auf Domain
11596+ const targetCategory = this.getTargetCategoryForDomain(actionDomain);
11597+
11598+ // 2. Finde das Action-Item in allItems
11599+ const actionItem = this.allItems.find(item => item.id === actionId);
11600+ if (!actionItem) {
11601+ console.warn(`❌ Action item not found: ${actionId}`);
11602+ return;
11603+ }
11604+
11605+ // 3. Schließe aktuelle Detail-View
11606+ this.closeDetailView();
11607+
11608+ // 4. Wechsle zur Ziel-Kategorie
11609+ this.switchToCategory(targetCategory);
11610+
11611+ // 5. Öffne Detail-View für die Action
11612+ setTimeout(() => {
11613+ console.log(`✅ Opening detail view for action: ${actionItem.name}`);
11614+ this.showDetailView(actionItem);
11615+ }, 100); // Kurze Verzögerung für smooth transition
11616+ }
11617+
11618+ // 🎯 GET TARGET CATEGORY FOR DOMAIN
11619+ getTargetCategoryForDomain(domain) {
11620+ const categoryMap = {
11621+ 'scene': 'scenes',
11622+ 'script': 'scripts',
11623+ 'automation': 'automations'
11624+ };
11625+
11626+ return categoryMap[domain] || 'devices';
11627+ }
11628+
11629+ // 🎯 SWITCH TO CATEGORY
11630+ switchToCategory(targetCategory) {
11631+ console.log(`🔄 Switching to category: ${targetCategory}`);
11632+
11633+ // Update activeCategory
11634+ this.activeCategory = targetCategory;
11635+
11636+ // Update category buttons
11637+ const categoryButtons = this.shadowRoot.querySelectorAll('.category-btn');
11638+ categoryButtons.forEach(btn => {
11639+ btn.classList.remove('active');
11640+ if (btn.dataset.category === targetCategory) {
11641+ btn.classList.add('active');
11642+ }
11643+ });
11644+
11645+ // Update placeholder und icon
11646+ this.updateCategoryIcon();
11647+ this.updatePlaceholder();
11648+
11649+ // Show items for new category
11650+ this.showCurrentCategoryItems();
11651+ }
1155911652
1156011653 // 🎯 TRIGGER ACTION
1156111654 triggerAction(actionId) {
0 commit comments