switch mp3 to tts, add genserver to app supervisor tree that periodically checks for newly connected devices and plays their associated tts message

This commit is contained in:
2024-07-17 18:20:05 -04:00
parent 8668405143
commit a085aee5c8
18 changed files with 101 additions and 200 deletions

View File

@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<.live_title suffix=" · Phoenix Framework">
<%= assigns[:page_title] || "HereIAm" %>
<%= assigns[:page_title] || "Here I Am" %>
</.live_title>
<link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>

View File

@@ -3,10 +3,10 @@
<div class="container mx-auto text-center py-10">
<article class="prose mx-auto px-4">
<p>
This site allows you to set an MP3 to play when your device connects to the network.
This site allows you to set a message to play when your device connects to the network.
</p>
<a href="/devices">
<button class="btn btn-primary mt-5">Manage Devices</button>
<.button class="mt-5">Manage Devices</.button>
</a>
</article>
</div>

View File

@@ -20,7 +20,7 @@ defmodule HereIAmWeb.DeviceLive.FormComponent do
phx-submit="save"
>
<.input field={@form[:ip_address]} type="text" label="IP Address" />
<.input field={@form[:audio]} type="text" label="Audio" />
<.input field={@form[:tts]} type="text" label="tts" />
<:actions>
<.button phx-disable-with="Saving...">Save Device</.button>
</:actions>

View File

@@ -13,7 +13,7 @@
row_click={fn {_id, device} -> JS.navigate(~p"/devices/#{device}") end}
>
<:col :let={{_id, device}} label="IP Address"><%= device.ip_address %></:col>
<:col :let={{_id, device}} label="Audio"><%= device.audio %></:col>
<:col :let={{_id, device}} label="TTS"><%= device.tts %></:col>
<:action :let={{_id, device}}>
<div class="sr-only">
<.link navigate={~p"/devices/#{device}"}>Show</.link>

View File

@@ -10,7 +10,7 @@
<.list>
<:item title="IP Address"><%= @device.ip_address %></:item>
<:item title="Audio"><%= @device.audio %></:item>
<:item title="TTS"><%= @device.tts %></:item>
</.list>
<.back navigate={~p"/devices"}>Back to devices</.back>