Implement, edit, and analyze frontend code for the Archie Home Assistant project — Django templates, static JS/CSS files, UI components, and template inheritance. Use this skill when working on HTML templates, JavaScript modules, CSS styling, or when the user asks to change how something looks or behaves in the browser. Use it even for small UI tweaks. Trigger on: "template", "html", "css", "javascript", "js", "frontend", "UI", "widget", "sidebar", "chat interface", "dashboard layout", "styles", "button", "component", "page", "render".
The frontend is Django templates + vanilla JavaScript with React via CDN — no build tool (no webpack/vite).
homeassistant/
├── webapp/
│ ├── templates/webapp/
│ │ ├── layout.html # Master layout — base for all pages
│ │ ├── index.html # Dashboard (extends layout)
│ │ └── login.html
│ └── static/webapp/
│ ├── css/custom.css # Single global stylesheet
│ └── js/
│ ├── main.js # Entry point, initializes page
│ ├── globals.js # Global state (window.* vars)
│ ├── dashboard.js # Dashboard widget logic
│ ├── dashboard-api.js
│ ├── sidebar.js # Left sidebar collapse/expand
│ ├── chat.js # AI chat panel (mounts React)
│ ├── widget.js # Reusable widget helpers
│ ├── utils.js
│ ├── data.js
│ └── chat/
│ ├── ChatAssistant.js # Main React component (functional, hooks)
│ ├── api.js # ChatAPI class — AJAX to /ai-assistant/
│ └── components/
│ ├── UIElements.js # Renders AI-returned UIElements/Cards
│ ├── ChatInput.js # Message input bar
│ └── ChartComponent.js
├── light/templates/light/
│ ├── base.html # Light-app base (extends webapp layout)
│ ├── dashboard.html
│ ├── device_list.html
│ ├── device_detail.html
│ ├── group_list.html
│ └── schedule_list.html
├── weather/templates/weather/weather.html
└── camera/templates/camera/camera.html
| Technology | Usage |
|---|---|
| Django template engine | HTML, {% block %}, {% url %}, {% static %} |
| React 18 (CDN) | Chat assistant UI — ChatAssistant.js is a functional component |
| Lucide Icons (CDN) | Icons — call lucide.createIcons() after DOM updates |
| Bootstrap (CDN) | Grid, utilities, base components |
| Vanilla JS (ES6+) | Everything outside the chat component |
Before writing code, determine:
*/templates/ and use Django syntax. Static files are in webapp/static/webapp/.webapp/layout.html or the app's own base.html.chat/ChatAssistant.js or chat/components/.Always read the relevant files before making changes — never guess existing structure:
layout.htmlindex.html + dashboard.jsChatAssistant.js + UIElements.js**/{page-name}.html{% extends "webapp/layout.html" %} or {% extends "light/base.html" %}{% load static %} and {% static 'path/to/file' %}{% url 'view-name' %} — never hardcode paths{{ variable }}<script> tags in the templateuseState, useEffect, useRef)window.* (see globals.js)lucide.createIcons()setInterval is acceptable (existing pattern)fetch for API calls; the ChatAPI class handles AI-assistant callshomeassistant/webapp/static/webapp/css/custom.cssvar(--color-*)) are used for theming — check existing variables before adding new ones.chat-sidebar__header, .widget-card--active)templates/<app>/ directoryhomeassistant/<app>/urls.pyviews.pywebapp/static/webapp/ and reference with {% static %}const / let, never varWhen implementing frontend changes, always:
<script> tag, place it at the end of the {% block scripts %} blocklucide.createIcons() after adding new DOM with icon elementsCtrl+Shift+R) clears browser cache<div id="..."> exists in the template before ReactDOM.render(){% csrf_token %} tag in forms; for fetch, read document.cookie for the csrftoken value